diff --git a/Assets/PerfectWorld/Scripts/Addressable/AddressableManager.cs b/Assets/PerfectWorld/Scripts/Addressable/AddressableManager.cs
index 443cb313d5..5661a263a8 100644
--- a/Assets/PerfectWorld/Scripts/Addressable/AddressableManager.cs
+++ b/Assets/PerfectWorld/Scripts/Addressable/AddressableManager.cs
@@ -5,7 +5,6 @@ using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.AsyncOperations;
-using UnityEngine.ResourceManagement.ResourceLocations;
namespace BrewMonster.Scripts
{
diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs
index 6b3c96cf66..66c116a652 100644
--- a/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs
+++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs
@@ -67,7 +67,7 @@ public class AAssit
/// re-seeked before reading the count and each element.
/// Element type to deserialize. Must be blittable/marshallable via .
/// The populated array when count > 0; otherwise null.
- public static T[] ReadArrayPointerFromBinary(FileStream stream, ref long readBytes, long fileOffset = -1)
+ public static T[] ReadArrayPointerFromBinary(Stream stream, ref long readBytes, long fileOffset = -1)
{
// seek to the fileOffset if it's >= 0
if (fileOffset >= 0)
@@ -112,7 +112,7 @@ public class AAssit
return buffer;
}
- public static bool GetBoolFromFileStream(FileStream fs, ref long readBytes)
+ public static bool GetBoolFromFileStream(Stream fs, ref long readBytes)
{
byte[] buffer = new byte[1];
int bytesRead = fs.Read(buffer, 0, 1);
@@ -123,7 +123,7 @@ public class AAssit
return buffer[0] != 0;
}
- public static int GetIntFromFileStream(FileStream fs, ref long readBytes)
+ public static int GetIntFromFileStream(Stream fs, ref long readBytes)
{
byte[] buffer = new byte[4];
int bytesRead = fs.Read(buffer, 0, 4);
@@ -134,7 +134,7 @@ public class AAssit
return BitConverter.ToInt32(buffer, 0);
}
- public static uint GetUIntFromFileStream(FileStream fs, ref long readBytes)
+ public static uint GetUIntFromFileStream(Stream fs, ref long readBytes)
{
byte[] buffer = new byte[4];
int bytesRead = fs.Read(buffer, 0, 4);
@@ -145,7 +145,7 @@ public class AAssit
return BitConverter.ToUInt32(buffer, 0);
}
- public static long GetLongFromFileStream(FileStream fs, ref long readBytes)
+ public static long GetLongFromFileStream(Stream fs, ref long readBytes)
{
byte[] buffer = new byte[8];
int bytesRead = fs.Read(buffer, 0, 8);
diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs
index e2f44de877..a0c091501c 100644
--- a/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs
+++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs
@@ -1,4 +1,6 @@
using System;
+using BrewMonster.Scripts;
+using Cysharp.Threading.Tasks;
using ModelRenderer.Scripts.GameData;
using UnityEngine;
@@ -15,12 +17,21 @@ namespace BrewMonster
}
public async void Initialize()
+ {
+ await InitializeInternal();
+ }
+
+ public async UniTask InitializeInternal()
{
_elementDataMan = new();
_instance = this;
try
{
+ while (!AddressableManager.Instance.IsInitialized())
+ {
+ await UniTask.DelayFrame(1);
+ }
var result = await _elementDataMan.load_data();
if (result == -1)
{
diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs
index 4a501d9e3b..5e7e12c927 100644
--- a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs
+++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs
@@ -1,4 +1,6 @@
using BrewMonster;
+using BrewMonster.Scripts;
+using Cysharp.Threading.Tasks;
using System.Collections.Generic;
using System.IO;
using System.Text;
@@ -300,26 +302,28 @@ namespace ModelRenderer.Scripts.GameData
return true;
}
- public async Task load_data(string pathname = "")
+ public async UniTask load_data(string pathname = "")
{
- #if UNITY_ANDROID && !UNITY_EDITOR
- var success = await MoveElementFileToPersistentPath();
- if (!success)
- {
- BMLogger.LogError("ElementDataMan: Failed to move element file to persistent path");
- return -1;
- }
+ // #if UNITY_ANDROID && !UNITY_EDITOR
+ // var success = await MoveElementFileToPersistentPath();
+ // if (!success)
+ // {
+ // BMLogger.LogError("ElementDataMan: Failed to move element file to persistent path");
+ // return -1;
+ // }
- pathname = Path.Combine(UnityEngine.Application.persistentDataPath, "elements.data");
- #endif
- if (string.IsNullOrEmpty(pathname))
- {
- pathname = Path.Combine(UnityEngine.Application.streamingAssetsPath, "elements.data");
- }
+ // pathname = Path.Combine(UnityEngine.Application.persistentDataPath, "elements.data");
+ // #endif
+ // if (string.IsNullOrEmpty(pathname))
+ // {
+ // pathname = Path.Combine(UnityEngine.Application.streamingAssetsPath, "elements.data");
+ // }
- if (!File.Exists(pathname)) return -1;
+ // if (!File.Exists(pathname)) return -1;
- using (var file = new FileStream(pathname, FileMode.Open, FileAccess.Read))
+ var dataFile = await AddressableManager.Instance.LoadTextAssetAsync("elements.data");
+
+ using (var file = new MemoryStream(dataFile.bytes))
{
long dwRead = 0;
int version = AAssit.GetIntFromFileStream(file, ref dwRead);
diff --git a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs
index cd252cbbf3..ba788aaf41 100644
--- a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs
+++ b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs
@@ -3924,8 +3924,8 @@ namespace BrewMonster
public int num_option; // number of options
public option[] options; // options pointer
-
- public void Read(FileStream file)
+
+ public void Read(Stream file)
{
long dwRead = file.Position;
id = AAssit.GetIntFromFileStream(file, ref dwRead);
@@ -3943,7 +3943,7 @@ namespace BrewMonster
public window[] windows; // windows pointer
- public void Read(FileStream file)
+ public void Read(Stream file)
{
long dwRead = file.Position;
id_talk = AAssit.GetUIntFromFileStream(file, ref dwRead);
diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/CSNetwork.csproj.meta b/Assets/PerfectWorld/Scripts/Network/CSNetwork/CSNetwork.csproj.meta
deleted file mode 100644
index 333a9b1482..0000000000
--- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/CSNetwork.csproj.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: d0c06c588e2a6442488a3542551fb243
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant: