Merge branch 'develop' into feature/elseplayer

# Conflicts:
#	Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.dll
#	Assets/PerfectWorld/Scripts/Network/EC_ManMessageMono.cs
#	Assets/Scripts/CECHostPlayer.cs
#	Assets/Scripts/GameController.cs
This commit is contained in:
Tungdv
2025-09-13 16:36:09 +07:00
46 changed files with 38537 additions and 323 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8042a2d38498a7d44b8570ef149ec540
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+139
View File
@@ -0,0 +1,139 @@
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Unity.BossRoom.Editor
{
/// <summary>
/// Class that permits auto-loading a bootstrap scene when the editor switches play state. This class is
/// initialized when Unity is opened and when scripts are recompiled. This is to be able to subscribe to
/// EditorApplication's playModeStateChanged event, which is when we wish to open a new scene.
/// </summary>
/// <remarks>
/// A critical edge case scenario regarding NetworkManager is accounted for here.
/// A NetworkObject's GlobalObjectIdHash value is currently generated in OnValidate() which is invoked during a
/// build and when the asset is loaded/viewed in the editor.
/// If we were to manually open Bootstrap scene via EditorSceneManager.OpenScene(...) as the editor is exiting play
/// mode, Bootstrap scene would be entering play mode within the editor prior to having loaded any assets, meaning
/// NetworkManager itself has no entry within the AssetDatabase cache. As a result of this, any referenced Network
/// Prefabs wouldn't have any entry either.
/// To account for this necessary AssetDatabase step, whenever we're redirecting from a new scene, or a scene
/// existing in our EditorBuildSettings, we forcefully stop the editor, open Bootstrap scene, and re-enter play
/// mode. This provides the editor the chance to create AssetDatabase cache entries for the Network Prefabs assigned
/// to the NetworkManager.
/// If we are entering play mode directly from Bootstrap scene, no additional steps need to be taken and the scene
/// is loaded normally.
/// </remarks>
[InitializeOnLoad]
public class SceneBootstrapper
{
const string k_PreviousSceneKey = "PreviousScene";
const string k_ShouldLoadBootstrapSceneKey = "LoadMainMenuScene";
const string k_LoadBootstrapSceneOnPlay = "FirstSceneLoad/Load MainMenu Scene On Play";
const string k_DoNotLoadBootstrapSceneOnPlay = "FirstSceneLoad/Don't Load MainMenu Scene On Play";
const string k_TestRunnerSceneName = "InitTestScene";
static bool s_RestartingToSwitchScene;
static string BootstrapScene => EditorBuildSettings.scenes[0].path;
static string PreviousScene
{
get => EditorPrefs.GetString(k_PreviousSceneKey);
set => EditorPrefs.SetString(k_PreviousSceneKey, value);
}
static bool ShouldLoadBootstrapScene
{
get
{
if (!EditorPrefs.HasKey(k_ShouldLoadBootstrapSceneKey))
{
EditorPrefs.SetBool(k_ShouldLoadBootstrapSceneKey, true);
}
return EditorPrefs.GetBool(k_ShouldLoadBootstrapSceneKey, true);
}
set => EditorPrefs.SetBool(k_ShouldLoadBootstrapSceneKey, value);
}
static SceneBootstrapper()
{
EditorApplication.playModeStateChanged += EditorApplicationOnplayModeStateChanged;
}
[MenuItem(k_LoadBootstrapSceneOnPlay, true)]
static bool ShowLoadBootstrapSceneOnPlay() => !ShouldLoadBootstrapScene;
[MenuItem(k_LoadBootstrapSceneOnPlay)]
static void EnableLoadBootstrapSceneOnPlay() => ShouldLoadBootstrapScene = true;
[MenuItem(k_DoNotLoadBootstrapSceneOnPlay, true)]
static bool ShowDoNotLoadBootstrapSceneOnPlay() => ShouldLoadBootstrapScene;
[MenuItem(k_DoNotLoadBootstrapSceneOnPlay)]
static void DisableDoNotLoadBootstrapSceneOnPlay() => ShouldLoadBootstrapScene = false;
static void EditorApplicationOnplayModeStateChanged(PlayModeStateChange playModeStateChange)
{
if (IsTestRunnerActive() || !ShouldLoadBootstrapScene)
{
return;
}
if (s_RestartingToSwitchScene)
{
if (playModeStateChange == PlayModeStateChange.EnteredPlayMode)
{
s_RestartingToSwitchScene = false;
}
return;
}
if (playModeStateChange == PlayModeStateChange.ExitingEditMode)
{
PreviousScene = EditorSceneManager.GetActiveScene().path;
if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
{
if (!string.IsNullOrEmpty(BootstrapScene) &&
System.Array.Exists(EditorBuildSettings.scenes, scene => scene.path == BootstrapScene))
{
s_RestartingToSwitchScene = true;
EditorApplication.isPlaying = false;
// Đóng tất cả các scene đang mở
for (int i = SceneManager.sceneCount - 1; i >= 0; i--)
{
Scene scene = SceneManager.GetSceneAt(i);
if (scene.isLoaded)
{
EditorSceneManager.CloseScene(scene, true);
}
}
// Mở scene đầu tiên trong danh sách build
EditorSceneManager.OpenScene(BootstrapScene);
EditorApplication.isPlaying = true;
}
}
else
{
EditorApplication.isPlaying = false;
}
}
else if (playModeStateChange == PlayModeStateChange.EnteredEditMode && !string.IsNullOrEmpty(PreviousScene))
{
EditorSceneManager.OpenScene(PreviousScene);
}
}
static bool IsTestRunnerActive()
{
return EditorSceneManager.GetActiveScene().name.StartsWith(k_TestRunnerSceneName);
}
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 614cce81bc9884a438600443cd510338
+75
View File
@@ -0,0 +1,75 @@
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.IO;
using System.Linq;
public class QuickSceneWindow : EditorWindow
{
[MenuItem("GameObject/Quick Open Adaptive Scene", false, 1)]
public static void ShowWindow()
{
var window = GetWindow<QuickSceneWindow>("Quick Scene");
// Kích thước cửa sổ
float width = 250;
float height = 300;
// Lấy kích thước màn hình Unity Editor
float screenWidth = EditorGUIUtility.GetMainWindowPosition().width;
float screenHeight = EditorGUIUtility.GetMainWindowPosition().height;
// Tính toán vị trí để căn giữa
float x = (screenWidth - width) / 2;
float y = (screenHeight - height) / 2;
// Đặt vị trí và kích thước cho cửa sổ
window.position = new Rect(x, y, width, height);
window.Show();
}
void OnGUI()
{
EditorGUILayout.LabelField("Available Scenes:", EditorStyles.boldLabel);
EditorGUILayout.Space();
var scenes = EditorBuildSettings.scenes;
string currentScenePath = EditorSceneManager.GetActiveScene().path;
if (scenes.Length == 0)
{
EditorGUILayout.HelpBox("No Scenes in Build Settings", MessageType.Warning);
return;
}
// Lọc ra các scene không phải scene hiện tại
var availableScenes = scenes.Where(scene =>
scene.enabled &&
!string.Equals(scene.path, currentScenePath, System.StringComparison.OrdinalIgnoreCase)
);
if (!availableScenes.Any())
{
EditorGUILayout.HelpBox("No other scenes available", MessageType.Info);
return;
}
foreach (var scene in availableScenes)
{
string sceneName = Path.GetFileNameWithoutExtension(scene.path);
if (GUILayout.Button(sceneName, GUILayout.Height(30)))
{
OpenSceneAdditively(scene.path);
}
}
}
private void OpenSceneAdditively(string path)
{
if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
{
EditorSceneManager.OpenScene(path, OpenSceneMode.Additive);
Debug.Log($"Opened scene additively: {path}");
this.Close();
}
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1739d340501e2b641b3c8d53dfddce7e
@@ -1,130 +1,130 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.1/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.1": {},
".NETStandard,Version=v2.1/": {
"CSNetwork/1.0.0": {
"dependencies": {
"System.Reflection.Metadata": "9.0.8"
},
"runtime": {
"CSNetwork.dll": {}
}
},
"System.Buffers/4.5.1": {
"runtime": {
"lib/netstandard2.0/System.Buffers.dll": {
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.6.28619.1"
}
}
},
"System.Collections.Immutable/9.0.8": {
"dependencies": {
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/System.Collections.Immutable.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.825.36511"
}
}
},
"System.Memory/4.5.5": {
"dependencies": {
"System.Buffers": "4.5.1",
"System.Numerics.Vectors": "4.4.0",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/System.Memory.dll": {
"assemblyVersion": "4.0.1.2",
"fileVersion": "4.6.31308.1"
}
}
},
"System.Numerics.Vectors/4.4.0": {
"runtime": {
"lib/netstandard2.0/System.Numerics.Vectors.dll": {
"assemblyVersion": "4.1.3.0",
"fileVersion": "4.6.25519.3"
}
}
},
"System.Reflection.Metadata/9.0.8": {
"dependencies": {
"System.Collections.Immutable": "9.0.8",
"System.Memory": "4.5.5"
},
"runtime": {
"lib/netstandard2.0/System.Reflection.Metadata.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.825.36511"
}
}
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"runtime": {
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
}
}
},
"libraries": {
"CSNetwork/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"System.Buffers/4.5.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==",
"path": "system.buffers/4.5.1",
"hashPath": "system.buffers.4.5.1.nupkg.sha512"
},
"System.Collections.Immutable/9.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Eje6exD7AGKPg5SIkmjyWTBq0KK6SpfTBfdFUmpGG07mNbYimFJ+jyVnILcs0ikFOXoYTBpBOxKYgAk2hhjYOw==",
"path": "system.collections.immutable/9.0.8",
"hashPath": "system.collections.immutable.9.0.8.nupkg.sha512"
},
"System.Memory/4.5.5": {
"type": "package",
"serviceable": true,
"sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
"path": "system.memory/4.5.5",
"hashPath": "system.memory.4.5.5.nupkg.sha512"
},
"System.Numerics.Vectors/4.4.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==",
"path": "system.numerics.vectors/4.4.0",
"hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512"
},
"System.Reflection.Metadata/9.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-oJQezcASFomKvSp+06pzvSFRTnzdUJtiO19peAdZ9RwiqZinBV56u7zW5fEGf2/VrQFL3qZSV7UapgG31XRWQA==",
"path": "system.reflection.metadata/9.0.8",
"hashPath": "system.reflection.metadata.9.0.8.nupkg.sha512"
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
"path": "system.runtime.compilerservices.unsafe/6.0.0",
"hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512"
}
}
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.1/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.1": {},
".NETStandard,Version=v2.1/": {
"CSNetwork/1.0.0": {
"dependencies": {
"System.Reflection.Metadata": "9.0.8"
},
"runtime": {
"CSNetwork.dll": {}
}
},
"System.Buffers/4.5.1": {
"runtime": {
"lib/netstandard2.0/System.Buffers.dll": {
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.6.28619.1"
}
}
},
"System.Collections.Immutable/9.0.8": {
"dependencies": {
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/System.Collections.Immutable.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.825.36511"
}
}
},
"System.Memory/4.5.5": {
"dependencies": {
"System.Buffers": "4.5.1",
"System.Numerics.Vectors": "4.4.0",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/System.Memory.dll": {
"assemblyVersion": "4.0.1.2",
"fileVersion": "4.6.31308.1"
}
}
},
"System.Numerics.Vectors/4.4.0": {
"runtime": {
"lib/netstandard2.0/System.Numerics.Vectors.dll": {
"assemblyVersion": "4.1.3.0",
"fileVersion": "4.6.25519.3"
}
}
},
"System.Reflection.Metadata/9.0.8": {
"dependencies": {
"System.Collections.Immutable": "9.0.8",
"System.Memory": "4.5.5"
},
"runtime": {
"lib/netstandard2.0/System.Reflection.Metadata.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.825.36511"
}
}
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"runtime": {
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
}
}
},
"libraries": {
"CSNetwork/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"System.Buffers/4.5.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==",
"path": "system.buffers/4.5.1",
"hashPath": "system.buffers.4.5.1.nupkg.sha512"
},
"System.Collections.Immutable/9.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Eje6exD7AGKPg5SIkmjyWTBq0KK6SpfTBfdFUmpGG07mNbYimFJ+jyVnILcs0ikFOXoYTBpBOxKYgAk2hhjYOw==",
"path": "system.collections.immutable/9.0.8",
"hashPath": "system.collections.immutable.9.0.8.nupkg.sha512"
},
"System.Memory/4.5.5": {
"type": "package",
"serviceable": true,
"sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
"path": "system.memory/4.5.5",
"hashPath": "system.memory.4.5.5.nupkg.sha512"
},
"System.Numerics.Vectors/4.4.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==",
"path": "system.numerics.vectors/4.4.0",
"hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512"
},
"System.Reflection.Metadata/9.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-oJQezcASFomKvSp+06pzvSFRTnzdUJtiO19peAdZ9RwiqZinBV56u7zW5fEGf2/VrQFL3qZSV7UapgG31XRWQA==",
"path": "system.reflection.metadata/9.0.8",
"hashPath": "system.reflection.metadata.9.0.8.nupkg.sha512"
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
"path": "system.runtime.compilerservices.unsafe/6.0.0",
"hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512"
}
}
}
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
@@ -6,9 +7,21 @@ namespace BrewMonster
{
public class AutoInitializer : MonoBehaviour
{
private List<IAutoInitialize> _autoInitializers = new();
private void Awake()
{
Initialize();
DontDestroyOnLoad(gameObject);
}
void OnDestroy()
{
foreach (var autoInitializer in _autoInitializers)
{
autoInitializer.Dispose();
}
_autoInitializers.Clear();
}
@@ -77,6 +90,7 @@ namespace BrewMonster
try
{
(instance as IAutoInitialize)?.Initialize();
_autoInitializers.Add(instance as IAutoInitialize);
}
catch (Exception ex)
{
@@ -0,0 +1,74 @@
using System;
using System.Text;
namespace ModelRenderer.Scripts.Common
{
public class ByteToStringUtils
{
public static string UshortArrayToUnicodeString(ushort[] ushortArray)
{
if (ushortArray == null || ushortArray.Length == 0)
return string.Empty;
// First convert ushort array to byte array
// Each ushort (16 bits) can be up to two bytes in GBK
byte[] byteArray = new byte[ushortArray.Length * 2];
Buffer.BlockCopy(ushortArray, 0, byteArray, 0, byteArray.Length);
// Convert bytes to string using GBK encoding
try
{
return Encoding.Unicode.GetString(byteArray);
}
catch (Exception ex)
{
UnityEngine.Debug.LogError($"Error converting bytes to GBK string: {ex.Message}");
return string.Empty;
}
}
public static string UshortArrayToCP936String(ushort[] ushortArray)
{
if (ushortArray == null || ushortArray.Length == 0)
return string.Empty;
// First convert ushort array to byte array
// Each ushort (16 bits) can be up to two bytes in GBK
byte[] byteArray = new byte[ushortArray.Length * 2];
Buffer.BlockCopy(ushortArray, 0, byteArray, 0, byteArray.Length);
return ByteArrayToCP936String(byteArray);
}
public static string ByteArrayToCP936String(byte[] byteArray)
{
if (byteArray == null || byteArray.Length == 0)
return string.Empty;
try
{
// Code page 936 is the code page for Simplified Chinese (GB2312/GBK)
// You may need to import System.Text.Encoding.CodePages package for Unity/modern .NET
Encoding cp936Encoding = Encoding.GetEncoding(936);
// Convert the byte array to a string using code page 936 encoding
return cp936Encoding.GetString(byteArray);
}
catch (Exception ex)
{
UnityEngine.Debug.LogError($"Error converting bytes to CP936 string: {ex.Message}");
return string.Empty;
}
}
public static string ByteArrayToUnicodeString(byte[] byteArray)
{
if (byteArray == null || byteArray.Length == 0)
return string.Empty;
return Encoding.Unicode.GetString(byteArray);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 88f3ebc7691e645f6a19f5f6c712d2c5
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fb577bf0f012e483c822630365667cd4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,675 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine;
public class AAssit
{
public static T ReadFromBinaryOf<T>(Stream stream, ref long readBytes, long fileOffset = -1)
{
// If fileOffset >= 0, seek to that position in the file
if (fileOffset >= 0)
{
stream.Seek(fileOffset, SeekOrigin.Begin);
}
int size = Marshal.SizeOf(typeof(T));
byte[] buffer = new byte[size];
// Read `size` bytes into `buffer[0..size]`
int bytesRead = stream.Read(buffer, 0, size);
if (bytesRead < size)
{
Console.WriteLine($"ERROR::Not enough data in stream to read {typeof(T).Name}. Expected {size} bytes, but only read {bytesRead}.");
return default(T);
}
// Accumulate the number of bytes read
readBytes += bytesRead;
// Pin and marshal
GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
try
{
return (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T));
}
finally
{
handle.Free();
}
}
public static T[] ReadArrayFromBinary<T>(Stream stream, int arraySize, ref long readBytes, long fileOffset = -1)
{
T[] array = new T[arraySize];
for (int i = 0; i < arraySize; i++)
{
array[i] = ReadFromBinaryOf<T>(stream, ref readBytes, fileOffset);
}
return array;
}
public static T[] ReadArrayFromBinary<T>(FileStream stream, ref long readBytes, long fileOffset = -1)
{
// seek to the fileOffset if it's >= 0
if (fileOffset >= 0)
{
stream.Seek(fileOffset, SeekOrigin.Begin);
}
// Read the first 4 bytes to get the array size
int arraySize = GetIntFromFileStream(stream, ref readBytes);
if (arraySize <= 0) return null;
T[] array = new T[arraySize];
for (int i = 0; i < arraySize; i++)
{
array[i] = ReadFromBinaryOf<T>(stream, ref readBytes, fileOffset);
}
return array;
}
public static byte[] ReadByArray(Stream stream, ref long readBytes, int size, long fileOffset = -1)
{
// If fileOffset >= 0, seek to that position in the file
if (fileOffset >= 0)
{
stream.Seek(fileOffset, SeekOrigin.Begin);
}
byte[] buffer = new byte[size];
// Read `size` bytes into `buffer[0..size]`
int bytesRead = stream.Read(buffer, 0, size);
if (bytesRead < size)
{
Console.WriteLine($"ERROR::Not enough data in stream to read byte array. Expected {size} bytes, but only read {bytesRead}.");
return null;
}
// Accumulate the number of bytes read
readBytes += bytesRead;
return buffer;
}
public static bool GetBoolFromFileStream(FileStream fs, ref long readBytes)
{
byte[] buffer = new byte[1];
int bytesRead = fs.Read(buffer, 0, 1);
if (bytesRead < 1)
throw new EndOfStreamException("Not enough data in stream to read bool.");
readBytes += bytesRead;
return buffer[0] != 0;
}
public static int GetIntFromFileStream(FileStream fs, ref long readBytes)
{
byte[] buffer = new byte[4];
int bytesRead = fs.Read(buffer, 0, 4);
if (bytesRead < 4)
throw new EndOfStreamException("Not enough data in stream to read int.");
readBytes += bytesRead;
return BitConverter.ToInt32(buffer, 0);
}
public static uint GetUIntFromFileStream(FileStream fs, ref long readBytes)
{
byte[] buffer = new byte[4];
int bytesRead = fs.Read(buffer, 0, 4);
if (bytesRead < 4)
throw new EndOfStreamException("Not enough data in stream to read uint.");
readBytes += bytesRead;
return BitConverter.ToUInt32(buffer, 0);
}
public static long GetLongFromFileStream(FileStream fs, ref long readBytes)
{
byte[] buffer = new byte[8];
int bytesRead = fs.Read(buffer, 0, 8);
if (bytesRead < 8)
throw new EndOfStreamException("Not enough data in stream to read long.");
readBytes += bytesRead;
return BitConverter.ToInt64(buffer, 0);
}
/// <summary>
/// Get the substring after <paramref name="tag"/> if <paramref name="buffer"/> starts with <paramref name="tag"/>.
/// </summary>
/// <param name="buffer">The full string to check.</param>
/// <param name="tag">The tag string to look for at the beginning of <paramref name="buffer"/>.</param>
/// <param name="result">
/// Outputs the substring of <paramref name="buffer"/> that appears immediately after <paramref name="tag"/>,
/// if <paramref name="buffer"/> does indeed start with <paramref name="tag"/>.
/// </param>
/// <returns>
/// True if <paramref name="buffer"/> starts with <paramref name="tag"/>; false otherwise.
/// </returns>
public static bool GetStringFromCharsAfter(char[] buffer, string tag, out string result)
{
// from buffer to string
string source = new string(buffer);
return GetStringAfter(source, tag, out result);
}
public static bool GetStringAfter(string source, string tag, out string result)
{
// Initialize the output in case we return false
result = string.Empty;
// Check if buffer starts with the specified tag
if (!source.StartsWith(tag))
return false;
// If it starts with tag, skip tag.Length characters
// and copy the rest to result
result = source.Substring(tag.Length);
return true;
}
/// <summary>
/// Reads a string from a binary stream at the position indicated by <paramref name="readBytes"/>.
/// 1) Seeks to <paramref name="readBytes"/> from the start of the stream (SeekOrigin.Begin).
/// 2) Reads 4 bytes (an int) that specify the string length (in bytes).
/// 3) If length is 0, returns "".
/// 4) Otherwise, reads the specified number of bytes and decodes to a string.
/// 5) Updates <paramref name="readBytes"/> to the new position after reading.
/// </summary>
/// <param name="stream">The stream from which to read.</param>
/// <param name="readBytes">
/// On entry, this indicates where to seek in the stream (from the beginning).
/// On exit, this will be updated to the new position after reading.
/// </param>
/// <param name="result">Outputs the decoded string.</param>
/// <returns>True if successful; otherwise false (e.g., not enough data).</returns>
public static bool ReadString(Stream stream, ref long readBytes, out string result)
{
result = ReadString(stream, ref readBytes);
return result != null;
}
public static string ReadString(Stream stream, ref long readBytes)
{
var result = string.Empty;
try
{
int length = 0;
byte[] buffer = new byte[4];
int byteRead = stream.Read(buffer, 0, 4);
if (byteRead < 4)
return null;
readBytes += byteRead;
length = BitConverter.ToInt32(buffer, 0);
if (length == 0)
return null;
buffer = new byte[length];
byteRead = stream.Read(buffer, 0, length);
if (byteRead < length)
return null;
readBytes += byteRead;
// Encoding encoding =
result = Encoding.GetEncoding(936).GetString(buffer);
return result;
}
catch (Exception e)
{
// Could be EndOfStreamException, IOException, etc.
// Handle or log the exception as needed
return null;
}
}
public static void ReadLine(Stream stream, ref long bytesRead, out string result)
{
result = Fgets(stream, 1024, Encoding.GetEncoding(936));
bytesRead += result.Length;
}
/// <summary>
/// Reads a null-terminated string from <paramref name="stream"/>, starting at <paramref name="fileOffset"/>.
/// - Seeks to <paramref name="fileOffset"/> in the file.
/// - Reads one byte at a time until encountering a null (0x00) or reaching <paramref name="bufferLength"/> - 1.
/// - Decodes the collected bytes using the specified <paramref name="encoding"/>.
/// - Appends how many bytes it actually read to <paramref name="alreadyReadBytes"/>.
///
/// Returns true on success (string in <paramref name="result"/>), or false if an error occurs
/// (EOF, buffer overflow, etc.).
/// </summary>
/// <param name="stream">Open, readable <see cref="Stream"/>.</param>
/// <param name="fileOffset">Absolute offset in the file to seek before reading.</param>
/// <param name="bufferLength">Maximum number of characters to collect (like the C++ dwBufferLength).</param>
/// <param name="alreadyReadBytes">Accumulates how many bytes we've read so far across calls.</param>
/// <param name="encoding">Encoding used to interpret the raw bytes (e.g. <see cref="Encoding.ASCII"/>).</param>
/// <param name="result">Outputs the decoded string (excluding the null terminator).</param>
/// <returns>True if a string was successfully read, false otherwise.</returns>
public static bool ReadString(Stream stream,long fileOffset,int bufferLength,ref long alreadyReadBytes, Encoding encoding,out string result)
{
result = null;
// Basic argument checks
if (stream == null)
throw new ArgumentNullException(nameof(stream));
if (!stream.CanRead)
throw new ArgumentException("Stream must be readable.", nameof(stream));
if (bufferLength < 2)
throw new ArgumentOutOfRangeException(nameof(bufferLength), "Buffer length must be >= 2.");
if (encoding == null)
throw new ArgumentNullException(nameof(encoding));
// 1) Seek to the specified offset from the beginning of the file
stream.Seek(fileOffset, SeekOrigin.Begin);
// 2) We will collect bytes into this temporary array (exclude the null terminator)
byte[] buffer = new byte[bufferLength - 1];
int index = 0;
// Try reading first byte
int firstByte = stream.ReadByte();
if (firstByte == -1)
{
// EOF immediately
return false;
}
// We have read 1 byte so far in this call
long localRead = 1;
byte b = (byte)firstByte;
// 3) Read until we hit a zero byte (null terminator) or fill the buffer
while (b != 0)
{
buffer[index++] = b;
// Check for overflow
if (index >= bufferLength - 1)
{
// We would overflow if we read more data
return false;
}
int nextByte = stream.ReadByte();
if (nextByte == -1)
{
// EOF before we found a null terminator
return false;
}
localRead++;
b = (byte)nextByte;
// Loop continues until b == 0
}
// If we get here, b == 0 => null terminator found.
// localRead already includes the byte we used for the null terminator
// 4) Update total bytes read (across calls)
alreadyReadBytes += localRead;
// 5) Convert the collected bytes to a string
result = encoding.GetString(buffer, 0, index);
return true;
}
/// <summary>
/// Reads up to <paramref name="maxLength"/> - 1 characters from <paramref name="stream"/>,
/// stopping at newline or EOF. Returns the line (including the newline) or null if no bytes were read.
/// </summary>
/// <param name="stream">An open readable Stream.</param>
/// <param name="maxLength">
/// The maximum number of characters to read (like the buffer size in fgets).
/// The actual string can have up to maxLength - 1 characters plus a null terminator in C terms.
/// </param>
/// <param name="encoding">The character encoding (ASCII, UTF8, etc.).</param>
/// <returns>A string containing the line, or null if no data was read.</returns>
public static string Fgets(Stream stream, int maxLength, Encoding encoding)
{
if (stream == null) throw new ArgumentNullException(nameof(stream));
if (!stream.CanRead) throw new ArgumentException("Stream is not readable.", nameof(stream));
if (maxLength <= 1) throw new ArgumentOutOfRangeException(nameof(maxLength), "Must be at least 2.");
// We'll store the raw bytes in a temporary buffer.
// maxLength - 1 because, in the C analogy, one char is reserved for '\0'.
// But in C#, we'll just use that as a ceiling.
byte[] buffer = new byte[maxLength - 1];
int totalRead = 0;
while (true)
{
int b = stream.ReadByte();
if (b == -1)
{
// EOF reached, stop reading
break;
}
// Put this byte into our buffer
buffer[totalRead++] = (byte)b;
// If we hit a newline, stop (mimicking fgets which stops at '\n')
if (b == '\n')
{
break;
}
// If we've filled up the buffer (maxLength - 1 bytes), stop
if (totalRead >= buffer.Length)
{
break;
}
}
// If we didn't read anything at all, return null (like fgets returning NULL on EOF)
if (totalRead == 0)
{
return null;
}
// Convert the bytes we read into a string
return encoding.GetString(buffer, 0, totalRead);
}
private static readonly uint[] l_aCRC32Table = new uint[]
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
0x2d02ef8d
};
public static uint MakeIDFromString(string str)
{
if (str == null)
throw new ArgumentNullException(nameof(str));
uint c = 0xffffffff; // shift register contents
byte[] bytes = Encoding.ASCII.GetBytes(str);
foreach (byte b in bytes)
{
c = l_aCRC32Table[(c ^ b) & 0xff] ^ (c >> 8);
}
return c ^ 0xffffffff;
}
// load the DXT texture from the byte array.
// The byte array is loaded after loading the A3DSkin
public static Texture2D LoadTextureDXT(byte[] ddsBytes)
{
// from 72 to 76 is the texture format
// get the texture format from the ddsBytes
byte[] formatBytes = new byte[4];
Array.Copy(ddsBytes, 84, formatBytes, 0, 4);
// Convert the byte array to a string (assume it's ASCII-encoded)
string textureFormat = Encoding.UTF8.GetString(formatBytes);
TextureFormat.TryParse(textureFormat, out TextureFormat textureFormatEnum);
if (textureFormatEnum != TextureFormat.DXT1 && textureFormatEnum != TextureFormat.DXT5)
{
Console.WriteLine($"ERROR::Expected DXT1 or DXT5 texture format, but got {textureFormat}. Using DXT5 instead.");
textureFormatEnum = TextureFormat.DXT5;
}
byte ddsSizeCheck = ddsBytes[4];
if (ddsSizeCheck != 124)
{
Console.WriteLine("ERROR::Invalid DDS DXTn texture. Unable to read"); //this header byte should be 124 for DDS image files
return Texture2D.whiteTexture;
}
int height = ddsBytes[13] * 256 + ddsBytes[12];
int width = ddsBytes[17] * 256 + ddsBytes[16];
int DDS_HEADER_SIZE = 128;
byte[] dxtBytes = new byte[ddsBytes.Length - DDS_HEADER_SIZE];
Buffer.BlockCopy(ddsBytes, DDS_HEADER_SIZE, dxtBytes, 0, ddsBytes.Length - DDS_HEADER_SIZE);
Texture2D texture = new Texture2D(width, height, textureFormatEnum, false);
texture.LoadRawTextureData(dxtBytes);
texture.Apply();
return (texture);
}
public static Texture2D LoadTextureTGA(string filePath)
{
if (!File.Exists(filePath)) return Texture2D.whiteTexture;
using (var tgaStream = File.OpenRead(filePath))
using (BinaryReader r = new BinaryReader(tgaStream))
{
// Skip some header info we don't care about.
// Even if we did care, we have to move the stream seek point to the beginning,
// as the previous method in the workflow left it at the end.
r.BaseStream.Seek(12, SeekOrigin.Begin);
short width = r.ReadInt16();
short height = r.ReadInt16();
int bitDepth = r.ReadByte();
// Skip a byte of header information we don't care about.
r.BaseStream.Seek(1, SeekOrigin.Current);
Texture2D tex = new Texture2D(width, height);
Color32[] pulledColors = new Color32[width * height];
if (bitDepth == 32)
{
for (int i = 0; i < width * height; i++)
{
byte red = r.ReadByte();
byte green = r.ReadByte();
byte blue = r.ReadByte();
byte alpha = r.ReadByte();
pulledColors[i] = new Color32(blue, green, red, alpha);
}
}
else if (bitDepth == 24)
{
for (int i = 0; i < width * height; i++)
{
byte red = r.ReadByte();
byte green = r.ReadByte();
byte blue = r.ReadByte();
pulledColors[i] = new Color32(blue, green, red, 1);
}
}
else
{
throw new Exception("TGA texture had non 32/24 bit depth.");
}
tex.SetPixels32(pulledColors);
tex.Apply();
return tex;
}
}
/// <summary>
/// Saves a Texture2D to a PNG file at the specified absolute path.
/// If a file already exists at the path, returns true without overwriting.
/// If the file doesn't exist, creates a new PNG file and saves the texture.
/// </summary>
/// <param name="texture">The Texture2D to save as PNG</param>
/// <param name="absolutePath">The absolute file path where to save the PNG</param>
/// <returns>True if file already exists or was successfully saved, false on error</returns>
public static bool SaveTexture2DToPNG(Texture2D texture, string absolutePath, bool compressedTexture = false)
{
// Check if texture parameter is valid
if (texture == null)
{
Debug.LogError("SaveTexture2DToPNG: Texture is null");
return false;
}
// Check if the absolute path is valid
if (string.IsNullOrEmpty(absolutePath))
{
Debug.LogError("SaveTexture2DToPNG: Absolute path is null or empty");
return false;
}
// Check if file already exists
if (File.Exists(absolutePath))
{
return true; // File already exists, return true
}
try
{
// Ensure the directory exists
string directory = Path.GetDirectoryName(absolutePath);
if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
if (compressedTexture)
{
// Create a temporary RenderTexture with same dimensions as source
RenderTexture tempRT = RenderTexture.GetTemporary(
texture.width,
texture.height,
0,
RenderTextureFormat.ARGB32
);
// Copy compressed texture to RT, decompressing on GPU
Graphics.Blit(texture, tempRT);
// Create new uncompressed texture
Texture2D uncompressedTex = new Texture2D(
texture.width,
texture.height,
TextureFormat.ARGB32,
false
);
// Store active RT and switch to temp
RenderTexture prevRT = RenderTexture.active;
RenderTexture.active = tempRT;
// Read pixels from RT into uncompressed texture
uncompressedTex.ReadPixels(new Rect(0, 0, tempRT.width, tempRT.height), 0, 0);
uncompressedTex.Apply();
// Restore previous RT and release temp
RenderTexture.active = prevRT;
RenderTexture.ReleaseTemporary(tempRT);
// Use uncompressed texture instead of original
texture = uncompressedTex;
}
// Encode texture to PNG
byte[] pngBytes = texture.EncodeToPNG();
if (pngBytes == null || pngBytes.Length == 0)
{
Debug.LogError("SaveTexture2DToPNG: Failed to encode texture to PNG");
return false;
}
// Write PNG bytes to file
File.WriteAllBytes(absolutePath, pngBytes);
Debug.Log($"SaveTexture2DToPNG: Successfully saved texture to {absolutePath}");
return true;
}
catch (Exception e)
{
Debug.LogError($"SaveTexture2DToPNG: Error saving texture to {absolutePath}: {e.Message}");
return false;
}
}
/// <summary>
/// This is for when we load a byte buffer for string. \
/// We have to remove the empty byte at the end so the string can be decoded correctly.
/// </summary>
/// <param name="buffer"></param>
public static void RemoveEmptyByte(ref byte[] buffer)
{
int firstEmptyByte = Array.IndexOf(buffer, (byte)0);
if (firstEmptyByte != -1)
{
Array.Resize(ref buffer, firstEmptyByte);
}
}
}
public struct StringStruct
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2048)]
public char[] value;
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a80dd3d13d411402590a158039cb737c
@@ -0,0 +1,37 @@
using System;
using ModelRenderer.Scripts.GameData;
namespace BrewMonster
{
public class ElementDataManProvider : IAutoInitialize
{
private static ElementDataManProvider _instance;
private elementdataman _elementDataMan;
public static elementdataman GetElementDataMan()
{
return _instance._elementDataMan;
}
public void Initialize()
{
_elementDataMan = new();
_instance = this;
try
{
_elementDataMan.load_data();
}
catch (Exception ex)
{
Logger.LogError($"ElementDataManProvider: Failed to load element data: {ex}");
}
}
public void Dispose()
{
_elementDataMan = null;
_instance = null;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 63743217e486c458c898f68ece49e459
@@ -0,0 +1,721 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using BrewMonster;
namespace ModelRenderer.Scripts.GameData
{
public class elementdataman
{
private static elementdataman instance;
public static elementdataman Instance
{
get
{
if (instance == null)
{
instance = new elementdataman();
}
return instance;
}
}
public Dictionary<uint, DATA_TYPE> essence_id_data_type_map = new Dictionary<uint, DATA_TYPE>();
public Dictionary<uint, object> essence_id_data_map = new Dictionary<uint, object>();
public EQUIPMENT_ADDON[] equipment_addon_array = new EQUIPMENT_ADDON[0];
public WEAPON_MAJOR_TYPE[] weapon_major_type_array = new WEAPON_MAJOR_TYPE[0];
public WEAPON_SUB_TYPE[] weapon_sub_type_array = new WEAPON_SUB_TYPE[0];
public WEAPON_ESSENCE[] weapon_essence_array = new WEAPON_ESSENCE[0];
public ARMOR_MAJOR_TYPE[] armor_major_type_array = new ARMOR_MAJOR_TYPE[0];
public ARMOR_SUB_TYPE[] armor_sub_type_array = new ARMOR_SUB_TYPE[0];
public ARMOR_ESSENCE[] armor_essence_array = new ARMOR_ESSENCE[0];
public DECORATION_MAJOR_TYPE[] decoration_major_type_array = new DECORATION_MAJOR_TYPE[0];
public DECORATION_SUB_TYPE[] decoration_sub_type_array = new DECORATION_SUB_TYPE[0];
public DECORATION_ESSENCE[] decoration_essence_array = new DECORATION_ESSENCE[0];
public MEDICINE_MAJOR_TYPE[] medicine_major_type_array = new MEDICINE_MAJOR_TYPE[0];
public MEDICINE_SUB_TYPE[] medicine_sub_type_array = new MEDICINE_SUB_TYPE[0];
public MEDICINE_ESSENCE[] medicine_essence_array = new MEDICINE_ESSENCE[0];
public MATERIAL_MAJOR_TYPE[] material_major_type_array = new MATERIAL_MAJOR_TYPE[0];
public MATERIAL_SUB_TYPE[] material_sub_type_array = new MATERIAL_SUB_TYPE[0];
public MATERIAL_ESSENCE[] material_essence_array = new MATERIAL_ESSENCE[0];
public DAMAGERUNE_SUB_TYPE[] damagerune_sub_type_array = new DAMAGERUNE_SUB_TYPE[0];
public DAMAGERUNE_ESSENCE[] damagerune_essence_array = new DAMAGERUNE_ESSENCE[0];
public ARMORRUNE_SUB_TYPE[] armorrune_sub_type_array = new ARMORRUNE_SUB_TYPE[0];
public ARMORRUNE_ESSENCE[] armorrune_essence_array = new ARMORRUNE_ESSENCE[0];
public SKILLTOME_SUB_TYPE[] skilltome_sub_type_array = new SKILLTOME_SUB_TYPE[0];
public SKILLTOME_ESSENCE[] skilltome_essence_array = new SKILLTOME_ESSENCE[0];
public FLYSWORD_ESSENCE[] flysword_essence_array = new FLYSWORD_ESSENCE[0];
public WINGMANWING_ESSENCE[] wingmanwing_essence_array = new WINGMANWING_ESSENCE[0];
public TOWNSCROLL_ESSENCE[] townscroll_essence_array = new TOWNSCROLL_ESSENCE[0];
public UNIONSCROLL_ESSENCE[] unionscroll_essence_array = new UNIONSCROLL_ESSENCE[0];
public REVIVESCROLL_ESSENCE[] revivescroll_essence_array = new REVIVESCROLL_ESSENCE[0];
public ELEMENT_ESSENCE[] element_essence_array = new ELEMENT_ESSENCE[0];
public TASKMATTER_ESSENCE[] taskmatter_essence_array = new TASKMATTER_ESSENCE[0];
public TOSSMATTER_ESSENCE[] tossmatter_essence_array = new TOSSMATTER_ESSENCE[0];
public PROJECTILE_TYPE[] projectile_type_array = new PROJECTILE_TYPE[0];
public PROJECTILE_ESSENCE[] projectile_essence_array = new PROJECTILE_ESSENCE[0];
public QUIVER_SUB_TYPE[] quiver_sub_type_array = new QUIVER_SUB_TYPE[0];
public QUIVER_ESSENCE[] quiver_essence_array = new QUIVER_ESSENCE[0];
public STONE_SUB_TYPE[] stone_sub_type_array = new STONE_SUB_TYPE[0];
public STONE_ESSENCE[] stone_essence_array = new STONE_ESSENCE[0];
public MONSTER_ADDON[] monster_addon_array = new MONSTER_ADDON[0];
public MONSTER_TYPE[] monster_type_array = new MONSTER_TYPE[0];
public MONSTER_ESSENCE[] monster_essence_array = new MONSTER_ESSENCE[0];
public NPC_TALK_SERVICE[] npc_talk_service_array = new NPC_TALK_SERVICE[0];
public NPC_SELL_SERVICE[] npc_sell_service_array = new NPC_SELL_SERVICE[0];
public NPC_BUY_SERVICE[] npc_buy_service_array = new NPC_BUY_SERVICE[0];
public NPC_REPAIR_SERVICE[] npc_repair_service_array = new NPC_REPAIR_SERVICE[0];
public NPC_INSTALL_SERVICE[] npc_install_service_array = new NPC_INSTALL_SERVICE[0];
public NPC_UNINSTALL_SERVICE[] npc_uninstall_service_array = new NPC_UNINSTALL_SERVICE[0];
public NPC_TASK_IN_SERVICE[] npc_task_in_service_array = new NPC_TASK_IN_SERVICE[0];
public NPC_TASK_OUT_SERVICE[] npc_task_out_service_array = new NPC_TASK_OUT_SERVICE[0];
public NPC_TASK_MATTER_SERVICE[] npc_task_matter_service_array = new NPC_TASK_MATTER_SERVICE[0];
public NPC_SKILL_SERVICE[] npc_skill_service_array = new NPC_SKILL_SERVICE[0];
public NPC_HEAL_SERVICE[] npc_heal_service_array = new NPC_HEAL_SERVICE[0];
public NPC_TRANSMIT_SERVICE[] npc_transmit_service_array = new NPC_TRANSMIT_SERVICE[0];
public NPC_TRANSPORT_SERVICE[] npc_transport_service_array = new NPC_TRANSPORT_SERVICE[0];
public NPC_PROXY_SERVICE[] npc_proxy_service_array = new NPC_PROXY_SERVICE[0];
public NPC_STORAGE_SERVICE[] npc_storage_service_array = new NPC_STORAGE_SERVICE[0];
public NPC_MAKE_SERVICE[] npc_make_service_array = new NPC_MAKE_SERVICE[0];
public NPC_DECOMPOSE_SERVICE[] npc_decompose_service_array = new NPC_DECOMPOSE_SERVICE[0];
public NPC_TYPE[] npc_type_array = new NPC_TYPE[0];
public NPC_ESSENCE[] npc_essence_array = new NPC_ESSENCE[0];
public talk_proc[] talk_proc_array = new talk_proc[0];
public FACE_TEXTURE_ESSENCE[] face_texture_essence_array = new FACE_TEXTURE_ESSENCE[0];
public FACE_SHAPE_ESSENCE[] face_shape_essence_array = new FACE_SHAPE_ESSENCE[0];
public FACE_EMOTION_TYPE[] face_emotion_type_array = new FACE_EMOTION_TYPE[0];
public FACE_EXPRESSION_ESSENCE[] face_expression_essence_array = new FACE_EXPRESSION_ESSENCE[0];
public FACE_HAIR_ESSENCE[] face_hair_essence_array = new FACE_HAIR_ESSENCE[0];
public FACE_MOUSTACHE_ESSENCE[] face_moustache_essence_array = new FACE_MOUSTACHE_ESSENCE[0];
public COLORPICKER_ESSENCE[] colorpicker_essence_array = new COLORPICKER_ESSENCE[0];
public CUSTOMIZEDATA_ESSENCE[] customizedata_essence_array = new CUSTOMIZEDATA_ESSENCE[0];
public RECIPE_MAJOR_TYPE[] recipe_major_type_array = new RECIPE_MAJOR_TYPE[0];
public RECIPE_SUB_TYPE[] recipe_sub_type_array = new RECIPE_SUB_TYPE[0];
public RECIPE_ESSENCE[] recipe_essence_array = new RECIPE_ESSENCE[0];
public ENEMY_FACTION_CONFIG[] enemy_faction_config_array = new ENEMY_FACTION_CONFIG[0];
public CHARACTER_CLASS_CONFIG[] character_class_config_array = new CHARACTER_CLASS_CONFIG[0];
public PARAM_ADJUST_CONFIG[] param_adjust_config_array = new PARAM_ADJUST_CONFIG[0];
public PLAYER_ACTION_INFO_CONFIG[] player_action_info_config_array = new PLAYER_ACTION_INFO_CONFIG[0];
public TASKDICE_ESSENCE[] taskdice_essence_array = new TASKDICE_ESSENCE[0];
public TASKNORMALMATTER_ESSENCE[] tasknormalmatter_essence_array = new TASKNORMALMATTER_ESSENCE[0];
public FACE_FALING_ESSENCE[] face_faling_essence_array = new FACE_FALING_ESSENCE[0];
public PLAYER_LEVELEXP_CONFIG[] player_levelexp_config_array = new PLAYER_LEVELEXP_CONFIG[0];
public MINE_TYPE[] mine_type_array = new MINE_TYPE[0];
public MINE_ESSENCE[] mine_essence_array = new MINE_ESSENCE[0];
public NPC_IDENTIFY_SERVICE[] npc_identify_service_array = new NPC_IDENTIFY_SERVICE[0];
public FASHION_MAJOR_TYPE[] fashion_major_type_array = new FASHION_MAJOR_TYPE[0];
public FASHION_SUB_TYPE[] fashion_sub_type_array = new FASHION_SUB_TYPE[0];
public FASHION_ESSENCE[] fashion_essence_array = new FASHION_ESSENCE[0];
public FACETICKET_MAJOR_TYPE[] faceticket_major_type_array = new FACETICKET_MAJOR_TYPE[0];
public FACETICKET_SUB_TYPE[] faceticket_sub_type_array = new FACETICKET_SUB_TYPE[0];
public FACETICKET_ESSENCE[] faceticket_essence_array = new FACETICKET_ESSENCE[0];
public FACEPILL_MAJOR_TYPE[] facepill_major_type_array = new FACEPILL_MAJOR_TYPE[0];
public FACEPILL_SUB_TYPE[] facepill_sub_type_array = new FACEPILL_SUB_TYPE[0];
public FACEPILL_ESSENCE[] facepill_essence_array = new FACEPILL_ESSENCE[0];
public SUITE_ESSENCE[] suite_essence_array = new SUITE_ESSENCE[0];
public GM_GENERATOR_TYPE[] gm_generator_type_array = new GM_GENERATOR_TYPE[0];
public GM_GENERATOR_ESSENCE[] gm_generator_essence_array = new GM_GENERATOR_ESSENCE[0];
public PET_TYPE[] pet_type_array = new PET_TYPE[0];
public PET_ESSENCE[] pet_essence_array = new PET_ESSENCE[0];
public PET_EGG_ESSENCE[] pet_egg_essence_array = new PET_EGG_ESSENCE[0];
public PET_FOOD_ESSENCE[] pet_food_essence_array = new PET_FOOD_ESSENCE[0];
public PET_FACETICKET_ESSENCE[] pet_faceticket_essence_array = new PET_FACETICKET_ESSENCE[0];
public FIREWORKS_ESSENCE[] fireworks_essence_array = new FIREWORKS_ESSENCE[0];
public WAR_TANKCALLIN_ESSENCE[] war_tankcallin_essence_array = new WAR_TANKCALLIN_ESSENCE[0];
public NPC_WAR_TOWERBUILD_SERVICE[] npc_war_towerbuild_service_array = new NPC_WAR_TOWERBUILD_SERVICE[0];
public PLAYER_SECONDLEVEL_CONFIG[] player_secondlevel_config_array = new PLAYER_SECONDLEVEL_CONFIG[0];
public NPC_RESETPROP_SERVICE[] npc_resetprop_service_array = new NPC_RESETPROP_SERVICE[0];
public NPC_PETNAME_SERVICE[] npc_petname_service_array = new NPC_PETNAME_SERVICE[0];
public NPC_PETLEARNSKILL_SERVICE[] npc_petlearnskill_service_array = new NPC_PETLEARNSKILL_SERVICE[0];
public NPC_PETFORGETSKILL_SERVICE[] npc_petforgetskill_service_array = new NPC_PETFORGETSKILL_SERVICE[0];
public SKILLMATTER_ESSENCE[] skillmatter_essence_array = new SKILLMATTER_ESSENCE[0];
public REFINE_TICKET_ESSENCE[] refine_ticket_essence_array = new REFINE_TICKET_ESSENCE[0];
public DESTROYING_ESSENCE[] destroying_essence_array = new DESTROYING_ESSENCE[0];
public NPC_EQUIPBIND_SERVICE[] npc_equipbind_service_array = new NPC_EQUIPBIND_SERVICE[0];
public NPC_EQUIPDESTROY_SERVICE[] npc_equipdestroy_service_array = new NPC_EQUIPDESTROY_SERVICE[0];
public NPC_EQUIPUNDESTROY_SERVICE[] npc_equipundestroy_service_array = new NPC_EQUIPUNDESTROY_SERVICE[0];
public BIBLE_ESSENCE[] bible_essence_array = new BIBLE_ESSENCE[0];
public SPEAKER_ESSENCE[] speaker_essence_array = new SPEAKER_ESSENCE[0];
public AUTOMP_ESSENCE[] automp_essence_array = new AUTOMP_ESSENCE[0];
public AUTOHP_ESSENCE[] autohp_essence_array = new AUTOHP_ESSENCE[0];
public DOUBLE_EXP_ESSENCE[] double_exp_essence_array = new DOUBLE_EXP_ESSENCE[0];
public TRANSMITSCROLL_ESSENCE[] transmitscroll_essence_array = new TRANSMITSCROLL_ESSENCE[0];
public DYE_TICKET_ESSENCE[] dye_ticket_essence_array = new DYE_TICKET_ESSENCE[0];
public GOBLIN_ESSENCE[] goblin_essence_array = new GOBLIN_ESSENCE[0];
public GOBLIN_EQUIP_TYPE[] goblin_equip_type_array = new GOBLIN_EQUIP_TYPE[0];
public GOBLIN_EQUIP_ESSENCE[] goblin_equip_essence_array = new GOBLIN_EQUIP_ESSENCE[0];
public GOBLIN_EXPPILL_ESSENCE[] goblin_exppill_essence_array = new GOBLIN_EXPPILL_ESSENCE[0];
public SELL_CERTIFICATE_ESSENCE[] sell_certificate_essence_array = new SELL_CERTIFICATE_ESSENCE[0];
public TARGET_ITEM_ESSENCE[] target_item_essence_array = new TARGET_ITEM_ESSENCE[0];
public LOOK_INFO_ESSENCE[] look_info_essence_array = new LOOK_INFO_ESSENCE[0];
public UPGRADE_PRODUCTION_CONFIG[] upgrade_production_config_array = new UPGRADE_PRODUCTION_CONFIG[0];
public ACC_STORAGE_BLACKLIST_CONFIG[] acc_storage_blacklist_config_array = new ACC_STORAGE_BLACKLIST_CONFIG[0];
public FACE_HAIR_TEXTURE_MAP[] face_hair_texture_map_array = new FACE_HAIR_TEXTURE_MAP[0];
public MULTI_EXP_CONFIG[] multi_exp_config_array = new MULTI_EXP_CONFIG[0];
public INC_SKILL_ABILITY_ESSENCE[] inc_skill_ability_essence_array = new INC_SKILL_ABILITY_ESSENCE[0];
public GOD_EVIL_CONVERT_CONFIG[] god_evil_convert_config_array = new GOD_EVIL_CONVERT_CONFIG[0];
public WEDDING_CONFIG[] wedding_config_array = new WEDDING_CONFIG[0];
public WEDDING_BOOKCARD_ESSENCE[] wedding_bookcard_essence_array = new WEDDING_BOOKCARD_ESSENCE[0];
public WEDDING_INVITECARD_ESSENCE[] wedding_invitecard_essence_array = new WEDDING_INVITECARD_ESSENCE[0];
public SHARPENER_ESSENCE[] sharpener_essence_array = new SHARPENER_ESSENCE[0];
public FACE_THIRDEYE_ESSENCE[] face_thirdeye_essence_array = new FACE_THIRDEYE_ESSENCE[0];
public FACTION_FORTRESS_CONFIG[] faction_fortress_config_array = new FACTION_FORTRESS_CONFIG[0];
public FACTION_BUILDING_SUB_TYPE[] faction_building_sub_type_array = new FACTION_BUILDING_SUB_TYPE[0];
public FACTION_BUILDING_ESSENCE[] faction_building_essence_array = new FACTION_BUILDING_ESSENCE[0];
public FACTION_MATERIAL_ESSENCE[] faction_material_essence_array = new FACTION_MATERIAL_ESSENCE[0];
public CONGREGATE_ESSENCE[] congregate_essence_array = new CONGREGATE_ESSENCE[0];
public ENGRAVE_MAJOR_TYPE[] engrave_major_type_array = new ENGRAVE_MAJOR_TYPE[0];
public ENGRAVE_SUB_TYPE[] engrave_sub_type_array = new ENGRAVE_SUB_TYPE[0];
public ENGRAVE_ESSENCE[] engrave_essence_array = new ENGRAVE_ESSENCE[0];
public NPC_ENGRAVE_SERVICE[] npc_engrave_service_array = new NPC_ENGRAVE_SERVICE[0];
public NPC_RANDPROP_SERVICE[] npc_randprop_service_array = new NPC_RANDPROP_SERVICE[0];
public RANDPROP_TYPE[] randprop_type_array = new RANDPROP_TYPE[0];
public RANDPROP_ESSENCE[] randprop_essence_array = new RANDPROP_ESSENCE[0];
public WIKI_TABOO_CONFIG[] wiki_taboo_config_array = new WIKI_TABOO_CONFIG[0];
public FORCE_CONFIG[] force_config_array = new FORCE_CONFIG[0];
public FORCE_TOKEN_ESSENCE[] force_token_essence_array = new FORCE_TOKEN_ESSENCE[0];
public NPC_FORCE_SERVICE[] npc_force_service_array = new NPC_FORCE_SERVICE[0];
public PLAYER_DEATH_DROP_CONFIG[] player_death_drop_config_array = new PLAYER_DEATH_DROP_CONFIG[0];
public DYNSKILLEQUIP_ESSENCE[] dynskillequip_essence_array = new DYNSKILLEQUIP_ESSENCE[0];
public CONSUME_POINTS_CONFIG[] consume_points_config_array = new CONSUME_POINTS_CONFIG[0];
public ONLINE_AWARDS_CONFIG[] online_awards_config_array = new ONLINE_AWARDS_CONFIG[0];
public COUNTRY_CONFIG[] country_config_array = new COUNTRY_CONFIG[0];
public GM_ACTIVITY_CONFIG[] gm_activity_config_array = new GM_ACTIVITY_CONFIG[0];
public FASHION_WEAPON_CONFIG[] fashion_weapon_config_array = new FASHION_WEAPON_CONFIG[0];
public PET_EVOLVE_CONFIG[] pet_evolve_config_array = new PET_EVOLVE_CONFIG[0];
public PET_EVOLVED_SKILL_CONFIG[] pet_evolved_skill_config_array = new PET_EVOLVED_SKILL_CONFIG[0];
public MONEY_CONVERTIBLE_ESSENCE[] money_convertible_essence_array = new MONEY_CONVERTIBLE_ESSENCE[0];
public STONE_CHANGE_RECIPE_TYPE[] stone_change_recipe_type_array = new STONE_CHANGE_RECIPE_TYPE[0];
public STONE_CHANGE_RECIPE[] stone_change_recipe_array = new STONE_CHANGE_RECIPE[0];
public MERIDIAN_CONFIG[] meridian_config_array = new MERIDIAN_CONFIG[0];
public PET_EVOLVED_SKILL_RAND_CONFIG[] pet_evolved_skill_rand_config_array = new PET_EVOLVED_SKILL_RAND_CONFIG[0];
public AUTOTASK_DISPLAY_CONFIG[] autotask_display_config_array = new AUTOTASK_DISPLAY_CONFIG[0];
public TOUCH_SHOP_CONFIG[] touch_shop_config_array = new TOUCH_SHOP_CONFIG[0];
public TITLE_CONFIG[] title_config_array = new TITLE_CONFIG[0];
public COMPLEX_TITLE_CONFIG[] complex_title_config_array = new COMPLEX_TITLE_CONFIG[0];
public MONSTER_SPIRIT_ESSENCE[] monster_spirit_essence_array = new MONSTER_SPIRIT_ESSENCE[0];
public PLAYER_SPIRIT_CONFIG[] player_spirit_config_array = new PLAYER_SPIRIT_CONFIG[0];
public PLAYER_REINCARNATION_CONFIG[] player_reincarnation_config_array = new PLAYER_REINCARNATION_CONFIG[0];
public HISTORY_STAGE_CONFIG[] history_stage_config_array = new HISTORY_STAGE_CONFIG[0];
public HISTORY_ADVANCE_CONFIG[] history_advance_config_array = new HISTORY_ADVANCE_CONFIG[0];
public AUTOTEAM_CONFIG[] autoteam_config_array = new AUTOTEAM_CONFIG[0];
public PLAYER_REALM_CONFIG[] player_realm_config_array = new PLAYER_REALM_CONFIG[0];
public CHARIOT_CONFIG[] chariot_config_array = new CHARIOT_CONFIG[0];
public CHARIOT_WAR_CONFIG[] chariot_war_config_array = new CHARIOT_WAR_CONFIG[0];
public POKER_LEVELEXP_CONFIG[] poker_levelexp_config_array = new POKER_LEVELEXP_CONFIG[0];
public POKER_SUITE_ESSENCE[] poker_suite_essence_array = new POKER_SUITE_ESSENCE[0];
public POKER_DICE_ESSENCE[] poker_dice_essence_array = new POKER_DICE_ESSENCE[0];
public POKER_SUB_TYPE[] poker_sub_type_array = new POKER_SUB_TYPE[0];
public POKER_ESSENCE[] poker_essence_array = new POKER_ESSENCE[0];
public TOKEN_SHOP_CONFIG[] token_shop_config_array = new TOKEN_SHOP_CONFIG[0];
public SHOP_TOKEN_ESSENCE[] shop_token_essence_array = new SHOP_TOKEN_ESSENCE[0];
public GT_CONFIG[] gt_config_array = new GT_CONFIG[0];
public RAND_SHOP_CONFIG[] rand_shop_config_array = new RAND_SHOP_CONFIG[0];
public PROFIT_TIME_CONFIG[] profit_time_config_array = new PROFIT_TIME_CONFIG[0];
public FACTION_PVP_CONFIG[] faction_pvp_config_array = new FACTION_PVP_CONFIG[0];
public UNIVERSAL_TOKEN_ESSENCE[] universal_token_essence_array = new UNIVERSAL_TOKEN_ESSENCE[0];
public TASK_LIST_CONFIG[] task_list_config_array = new TASK_LIST_CONFIG[0];
public TASK_DICE_BY_WEIGHT_CONFIG[] task_dice_by_weight_config_array = new TASK_DICE_BY_WEIGHT_CONFIG[0];
public FASHION_SUITE_ESSENCE[] fashion_suite_essence_array = new FASHION_SUITE_ESSENCE[0];
public FASHION_BEST_COLOR_CONFIG[] fashion_best_color_config_array = new FASHION_BEST_COLOR_CONFIG[0];
public SIGN_AWARD_CONFIG[] sign_award_config_array = new SIGN_AWARD_CONFIG[0];
public int load_data(string pathname = "")
{
if (string.IsNullOrEmpty(pathname))
{
pathname = Path.Combine(UnityEngine.Application.streamingAssetsPath, "elements.data");
}
if (!File.Exists(pathname)) return -1;
using (var file = new FileStream(pathname, FileMode.Open, FileAccess.Read))
{
long dwRead = 0;
int version = AAssit.GetIntFromFileStream(file, ref dwRead);
if (version != 805306495)
{
Logger.LogError("ERROR:: File version mismatch");
return -1;
}
//time_t
long t = AAssit.GetIntFromFileStream(file, ref dwRead);
// if(equipment_addon_array.load(file) != 0) return -1;
equipment_addon_array = AAssit.ReadArrayFromBinary<EQUIPMENT_ADDON>(file, ref dwRead);
// if(weapon_major_type_array.load(file) != 0) return -1;
weapon_major_type_array = AAssit.ReadArrayFromBinary<WEAPON_MAJOR_TYPE>(file, ref dwRead);
// if(weapon_sub_type_array.load(file) != 0) return -1;
weapon_sub_type_array = AAssit.ReadArrayFromBinary<WEAPON_SUB_TYPE>(file, ref dwRead);
// if(weapon_essence_array.load(file) != 0) return -1;
weapon_essence_array = AAssit.ReadArrayFromBinary<WEAPON_ESSENCE>(file, ref dwRead);
// if(armor_major_type_array.load(file) != 0) return -1;
armor_major_type_array = AAssit.ReadArrayFromBinary<ARMOR_MAJOR_TYPE>(file, ref dwRead);
// if(armor_sub_type_array.load(file) != 0) return -1;
armor_sub_type_array = AAssit.ReadArrayFromBinary<ARMOR_SUB_TYPE>(file, ref dwRead);
// if(armor_essence_array.load(file) != 0) return -1;
armor_essence_array = AAssit.ReadArrayFromBinary<ARMOR_ESSENCE>(file, ref dwRead);
// if(decoration_major_type_array.load(file) != 0) return -1;
decoration_major_type_array = AAssit.ReadArrayFromBinary<DECORATION_MAJOR_TYPE>(file, ref dwRead);
// if(decoration_sub_type_array.load(file) != 0) return -1;
decoration_sub_type_array = AAssit.ReadArrayFromBinary<DECORATION_SUB_TYPE>(file, ref dwRead);
// if(decoration_essence_array.load(file) != 0) return -1;
decoration_essence_array = AAssit.ReadArrayFromBinary<DECORATION_ESSENCE>(file, ref dwRead);
medicine_major_type_array = AAssit.ReadArrayFromBinary<MEDICINE_MAJOR_TYPE>(file, ref dwRead);
medicine_sub_type_array = AAssit.ReadArrayFromBinary<MEDICINE_SUB_TYPE>(file, ref dwRead);
medicine_essence_array = AAssit.ReadArrayFromBinary<MEDICINE_ESSENCE>(file, ref dwRead);
material_major_type_array = AAssit.ReadArrayFromBinary<MATERIAL_MAJOR_TYPE>(file, ref dwRead);
material_sub_type_array = AAssit.ReadArrayFromBinary<MATERIAL_SUB_TYPE>(file, ref dwRead);
material_essence_array = AAssit.ReadArrayFromBinary<MATERIAL_ESSENCE>(file, ref dwRead);
damagerune_sub_type_array = AAssit.ReadArrayFromBinary<DAMAGERUNE_SUB_TYPE>(file, ref dwRead);
damagerune_essence_array = AAssit.ReadArrayFromBinary<DAMAGERUNE_ESSENCE>(file, ref dwRead);
armorrune_sub_type_array = AAssit.ReadArrayFromBinary<ARMORRUNE_SUB_TYPE>(file, ref dwRead);
armorrune_essence_array = AAssit.ReadArrayFromBinary<ARMORRUNE_ESSENCE>(file, ref dwRead);
// skip the computer's name of the exporter
int tag = AAssit.GetIntFromFileStream(file, ref dwRead);
AAssit.ReadString(file, ref dwRead, out var result);
t = AAssit.GetIntFromFileStream(file, ref dwRead);
skilltome_sub_type_array = AAssit.ReadArrayFromBinary<SKILLTOME_SUB_TYPE>(file, ref dwRead);
skilltome_essence_array = AAssit.ReadArrayFromBinary<SKILLTOME_ESSENCE>(file, ref dwRead);
flysword_essence_array = AAssit.ReadArrayFromBinary<FLYSWORD_ESSENCE>(file, ref dwRead);
wingmanwing_essence_array = AAssit.ReadArrayFromBinary<WINGMANWING_ESSENCE>(file, ref dwRead);
townscroll_essence_array = AAssit.ReadArrayFromBinary<TOWNSCROLL_ESSENCE>(file, ref dwRead);
unionscroll_essence_array = AAssit.ReadArrayFromBinary<UNIONSCROLL_ESSENCE>(file, ref dwRead);
revivescroll_essence_array = AAssit.ReadArrayFromBinary<REVIVESCROLL_ESSENCE>(file, ref dwRead);
element_essence_array = AAssit.ReadArrayFromBinary<ELEMENT_ESSENCE>(file, ref dwRead);
taskmatter_essence_array = AAssit.ReadArrayFromBinary<TASKMATTER_ESSENCE>(file, ref dwRead);
tossmatter_essence_array = AAssit.ReadArrayFromBinary<TOSSMATTER_ESSENCE>(file, ref dwRead);
projectile_type_array = AAssit.ReadArrayFromBinary<PROJECTILE_TYPE>(file, ref dwRead);
projectile_essence_array = AAssit.ReadArrayFromBinary<PROJECTILE_ESSENCE>(file, ref dwRead);
quiver_sub_type_array = AAssit.ReadArrayFromBinary<QUIVER_SUB_TYPE>(file, ref dwRead);
quiver_essence_array = AAssit.ReadArrayFromBinary<QUIVER_ESSENCE>(file, ref dwRead);
stone_sub_type_array = AAssit.ReadArrayFromBinary<STONE_SUB_TYPE>(file, ref dwRead);
stone_essence_array = AAssit.ReadArrayFromBinary<STONE_ESSENCE>(file, ref dwRead);
monster_addon_array = AAssit.ReadArrayFromBinary<MONSTER_ADDON>(file, ref dwRead);
monster_type_array = AAssit.ReadArrayFromBinary<MONSTER_TYPE>(file, ref dwRead);
monster_essence_array = AAssit.ReadArrayFromBinary<MONSTER_ESSENCE>(file, ref dwRead);
npc_talk_service_array = AAssit.ReadArrayFromBinary<NPC_TALK_SERVICE>(file, ref dwRead);
npc_sell_service_array = AAssit.ReadArrayFromBinary<NPC_SELL_SERVICE>(file, ref dwRead);
npc_buy_service_array = AAssit.ReadArrayFromBinary<NPC_BUY_SERVICE>(file, ref dwRead);
npc_repair_service_array = AAssit.ReadArrayFromBinary<NPC_REPAIR_SERVICE>(file, ref dwRead);
npc_install_service_array = AAssit.ReadArrayFromBinary<NPC_INSTALL_SERVICE>(file, ref dwRead);
npc_uninstall_service_array = AAssit.ReadArrayFromBinary<NPC_UNINSTALL_SERVICE>(file, ref dwRead);
npc_task_in_service_array = AAssit.ReadArrayFromBinary<NPC_TASK_IN_SERVICE>(file, ref dwRead);
npc_task_out_service_array = AAssit.ReadArrayFromBinary<NPC_TASK_OUT_SERVICE>(file, ref dwRead);
npc_task_matter_service_array = AAssit.ReadArrayFromBinary<NPC_TASK_MATTER_SERVICE>(file, ref dwRead);
npc_skill_service_array = AAssit.ReadArrayFromBinary<NPC_SKILL_SERVICE>(file, ref dwRead);
npc_heal_service_array = AAssit.ReadArrayFromBinary<NPC_HEAL_SERVICE>(file, ref dwRead);
npc_transmit_service_array = AAssit.ReadArrayFromBinary<NPC_TRANSMIT_SERVICE>(file, ref dwRead);
npc_transport_service_array = AAssit.ReadArrayFromBinary<NPC_TRANSPORT_SERVICE>(file, ref dwRead);
npc_proxy_service_array = AAssit.ReadArrayFromBinary<NPC_PROXY_SERVICE>(file, ref dwRead);
npc_storage_service_array = AAssit.ReadArrayFromBinary<NPC_STORAGE_SERVICE>(file, ref dwRead);
npc_make_service_array = AAssit.ReadArrayFromBinary<NPC_MAKE_SERVICE>(file, ref dwRead);
npc_decompose_service_array = AAssit.ReadArrayFromBinary<NPC_DECOMPOSE_SERVICE>(file, ref dwRead);
npc_type_array = AAssit.ReadArrayFromBinary<NPC_TYPE>(file, ref dwRead);
npc_essence_array = AAssit.ReadArrayFromBinary<NPC_ESSENCE>(file, ref dwRead);
uint sz = AAssit.GetUIntFromFileStream(file, ref dwRead);
if (sz <= 0) return -1;
talk_proc_array = new talk_proc[sz];
for (int i = 0; i < sz; i++)
{
talk_proc tp = new talk_proc();
tp.Read(file);
talk_proc_array[i] = tp;
}
face_texture_essence_array = AAssit.ReadArrayFromBinary<FACE_TEXTURE_ESSENCE>(file, ref dwRead);
face_shape_essence_array = AAssit.ReadArrayFromBinary<FACE_SHAPE_ESSENCE>(file, ref dwRead);
face_emotion_type_array = AAssit.ReadArrayFromBinary<FACE_EMOTION_TYPE>(file, ref dwRead);
face_expression_essence_array = AAssit.ReadArrayFromBinary<FACE_EXPRESSION_ESSENCE>(file, ref dwRead);
face_hair_essence_array = AAssit.ReadArrayFromBinary<FACE_HAIR_ESSENCE>(file, ref dwRead);
face_moustache_essence_array = AAssit.ReadArrayFromBinary<FACE_MOUSTACHE_ESSENCE>(file, ref dwRead);
colorpicker_essence_array = AAssit.ReadArrayFromBinary<COLORPICKER_ESSENCE>(file, ref dwRead);
customizedata_essence_array = AAssit.ReadArrayFromBinary<CUSTOMIZEDATA_ESSENCE>(file, ref dwRead);
recipe_major_type_array = AAssit.ReadArrayFromBinary<RECIPE_MAJOR_TYPE>(file, ref dwRead);
recipe_sub_type_array = AAssit.ReadArrayFromBinary<RECIPE_SUB_TYPE>(file, ref dwRead);
recipe_essence_array = AAssit.ReadArrayFromBinary<RECIPE_ESSENCE>(file, ref dwRead);
enemy_faction_config_array = AAssit.ReadArrayFromBinary<ENEMY_FACTION_CONFIG>(file, ref dwRead);
character_class_config_array = AAssit.ReadArrayFromBinary<CHARACTER_CLASS_CONFIG>(file, ref dwRead);
param_adjust_config_array = AAssit.ReadArrayFromBinary<PARAM_ADJUST_CONFIG>(file, ref dwRead);
player_action_info_config_array = AAssit.ReadArrayFromBinary<PLAYER_ACTION_INFO_CONFIG>(file, ref dwRead);
taskdice_essence_array = AAssit.ReadArrayFromBinary<TASKDICE_ESSENCE>(file, ref dwRead);
tasknormalmatter_essence_array = AAssit.ReadArrayFromBinary<TASKNORMALMATTER_ESSENCE>(file, ref dwRead);
face_faling_essence_array = AAssit.ReadArrayFromBinary<FACE_FALING_ESSENCE>(file, ref dwRead);
player_levelexp_config_array = AAssit.ReadArrayFromBinary<PLAYER_LEVELEXP_CONFIG>(file, ref dwRead);
mine_type_array = AAssit.ReadArrayFromBinary<MINE_TYPE>(file, ref dwRead);
mine_essence_array = AAssit.ReadArrayFromBinary<MINE_ESSENCE>(file, ref dwRead);
npc_identify_service_array = AAssit.ReadArrayFromBinary<NPC_IDENTIFY_SERVICE>(file, ref dwRead);
fashion_major_type_array = AAssit.ReadArrayFromBinary<FASHION_MAJOR_TYPE>(file, ref dwRead);
fashion_sub_type_array = AAssit.ReadArrayFromBinary<FASHION_SUB_TYPE>(file, ref dwRead);
fashion_essence_array = AAssit.ReadArrayFromBinary<FASHION_ESSENCE>(file, ref dwRead);
faceticket_major_type_array = AAssit.ReadArrayFromBinary<FACETICKET_MAJOR_TYPE>(file, ref dwRead);
faceticket_sub_type_array = AAssit.ReadArrayFromBinary<FACETICKET_SUB_TYPE>(file, ref dwRead);
faceticket_essence_array = AAssit.ReadArrayFromBinary<FACETICKET_ESSENCE>(file, ref dwRead);
facepill_major_type_array = AAssit.ReadArrayFromBinary<FACEPILL_MAJOR_TYPE>(file, ref dwRead);
facepill_sub_type_array = AAssit.ReadArrayFromBinary<FACEPILL_SUB_TYPE>(file, ref dwRead);
facepill_essence_array = AAssit.ReadArrayFromBinary<FACEPILL_ESSENCE>(file, ref dwRead);
suite_essence_array = AAssit.ReadArrayFromBinary<SUITE_ESSENCE>(file, ref dwRead);
gm_generator_type_array = AAssit.ReadArrayFromBinary<GM_GENERATOR_TYPE>(file, ref dwRead);
gm_generator_essence_array = AAssit.ReadArrayFromBinary<GM_GENERATOR_ESSENCE>(file, ref dwRead);
pet_type_array = AAssit.ReadArrayFromBinary<PET_TYPE>(file, ref dwRead);
pet_essence_array = AAssit.ReadArrayFromBinary<PET_ESSENCE>(file, ref dwRead);
pet_egg_essence_array = AAssit.ReadArrayFromBinary<PET_EGG_ESSENCE>(file, ref dwRead);
pet_food_essence_array = AAssit.ReadArrayFromBinary<PET_FOOD_ESSENCE>(file, ref dwRead);
pet_faceticket_essence_array = AAssit.ReadArrayFromBinary<PET_FACETICKET_ESSENCE>(file, ref dwRead);
fireworks_essence_array = AAssit.ReadArrayFromBinary<FIREWORKS_ESSENCE>(file, ref dwRead);
war_tankcallin_essence_array = AAssit.ReadArrayFromBinary<WAR_TANKCALLIN_ESSENCE>(file, ref dwRead);
tag = AAssit.GetIntFromFileStream(file, ref dwRead);
AAssit.ReadString(file, ref dwRead, out result);
npc_war_towerbuild_service_array = AAssit.ReadArrayFromBinary<NPC_WAR_TOWERBUILD_SERVICE>(file, ref dwRead);
player_secondlevel_config_array = AAssit.ReadArrayFromBinary<PLAYER_SECONDLEVEL_CONFIG>(file, ref dwRead);
npc_resetprop_service_array = AAssit.ReadArrayFromBinary<NPC_RESETPROP_SERVICE>(file, ref dwRead);
npc_petname_service_array = AAssit.ReadArrayFromBinary<NPC_PETNAME_SERVICE>(file, ref dwRead);
npc_petlearnskill_service_array = AAssit.ReadArrayFromBinary<NPC_PETLEARNSKILL_SERVICE>(file, ref dwRead);
npc_petforgetskill_service_array = AAssit.ReadArrayFromBinary<NPC_PETFORGETSKILL_SERVICE>(file, ref dwRead);
skillmatter_essence_array = AAssit.ReadArrayFromBinary<SKILLMATTER_ESSENCE>(file, ref dwRead);
refine_ticket_essence_array = AAssit.ReadArrayFromBinary<REFINE_TICKET_ESSENCE>(file, ref dwRead);
destroying_essence_array = AAssit.ReadArrayFromBinary<DESTROYING_ESSENCE>(file, ref dwRead);
npc_equipbind_service_array = AAssit.ReadArrayFromBinary<NPC_EQUIPBIND_SERVICE>(file, ref dwRead);
npc_equipdestroy_service_array = AAssit.ReadArrayFromBinary<NPC_EQUIPDESTROY_SERVICE>(file, ref dwRead);
npc_equipundestroy_service_array = AAssit.ReadArrayFromBinary<NPC_EQUIPUNDESTROY_SERVICE>(file, ref dwRead);
bible_essence_array = AAssit.ReadArrayFromBinary<BIBLE_ESSENCE>(file, ref dwRead);
speaker_essence_array = AAssit.ReadArrayFromBinary<SPEAKER_ESSENCE>(file, ref dwRead);
autohp_essence_array = AAssit.ReadArrayFromBinary<AUTOHP_ESSENCE>(file, ref dwRead);
automp_essence_array = AAssit.ReadArrayFromBinary<AUTOMP_ESSENCE>(file, ref dwRead);
double_exp_essence_array = AAssit.ReadArrayFromBinary<DOUBLE_EXP_ESSENCE>(file, ref dwRead);
transmitscroll_essence_array = AAssit.ReadArrayFromBinary<TRANSMITSCROLL_ESSENCE>(file, ref dwRead);
dye_ticket_essence_array = AAssit.ReadArrayFromBinary<DYE_TICKET_ESSENCE>(file, ref dwRead);
goblin_essence_array = AAssit.ReadArrayFromBinary<GOBLIN_ESSENCE>(file, ref dwRead);
goblin_equip_type_array = AAssit.ReadArrayFromBinary<GOBLIN_EQUIP_TYPE>(file, ref dwRead);
goblin_equip_essence_array = AAssit.ReadArrayFromBinary<GOBLIN_EQUIP_ESSENCE>(file, ref dwRead);
goblin_exppill_essence_array = AAssit.ReadArrayFromBinary<GOBLIN_EXPPILL_ESSENCE>(file, ref dwRead);
sell_certificate_essence_array = AAssit.ReadArrayFromBinary<SELL_CERTIFICATE_ESSENCE>(file, ref dwRead);
// target_item_essence_array = AAssit.ReadArrayFromBinary<TARGET_ITEM_ESSENCE>(file, ref dwRead);
// look_info_essence_array = AAssit.ReadArrayFromBinary<LOOK_INFO_ESSENCE>(file, ref dwRead);
// upgrade_production_config_array = AAssit.ReadArrayFromBinary<UPGRADE_PRODUCTION_CONFIG>(file, ref dwRead);
// acc_storage_blacklist_config_array = AAssit.ReadArrayFromBinary<ACC_STORAGE_BLACKLIST_CONFIG>(file, ref dwRead);
// face_hair_texture_map_array = AAssit.ReadArrayFromBinary<FACE_HAIR_TEXTURE_MAP>(file, ref dwRead);
// multi_exp_config_array = AAssit.ReadArrayFromBinary<MULTI_EXP_CONFIG>(file, ref dwRead);
// inc_skill_ability_essence_array = AAssit.ReadArrayFromBinary<INC_SKILL_ABILITY_ESSENCE>(file, ref dwRead);
// god_evil_convert_config_array = AAssit.ReadArrayFromBinary<GOD_EVIL_CONVERT_CONFIG>(file, ref dwRead);
// wedding_config_array = AAssit.ReadArrayFromBinary<WEDDING_CONFIG>(file, ref dwRead);
// wedding_bookcard_essence_array = AAssit.ReadArrayFromBinary<WEDDING_BOOKCARD_ESSENCE>(file, ref dwRead);
// wedding_invitecard_essence_array = AAssit.ReadArrayFromBinary<WEDDING_INVITECARD_ESSENCE>(file, ref dwRead);
// sharpener_essence_array = AAssit.ReadArrayFromBinary<SHARPENER_ESSENCE>(file, ref dwRead);
// face_thirdeye_essence_array = AAssit.ReadArrayFromBinary<FACE_THIRDEYE_ESSENCE>(file, ref dwRead);
// faction_fortress_config_array = AAssit.ReadArrayFromBinary<FACTION_FORTRESS_CONFIG>(file, ref dwRead);
// faction_building_sub_type_array = AAssit.ReadArrayFromBinary<FACTION_BUILDING_SUB_TYPE>(file, ref dwRead);
// faction_building_essence_array = AAssit.ReadArrayFromBinary<FACTION_BUILDING_ESSENCE>(file, ref dwRead);
// faction_material_essence_array = AAssit.ReadArrayFromBinary<FACTION_MATERIAL_ESSENCE>(file, ref dwRead);
// congregate_essence_array = AAssit.ReadArrayFromBinary<CONGREGATE_ESSENCE>(file, ref dwRead);
// engrave_major_type_array = AAssit.ReadArrayFromBinary<ENGRAVE_MAJOR_TYPE>(file, ref dwRead);
// engrave_sub_type_array = AAssit.ReadArrayFromBinary<ENGRAVE_SUB_TYPE>(file, ref dwRead);
// engrave_essence_array = AAssit.ReadArrayFromBinary<ENGRAVE_ESSENCE>(file, ref dwRead);
// npc_engrave_service_array = AAssit.ReadArrayFromBinary<NPC_ENGRAVE_SERVICE>(file, ref dwRead);
// npc_randprop_service_array = AAssit.ReadArrayFromBinary<NPC_RANDPROP_SERVICE>(file, ref dwRead);
// randprop_type_array = AAssit.ReadArrayFromBinary<RANDPROP_TYPE>(file, ref dwRead);
// randprop_essence_array = AAssit.ReadArrayFromBinary<RANDPROP_ESSENCE>(file, ref dwRead);
// wiki_taboo_config_array = AAssit.ReadArrayFromBinary<WIKI_TABOO_CONFIG>(file, ref dwRead);
// force_config_array = AAssit.ReadArrayFromBinary<FORCE_CONFIG>(file, ref dwRead);
// force_token_essence_array = AAssit.ReadArrayFromBinary<FORCE_TOKEN_ESSENCE>(file, ref dwRead);
// npc_force_service_array = AAssit.ReadArrayFromBinary<NPC_FORCE_SERVICE>(file, ref dwRead);
// player_death_drop_config_array = AAssit.ReadArrayFromBinary<PLAYER_DEATH_DROP_CONFIG>(file, ref dwRead);
// dynskillequip_essence_array = AAssit.ReadArrayFromBinary<DYNSKILLEQUIP_ESSENCE>(file, ref dwRead);
// consume_points_config_array = AAssit.ReadArrayFromBinary<CONSUME_POINTS_CONFIG>(file, ref dwRead);
// online_awards_config_array = AAssit.ReadArrayFromBinary<ONLINE_AWARDS_CONFIG>(file, ref dwRead);
// country_config_array = AAssit.ReadArrayFromBinary<COUNTRY_CONFIG>(file, ref dwRead);
// gm_activity_config_array = AAssit.ReadArrayFromBinary<GM_ACTIVITY_CONFIG>(file, ref dwRead);
// fashion_weapon_config_array = AAssit.ReadArrayFromBinary<FASHION_WEAPON_CONFIG>(file, ref dwRead);
// pet_evolve_config_array = AAssit.ReadArrayFromBinary<PET_EVOLVE_CONFIG>(file, ref dwRead);
// pet_evolved_skill_config_array = AAssit.ReadArrayFromBinary<PET_EVOLVED_SKILL_CONFIG>(file, ref dwRead);
// money_convertible_essence_array = AAssit.ReadArrayFromBinary<MONEY_CONVERTIBLE_ESSENCE>(file, ref dwRead);
// stone_change_recipe_type_array = AAssit.ReadArrayFromBinary<STONE_CHANGE_RECIPE_TYPE>(file, ref dwRead);
// stone_change_recipe_array = AAssit.ReadArrayFromBinary<STONE_CHANGE_RECIPE>(file, ref dwRead);
// meridian_config_array = AAssit.ReadArrayFromBinary<MERIDIAN_CONFIG>(file, ref dwRead);
// pet_evolved_skill_rand_config_array = AAssit.ReadArrayFromBinary<PET_EVOLVED_SKILL_RAND_CONFIG>(file, ref dwRead);
// autotask_display_config_array = AAssit.ReadArrayFromBinary<AUTOTASK_DISPLAY_CONFIG>(file, ref dwRead);
// touch_shop_config_array = AAssit.ReadArrayFromBinary<TOUCH_SHOP_CONFIG>(file, ref dwRead);
// title_config_array = AAssit.ReadArrayFromBinary<TITLE_CONFIG>(file, ref dwRead);
// complex_title_config_array = AAssit.ReadArrayFromBinary<COMPLEX_TITLE_CONFIG>(file, ref dwRead);
// monster_spirit_essence_array = AAssit.ReadArrayFromBinary<MONSTER_SPIRIT_ESSENCE>(file, ref dwRead);
// player_spirit_config_array = AAssit.ReadArrayFromBinary<PLAYER_SPIRIT_CONFIG>(file, ref dwRead);
// player_reincarnation_config_array = AAssit.ReadArrayFromBinary<PLAYER_REINCARNATION_CONFIG>(file, ref dwRead);
// history_stage_config_array = AAssit.ReadArrayFromBinary<HISTORY_STAGE_CONFIG>(file, ref dwRead);
// history_advance_config_array = AAssit.ReadArrayFromBinary<HISTORY_ADVANCE_CONFIG>(file, ref dwRead);
// autoteam_config_array = AAssit.ReadArrayFromBinary<AUTOTEAM_CONFIG>(file, ref dwRead);
// player_realm_config_array = AAssit.ReadArrayFromBinary<PLAYER_REALM_CONFIG>(file, ref dwRead);
// chariot_config_array = AAssit.ReadArrayFromBinary<CHARIOT_CONFIG>(file, ref dwRead);
// chariot_war_config_array = AAssit.ReadArrayFromBinary<CHARIOT_WAR_CONFIG>(file, ref dwRead);
// poker_levelexp_config_array = AAssit.ReadArrayFromBinary<POKER_LEVELEXP_CONFIG>(file, ref dwRead);
// poker_suite_essence_array = AAssit.ReadArrayFromBinary<POKER_SUITE_ESSENCE>(file, ref dwRead);
// poker_dice_essence_array = AAssit.ReadArrayFromBinary<POKER_DICE_ESSENCE>(file, ref dwRead);
// poker_sub_type_array = AAssit.ReadArrayFromBinary<POKER_SUB_TYPE>(file, ref dwRead);
// poker_essence_array = AAssit.ReadArrayFromBinary<POKER_ESSENCE>(file, ref dwRead);
// token_shop_config_array = AAssit.ReadArrayFromBinary<TOKEN_SHOP_CONFIG>(file, ref dwRead);
// shop_token_essence_array = AAssit.ReadArrayFromBinary<SHOP_TOKEN_ESSENCE>(file, ref dwRead);
// gt_config_array = AAssit.ReadArrayFromBinary<GT_CONFIG>(file, ref dwRead);
// rand_shop_config_array = AAssit.ReadArrayFromBinary<RAND_SHOP_CONFIG>(file, ref dwRead);
// profit_time_config_array = AAssit.ReadArrayFromBinary<PROFIT_TIME_CONFIG>(file, ref dwRead);
// faction_pvp_config_array = AAssit.ReadArrayFromBinary<FACTION_PVP_CONFIG>(file, ref dwRead);
// universal_token_essence_array = AAssit.ReadArrayFromBinary<UNIVERSAL_TOKEN_ESSENCE>(file, ref dwRead);
// task_list_config_array = AAssit.ReadArrayFromBinary<TASK_LIST_CONFIG>(file, ref dwRead);
// task_dice_by_weight_config_array = AAssit.ReadArrayFromBinary<TASK_DICE_BY_WEIGHT_CONFIG>(file, ref dwRead);
// fashion_suite_essence_array = AAssit.ReadArrayFromBinary<FASHION_SUITE_ESSENCE>(file, ref dwRead);
// fashion_best_color_config_array = AAssit.ReadArrayFromBinary<FASHION_BEST_COLOR_CONFIG>(file, ref dwRead);
// sign_award_config_array = AAssit.ReadArrayFromBinary<SIGN_AWARD_CONFIG>(file, ref dwRead);
}
SetupDataMap();
return 0;
}
public void SetupDataMap()
{
foreach (var item in equipment_addon_array)
{
add_id_index(ID_SPACE.ID_SPACE_ADDON, item.id, DATA_TYPE.DT_EQUIPMENT_ADDON);
add_id_data(ID_SPACE.ID_SPACE_ADDON, item.id, item);
}
foreach (var item in weapon_major_type_array)
{
add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_WEAPON_MAJOR_TYPE);
add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item);
}
foreach (var item in weapon_sub_type_array)
{
add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_WEAPON_SUB_TYPE);
add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item);
}
foreach (var item in npc_essence_array)
{
add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_NPC_ESSENCE);
add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item);
}
foreach (var item in weapon_essence_array)
{
add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_WEAPON_ESSENCE);
add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item);
}
foreach (var item in unionscroll_essence_array)
{
add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_UNIONSCROLL_ESSENCE);
add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item);
}
}
public void SaveDataToTextFile()
{
StringBuilder sb = new();
// foreach (var weaponEssence in weapon_essence_array)
// {
// sb.AppendLine(weaponEssence.ToString());
// }
// Write the StringBuilder content to a text file
// string filePath = " weapon_names.txt";
// using (StreamWriter writer = new StreamWriter(filePath))
// {
// writer.Write(sb.ToString());
// writer.Close();
// }
// foreach (var item in npc_type_array)
// {
// sb.AppendLine(item.ToString());
// }
// string filePath = " NPC_INFO.txt";
// using (StreamWriter writer = new StreamWriter(filePath))
// {
// writer.Write(sb.ToString());
// writer.Close();
// }
// foreach (var item in npc_essence_array)
// {
// sb.AppendLine($"NPC {item.Name} FILE: {item.FileModel} MSG: {item.HelloMsg}");
// }
// string filePath = "npc_essence_hello.txt";
// using (StreamWriter writer = new StreamWriter(filePath))
// {
// writer.Write(sb.ToString());
// writer.Close();
// }
// foreach (var item in face_hair_essence_array)
// {
// sb.AppendLine(item.ToString());
// }
// string filePath = " face_hair_essence_array.txt";
// using (StreamWriter writer = new StreamWriter(filePath))
// {
// writer.Write(sb.ToString());
// writer.Close();
// }
// save player_action_info_config_array to text file
sb.Clear();
foreach (var item in player_action_info_config_array)
{
sb.AppendLine(item.ToString());
}
string filePath = "player_action_info_config_array.txt";
using (StreamWriter writer = new StreamWriter(filePath))
{
writer.Write(sb.ToString());
writer.Close();
}
}
void add_id_index(ID_SPACE idSpace, uint id, DATA_TYPE type)
{
switch (idSpace)
{
case ID_SPACE.ID_SPACE_ESSENCE:
essence_id_data_type_map[id] = type;
break;
default:
break;
}
}
void add_id_data(ID_SPACE idSpace, uint id, object data)
{
switch (idSpace)
{
case ID_SPACE.ID_SPACE_ESSENCE:
essence_id_data_map[id] = data;
break;
default:
break;
}
}
public DATA_TYPE get_data_type(uint id, ID_SPACE idspace)
{
switch (idspace)
{
case ID_SPACE.ID_SPACE_ESSENCE:
if (essence_id_data_type_map.TryGetValue(id, out DATA_TYPE type))
{
return type;
}
break;
default:
break;
}
return DATA_TYPE.DT_INVALID;
}
public object get_data_ptr(uint id, ID_SPACE idspace)
{
switch (idspace)
{
case ID_SPACE.ID_SPACE_ESSENCE:
if (essence_id_data_map.TryGetValue(id, out object data))
{
return data;
}
break;
default:
return null;
}
return null;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f663d3335e04a41b1bb64e834321388b
@@ -3,5 +3,6 @@
public interface IAutoInitialize
{
void Initialize();
void Dispose();
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ffefaa73e3c3149e48a3ffd4483f8724
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8c492cf21479148e48c82b1c08e8e4ec
@@ -16,6 +16,7 @@ namespace PerfectWorld.Scripts.Managers
{
namespace BrewMonster.Managers
{
[Serializable]
public class EC_ManPlayer : IMsgHandler
{
Dictionary<int, int> m_UkPlayerTab = new Dictionary<int, int>();
@@ -24,9 +25,11 @@ namespace PerfectWorld.Scripts.Managers
public int HandlerId => (int)MANAGER_INDEX.MAN_PLAYER;
public bool ProcessMessage(ECMSG Msg)
{
Debug.LogWarning("HoangDev : EC_ManPlayerProcessMessage");
if (Msg.iSubID == 0)
{
Debug.LogWarning("HoangDev : EC_ManPlayerEC_ManPlayerEC_ManPlayer");
GameController.Instance.GetHostPlayer().ProcessMessage(Msg);
}
else if (Msg.iSubID < 0)
{
@@ -58,6 +61,7 @@ namespace PerfectWorld.Scripts.Managers
public void OnMsgPlayerInfo(ECMSG Msg)
{
Debug.LogWarning("OnMsgPlayerInfo ");
int iHostID = Convert.ToInt32(Msg.dwParam3);
int lenghtByte = Marshal.SizeOf<int>();
byte[] byteArray = new byte[lenghtByte];
@@ -110,6 +114,7 @@ namespace PerfectWorld.Scripts.Managers
{
bool isDoneWorldRender = false;
bool isDoneNPCRender = false;
Debug.Log("HostPlayerInfo1HostPlayerInfo1");
Action actLoadChar = () =>
{
if(!isDoneNPCRender || !isDoneWorldRender)
@@ -119,13 +124,18 @@ namespace PerfectWorld.Scripts.Managers
GameController.Instance.InitCharacter(info);
};
string nameScene = "NPCRender";
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single, (value) =>
/* UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single, (value) =>
{
isDoneNPCRender = value;
actLoadChar?.Invoke();
});
nameScene = "WorldRender";
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Additive, (value) =>
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Additive, (value) =>
{
isDoneWorldRender = value;
actLoadChar?.Invoke();
});*/
UnityGameSession.Instance.LoadScene("HoangTest", LoadSceneMode.Single, (value) =>
{
isDoneWorldRender = value;
actLoadChar?.Invoke();
@@ -5,12 +5,11 @@ using PerfectWorld.Scripts.Managers.BrewMonster.Managers;
namespace BrewMonster
{
[Serializable]
public class EC_ManMessageMono : MonoBehaviour
{
private static EC_ManMessageMono instance;
EC_ManPlayer EC_ManPlayer;
public static EC_ManMessageMono Instance
{
get
@@ -23,6 +22,7 @@ namespace BrewMonster
}
}
public EC_ManPlayer EC_ManPlayer;
public EC_ManPlayer GetECManPlayer { get => EC_ManPlayer;}
private void Awake()
@@ -35,7 +35,7 @@ namespace BrewMonster
private void OnDestroy()
{
EC_ManMessage.Dispose();
}
private void Update()
@@ -122,5 +122,10 @@ namespace BrewMonster.Network
}
actDone?.Invoke(true);
}
void OnDestroy()
{
_gameSession.Disconnect();
}
}
}
@@ -4,6 +4,7 @@ using CSNetwork.Protocols;
using CSNetwork.Protocols.RPCData;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
namespace BrewMonster.UI
+3 -4
View File
@@ -99,19 +99,18 @@ MonoBehaviour:
m_GameObject: {fileID: 6513559496054861882}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0525de198450e14f9f6ad854b95ec99, type: 3}
m_Script: {fileID: 11500000, guid: c0911af06fee458459c86236ea21b716, type: 3}
m_Name:
m_EditorClassIdentifier:
txtName: {fileID: 0}
controller: {fileID: 2967440448469171042}
animator: {fileID: 0}
joystick: {fileID: 0}
btnJump: {fileID: 0}
btnRun: {fileID: 0}
parentModel: {fileID: 78581589932911603}
parentModel: {fileID: 0}
extraGroundDistance: 0.05
radiusEpsilon: 0.005
groundMask:
serializedVersion: 2
m_Bits: 1
m_Bits: 0
slopeToleranceDeg: 2
File diff suppressed because one or more lines are too long
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9172bad49fed35e46819504e93c44a84
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,20 +1,24 @@
using CSNetwork.GPDataType;
using BrewMonster.Network;
using CSNetwork;
using CSNetwork.GPDataType;
using CSNetwork.C2SCommand;
using CSNetwork.Protocols;
using CSNetwork.Protocols.RPCData;
using PerfectWorld.Scripts.Managers;
using System;
using System.IO;
using System.Text;
using TMPro;
using UnityEditor.SearchService;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Scene = UnityEngine.SceneManagement.Scene;
public class CharacterCtrl : MonoBehaviour
public class CECHostPlayer : MonoBehaviour
{
[SerializeField] private TextMeshPro txtName;
[SerializeField] private CharacterController controller;
[SerializeField] private Animator animator;
[SerializeField] private Joystick joystick;
[SerializeField] private Button btnJump;
@@ -23,6 +27,7 @@ public class CharacterCtrl : MonoBehaviour
PlayerStateMachine playerStateMachine;
PlayerMoveState moveState;
CECHostMove m_MoveCtrl;
float playerSpeed = 5.0f;
float jumpHeight = 1.5f;
@@ -32,6 +37,7 @@ public class CharacterCtrl : MonoBehaviour
bool isGrounded = false;
bool isRun = false;
GameObject modle;
Vector3 m_vLastSevPos;
// ====== Ground cast config ======
[Header("Ground Cast")]
@@ -52,6 +58,7 @@ public class CharacterCtrl : MonoBehaviour
{
moveState = new PlayerMoveState(this);
playerStateMachine = new PlayerStateMachine();
m_MoveCtrl = new CECHostMove(this);
// Cache: không bắt buộc, nhưng gọn tay và ít gọi property lặp.
if (controller != null)
@@ -78,9 +85,10 @@ public class CharacterCtrl : MonoBehaviour
private void Update()
{
m_MoveCtrl.Tick(Time.deltaTime);
// Nếu có thay đổi runtime, có thể lấy lại mỗi vài giây/Start nếu bạn thích:
// ccRadius = controller.radius; ccSkin = controller.skinWidth;
return;
playerStateMachine.UpdateState();
}
@@ -115,12 +123,13 @@ public class CharacterCtrl : MonoBehaviour
if (move != Vector3.zero)
{
transform.forward = move;
if (isRun) SetAnimRun();
else SetAnimWalk();
Debug.LogWarning("HoangDev :HandleMovement");
m_MoveCtrl.GroundMove(Time.deltaTime);
m_MoveCtrl.SendMoveCmd(transform.position, controller.velocity, (int)MoveMode.GP_MOVE_WALK);
}
else
{
SetAnimIdle();
}
Vector3 finalMove = (move * playerSpeed) + (playerVelocity.y * Vector3.up);
@@ -170,10 +179,28 @@ public class CharacterCtrl : MonoBehaviour
if (isGrounded)
{
playerVelocity.y = Mathf.Sqrt(jumpHeight * -2f * gravityValue);
SetAnimJump();
}
}
public void ProcessMessage(in ECMSG Msg)
{
switch ((int)Msg.dwMsg)
{
case int value when value == EC_MsgDef.MSG_HST_CORRECTPOS: OnMsgHstCorrectPos(Msg); break;
}
}
public void OnMsgHstCorrectPos(in ECMSG Msg)
{
Debug.Log("OnMsgHstCorrectPos");
cmd_host_correct_pos pCmd = (cmd_host_correct_pos)Msg.dwParam1;
Debug.LogWarning("pCmd.pos " + pCmd.pos);
SetPos(pCmd.pos);
}
private void SetPos(Vector3 pos)
{
transform.position = pos;
}
public void SetStatusRun(bool value)
{
if (!isGrounded)
@@ -183,7 +210,6 @@ public class CharacterCtrl : MonoBehaviour
}
isRun = value;
}
public void InitCharacter(cmd_self_info_1 role)
{
string roleName = "(Error decoding name)";
@@ -196,6 +222,7 @@ public class CharacterCtrl : MonoBehaviour
transform.position = pos;
SetModelHostPlayer();
Debug.LogError("Pos Character = " + pos);
joystick = FindAnyObjectByType<Joystick>();
}
public void InitCharacter(info_player_1 role)
@@ -211,35 +238,6 @@ public class CharacterCtrl : MonoBehaviour
SetModelHostPlayer();
Debug.LogError("Pos Character = " + pos);
}
private void SetAnimIdle()
{
if (stateAnim == StateAnim.Idle || !isGrounded) return;
stateAnim = StateAnim.Idle;
animator.SetTrigger("Idle");
}
private void SetAnimRun()
{
if (stateAnim == StateAnim.Run || !isGrounded) return;
stateAnim = StateAnim.Run;
animator.SetTrigger("Run");
}
private void SetAnimWalk()
{
if (stateAnim == StateAnim.Walk || !isGrounded) return;
stateAnim = StateAnim.Walk;
animator.SetTrigger("Walk");
}
private void SetAnimJump()
{
if (stateAnim == StateAnim.Jump) return;
stateAnim = StateAnim.Jump;
// Tạm dùng Idle trigger như code cũ của bạn
animator.SetTrigger("Idle");
}
}
public enum StateAnim
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c0911af06fee458459c86236ea21b716
-2
View File
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: c0525de198450e14f9f6ad854b95ec99
+28
View File
@@ -1,3 +1,4 @@
using CSNetwork.GPDataType;
using UnityEngine;
struct cmd_player_move
@@ -9,3 +10,30 @@ struct cmd_player_move
byte move_mode; // Walk run swim fly .... walk_back run_back
ushort stamp; // move command stamp
};
struct cmd_host_correct_pos
{
public Vector3 pos;
public ushort stamp;
};
enum MoveMode
{
GP_MOVE_WALK = 0,
GP_MOVE_RUN = 1,
GP_MOVE_STAND = 2,
GP_MOVE_FALL = 3,
GP_MOVE_SLIDE = 4,
GP_MOVE_PUSH = 5, // only sent to NPC
GP_MOVE_FLYFALL = 6,
GP_MOVE_RETURN = 7,
GP_MOVE_JUMP = 8,
GP_MOVE_PULL = 9, // only sent to NPC
GP_MOVE_BLINK = 10, // only sent to NPC£¨Ë²ÒÆ£©
GP_MOVE_MASK = 0x0f,
GP_MOVE_TURN = 0x10, // Turnaround
GP_MOVE_DEAD = 0x20,
GP_MOVE_AIR = 0x40,
GP_MOVE_WATER = 0x80,
GP_MOVE_ENVMASK = 0xc0,
};
+1
View File
@@ -0,0 +1 @@

+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a6f8dac8f744ee042aa1d70fb415e353
+63 -65
View File
@@ -4,76 +4,74 @@ using System.Data;
using Unity.VisualScripting;
using UnityEngine;
namespace PerfectWorld.Scripts.Managers
public class GameController : MonoBehaviour
{
public class GameController : MonoBehaviour
{
private static GameController instance;
private static GameController instance;
[SerializeField] private CharacterCtrl characterPrefab;
//[SerializeField] private Transform ground;
[SerializeField] private CECHostPlayer characterPrefab;
//[SerializeField] private Transform ground;
CECHostPlayer hostPlayer;
Camera camera;
Camera camera;
public static GameController Instance
{
get
public static GameController Instance
{
get
{
if (instance == null)
{
if (instance == null)
{
instance = FindAnyObjectByType<GameController>();
}
return instance;
instance = FindAnyObjectByType<GameController>();
}
}
private void Awake()
{
if(instance == null)
{
instance = this;
}
}
private void Start()
{
camera = Camera.main;
}
public void Log(string s)
{
Debug.LogError(s);
}
public GameObject InitCharacter(cmd_self_info_1 info)
{
if(characterPrefab == null)
{
Debug.LogError("null prefab");
return null;
}
CharacterCtrl character = Instantiate(characterPrefab, transform);
character.InitCharacter(info);
//Vector3 pos = new Vector3(info.pos.x, info.pos.y, info.pos.z);
//Vector3 posCam = pos;
//posCam.z -= 10f;
//camera.transform.position = posCam;
//Vector3 posGround = pos;
//posGround.y -= 2f;
//ground.transform.position = posGround;
return character.gameObject;
}
public GameObject InitCharacter(info_player_1 info)
{
if (characterPrefab == null)
{
Debug.LogError("null prefab");
return null;
}
CharacterCtrl character = Instantiate(characterPrefab, transform);
character.InitCharacter(info);
return character.gameObject;
return instance;
}
}
private void Awake()
{
if(instance == null)
{
instance = this;
}
}
private void Start()
{
camera = Camera.main;
}
public void Log(string s)
{
Debug.LogError(s);
}
public CECHostPlayer GetHostPlayer()
{
return hostPlayer;
}
public void InitCharacter(cmd_self_info_1 info)
{
if(characterPrefab == null)
{
Debug.LogError("null prefab");
return;
}
hostPlayer = Instantiate(characterPrefab, transform);
hostPlayer.InitCharacter(info);
//Vector3 pos = new Vector3(info.pos.x, info.pos.y, info.pos.z);
//Vector3 posCam = pos;
//posCam.z -= 10f;
//camera.transform.position = posCam;
//Vector3 posGround = pos;
//posGround.y -= 2f;
//ground.transform.position = posGround;
}
public GameObject InitCharacter(info_player_1 info)
{
if (characterPrefab == null)
{
Debug.LogError("null prefab");
return null;
}
CECHostPlayer character = Instantiate(characterPrefab, transform);
character.InitCharacter(info);
return character.gameObject;
}
}
+53
View File
@@ -0,0 +1,53 @@
using UnityEngine;
public class CECCounter
{
// Thuộc tính
protected float m_dwCounter; // Counter
protected float m_dwPeriod; // Count period
// Constructor
public CECCounter()
{
m_dwCounter = 0;
m_dwPeriod = 0;
}
// Set / Get period
public void SetPeriod(float dwPeriod) { m_dwPeriod = dwPeriod; }
public float GetPeriod() { return m_dwPeriod; }
// Set / Get counter
public void SetCounter(float dwCounter) { m_dwCounter = dwCounter; }
public float GetCounter() { return m_dwCounter; }
// Has counter reached period ?
public bool IsFull()
{
Debug.LogWarning($"HoangDev : {m_dwCounter} {m_dwPeriod} ");
return (m_dwCounter >= m_dwPeriod);
}
// Reset counter
public void Reset(bool bFull = false)
{
m_dwCounter = bFull ? m_dwPeriod : 0;
}
// Increase counter
public bool IncCounter(float dwCounter)
{
m_dwCounter += dwCounter;
return (m_dwCounter >= m_dwPeriod);
}
// Decrease counter
public void DecCounter(float dwCounter)
{
if (m_dwCounter <= dwCounter)
m_dwCounter = 0;
else
m_dwCounter -= dwCounter;
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6f330a50f34b90341a81715e467a1e7d
+85 -3
View File
@@ -1,13 +1,95 @@
using System;
using BrewMonster.Network;
using CSNetwork.C2SCommand;
using CSNetwork.GPDataType;
using System;
using System.Collections.Generic;
using System.Runtime.ConstrainedExecution;
using System.Text;
using UnityEngine;
using CSNetwork.Protocols;
using UnityEngine.LightTransport;
public class CECHostMove
{
// Giữ reference tới CECHostPlayer y như bản gốc
ushort m_wMoveStamp;
float m_fMoveTime;
CECHostPlayer m_pHost;
CECCounter m_CmdTimeCnt;
bool m_bStop;
const float MOVECMD_INTERVAL = .5f;
Vector3 m_vLastSevPos;
public CECHostMove(CECHostPlayer pHost)
{
m_wMoveStamp = 0;
m_fMoveTime = 0.0f;
m_pHost = pHost;
m_bStop = true;
m_CmdTimeCnt = new CECCounter();
m_CmdTimeCnt.SetPeriod(MOVECMD_INTERVAL);
}
public void Tick(float dwDeltaTime)
{
m_CmdTimeCnt.IncCounter(dwDeltaTime);
}
public void SendMoveCmd(in Vector3 vCurPos, in Vector3 vVel, int iMoveMode, bool bForceSend = false)
{
Vector3 vMoveDir = vVel;
float fSpeed = vMoveDir.magnitude;
SendMoveCmd(vCurPos, fSpeed, iMoveMode, bForceSend);
}
void SendMoveCmd(in Vector3 vCurPos,
float fSpeed, int iMoveMode, bool bForceSend)
{
if (m_bStop)
{
// m_CmdTimeCnt.Reset();
m_CmdTimeCnt.SetCounter((m_fMoveTime * 1000));
m_bStop = false;
}
if (!bForceSend && !m_CmdTimeCnt.IsFull())
return;
int iTime = (int)(m_fMoveTime * 1000);
if (iTime < 200)
{
if (iTime == 0 || !bForceSend)
{
// if time is too little, wait again
m_CmdTimeCnt.SetCounter(iTime);
return;
}
}
m_CmdTimeCnt.Reset();
c2s_CmdPlayerMove(vCurPos, vCurPos, iTime/* MOVECMD_INTERVAL */, fSpeed, iMoveMode, m_wMoveStamp++);
m_vLastSevPos = vCurPos;
}
private void Reset()
{
m_bStop = true;
}
private void c2s_CmdPlayerMove(in Vector3 vCurPos, in Vector3 vDest,
int iTime, float fSpeed, int iMoveMode, ushort wStamp)
{
gamedatasend gamedatasend = new gamedatasend();
//TODO: tim cach convert vector 3 unity sang System.Numerics.Vector3
Debug.LogWarning("vCurPos " + vCurPos);
gamedatasend.Data = C2SCommandFactory.CreatePlayerMove(ToSysVec3(vCurPos), ToSysVec3(vDest), (ushort)iTime, (short)fSpeed, (byte)iMoveMode, wStamp);
UnityGameSession.SendProtocol(gamedatasend);
Debug.LogWarning("HoangDev : SendProtocolSendProtocolSendProtocol");
}
public void GroundMove(float ftime)
{
m_fMoveTime += ftime;
}
public System.Numerics.Vector3 ToSysVec3(UnityEngine.Vector3 v)
=> new System.Numerics.Vector3(v.x, v.y, v.z);
}
public struct CDR_INFO
{
@@ -2,7 +2,7 @@ using UnityEngine;
public class PlayerMoveState : PlayerState
{
public PlayerMoveState(CharacterCtrl characterCtrl) : base(characterCtrl)
public PlayerMoveState(CECHostPlayer characterCtrl) : base(characterCtrl)
{
}
+2 -2
View File
@@ -2,8 +2,8 @@ using UnityEngine;
public abstract class PlayerState
{
protected readonly CharacterCtrl _characterCtrl;
public PlayerState(CharacterCtrl characterCtrl)
protected readonly CECHostPlayer _characterCtrl;
public PlayerState(CECHostPlayer characterCtrl)
{
_characterCtrl = characterCtrl;
}
+1 -2
View File
@@ -3,7 +3,7 @@ using UnityEngine;
public class PlayerStateMachine
{
PlayerState _state;
CharacterCtrl _characterCtrl;
CECHostPlayer _characterCtrl;
public void InitState(PlayerState state)
{
@@ -35,5 +35,4 @@ public class PlayerStateMachine
_state.Update();
}
//TODO: tìm OnMsgHstCorrectPos bên C++
}
@@ -8,7 +8,7 @@ using UnityEngine.InputSystem;
namespace StarterAssets
{
[RequireComponent(typeof(CharacterCtrl))]
[RequireComponent(typeof(CECHostPlayer))]
#if ENABLE_INPUT_SYSTEM
[RequireComponent(typeof(PlayerInput))]
#endif
@@ -102,7 +102,7 @@ namespace StarterAssets
private PlayerInput _playerInput;
#endif
private Animator _animator;
private CharacterCtrl _controller;
private CECHostPlayer _controller;
private StarterAssetsInputs _input;
private GameObject _mainCamera;
@@ -137,7 +137,7 @@ namespace StarterAssets
_cinemachineTargetYaw = CinemachineCameraTarget.transform.rotation.eulerAngles.y;
_hasAnimator = TryGetComponent(out _animator);
_controller = GetComponent<CharacterCtrl>();
_controller = GetComponent<CECHostPlayer>();
_input = GetComponent<StarterAssetsInputs>();
#if ENABLE_INPUT_SYSTEM
_playerInput = GetComponent<PlayerInput>();
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b757a79b0fc6f4adcbf4960449c6471f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 26c8460e0031e4a668625e9e08a5eceb
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -2,20 +2,24 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2180264
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LiberationSans SDF Material
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3}
m_ShaderKeywords:
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@@ -67,6 +71,7 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Ambient: 0.5
- _Bevel: 0.5
@@ -148,6 +153,8 @@ Material:
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -161,11 +168,6 @@ MonoBehaviour:
m_Name: LiberationSans SDF - Fallback
m_EditorClassIdentifier:
m_Version: 1.1.0
m_Material: {fileID: 2180264}
m_SourceFontFileGUID: e3265ab4bf004d28a9537516768c1c75
m_SourceFontFile: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75, type: 3}
m_AtlasPopulationMode: 1
InternalDynamicOS: 0
m_FaceInfo:
m_FaceIndex: 0
m_FamilyName: Liberation Sans
@@ -188,57 +190,8 @@ MonoBehaviour:
m_StrikethroughOffset: 18
m_StrikethroughThickness: 6.298828
m_TabWidth: 24
m_GlyphTable: []
m_CharacterTable: []
m_AtlasTextures:
- {fileID: 28268798066460806}
m_AtlasTextureIndex: 0
m_IsMultiAtlasTexturesEnabled: 1
m_ClearDynamicDataOnBuild: 1
m_UsedGlyphRects: []
m_FreeGlyphRects:
- m_X: 0
m_Y: 0
m_Width: 511
m_Height: 511
m_fontInfo:
Name: Liberation Sans
PointSize: 86
Scale: 1
CharacterCount: 250
LineHeight: 98.90625
Baseline: 0
Ascender: 77.84375
CapHeight: 59.1875
Descender: -18.21875
CenterLine: 0
SuperscriptOffset: 77.84375
SubscriptOffset: -12.261719
SubSize: 0.5
Underline: -12.261719
UnderlineThickness: 6.298828
strikethrough: 23.675
strikethroughThickness: 0
TabWidth: 239.0625
Padding: 9
AtlasWidth: 1024
AtlasHeight: 1024
atlas: {fileID: 0}
m_AtlasWidth: 512
m_AtlasHeight: 512
m_AtlasPadding: 9
m_AtlasRenderMode: 4169
m_glyphInfoList: []
m_KerningTable:
kerningPairs: []
m_FontFeatureTable:
m_MultipleSubstitutionRecords: []
m_LigatureSubstitutionRecords: []
m_GlyphPairAdjustmentRecords: []
m_MarkToBaseAdjustmentRecords: []
m_MarkToMarkAdjustmentRecords: []
fallbackFontAssets: []
m_FallbackFontAssetTable: []
m_Material: {fileID: 2180264}
m_SourceFontFileGUID: e3265ab4bf004d28a9537516768c1c75
m_CreationSettings:
sourceFontFileName:
sourceFontFileGUID: e3265ab4bf004d28a9537516768c1c75
@@ -258,6 +211,36 @@ MonoBehaviour:
fontStyleModifier: 0
renderMode: 4169
includeFontFeatures: 1
m_SourceFontFile: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75, type: 3}
m_SourceFontFilePath:
m_AtlasPopulationMode: 1
InternalDynamicOS: 0
m_GlyphTable: []
m_CharacterTable: []
m_AtlasTextures:
- {fileID: 28268798066460806}
m_AtlasTextureIndex: 0
m_IsMultiAtlasTexturesEnabled: 1
m_GetFontFeatures: 1
m_ClearDynamicDataOnBuild: 1
m_AtlasWidth: 512
m_AtlasHeight: 512
m_AtlasPadding: 9
m_AtlasRenderMode: 4169
m_UsedGlyphRects: []
m_FreeGlyphRects:
- m_X: 0
m_Y: 0
m_Width: 511
m_Height: 511
m_FontFeatureTable:
m_MultipleSubstitutionRecords: []
m_LigatureSubstitutionRecords: []
m_GlyphPairAdjustmentRecords: []
m_MarkToBaseAdjustmentRecords: []
m_MarkToMarkAdjustmentRecords: []
m_ShouldReimportFontFeatures: 0
m_FallbackFontAssetTable: []
m_FontWeightTable:
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
@@ -306,6 +289,33 @@ MonoBehaviour:
boldSpacing: 7
italicStyle: 35
tabSize: 10
m_fontInfo:
Name: Liberation Sans
PointSize: 86
Scale: 1
CharacterCount: 250
LineHeight: 98.90625
Baseline: 0
Ascender: 77.84375
CapHeight: 59.1875
Descender: -18.21875
CenterLine: 0
SuperscriptOffset: 77.84375
SubscriptOffset: -12.261719
SubSize: 0.5
Underline: -12.261719
UnderlineThickness: 6.298828
strikethrough: 23.675
strikethroughThickness: 0
TabWidth: 239.0625
Padding: 9
AtlasWidth: 1024
AtlasHeight: 1024
m_glyphInfoList: []
m_KerningTable:
kerningPairs: []
fallbackFontAssets: []
atlas: {fileID: 0}
--- !u!28 &28268798066460806
Texture2D:
m_ObjectHideFlags: 0
@@ -316,17 +326,21 @@ Texture2D:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 2
m_Width: 0
m_Height: 0
m_CompleteImageSize: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 3
m_Width: 1
m_Height: 1
m_CompleteImageSize: 1
m_MipsStripped: 0
m_TextureFormat: 1
m_MipCount: 1
m_IsReadable: 1
m_IsPreProcessed: 0
m_IgnoreMipmapLimit: 0
m_MipmapLimitGroupName:
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_VTOnly: 0
m_AlphaIsTransparency: 0
m_ImageCount: 1
m_TextureDimension: 2
@@ -340,9 +354,11 @@ Texture2D:
m_WrapW: 0
m_LightmapFormat: 0
m_ColorSpace: 0
image data: 0
_typelessdata:
m_PlatformBlob:
image data: 1
_typelessdata: 00
m_StreamData:
serializedVersion: 2
offset: 0
size: 0
path:
@@ -17,6 +17,9 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/WorldRender.unity
guid: 6d5fa77a0ed1542c8a76520fd198c7f1
- enabled: 1
path: Assets/Scenes/HoangTest.unity
guid: 9172bad49fed35e46819504e93c44a84
m_configObjects:
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
m_UseUCBPForAssetBundles: 0