diff --git a/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiPrefabCache.cs b/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiPrefabCache.cs index e6823ad..81aabc6 100644 --- a/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiPrefabCache.cs +++ b/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiPrefabCache.cs @@ -1,3 +1,4 @@ +#if UNITY_EDITOR using System; using System.Collections.Generic; using UnityEditor; @@ -21,4 +22,5 @@ public class AxiPrefabCache_Com2GUID public string ToPATH; public string ToGUID; public MonoScript monoScript; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiProjectTools.cs b/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiProjectTools.cs index 740bb4c..f531ce2 100644 --- a/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiProjectTools.cs +++ b/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiProjectTools.cs @@ -1,3 +1,4 @@ +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.IO; @@ -86,7 +87,7 @@ public class AxiProjectTools : EditorWindow static void LoopPrefabNode(string rootPath, GameObject trans, int depth) { string nodename = $"{rootPath}>{trans.name}"; -#if UNITY_5_4_OR_NEWER && !UNITY_2018_4_OR_NEWER +#if UNITY_2018_4_OR_NEWER GameObject prefabRoot = trans.gameObject; int comCount = prefabRoot.GetComponentCount(); for (int i = 0; i < comCount; i++) @@ -95,11 +96,6 @@ public class AxiProjectTools : EditorWindow if (com == null) continue; - if (com.name.Contains("VideoPlayer")) - { - - } - MonoBehaviour monoCom = com as MonoBehaviour; if (monoCom == null) continue; @@ -262,11 +258,13 @@ public class AxiProjectTools : EditorWindow } - [MenuItem("Axibug移植工具/[5]UnPack所有预制体")] + [MenuItem("Axibug移植工具/[5]UnPack所有嵌套预制体和场景中的预制体")] public static void UnpackPrefabs() { - string[] allAssetPaths = AssetDatabase.GetAllAssetPaths(); +#if UNITY_2018_4_OR_NEWER + GoTAxiProjectToolsSence(); + string[] allAssetPaths = AssetDatabase.GetAllAssetPaths(); int prefabCount = 0; foreach (string path in allAssetPaths) @@ -278,13 +276,41 @@ public class AxiProjectTools : EditorWindow prefabCount++; } } - Debug.Log($"Unpacked {prefabCount} prefabs."); + Debug.Log($"{prefabCount}个预制体Unpack"); - Debug.Log("处理完毕 [5]UnPack所有预制体"); - } + string[] sceneGuids = AssetDatabase.FindAssets("t:scene"); + foreach (string guid in sceneGuids) + { + string path = AssetDatabase.GUIDToAssetPath(guid); + if (path.Contains(toolSenceName)) + continue; - static void UnpackPrefab(string prefabPath) + EditorSceneManager.OpenScene(path); + Scene currentScene = SceneManager.GetActiveScene(); + GameObject[] rootObjects = currentScene.GetRootGameObjects(); + foreach (GameObject rootObj in rootObjects) + { + // 遍历场景中的所有对象 + TraverseHierarchy(rootObj); + } + // Save the scene // 获取当前打开的场景 + currentScene = EditorSceneManager.GetActiveScene(); + // 保存场景到文件(默认路径和名称) + bool success = EditorSceneManager.SaveScene(currentScene, currentScene.path); + + Debug.Log($"{currentScene.name}场景中 所有物体Unpack"); + } + + GoTAxiProjectToolsSence(); + Debug.Log("处理完毕 [5]UnPack所有预制体"); +#else + Debug.Log("低版本不要执行本函数"); +#endif + } + + static void UnpackPrefab(string prefabPath) { +#if UNITY_2018_4_OR_NEWER GameObject prefabInstance = AssetDatabase.LoadAssetAtPath(prefabPath); if (prefabInstance == null) { @@ -296,10 +322,14 @@ public class AxiProjectTools : EditorWindow TraverseHierarchy(obj); PrefabUtility.SaveAsPrefabAsset(obj, prefabPath); GameObject.DestroyImmediate(obj); +#else + Debug.Log("低版本不要执行本函数"); +#endif } static void TraverseHierarchy(GameObject obj) { +#if UNITY_2018_4_OR_NEWER // 检查该对象是否是预制体的实例 if (PrefabUtility.IsPartOfPrefabInstance(obj)) { @@ -313,6 +343,9 @@ public class AxiProjectTools : EditorWindow { TraverseHierarchy(obj.transform.GetChild(i).gameObject); } +#else + Debug.Log("低版本不要执行本函数"); +#endif } @@ -379,4 +412,5 @@ public class AxiProjectTools : EditorWindow textureImporter.SaveAndReimport(); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs b/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs index b4b4da7..7077016 100644 --- a/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs +++ b/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs @@ -1,6 +1,8 @@ 锘縰sing AxibugEmuOnline.Client; using UnityEditor; using UnityEngine; +using System.Collections.Generic; + namespace AxibugEmuOnline.Editors { [CustomEditor(typeof(CommandDispatcher))] @@ -13,8 +15,8 @@ namespace AxibugEmuOnline.Editors if (!Application.isPlaying) return; var dispacather = target as CommandDispatcher; - - dispacather.GetRegisters(out var normal, out var solo); + IReadOnlyList normal; IReadOnlyList solo; + dispacather.GetRegisters(out normal, out solo); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("NORMAL"); diff --git a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs index 366ec90..29894d8 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs @@ -60,7 +60,7 @@ namespace AxiReplay if (!bNetInit) { data = default(ReplayStep); - frameDiff = default; + frameDiff = default(int); inputDiff = false; return false; } @@ -73,7 +73,7 @@ namespace AxiReplay if (!bNetInit) { data = default(ReplayStep); - frameDiff = default; + frameDiff = default(int); inputDiff = false; return false; } diff --git a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/ReplayWriter.cs b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/ReplayWriter.cs index a65f40d..950767e 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/ReplayWriter.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/ReplayWriter.cs @@ -5,152 +5,154 @@ using System.Text; namespace AxiReplay { - public class ReplayWriter : IReplayWriter - { - public ReplayData.ReplayFormat mFormat { get; private set; } - public Encoding TexEncoding { get; private set; } - ReplayHandler handler; - string mTitle; - string mNote; - int mAllFrame; - int mAllTime; - long mData; - int mSingleInputLenght; - int mSingleDataLenght; - MemoryStream mStream; - BinaryWriter mBinaryWriter; + public class ReplayWriter : IReplayWriter + { + public ReplayData.ReplayFormat mFormat { get; private set; } + public Encoding TexEncoding { get; private set; } + ReplayHandler handler; + string mTitle; + string mNote; + int mAllFrame; + int mAllTime; + long mData; + int mSingleInputLenght; + int mSingleDataLenght; + MemoryStream mStream; + BinaryWriter mBinaryWriter; - int mCurrFrame; - UInt64 mCurrInput; - ReplayStep wirteStep; + int mCurrFrame; + UInt64 mCurrInput; + ReplayStep wirteStep; - List dbgList = new List(); + List dbgList = new List(); - public ReplayWriter(string Title, string Note, ReplayData.ReplayFormat format, Encoding encoding) - { - mTitle = Title; - mNote = Note; - TexEncoding = encoding; - mFormat = format; - switch (mFormat) - { - case ReplayData.ReplayFormat.FM32IP64: mSingleInputLenght = sizeof(UInt64); break; - case ReplayData.ReplayFormat.FM32IP32: mSingleInputLenght = sizeof(UInt32); break; - case ReplayData.ReplayFormat.FM32IP16: mSingleInputLenght = sizeof(UInt16); break; - case ReplayData.ReplayFormat.FM32IPBYTE: mSingleInputLenght = sizeof(byte); break; - } - mSingleDataLenght = (sizeof(UInt32)) + mSingleInputLenght; + public ReplayWriter(string Title, string Note, ReplayData.ReplayFormat format, Encoding encoding) + { + mTitle = Title; + mNote = Note; + TexEncoding = encoding; + mFormat = format; + switch (mFormat) + { + case ReplayData.ReplayFormat.FM32IP64: mSingleInputLenght = sizeof(UInt64); break; + case ReplayData.ReplayFormat.FM32IP32: mSingleInputLenght = sizeof(UInt32); break; + case ReplayData.ReplayFormat.FM32IP16: mSingleInputLenght = sizeof(UInt16); break; + case ReplayData.ReplayFormat.FM32IPBYTE: mSingleInputLenght = sizeof(byte); break; + } + mSingleDataLenght = (sizeof(UInt32)) + mSingleInputLenght; - mStream = new MemoryStream(); - mBinaryWriter = new BinaryWriter(mStream); + mStream = new MemoryStream(); + mBinaryWriter = new BinaryWriter(mStream); - mCurrFrame = -1; - mCurrInput = int.MaxValue; - wirteStep = new ReplayStep(); + mCurrFrame = -1; + mCurrInput = int.MaxValue; + wirteStep = new ReplayStep(); - dbgList.Clear(); + dbgList.Clear(); - } + } - int byFrameIdx = 0; - /// - /// 寰鍓嶆帹杩涘抚鐨,鎸囧畾甯т笅鏍 - /// - /// - public void NextFramebyFrameIdx(int FrameID, UInt64 frameInput) - { - TakeFrame(FrameID - byFrameIdx, frameInput); - byFrameIdx = FrameID; - } + int byFrameIdx = 0; + /// + /// 寰鍓嶆帹杩涘抚鐨,鎸囧畾甯т笅鏍 + /// + /// + public void NextFramebyFrameIdx(int FrameID, UInt64 frameInput) + { + TakeFrame(FrameID - byFrameIdx, frameInput); + byFrameIdx = FrameID; + } - /// - /// 寰鍓嶆帹杩1甯х殑Input - /// - /// - public void NextFrame(UInt64 frameInput) - { - TakeFrame(1, frameInput); - } + /// + /// 寰鍓嶆帹杩1甯х殑Input + /// + /// + public void NextFrame(UInt64 frameInput) + { + TakeFrame(1, frameInput); + } - /// - /// 寰鍓嶆帹杩涙寚瀹氬抚鏁伴噺鐨処nput - /// - /// - public void TakeFrame(int addFrame, UInt64 frameInput) - { - if (addFrame < 0) - { + /// + /// 寰鍓嶆帹杩涙寚瀹氬抚鏁伴噺鐨処nput + /// + /// + public void TakeFrame(int addFrame, UInt64 frameInput) + { + if (addFrame < 0) + { - } - mCurrFrame += addFrame; - if (mCurrInput == frameInput) - return; - mCurrInput = frameInput; + } + mCurrFrame += addFrame; + if (mCurrInput == frameInput) + return; + mCurrInput = frameInput; - wirteStep.FrameStartID = mCurrFrame; - wirteStep.InPut = mCurrInput; - dbgList.Add($"{mCurrFrame} | {mCurrInput}"); + wirteStep.FrameStartID = mCurrFrame; + wirteStep.InPut = mCurrInput; + dbgList.Add($"{mCurrFrame} | {mCurrInput}"); - switch (mFormat) - { - case ReplayData.ReplayFormat.FM32IP64: - mBinaryWriter.Write(wirteStep.FrameStartID); - mBinaryWriter.Write(wirteStep.InPut); - break; - case ReplayData.ReplayFormat.FM32IP32: - mBinaryWriter.Write(BitConverter.GetBytes(wirteStep.All64Data), 0, 4 + 4); - break; - case ReplayData.ReplayFormat.FM32IP16: - mBinaryWriter.Write(BitConverter.GetBytes(wirteStep.All64Data), 0, 4 + 2); - break; - case ReplayData.ReplayFormat.FM32IPBYTE: - mBinaryWriter.Write(BitConverter.GetBytes(wirteStep.All64Data), 0, 4 + 1); - break; - } - } + switch (mFormat) + { + case ReplayData.ReplayFormat.FM32IP64: + mBinaryWriter.Write(wirteStep.FrameStartID); + mBinaryWriter.Write(wirteStep.InPut); + break; + case ReplayData.ReplayFormat.FM32IP32: + mBinaryWriter.Write(BitConverter.GetBytes(wirteStep.All64Data), 0, 4 + 4); + break; + case ReplayData.ReplayFormat.FM32IP16: + mBinaryWriter.Write(BitConverter.GetBytes(wirteStep.All64Data), 0, 4 + 2); + break; + case ReplayData.ReplayFormat.FM32IPBYTE: + mBinaryWriter.Write(BitConverter.GetBytes(wirteStep.All64Data), 0, 4 + 1); + break; + } + } - public void SaveData(string path, bool bWithDump = false, string dumppath = null) - { - ReplayData.GetStringByteData(mTitle, out byte[] titleData, out int titleLenghtWithEnd, TexEncoding); - ReplayData.GetStringByteData(mNote, out byte[] noteData, out int noteLenghtWithEnd, TexEncoding); + public void SaveData(string path, bool bWithDump = false, string dumppath = null) + { + byte[] titleData; int titleLenghtWithEnd; + ReplayData.GetStringByteData(mTitle, out titleData, out titleLenghtWithEnd, TexEncoding); + byte[] noteData; int noteLenghtWithEnd; + ReplayData.GetStringByteData(mNote, out noteData, out noteLenghtWithEnd, TexEncoding); - ReplayHandler handler = new ReplayHandler(); - handler.Format = (int)this.mFormat; - handler.DataOffset = ReplayData.HandlerLenght; - handler.CreateTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); - handler.AllFrame = wirteStep.FrameStartID; - handler.SingleLenght = mSingleDataLenght; + ReplayHandler handler = new ReplayHandler(); + handler.Format = (int)this.mFormat; + handler.DataOffset = ReplayData.HandlerLenght; + handler.CreateTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + handler.AllFrame = wirteStep.FrameStartID; + handler.SingleLenght = mSingleDataLenght; - using (FileStream fs = new FileStream(path, FileMode.Create)) - { - using (BinaryWriter bw = new BinaryWriter(fs)) - { - //鍐欏叆Handler - bw.Write(ReplayData.GetHandlerData(handler)); - //鍐欏叆Data - bw.Write(mStream.ToArray()); - } - } + using (FileStream fs = new FileStream(path, FileMode.Create)) + { + using (BinaryWriter bw = new BinaryWriter(fs)) + { + //鍐欏叆Handler + bw.Write(ReplayData.GetHandlerData(handler)); + //鍐欏叆Data + bw.Write(mStream.ToArray()); + } + } - if (bWithDump) - { - List temp = new List(); - temp.Add($"Format => {handler.Format}"); - temp.Add($"DataOffset => {handler.DataOffset}"); - temp.Add($"CreateTime => {handler.CreateTime}"); - temp.Add($"AllFrame => {handler.AllFrame}"); - temp.Add($"SingleLenght => {handler.SingleLenght}"); - dbgList.InsertRange(0, temp); - File.WriteAllLines(dumppath, dbgList); - } - } + if (bWithDump) + { + List temp = new List(); + temp.Add($"Format => {handler.Format}"); + temp.Add($"DataOffset => {handler.DataOffset}"); + temp.Add($"CreateTime => {handler.CreateTime}"); + temp.Add($"AllFrame => {handler.AllFrame}"); + temp.Add($"SingleLenght => {handler.SingleLenght}"); + dbgList.InsertRange(0, temp); + File.WriteAllLines(dumppath, dbgList); + } + } - public void Dispose() - { - mStream.Dispose(); - mBinaryWriter.Dispose(); - //TODO - } + public void Dispose() + { + mStream.Dispose(); + mBinaryWriter.Dispose(); + //TODO + } - } + } } diff --git a/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll b/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll new file mode 100644 index 0000000..3802b84 Binary files /dev/null and b/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll differ diff --git a/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll.meta b/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll.meta new file mode 100644 index 0000000..0c56f22 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 898ba71ded907534ba7eaada7855cadc \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll b/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll deleted file mode 100644 index c3c4a90..0000000 Binary files a/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll and /dev/null differ diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets.meta b/AxibugEmuOnline.Client/Assets/Plugins/PSVita.meta similarity index 77% rename from AxibugEmuOnline.Client/Assets/StreamingAssets.meta rename to AxibugEmuOnline.Client/Assets/Plugins/PSVita.meta index a8658aa..d610f70 100644 --- a/AxibugEmuOnline.Client/Assets/StreamingAssets.meta +++ b/AxibugEmuOnline.Client/Assets/Plugins/PSVita.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 353264361911f2f43bb2c088c7e73fec +guid: 957996f7ef8e16e4d83eace2efbcbfaa folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog.suprx b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog.suprx new file mode 100644 index 0000000..d1019d3 Binary files /dev/null and b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog.suprx differ diff --git a/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll.meta b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog.suprx.meta similarity index 69% rename from AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll.meta rename to AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog.suprx.meta index fa5284c..5769bd6 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll.meta +++ b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog.suprx.meta @@ -1,20 +1,19 @@ fileFormatVersion: 2 -guid: 324deac494a24a7499801349c7908062 +guid: 255d4b97366fc9e429c8cf1a54ee47b8 +timeCreated: 1499268372 +licenseType: Pro PluginImporter: externalObjects: {} serializedVersion: 2 iconMap: {} executionOrder: {} - defineConstraints: [] isPreloaded: 0 isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 platformData: - first: Any: second: - enabled: 1 + enabled: 0 settings: {} - first: Editor: Editor @@ -23,11 +22,10 @@ PluginImporter: settings: DefaultValueInitialized: true - first: - Windows Store Apps: WindowsStoreApps + PSP2: PSP2 second: - enabled: 0 - settings: - CPU: AnyCPU + enabled: 1 + settings: {} userData: assetBundleName: assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog_stub.a b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog_stub.a new file mode 100644 index 0000000..c18e702 Binary files /dev/null and b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog_stub.a differ diff --git a/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog_stub.a.meta b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog_stub.a.meta new file mode 100644 index 0000000..52eb106 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/CommonDialog_stub.a.meta @@ -0,0 +1,31 @@ +fileFormatVersion: 2 +guid: e4a33d16bdff8ff418e7a5fe120bd193 +timeCreated: 1499268372 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + PSP2: PSP2 + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Settings.meta b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/SonyAssemblies.meta similarity index 77% rename from AxibugEmuOnline.Client/Assets/Settings.meta rename to AxibugEmuOnline.Client/Assets/Plugins/PSVita/SonyAssemblies.meta index 725e849..bfc428b 100644 --- a/AxibugEmuOnline.Client/Assets/Settings.meta +++ b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/SonyAssemblies.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7c3fabe6430be6943b1fc06a25a275a8 +guid: b3de348afcfb8214ea5dced94199f16e folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/AxibugEmuOnline.Client/Assets/Plugins/PSVita/SonyAssemblies/SonyVitaCommonDialog.dll b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/SonyAssemblies/SonyVitaCommonDialog.dll new file mode 100644 index 0000000..2142c8b Binary files /dev/null and b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/SonyAssemblies/SonyVitaCommonDialog.dll differ diff --git a/AxibugEmuOnline.Client/Assets/Plugins/PSVita/SonyAssemblies/SonyVitaCommonDialog.dll.meta b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/SonyAssemblies/SonyVitaCommonDialog.dll.meta new file mode 100644 index 0000000..ec3ff35 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Plugins/PSVita/SonyAssemblies/SonyVitaCommonDialog.dll.meta @@ -0,0 +1,92 @@ +fileFormatVersion: 2 +guid: eb76ae7b43c117c449fe04e536cf3f34 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Editor: 0 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude PSP2: 0 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + PSP2: PSP2 + second: + enabled: 1 + settings: {} + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab b/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab index 81baa9f..53110e4 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab @@ -25,12 +25,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 9760340517325694} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4232056521131536011} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &9003897287163669553 MonoBehaviour: @@ -56,6 +57,7 @@ AudioSource: serializedVersion: 4 OutputAudioMixerGroup: {fileID: 0} m_audioClip: {fileID: 0} + m_Resource: {fileID: 0} m_PlayOnAwake: 1 m_Volume: 1 m_Pitch: 1 @@ -169,9 +171,9 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: -1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1038087993597378172} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -240,11 +242,11 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 3430872171738201552} - {fileID: 5684774662137182450} m_Father: {fileID: 4232056520494431727} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -289,12 +291,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4232056520112715746} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4232056521131536011} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &4232056520112715744 MonoBehaviour: @@ -311,6 +314,8 @@ MonoBehaviour: NesEmu: {fileID: 4232056521131536012} DrawCanvas: {fileID: 4232056520494431724} Image: {fileID: 4232056521759880274} + GPUTurboMat_gpu: {fileID: 2100000, guid: 07e28fcb992bc124e986f9d8ff3beb97, type: 2} + GPUTurbo: 1 --- !u!1 &4232056520494431712 GameObject: m_ObjectHideFlags: 0 @@ -322,7 +327,6 @@ GameObject: - component: {fileID: 4232056520494431727} - component: {fileID: 4232056520494431724} - component: {fileID: 4232056520494431725} - - component: {fileID: 4232056520494431726} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -340,11 +344,11 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4232056521759880275} - {fileID: 1038087993597378172} m_Father: {fileID: 4232056521131536011} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -368,7 +372,9 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -395,23 +401,6 @@ MonoBehaviour: m_DefaultSpriteDPI: 96 m_DynamicPixelsPerUnit: 1 m_PresetInfoIsWorld: 0 ---- !u!114 &4232056520494431726 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4232056520494431712} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 4294967295 --- !u!1 &4232056521131536013 GameObject: m_ObjectHideFlags: 0 @@ -436,15 +425,16 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4232056521131536013} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4232056520112715745} - {fileID: 4785916497946256520} - {fileID: 4232056520494431727} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &4232056521131536012 MonoBehaviour: @@ -458,10 +448,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 39557e19783acee499ace6c68549e8f8, type: 3} m_Name: m_EditorClassIdentifier: - InputTemplate: {fileID: 0} VideoProvider: {fileID: 4232056520112715744} AudioProvider: {fileID: 9003897287163669553} - m_bPause: 0 --- !u!1 &4232056521759880276 GameObject: m_ObjectHideFlags: 0 @@ -490,9 +478,9 @@ RectTransform: m_LocalRotation: {x: 1, y: 0, z: 0, w: 0} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4232056520494431727} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -519,7 +507,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: 07e28fcb992bc124e986f9d8ff3beb97, type: 2} + m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} @@ -562,9 +550,9 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1038087993597378172} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/RoomPlayerSlot/RoomPlayerSlotUnit.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/RoomPlayerSlot/RoomPlayerSlotUnit.prefab index 5615d88..fb3a327 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/RoomPlayerSlot/RoomPlayerSlotUnit.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/RoomPlayerSlot/RoomPlayerSlotUnit.prefab @@ -25,17 +25,18 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2371389415552619370} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1727149598719982521} + m_Children: + - {fileID: 1771748875814093347} + m_Father: {fileID: 8950855035476021338} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 84, y: 0} - m_SizeDelta: {x: 502, y: 160} + m_AnchoredPosition: {x: 49, y: 0} + m_SizeDelta: {x: 251, y: 80} m_Pivot: {x: 0, y: 0.5} --- !u!222 &6564505248202665844 CanvasRenderer: @@ -100,17 +101,17 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2721335758118728454} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1727149598719982521} + m_Father: {fileID: 8950855035476021338} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 142, y: 160} + m_SizeDelta: {x: 71, y: 80} m_Pivot: {x: 0, y: 0.5} --- !u!222 &9075115120373129637 CanvasRenderer: @@ -159,7 +160,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1727149598719982521} - - component: {fileID: 7654163251363580929} + - component: {fileID: 8370099016684185830} m_Layer: 5 m_Name: RoomPlayerSlotUnit m_TagString: Untagged @@ -179,20 +180,143 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 846681823671095772} - - {fileID: 6665974318866355999} + - {fileID: 8950855035476021338} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 100, y: 100} + m_SizeDelta: {x: 300, y: 100} m_Pivot: {x: 0, y: 1} ---- !u!222 &7654163251363580929 -CanvasRenderer: +--- !u!114 &8370099016684185830 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5376230278482525414} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1bfe4359a48b5c349b439e88eb53b8b1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_controllerIndex: 0 + m_connectInfoNode: {fileID: 2371389415552619370} + m_indexIcon: {fileID: 4536003039670490184} + m_playerName: {fileID: 6617607173830585898} +--- !u!1 &5662729590297657737 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8950855035476021338} + m_Layer: 5 + m_Name: Root + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8950855035476021338 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5662729590297657737} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 846681823671095772} + - {fileID: 6665974318866355999} + m_Father: {fileID: 1727149598719982521} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -0.000030517578, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &7128973212336692590 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1771748875814093347} + - component: {fileID: 4464870872037843803} + - component: {fileID: 6617607173830585898} + m_Layer: 5 + m_Name: playerName + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1771748875814093347 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7128973212336692590} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6665974318866355999} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 30.93, y: -1.59} + m_SizeDelta: {x: 146.1, y: 30.63} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4464870872037843803 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7128973212336692590} m_CullTransparentMesh: 1 +--- !u!114 &6617607173830585898 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7128973212336692590} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 33a3bdf8f6bd1ec4eba7c4bc58183212, type: 3} + m_FontSize: 20 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 4 + m_MaxSize: 20 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: PLAYER_NAME diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/XMBInfoBar.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/XMBInfoBar.prefab index 72e61f3..50cb8d7 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/XMBInfoBar.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/XMBInfoBar.prefab @@ -64,6 +64,85 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!1 &1793510994393845066 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2940710093054777883} + - component: {fileID: 6850622733671985395} + - component: {fileID: 2118483068810584522} + m_Layer: 5 + m_Name: ControlSlotInfo + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2940710093054777883 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1793510994393845066} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2921874279820016524} + - {fileID: 3201409976408832832} + - {fileID: 2711516940043786061} + - {fileID: 3283429487447647189} + m_Father: {fileID: 6362836288749559125} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &6850622733671985395 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1793510994393845066} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 3 + m_Spacing: 0 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!114 &2118483068810584522 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1793510994393845066} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 909a5b71ba48a9c46a57d43017072837, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &2196797712553207707 GameObject: m_ObjectHideFlags: 0 @@ -93,7 +172,8 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 2940710093054777883} m_Father: {fileID: 5353336693430589123} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -626,6 +706,7 @@ MonoBehaviour: DelayValue: {fileID: 6486398873987280650} OnlinePlayerCount: {fileID: 9033504323044377285} FPS: {fileID: 2545793518460288919} + ControlSlotInfoNode: {fileID: 1793510994393845066} --- !u!1 &5629957813601835122 GameObject: m_ObjectHideFlags: 0 @@ -1304,3 +1385,423 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1001 &3627982800791678196 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 2940710093054777883} + m_Modifications: + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Pivot.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_SizeDelta.x + value: 300 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5376230278482525414, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Name + value: P3 + objectReference: {fileID: 0} + - target: {fileID: 8370099016684185830, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_slotIndex + value: 2 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} +--- !u!224 &2711516940043786061 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + m_PrefabInstance: {fileID: 3627982800791678196} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &4208900619059435628 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 2940710093054777883} + m_Modifications: + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Pivot.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_SizeDelta.x + value: 300 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5376230278482525414, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Name + value: P4 + objectReference: {fileID: 0} + - target: {fileID: 8370099016684185830, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_slotIndex + value: 3 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} +--- !u!224 &3283429487447647189 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + m_PrefabInstance: {fileID: 4208900619059435628} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &4293513748768145657 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 2940710093054777883} + m_Modifications: + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Pivot.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_SizeDelta.x + value: 300 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5376230278482525414, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Name + value: P2 + objectReference: {fileID: 0} + - target: {fileID: 8370099016684185830, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_slotIndex + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} +--- !u!224 &3201409976408832832 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + m_PrefabInstance: {fileID: 4293513748768145657} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &4572424957848191029 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 2940710093054777883} + m_Modifications: + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Pivot.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_SizeDelta.x + value: 300 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5376230278482525414, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + propertyPath: m_Name + value: P1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} +--- !u!224 &2921874279820016524 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1727149598719982521, guid: cf7167f02ca8e8a4eb176121ffa58f50, type: 3} + m_PrefabInstance: {fileID: 4572424957848191029} + m_PrefabAsset: {fileID: 0} diff --git a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity index 4a40cf8..f1ceb1f 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity @@ -931,7 +931,8 @@ GameObject: m_Component: - component: {fileID: 802786939} - component: {fileID: 802786941} - - component: {fileID: 802786940} + - component: {fileID: 802786942} + - component: {fileID: 802786943} m_Layer: 5 m_Name: Image2 m_TagString: Untagged @@ -958,7 +959,15 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &802786940 +--- !u!222 &802786941 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 802786938} + m_CullTransparentMesh: 1 +--- !u!114 &802786942 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -967,7 +976,7 @@ MonoBehaviour: m_GameObject: {fileID: 802786938} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} @@ -978,24 +987,25 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: e043954733c440645ba43b09301ee4a6, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!222 &802786941 -CanvasRenderer: + m_Texture: {fileID: 2800000, guid: e043954733c440645ba43b09301ee4a6, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!114 &802786943 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 802786938} - m_CullTransparentMesh: 1 + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a0987fcca76655248ac8defaffd1cb45, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!224 &939125854 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} @@ -1010,9 +1020,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1124446957} - - component: {fileID: 1124446960} - - component: {fileID: 1124446959} - - component: {fileID: 1124446958} - component: {fileID: 1124446961} m_Layer: 5 m_Name: FilterPreview @@ -1028,83 +1035,20 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1124446956} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1471857115} - {fileID: 802786939} - m_Father: {fileID: 1335662459} + m_Father: {fileID: 1599240741} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0, y: 0} ---- !u!114 &1124446958 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1124446956} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 4294967295 ---- !u!114 &1124446959 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1124446956} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} - m_Name: - m_EditorClassIdentifier: - m_UiScaleMode: 1 - m_ReferencePixelsPerUnit: 100 - m_ScaleFactor: 1 - m_ReferenceResolution: {x: 1920, y: 1080} - m_ScreenMatchMode: 0 - m_MatchWidthOrHeight: 0 - m_PhysicalUnit: 3 - m_FallbackScreenDPI: 96 - m_DefaultSpriteDPI: 96 - m_DynamicPixelsPerUnit: 1 - m_PresetInfoIsWorld: 0 ---- !u!223 &1124446960 -Canvas: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1124446956} - m_Enabled: 1 - serializedVersion: 3 - m_RenderMode: 1 - m_Camera: {fileID: 1475480931} - m_PlaneDistance: 100 - m_PixelPerfect: 0 - m_ReceivesEvents: 1 - m_OverrideSorting: 0 - m_OverridePixelPerfect: 0 - m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 - m_AdditionalShaderChannelsFlag: 1 - m_UpdateRectTransformForStandalone: 0 - m_SortingLayerID: 0 - m_SortingOrder: 1 - m_TargetDisplay: 0 + m_Pivot: {x: 0.5, y: 0.5} --- !u!225 &1124446961 CanvasGroup: m_ObjectHideFlags: 0 @@ -1153,11 +1097,9 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1639312037} - - {fileID: 1475480929} - {fileID: 74796459} - {fileID: 1427887270} - {fileID: 1599240741} - - {fileID: 1124446957} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1335662460 @@ -1172,7 +1114,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 980f937ad27ad8540afeb8b7f100997e, type: 3} m_Name: m_EditorClassIdentifier: - m_filterVolume: {fileID: 1475480930} m_filterPreview: {fileID: 1124446961} m_xmbBg: {fileID: 730698712} bTest: 0 @@ -1229,6 +1170,18 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 1599240741} m_Modifications: + - target: {fileID: 245821230929098307, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 245821230929098307, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 245821230929098307, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1108503213262670097, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1253,6 +1206,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 1700008050955832379, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1700008050955832379, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1700008050955832379, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1700008050955832379, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1710183501897154830, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1341,6 +1310,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 2256656160383605798, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2256656160383605798, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2256656160383605798, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2256656160383605798, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2580867844924924490, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1369,6 +1354,158 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 2711516940043786061, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2711516940043786061, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2711516940043786061, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2711516940043786061, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2711516940043786061, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921874279820016524, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921874279820016524, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2940710093054777883, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2940710093054777883, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2940710093054777883, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2940710093054777883, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2940710093054777883, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2940710093054777883, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2940710093054777883, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3082393374055389930, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3082393374055389930, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3082393374055389930, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3082393374055389930, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3201409976408832832, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3201409976408832832, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3201409976408832832, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3201409976408832832, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3283429487447647189, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3283429487447647189, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3283429487447647189, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3283429487447647189, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3283429487447647189, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3382122818573208955, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3382122818573208955, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3515422821744378301, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3515422821744378301, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3515422821744378301, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3515422821744378301, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3515422821744378301, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3638410964911123998, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3638410964911123998, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3638410964911123998, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3638410964911123998, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4195056312044822544, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1409,6 +1546,18 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 4671900371089820408, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4671900371089820408, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4671900371089820408, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4701095282238438274, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1457,6 +1606,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 5155040771471469003, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5155040771471469003, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5155040771471469003, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5155040771471469003, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 5179542162941529357, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1577,6 +1742,22 @@ PrefabInstance: propertyPath: m_SizeDelta.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 6064974212694732928, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6064974212694732928, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6064974212694732928, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6064974212694732928, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6228199563403754553, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1649,6 +1830,26 @@ PrefabInstance: propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 6384207385666895815, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6384207385666895815, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6384207385666895815, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6384207385666895815, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6384207385666895815, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6462781698725903427, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1705,6 +1906,46 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 6696282460080611485, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6696282460080611485, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6696282460080611485, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6696282460080611485, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6696282460080611485, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7042646075262940748, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7042646075262940748, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7042646075262940748, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7042646075262940748, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7042646075262940748, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7158194035478552859, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1757,6 +1998,18 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 7294832541871909085, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7294832541871909085, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7294832541871909085, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7535416527851975519, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -1785,6 +2038,34 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 8720207225742131896, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8720207225742131896, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8720207225742131896, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8720207225742131896, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9044517244222250025, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9044517244222250025, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9044517244222250025, guid: 3b211f31b55a35e44a8fa38666f63383, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -1884,174 +2165,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: imgUI: {fileID: 1471857116} ---- !u!1 &1475480928 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1475480929} - - component: {fileID: 1475480931} - - component: {fileID: 1475480932} - - component: {fileID: 1475480930} - m_Layer: 5 - m_Name: GameCamera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1475480929 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1475480928} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.98, y: 20.14, z: 6.23} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1335662459} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1475480930 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1475480928} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} - m_Name: - m_EditorClassIdentifier: - sharedProfile: {fileID: 11400000, guid: 17060e2d2f9e5c340a526f08317e5a98, type: 2} - isGlobal: 1 - blendDistance: 0 - weight: 1 - priority: 0 ---- !u!20 &1475480931 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1475480928} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_Iso: 200 - m_ShutterSpeed: 0.005 - m_Aperture: 16 - m_FocusDistance: 10 - m_FocalLength: 50 - m_BladeCount: 5 - m_Curvature: {x: 2, y: 11} - m_BarrelClipping: 0.25 - m_Anamorphism: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 1 - orthographic size: 5 - m_Depth: -2 - m_CullingMask: - serializedVersion: 2 - m_Bits: 32 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!114 &1475480932 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1475480928} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} - m_Name: - m_EditorClassIdentifier: - volumeTrigger: {fileID: 0} - volumeLayer: - serializedVersion: 2 - m_Bits: 32 - stopNaNPropagation: 1 - finalBlitToCameraTarget: 0 - antialiasingMode: 0 - temporalAntialiasing: - jitterSpread: 0.75 - sharpness: 0.25 - stationaryBlending: 0.95 - motionBlending: 0.85 - subpixelMorphologicalAntialiasing: - quality: 2 - fastApproximateAntialiasing: - fastMode: 0 - keepAlpha: 0 - fog: - enabled: 1 - excludeSkybox: 1 - debugLayer: - lightMeter: - width: 512 - height: 256 - showCurves: 1 - histogram: - width: 512 - height: 256 - channel: 3 - waveform: - exposure: 0.12 - height: 256 - vectorscope: - size: 256 - exposure: 0.12 - overlaySettings: - linearDepth: 0 - motionColorIntensity: 4 - motionGridSize: 64 - colorBlindnessType: 0 - colorBlindnessStrength: 1 - m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2} - m_ShowToolkit: 0 - m_ShowCustomSorter: 0 - breakBeforeColorGrading: 0 - m_BeforeTransparentBundles: [] - m_BeforeStackBundles: - - assemblyQualifiedName: FixingPixelArtGrille, AxibugEmuOnline.Client, Version=0.0.0.0, - Culture=neutral, PublicKeyToken=null - - assemblyQualifiedName: MattiasCRT, AxibugEmuOnline.Client, Version=0.0.0.0, Culture=neutral, - PublicKeyToken=null - - assemblyQualifiedName: LCDPostEffect, AxibugEmuOnline.Client, Version=0.0.0.0, - Culture=neutral, PublicKeyToken=null - m_AfterStackBundles: [] --- !u!1 &1498586261 GameObject: m_ObjectHideFlags: 3 @@ -2190,10 +2303,11 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 1124446957} - {fileID: 1983793178} + - {fileID: 1469631713} - {fileID: 939125854} - {fileID: 1318590597} - - {fileID: 1469631713} m_Father: {fileID: 1335662459} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -2214,7 +2328,7 @@ GameObject: - component: {fileID: 1639312035} m_Layer: 0 m_Name: UICamera - m_TagString: Untagged + m_TagString: MainCamera m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -2263,7 +2377,7 @@ Camera: field of view: 60 orthographic: 1 orthographic size: 5 - m_Depth: -1 + m_Depth: 0 m_CullingMask: serializedVersion: 2 m_Bits: 32 @@ -2467,10 +2581,18 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 406143166925924216, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchoredPosition.x + value: -5 + objectReference: {fileID: 0} - target: {fileID: 736530578155193984, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 736530578155193984, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 935090267056593628, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -2963,6 +3085,10 @@ PrefabInstance: propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 8801936766261209235, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs index f7abd1f..dc8d979 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs @@ -34,6 +34,11 @@ namespace AxibugEmuOnline.Client.ClientCore #region Mono public static TickLoop tickLoop; private static CoroutineRunner coRunner; + +#if UNITY_PSP2 + public static SonyVitaCommonDialog sonyVitaCommonDialog; +#endif + #endregion #if UNITY_PSP2 && !UNITY_EDITOR //PSV鐪熸満 @@ -43,15 +48,13 @@ namespace AxibugEmuOnline.Client.ClientCore #endif public static void Init(Initer initer, bool isTest = false, string testSrvIP = "") { - PlayerPrefs.DeleteAll(); + //鍏朵粬骞冲彴蹇呰鐨勫垵濮嬪寲 + if (UnityEngine.Application.platform == RuntimePlatform.PSP2) + { + PSP2Init(); + } - if (UnityEngine.Application.platform == RuntimePlatform.PSP2) - { - //PSV 绛夊钩鍙伴渶瑕佹墜鍔ㄥ垱寤虹洰褰 - PSP2Init(); - } - - settings = new AppSettings(); + settings = new AppSettings(); log = new LogManager(); LogManager.OnLog += OnNoSugarNetLog; @@ -66,7 +69,7 @@ namespace AxibugEmuOnline.Client.ClientCore CacheMgr = new CacheManager(); roomMgr = new AppRoom(); share = new AppShare(); - filter = new FilterManager(initer.m_filterVolume, initer.m_filterPreview, initer.m_xmbBg); + filter = new FilterManager(initer.m_filterPreview, initer.m_xmbBg); bTest = isTest; mTestSrvIP = testSrvIP; var go = new GameObject("[AppAxibugEmuOnline]"); @@ -90,9 +93,12 @@ namespace AxibugEmuOnline.Client.ClientCore Directory.CreateDirectory(PersistentDataPath); #if UNITY_PSP2 + //鍒涘缓PSV寮圭獥UI + sonyVitaCommonDialog = new GameObject().AddComponent(); //閲婃斁瑙g爜 FMV鐨26M鍐呭瓨锛屼竴鑸父鎴忕敤涓嶄笂锛圥SP鎵嶇敤閭g牬鐜╂剰鍎匡級 UnityEngine.PSVita.PSVitaVideoPlayer.TransferMemToMonoHeap(); #endif + } private static IEnumerator AppTickFlow() @@ -122,7 +128,7 @@ namespace AxibugEmuOnline.Client.ClientCore yield break; } - AxiHttpProxy.SendWebRequestProxy request = AxiHttpProxy.Get($"{App.httpAPI.WebSiteApi}/CheckStandInfo?platform={platform}&version={Application.version}"); + AxiHttpProxy.SendWebRequestProxy request = AxiHttpProxy.Get($"{App.httpAPI.WebSiteApi}/CheckStandInfo?platform={platform}&version={Application.version}"); yield return request.SendWebRequest; if (!request.downloadHandler.isDone) yield break; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiHttp/AxiHttp.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiHttp/AxiHttp.cs index fa7717c..844cd2b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiHttp/AxiHttp.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiHttp/AxiHttp.cs @@ -14,7 +14,6 @@ using System.Threading; public static class PSVThread { - static Thread psvThread = new Thread(Loop); static AutoResetEvent autoEvent = new AutoResetEvent(false); static Queue qActs = new Queue(); static Queue qWork = new Queue(); @@ -29,6 +28,7 @@ public static class PSVThread } #if UNITY_PSP2 + static Thread psvThread = new Thread(Loop); static bool bSingleInit = false; static void SingleInit() { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs index 7517420..2814d83 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs @@ -9,7 +9,10 @@ /// 鐧诲綍鎴愬姛 /// OnLoginSucceed, - + /// + /// 褰撶櫥褰曡缃负false鏃 + /// + OnLossLoginState, /// /// 鐧诲綍澶辫触 /// @@ -62,11 +65,20 @@ /// /// 鏈嶅姟鍣ㄧ瓑寰匰tep鏇存柊 /// - OnRoomWaitStepChange, - + OnRoomWaitStepChange, + /// /// 褰撴埧闂翠腑鎵嬫焺浣嶄俊鎭彂鐢熶换浣曞彉鍖栨椂瑙﹀彂,杩涘叆鎴块棿鍚庝篃搴旇瑙﹀彂 /// - OnRoomSlotDataChanged, + OnRoomSlotDataChanged, + /// + /// 褰撴墜鏌勮繛鎺ヨ缃彂鐢熷彉鍖栨椂瑙﹀彂 + /// + OnControllerConnectChanged, + /// + /// 褰撴湰鏈烘墜鏌勬复鏈涙彃鍏ユ椂瑙﹀彂 + /// 鍙傛暟: 鏈湴鎵嬫焺搴忓彿[0,3] + /// + OnLocalJoyDesireInvert } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs index 5d97e11..9ec1ef0 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs @@ -1,28 +1,32 @@ -锘縰sing System; +锘縰sing Assets.Script.AppMain.Filter; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; namespace AxibugEmuOnline.Client { - public abstract class FilterEffect : PostProcessEffectSettings + public abstract class FilterEffect { - private List m_editableParamList; - + public BoolParameter Enable = new BoolParameter(false); + public abstract string Name { get; } public IReadOnlyCollection EditableParam => m_editableParamList.AsReadOnly(); - public abstract string Name { get; } + List m_editableParamList; + Material m_material; + + protected abstract string ShaderName { get; } public FilterEffect() { GetEditableFilterParamters(); + m_material = new Material(Shader.Find(ShaderName)); } - protected void GetEditableFilterParamters() + void GetEditableFilterParamters() { var parameters = (from t in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public) - where t.FieldType.IsSubclassOf(typeof(ParameterOverride)) + where t.FieldType.IsSubclassOf(typeof(FilterParameter)) where t.DeclaringType.IsSubclassOf(typeof(FilterEffect)) orderby t.MetadataToken select t); @@ -30,7 +34,7 @@ namespace AxibugEmuOnline.Client m_editableParamList = new List(); foreach (var param in parameters) { - var paramObj = (ParameterOverride)param.GetValue(this); + var paramObj = (FilterParameter)param.GetValue(this); var rangeAtt = param.GetCustomAttribute(); float min = 0; float max = 10; @@ -44,47 +48,41 @@ namespace AxibugEmuOnline.Client } } + public void Render(Texture src, RenderTexture result) + { + m_material.SetTexture("_MainTex", src); + OnRenderer(m_material, src, result); + } + + protected abstract void OnRenderer(Material renderMat, Texture src, RenderTexture result); + public class EditableParamerter { - private ParameterOverride m_paramObject; - private FieldInfo valueFieldInfo; + private FilterParameter m_paramObject; - public Type ValueType { get; private set; } + public Type ValueType => m_paramObject.ValueType; public string Name { get; private set; } public object Value { - get => valueFieldInfo.GetValue(m_paramObject); - set - { - valueFieldInfo.SetValue(m_paramObject, value); - m_paramObject.overrideState = true; - } + get => m_paramObject.Value; + set => m_paramObject.Value = value; } + public object MinValue { get; private set; } public object MaxValue { get; private set; } - public EditableParamerter(string name, ParameterOverride paramObject, object minValue, object maxValue) + public EditableParamerter(string name, FilterParameter paramObject, object minValue, object maxValue) { m_paramObject = paramObject; Name = name; var paramType = paramObject.GetType(); - valueFieldInfo = paramType.GetField("value", BindingFlags.Public | BindingFlags.Instance); - if (valueFieldInfo != null) - { - ValueType = valueFieldInfo.FieldType; - } - else - { - ValueType = typeof(object); - } - MinValue = minValue; MaxValue = maxValue; } - public void ResetToDefault() => m_paramObject.overrideState = false; + public void ResetToDefault() => m_paramObject.Value = null; public void Apply(object overrideValue) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs new file mode 100644 index 0000000..bc28153 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs @@ -0,0 +1,402 @@ +锘縰sing AxibugEmuOnline.Client.ClientCore; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using static AxibugEmuOnline.Client.FilterEffect; + +namespace AxibugEmuOnline.Client +{ + public class FilterManager + { + private List m_filters; + private Dictionary m_filterPlatforms = new Dictionary(); + private AlphaWraper m_previewFilterWraper; + FilterRomSetting m_filterRomSetting; + /// + /// 婊ら暅鍒楄〃 + /// + public IReadOnlyList Filters => m_filters; + + public FilterManager(CanvasGroup filterPreview, CanvasGroup mainBg) + { +#if UNITY_PSP2 + m_filters = new List(); + m_filterRomSetting = new FilterRomSetting(); + m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false); + return; +#endif + + m_filters = new List + { + new Filter(new FixingPixelArtGrille()), + new Filter(new LCDPostEffect()), + new Filter(new MattiasCRT()), + }; + var json = PlayerPrefs.GetString(nameof(FilterRomSetting)); + m_filterRomSetting = JsonUtility.FromJson(json) ?? new FilterRomSetting(); + + m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false); + ShutDownFilterPreview(); + ShutDownFilter(); + } + + private RenderTexture result = null; + public Texture ExecuteFilterRender(Texture src) + { + if (result == null) + { + //result = RenderTexture.GetTemporary(Screen.width, Screen.height); + result = Initer.instance.renderTest; + } + else if (result.width != Screen.width || result.height != Screen.height) + { + //RenderTexture.ReleaseTemporary(result); + //result = RenderTexture.GetTemporary(Screen.width, Screen.height); + result = Initer.instance.renderTest; + } + + + + bool anyFilterEnable = false; + foreach (var filter in Filters) + { + if (!filter.m_setting.Enable.GetValue()) continue; + filter.m_setting.Render(src, result); + anyFilterEnable = true; + } + + if (anyFilterEnable) + return result; + else + return src; + } + + /// 鍏抽棴婊ら暅棰勮 + public void ShutDownFilterPreview() + { + m_previewFilterWraper.On = false; + } + + /// 寮鍚护闀滈瑙 + public void EnableFilterPreview() + { + m_previewFilterWraper.On = true; + } + + /// + /// 鎵撳紑婊ら暅 + /// + /// + public void EnableFilter(Filter filter) + { + foreach (var selfFiler in Filters) + { + if (selfFiler != filter) selfFiler.m_setting.Enable.Override(false); + else selfFiler.m_setting.Enable.Override(true); + } + } + + /// + /// 鍏抽棴婊ら暅鏁堟灉 + /// + public void ShutDownFilter() + { + //鍏抽棴鎵鏈夊悗澶勭悊鏁堟灉 + foreach (var filter in Filters) + filter.m_setting.Enable.Override(false); + } + + /// + /// 涓烘寚瀹歳om璁剧疆婊ら暅浠ュ強婊ら暅鐨勯璁 + /// + /// rom瀵硅薄 + /// 婊ら暅 + /// 婊ら暅棰勮 + public void SetupFilter(RomFile rom, Filter filter, FilterPreset preset) + { + m_filterRomSetting.Setup(rom, filter, preset); + + string json = m_filterRomSetting.ToJson(); + PlayerPrefs.SetString(nameof(FilterRomSetting), json); + } + + /// + /// 鑾峰緱鎸囧畾rom閰嶇疆鐨勬护闀滆缃 + /// + /// rom瀵硅薄 + /// 姝ゅ厓缁勪换鎰忓唴浠绘剰鎴愬憳閮芥湁鍙兘涓虹┖ + public GetFilterSetting_result GetFilterSetting(RomFile rom) + { + var value = m_filterRomSetting.Get(rom); + Filter filter = null; + FilterPreset preset = null; + + //filter = Filters.FirstOrDefault(f => f.Name == value.filterName); + //if (filter != null) + //{ + // string presetName = value.presetName; + // preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); + //} + + filter = Filters.FirstOrDefault(f => f.Name == value.Item1); + if (filter != null) + { + string presetName = value.Item2; + preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); + } + + return new GetFilterSetting_result() + { + filter = filter, + preset = preset + }; + } + + public struct GetFilterSetting_result + { + public Filter filter; + public FilterPreset preset; + } + + public class Filter + { + public string Name => m_setting.Name; + public IReadOnlyCollection Paramerters => m_setting.EditableParam; + /// 婊ら暅棰勮 + public List Presets = new List(); + /// 婊ら暅榛樿棰勮 + public FilterPreset DefaultPreset = new FilterPreset("DEFAULT"); + + internal FilterEffect m_setting; + + public Filter(FilterEffect setting) + { + m_setting = setting; + + loadPresets(); + } + + private void loadPresets() + { + var json = PlayerPrefs.GetString($"Filter_{Name}_PresetList", string.Empty); + var loadedPresets = JsonUtility.FromJson(json); + if (loadedPresets == null) return; + else Presets = loadedPresets.presets; + } + + public void SavePresets() + { + var json = JsonUtility.ToJson(new FilterPresetList(Presets)); + PlayerPrefs.SetString($"Filter_{Name}_PresetList", json); + } + + public MsgBool CreatePreset(string presetName, out FilterPreset newPreset) + { + newPreset = null; + if (string.IsNullOrWhiteSpace(presetName)) return "鍚嶇О涓嶈兘涓虹┖"; + if (Presets.Count(p => p.Name == presetName) != 0) return "鍚嶇О閲嶅"; + + newPreset = new FilterPreset(presetName); + Presets.Add(newPreset); + + SavePresets(); + + return true; + } + + public void RemovePreset(FilterPreset preset) + { + if (!Presets.Remove(preset)) return; + SavePresets(); + + EventInvoker.RaiseFilterPresetRemoved(this, preset); + } + + public void ResetPreset() + { + foreach (var param in Paramerters) + { + param.ResetToDefault(); + } + } + + public void ApplyPreset(FilterPreset preset) + { + foreach (var param in Paramerters) + { + var value = preset.GetParamValue(param.Name, param.ValueType); + if (value == null) + param.ResetToDefault(); + else + param.Apply(value); + } + + } + + + } + + [Serializable] + private class FilterPresetList + { + public List presets; + + public FilterPresetList(List presets) + { + this.presets = presets; + foreach (var preset in presets) + { + preset.ReadyForJson(); + } + } + } + + [Serializable] + public class FilterPreset + { + [SerializeField] + public string Name; + [SerializeField] + private List m_paramName = new List(); + [SerializeField] + private List m_valueJson = new List(); + + private bool m_cacheReady = false; + private Dictionary m_paramName2ValueJson; + public FilterPreset(string presetName) + { + Name = presetName; + } + + public void ReadyForJson() + { + prepareCache(); + + m_paramName = m_paramName2ValueJson.Keys.ToList(); + m_valueJson = m_paramName2ValueJson.Values.ToList(); + } + + public string GetParamValueJson(string paramName) + { + prepareCache(); + string value; + m_paramName2ValueJson.TryGetValue(paramName, out value); + return value; + } + + public object GetParamValue(string paramName, Type valueType) + { + var rawStr = GetParamValueJson(paramName); + if (rawStr == null) return null; + + if (valueType == typeof(float)) + { + float floatVal; + float.TryParse(rawStr, out floatVal); + return floatVal; + } + else if (valueType.IsEnum) + { + var names = Enum.GetNames(valueType); + var values = Enum.GetValues(valueType); + + for (int i = 0; i < names.Length; i++) + { + if (names[i].Equals(rawStr)) + { + return values.GetValue(i); + } + } + return null; + } + else + { + App.log.Error($"灏氭湭鏀寔鐨勬护闀滃弬鏁扮被鍨媨valueType}"); + return null; + } + } + + public void SetParamValue(string paramName, Type valueType, object value) + { + prepareCache(); + m_paramName2ValueJson[paramName] = value.ToString(); + } + + private void prepareCache() + { + if (m_cacheReady) return; + + m_paramName2ValueJson = new Dictionary(); + for (int i = 0; i < m_paramName.Count; i++) + { + m_paramName2ValueJson[m_paramName[i]] = m_valueJson[i]; + } + + m_cacheReady = true; + } + } + + [Serializable] + public class FilterRomSetting + { + [SerializeField] + private List m_romID; + [SerializeField] + private List m_items; + + bool m_cacheReady = false; + Dictionary m_cache; + + public void Setup(RomFile rom, Filter filter, FilterPreset preset) + { + prepareCache(); + + if (filter == null) + m_cache.Remove(rom.ID); + else + m_cache[rom.ID] = new Item { FilterName = filter.Name, PresetName = preset != null ? preset.Name : null }; + } + + public string ToJson() + { + prepareCache(); + m_romID = m_cache.Keys.ToList(); + m_items = m_cache.Values.ToList(); + + return JsonUtility.ToJson(this); + } + + public ValueTuple Get(RomFile rom) + { + prepareCache(); + + Item item; + m_cache.TryGetValue(rom.ID, out item); + return new ValueTuple(item.FilterName, item.PresetName); + } + + private void prepareCache() + { + if (m_cacheReady) return; + + if (m_items == null) m_items = new List(); + if (m_romID == null) m_romID = new List(); + m_cache = new Dictionary(); + for (int i = 0; i < m_romID.Count && i < m_items.Count; i++) + { + m_cache[m_romID[i]] = m_items[i]; + } + + m_cacheReady = true; + } + + [Serializable] + struct Item + { + public string FilterName; + public string PresetName; + } + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs.meta new file mode 100644 index 0000000..dd404c5 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f61dfd2411084ec469cdb3faacca298e \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs new file mode 100644 index 0000000..bd0f51d --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs @@ -0,0 +1,49 @@ +锘縰sing System; +using System.Collections; +using UnityEngine; + +namespace Assets.Script.AppMain.Filter +{ + public abstract class FilterParameter + { + public abstract Type ValueType { get; } + + object m_overrideValue; + protected object m_defaultValue; + public object Value + { + get => m_overrideValue ?? m_defaultValue; + set => m_overrideValue = value; + } + } + + public class FilterParameter : FilterParameter + { + public override Type ValueType => typeof(T); + public void Override(T value) + { + Value = value; + } + public T GetValue() => (T)Value; + + public FilterParameter(T defaultValue) + { + m_defaultValue = defaultValue; + } + } + + public class BoolParameter : FilterParameter + { + public BoolParameter(bool defaultValue) : base(defaultValue) { } + } + + public class Vector2Parameter : FilterParameter + { + public Vector2Parameter(Vector2 defaultValue) : base(defaultValue) { } + } + + public class FloatParameter : FilterParameter + { + public FloatParameter(float defaultValue) : base(defaultValue) { } + } +} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs.meta new file mode 100644 index 0000000..9d5761a --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 53e95955f1beeb34a87d2046875fa16f \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs index 5fb1d04..999267e 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs @@ -1,50 +1,29 @@ -锘縰sing AxibugEmuOnline.Client; +锘縰sing Assets.Script.AppMain.Filter; +using AxibugEmuOnline.Client; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; -[System.Serializable] -[PostProcess(typeof(FixingPixelArtGrilleRenderer), PostProcessEvent.BeforeStack, "Filter/FixingPixelArtGrille")] public sealed class FixingPixelArtGrille : FilterEffect { public override string Name => nameof(FixingPixelArtGrille); - public ParameterOverride MaskStyle = new ParameterOverride { value = EnumMaskStyle.ApertureGrille }; - - [Tooltip("Emulated input resolution\nOptimize for resize")] - public Vector2Parameter DrawResolution = new Vector2Parameter - { - value = new Vector2(272, 240) - }; - - [Tooltip("Hardness of scanline")] + protected override string ShaderName => "PostEffect/FixingPixcelArtGrille"; + public FilterParameter MaskStyle = new FilterParameter(EnumMaskStyle.ApertureGrille); + public Vector2Parameter DrawResolution = new Vector2Parameter(new Vector2(272, 240)); [Range(-32, 0)] - public FloatParameter HardScan = new FloatParameter { value = -10 }; - - [Tooltip("Hardness of pixels in scanline")] + public FloatParameter HardScan = new FloatParameter(-10); [Range(-6, 0)] - public FloatParameter HardPix = new FloatParameter { value = -2 }; - - [Tooltip("Hardness of short vertical bloom")] + public FloatParameter HardPix = new FloatParameter(-2); [Range(-8, 0)] - public FloatParameter HardBloomScan = new FloatParameter { value = -4.0f }; - - [Tooltip("Hardness of short horizontal bloom")] + public FloatParameter HardBloomScan = new FloatParameter(-4.0f); [Range(-4, 0)] - public FloatParameter HardBloomPix = new FloatParameter { value = -1.5f }; - - [Tooltip("Amount of small bloom effect")] + public FloatParameter HardBloomPix = new FloatParameter(-1.5f); [Range(0, 1)] - public FloatParameter BloomAmount = new FloatParameter { value = 1 / 16f }; - - [Tooltip("Display warp")] - public Vector2Parameter Warp = new Vector2Parameter { value = new Vector2(1f / 64f, 1f / 24f) }; - - [Tooltip("Amount of shadow mask Light")] + public FloatParameter BloomAmount = new FloatParameter(1 / 16f); + public Vector2Parameter Warp = new Vector2Parameter(new Vector2(1f / 64f, 1f / 24f)); [Range(1, 3)] - public FloatParameter MaskLight = new FloatParameter { value = 1.5f }; + public FloatParameter MaskLight = new FloatParameter(1.5f); [Range(0.1f, 1)] - [Tooltip("Amount of shadow mask Dark")] - public FloatParameter MaskDrak = new FloatParameter { value = 0.5f }; + public FloatParameter MaskDrak = new FloatParameter(0.5f); public enum EnumMaskStyle { @@ -53,54 +32,41 @@ public sealed class FixingPixelArtGrille : FilterEffect StretchedVGA, VGAStyle } -} -public sealed class FixingPixelArtGrilleRenderer : PostProcessEffectRenderer -{ - private Shader shader; - private Material material; - public override void Init() + protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result) { - shader = Shader.Find("PostEffect/FixingPixcelArtGrille"); - material = new Material(shader); - } + renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0)); + renderMat.SetVector("_res", new Vector4(DrawResolution.GetValue().x, DrawResolution.GetValue().y, 0, 0)); + renderMat.SetFloat("_hardScan", HardScan.GetValue()); + renderMat.SetFloat("_hardPix", HardPix.GetValue()); + renderMat.SetFloat("_hardBloomScan", HardBloomScan.GetValue()); + renderMat.SetFloat("_hardBloomPix", HardBloomPix.GetValue()); + renderMat.SetFloat("_bloomAmount", BloomAmount.GetValue()); + renderMat.SetVector("_warp", Warp.GetValue()); + renderMat.SetFloat("_maskDark", MaskDrak.GetValue()); + renderMat.SetFloat("_maskLight", MaskLight.GetValue()); - public override void Render(PostProcessRenderContext context) - { - material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); - var res = settings.DrawResolution; - material.SetVector("_res", new Vector4(res.value.x, res.value.y, 0, 0)); - material.SetFloat("_hardScan", settings.HardScan.value); - material.SetFloat("_hardPix", settings.HardPix.value); - material.SetFloat("_hardBloomScan", settings.HardBloomScan.value); - material.SetFloat("_hardBloomPix", settings.HardBloomPix.value); - material.SetFloat("_bloomAmount", settings.BloomAmount.value); - material.SetVector("_warp", settings.Warp.value); - material.SetFloat("_maskDark", settings.MaskDrak.value); - material.SetFloat("_maskLight", settings.MaskLight.value); + renderMat.DisableKeyword("_MASKSTYLE_VGASTYLE"); + renderMat.DisableKeyword("_MASKSTYLE_TVSTYLE"); + renderMat.DisableKeyword("_MASKSTYLE_APERTUREGRILLE"); + renderMat.DisableKeyword("_MASKSTYLE_STRETCHEDVGA"); - material.DisableKeyword("_MASKSTYLE_VGASTYLE"); - material.DisableKeyword("_MASKSTYLE_TVSTYLE"); - material.DisableKeyword("_MASKSTYLE_APERTUREGRILLE"); - material.DisableKeyword("_MASKSTYLE_STRETCHEDVGA"); - - switch (settings.MaskStyle.value) + switch (MaskStyle.GetValue()) { - case FixingPixelArtGrille.EnumMaskStyle.VGAStyle: - material.EnableKeyword("_MASKSTYLE_VGASTYLE"); + case EnumMaskStyle.VGAStyle: + renderMat.EnableKeyword("_MASKSTYLE_VGASTYLE"); break; - case FixingPixelArtGrille.EnumMaskStyle.TVStyle: - material.EnableKeyword("_MASKSTYLE_TVSTYLE"); + case EnumMaskStyle.TVStyle: + renderMat.EnableKeyword("_MASKSTYLE_TVSTYLE"); break; - case FixingPixelArtGrille.EnumMaskStyle.ApertureGrille: - material.EnableKeyword("_MASKSTYLE_APERTUREGRILLE"); + case EnumMaskStyle.ApertureGrille: + renderMat.EnableKeyword("_MASKSTYLE_APERTUREGRILLE"); break; - case FixingPixelArtGrille.EnumMaskStyle.StretchedVGA: - material.EnableKeyword("_MASKSTYLE_STRETCHEDVGA"); + case EnumMaskStyle.StretchedVGA: + renderMat.EnableKeyword("_MASKSTYLE_STRETCHEDVGA"); break; } - - context.command.Blit(context.source, context.destination, material); + Graphics.Blit(src, result, renderMat); } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset deleted file mode 100644 index fb1eeac..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset +++ /dev/null @@ -1,96 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &-2985742813244632235 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 98a055cea8a1355429d1cbb752c4e60e, type: 3} - m_Name: MattiasCRT - m_EditorClassIdentifier: - active: 1 - enabled: - overrideState: 1 - value: 1 ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8e6292b2c06870d4495f009f912b9600, type: 3} - m_Name: GameCamera Profile - m_EditorClassIdentifier: - settings: - - {fileID: 117625959343581733} - - {fileID: -2985742813244632235} - - {fileID: 2118329037781486242} ---- !u!114 &117625959343581733 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e88ab71ab1a47d048ba0e45b742f6140, type: 3} - m_Name: FixingPixelArtGrille - m_EditorClassIdentifier: - active: 1 - enabled: - overrideState: 1 - value: 1 - MaskStyle: - overrideState: 0 - value: 1 - DrawResolution: - overrideState: 0 - value: {x: 272, y: 240} - HardScan: - overrideState: 0 - value: -10 - HardPix: - overrideState: 0 - value: -2 - HardBloomScan: - overrideState: 0 - value: -4 - HardBloomPix: - overrideState: 0 - value: -1.5 - BloomAmount: - overrideState: 0 - value: 0.0625 - Warp: - overrideState: 0 - value: {x: 0.015625, y: 0.041666668} - MaskLight: - overrideState: 0 - value: 1.5 - MaskDrak: - overrideState: 0 - value: 0.5 ---- !u!114 &2118329037781486242 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2a0a5286ac74b734ba8d1e0cfdfb9c8d, type: 3} - m_Name: LCDPostEffect - m_EditorClassIdentifier: - active: 1 - enabled: - overrideState: 1 - value: 1 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset.meta deleted file mode 100644 index 5376e6d..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 17060e2d2f9e5c340a526f08317e5a98 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs index db3d4f5..f8ccca3 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs @@ -1,28 +1,15 @@ 锘縰sing AxibugEmuOnline.Client; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; -[System.Serializable] -[PostProcess(typeof(LCDPostEffectRenderer), PostProcessEvent.BeforeStack, "Filter/LCDPostEffect")] public sealed class LCDPostEffect : FilterEffect { public override string Name => nameof(LCDPostEffect); + + protected override string ShaderName => "Filter/LCDPostEffect"; + + protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result) + { + renderMat.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); + Graphics.Blit(src, result, renderMat); + } } - -public sealed class LCDPostEffectRenderer : PostProcessEffectRenderer -{ - private Shader shader; - private Material material; - - public override void Init() - { - shader = Shader.Find("Filter/LCDPostEffect"); - material = new Material(shader); - } - - public override void Render(PostProcessRenderContext context) - { - material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); - context.command.Blit(context.source, context.destination, material); - } -} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs index b398e58..6e6c79d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs @@ -1,28 +1,15 @@ -using AxibugEmuOnline.Client; +锘縰sing AxibugEmuOnline.Client; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; -[System.Serializable] -[PostProcess(typeof(MattiasCRTRenderer), PostProcessEvent.BeforeStack, "Filter/MattiasCRT")] public sealed class MattiasCRT : FilterEffect { public override string Name => nameof(MattiasCRT); -} -public sealed class MattiasCRTRenderer : PostProcessEffectRenderer -{ - private Shader shader; - private Material material; + protected override string ShaderName => "Filter/MattiasCRT"; - public override void Init() + protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result) { - shader = Shader.Find("Filter/MattiasCRT"); - material = new Material(shader); - } - - public override void Render(PostProcessRenderContext context) - { - material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); - context.command.Blit(context.source, context.destination, material); + renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0)); + Graphics.Blit(src, result, renderMat); } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs new file mode 100644 index 0000000..8ba8837 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs @@ -0,0 +1,21 @@ +锘縰sing AxibugEmuOnline.Client.ClientCore; +using UnityEngine; +using UnityEngine.UI; + +[RequireComponent(typeof(RawImage))] +public class UIFilterPreviewer : MonoBehaviour +{ + private RawImage m_rawImg; + private Texture m_src; + + private void Awake() + { + m_rawImg = GetComponent(); + m_src = m_rawImg.texture; + } + + private void Update() + { + m_rawImg.texture = App.filter.ExecuteFilterRender(m_src); + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs.meta new file mode 100644 index 0000000..8e6b7bd --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a0987fcca76655248ac8defaffd1cb45 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs index 4a97765..8dc89d0 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs @@ -1,4 +1,4 @@ -using UnityEngine; +锘縰sing UnityEngine; namespace AxibugEmuOnline.Client { @@ -14,7 +14,9 @@ namespace AxibugEmuOnline.Client void Resume(); void SetupScheme(); void StartGame(RomFile romFile); - void DoReset(); + void DoReset(); + IControllerSetuper GetControllerSetuper(); + EnumPlatform Platform { get; } uint Frame { get; } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs index 56c3eaa..0a1eafc 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs @@ -1,12 +1,10 @@ using AxibugEmuOnline.Client.ClientCore; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; namespace AxibugEmuOnline.Client { public class Initer : MonoBehaviour { - public PostProcessVolume m_filterVolume; public CanvasGroup m_filterPreview; public CanvasGroup m_xmbBg; public static string dev_UUID; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs index 8000a1f..d2be7b5 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs @@ -13,7 +13,7 @@ namespace AxibugEmuOnline.Client.Manager /// private IEmuCore m_emuCore; - private VirtualNes.Core.IControllerSetuper m_controllerSetuper; + private IControllerSetuper m_controllerSetuper; /// /// unity鐨刢#瀹炵幇鏈塨ug,浠ユ帴鍙g被鍨嬩繚瀛樼殑monobehaviour寮曠敤,!=鍜==杩愮畻绗︽病鏈夎皟鐢ㄥ埌monobehaviour閲嶅啓杩囩殑杩愮畻绗 @@ -63,39 +63,31 @@ namespace AxibugEmuOnline.Client.Manager m_emuCore.SetupScheme(); - m_controllerSetuper = Supporter.GetControllerSetuper(); - - SetupController(); + m_controllerSetuper = m_emuCore.GetControllerSetuper(); + + //鑷姩鍒嗛厤0鍙锋墜鏌勫埌0鍙锋墜鏌勪綅 + m_controllerSetuper.SetConnect(con0ToSlot: 0); + Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged); Eventer.Instance.RegisterEvent(EEvent.OnRoomSlotDataChanged, OnSlotDataChanged); } private void OnSlotDataChanged() { - SetupController(); - } + long selfUID = App.user.userdata.UID; + uint? con0Slot; + uint? con1Slot; + uint? con2Slot; + uint? con3Slot; + + App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 0, out con0Slot); + App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 1, out con1Slot); + App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 2, out con2Slot); + App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 3, out con3Slot); + + m_controllerSetuper.SetConnect(con0Slot, con1Slot, con2Slot, con3Slot); - private void SetupController() - { - if (!App.roomMgr.InRoom) //涓嶅湪鎴块棿涓,鑷姩鍒嗛厤0鍙锋墜鏌勫埌0鍙锋墜鏌勪綅 - { - m_controllerSetuper.SetConnect(con0ToSlot: 0); - } - else //鍦ㄦ埧闂翠腑鍒欎娇鐢ㄦ湇鍔″櫒涓嬪彂鐨勬墜鏌勬Ы浣嶄俊鎭垎閰嶆湰鍦版墜鏌 - { - long selfUID = App.user.userdata.UID; - uint? con0Slot; - uint? con1Slot; - uint? con2Slot; - uint? con3Slot; - - App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 0, out con0Slot); - App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 1, out con1Slot); - App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 2, out con2Slot); - App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 3, out con3Slot); - - m_controllerSetuper.SetConnect(con0Slot, con1Slot, con2Slot, con3Slot); - } + Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged); } public void StopGame() diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs index c8033d7..2331c34 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs @@ -14,7 +14,7 @@ namespace AxibugEmuOnline.Client.Manager public class AppRoom { public Protobuf_Room_MiniInfo mineRoomMiniInfo { get; private set; } = null; - public bool InRoom => mineRoomMiniInfo != null; + public bool InRoom => App.user.IsLoggedIn && mineRoomMiniInfo != null; public bool IsHost => mineRoomMiniInfo?.HostPlayerUID == App.user.userdata.UID; public bool IsScreenProviderUID => mineRoomMiniInfo?.ScreenProviderUID == App.user.userdata.UID; public RoomGameState RoomState => mineRoomMiniInfo.GameState; @@ -35,6 +35,7 @@ namespace AxibugEmuOnline.Client.Manager Protobuf_Room_Create _Protobuf_Room_Create = new Protobuf_Room_Create(); Protobuf_Room_Join _Protobuf_Room_Join = new Protobuf_Room_Join(); Protobuf_Room_Leave _Protobuf_Room_Leave = new Protobuf_Room_Leave(); + Protobuf_Room_Change_PlaySlotWithJoy _Protobuf_Room_Change_PlaySlotWithJoy = new Protobuf_Room_Change_PlaySlotWithJoy(); Protobuf_Room_Player_Ready _Protobuf_Room_Player_Ready = new Protobuf_Room_Player_Ready(); Protobuf_Room_SinglePlayerInputData _Protobuf_Room_SinglePlayerInputData = new Protobuf_Room_SinglePlayerInputData(); Protobuf_Screnn_Frame _Protobuf_Screnn_Frame = new Protobuf_Screnn_Frame(); @@ -298,6 +299,12 @@ namespace AxibugEmuOnline.Client.Manager void RecvRoomMyRoomStateChange(byte[] reqData) { + if (mineRoomMiniInfo == null) + { + App.log.Error("RecvRoomMyRoomStateChange 鏃 mineRoomMiniInfo 涓虹┖"); + return; + } + Protobuf_Room_MyRoom_State_Change msg = ProtoBufHelper.DeSerizlize(reqData); long[] oldRoomPlayer = GetRoom4PlayerUIDs(); Protobuf_Room_GamePlaySlot[] oldslotArr = GetRoom4GameSlotMiniInfos(); @@ -399,8 +406,52 @@ namespace AxibugEmuOnline.Client.Manager // OverlayManager.PopTip($"[{PlayerName}]杩涘叆鎴块棿,鎵嬫焺浣:P{i}"); // } //} + } + + /// + /// 鍙戦佷慨鏀圭帺瀹舵Ы浣,浣嗘槸澧為噺 + /// + /// 鐜╁鍗犵敤鎴块棿GamePlaySlot鍜孡ocalJoyIdx瀛楀吀 + public void SendChangePlaySlotIdxWithJoyIdx(uint localJoyIndex, uint slotIndex) + { + if (!App.roomMgr.InRoom) return; + + Dictionary temp = new Dictionary(); + for (int i = 0; i < App.roomMgr.mineRoomMiniInfo.GamePlaySlotList.Count; i++) + { + var item = App.roomMgr.mineRoomMiniInfo.GamePlaySlotList[i]; + + if (item.PlayerUID <= 0) continue; + if (item.PlayerUID != App.user.userdata.UID) return; + temp[(uint)i] = (uint)item.PlayerLocalJoyIdx; + } + temp[slotIndex] = localJoyIndex; + + SendChangePlaySlotIdxWithJoyIdx(temp); } + /// + /// 鍙戦佷慨鏀圭帺瀹舵Ы浣,鍏ㄩ噺 + /// + /// 鐜╁鍗犵敤鎴块棿GamePlaySlot鍜孡ocalJoyIdx瀛楀吀 + public void SendChangePlaySlotIdxWithJoyIdx(Dictionary dictSlotIdx2LocalJoyIdx) + { + if (!InRoom) + return; + _Protobuf_Room_Change_PlaySlotWithJoy.SlotWithJoy.Clear(); + + foreach (var slotdata in dictSlotIdx2LocalJoyIdx) + { + _Protobuf_Room_Change_PlaySlotWithJoy.SlotWithJoy.Add(new Protobuf_PlaySlotIdxWithJoyIdx() + { + PlayerSlotIdx = (int)slotdata.Key, + PlayerLocalJoyIdx = (int)slotdata.Value, + }); + } + + App.log.Info($"SendChangePlaySlotIdxWithJoyIdx"); + App.network.SendToServer((int)CommandID.CmdRoomChangePlayerWithJoy, ProtoBufHelper.Serizlize(_Protobuf_Room_Change_PlaySlotWithJoy)); + } /// /// 涓婃姤鍗虫椂瀛樻。 /// @@ -512,16 +563,15 @@ namespace AxibugEmuOnline.Client.Manager /// /// /// - public static bool GetFreeSlot(this Protobuf_Room_MiniInfo roomMiniInfo, out int[] freeSlots) + public static bool GetFreeSlot(this Protobuf_Room_MiniInfo roomMiniInfo, ref List freeSlots) { - List temp = new List(); + freeSlots.Clear(); for (int i = 0; i < roomMiniInfo.GamePlaySlotList.Count; i++) { if (roomMiniInfo.GamePlaySlotList[i].PlayerUID <= 0) - temp.Add(i); + freeSlots.Add(i); } - freeSlots = temp.ToArray(); - return freeSlots.Length > 0; + return freeSlots.Count > 0; } /// @@ -530,15 +580,10 @@ namespace AxibugEmuOnline.Client.Manager public static bool GetPlayerSlotIdxByUid(this Protobuf_Room_MiniInfo roomMiniInfo, long uid, int joyIdx, out uint? slotIdx) { slotIdx = null; - //joyIdx鍙栧艰繑鍥瀃0,3],杩欎釜搴忓彿浠h〃鐜╁鏈湴鐨勬墜鏌勭紪鍙 - //todo : 鏍规嵁uid鍜宑ontrollerIndex 杩斿洖鍗犵敤鐨勪綅缃 - - //鐩墠鏈疄鐜,鎵鏈夐潪0鍙蜂綅缃殑鎵嬫焺,閮借繑鍥瀎alse - for (int i = 0; i < roomMiniInfo.GamePlaySlotList.Count; i++) { - if (roomMiniInfo.GamePlaySlotList[i].PlayerUID == uid) + if (roomMiniInfo.GamePlaySlotList[i].PlayerUID == uid && roomMiniInfo.GamePlaySlotList[i].PlayerLocalJoyIdx == joyIdx) { slotIdx = (uint)i; return true; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/ControllerInterface.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/ControllerInterface.cs new file mode 100644 index 0000000..e5958eb --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/ControllerInterface.cs @@ -0,0 +1,39 @@ +锘/// +/// 璐熻矗绠$悊鏈湴鎺у埗鍣ㄤ笌鍏蜂綋娓告垙涔嬮棿鐨勬Ы浣嶅垎閰 +/// +public interface IControllerSetuper +{ + /// + /// 璁剧疆鏈湴鎵嬫焺涓庢父鎴忔墜鏌勬Ы浣嶇殑鏄犲皠,杩欎釜鏂规硶鏄竴涓叏閲忔洿鏂版墜鏌勬彃鍏ヨ缃殑鏂规硶 + /// + void SetConnect( + uint? con0ToSlot = null, + uint? con1ToSlot = null, + uint? con2ToSlot = null, + uint? con3ToSlot = null); + + /// + /// 鎸囧畾鎵嬫焺鎻掓Ы浣,鑾峰彇褰撳墠妲戒綅杩炴帴鐨勬湰鍦版墜鏌勫簭鍙 + /// + /// + /// + int? GetSlotConnectingControllerIndex(int slotIndex); + IController GetSlotConnectingController(int slotIndex); + + /// + /// 鑾峰緱涓涓┖鐨勬Ы浣 + /// + /// + uint? GetFreeSlotIndex(); + + /// + /// 澧為噺寮忕殑淇敼涓涓墜鏌勫拰涓涓Ы浣嶇殑杩炴帴鍏崇郴 + /// + /// + /// + void LetControllerConnect(int conIndex, uint slotIndex); +} +public interface IController +{ + bool AnyButtonDown(); +} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/ControllerInterface.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/ControllerInterface.cs.meta new file mode 100644 index 0000000..511a806 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/ControllerInterface.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f567cb126b157854e9f9b2c71f8cda8e \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs deleted file mode 100644 index d38e10b..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs +++ /dev/null @@ -1,364 +0,0 @@ -锘縰sing AxibugEmuOnline.Client.ClientCore; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using UnityEngine.Rendering.PostProcessing; -using static AxibugEmuOnline.Client.FilterEffect; - -namespace AxibugEmuOnline.Client -{ - public class FilterManager - { - private PostProcessProfile m_filterPorfile; - private List m_filters; - private Dictionary m_filterPlatforms = new Dictionary(); - private AlphaWraper m_previewFilterWraper; - FilterRomSetting m_filterRomSetting; - /// - /// 婊ら暅鍒楄〃 - /// - public IReadOnlyList Filters => m_filters; - - public FilterManager(PostProcessVolume filterVolume, CanvasGroup filterPreview, CanvasGroup mainBg) - { - if (filterVolume == null) - return; - m_filterPorfile = filterVolume.profile; - m_filters = m_filterPorfile.settings.Where(setting => setting is FilterEffect).Select(setting => new Filter(setting as FilterEffect)).ToList(); - var json = PlayerPrefs.GetString(nameof(FilterRomSetting)); - m_filterRomSetting = JsonUtility.FromJson(json) ?? new FilterRomSetting(); - - m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false); - ShutDownFilterPreview(); - ShutDownFilter(); - } - - /// 鍏抽棴婊ら暅棰勮 - public void ShutDownFilterPreview() - { - m_previewFilterWraper.On = false; - } - - /// 寮鍚护闀滈瑙 - public void EnableFilterPreview() - { - m_previewFilterWraper.On = true; - } - - /// - /// 鎵撳紑婊ら暅 - /// - /// - public void EnableFilter(Filter filter) - { - foreach (var selfFiler in Filters) - { - if (selfFiler != filter) selfFiler.m_setting.enabled.Override(false); - else selfFiler.m_setting.enabled.Override(true); - } - } - - /// - /// 鍏抽棴婊ら暅鏁堟灉 - /// - public void ShutDownFilter() - { - //鍏抽棴鎵鏈夊悗澶勭悊鏁堟灉 - foreach (var setting in m_filterPorfile.settings) - setting.enabled.Override(false); - } - - /// - /// 涓烘寚瀹歳om璁剧疆婊ら暅浠ュ強婊ら暅鐨勯璁 - /// - /// rom瀵硅薄 - /// 婊ら暅 - /// 婊ら暅棰勮 - public void SetupFilter(RomFile rom, Filter filter, FilterPreset preset) - { - m_filterRomSetting.Setup(rom, filter, preset); - - string json = m_filterRomSetting.ToJson(); - PlayerPrefs.SetString(nameof(FilterRomSetting), json); - } - - /// - /// 鑾峰緱鎸囧畾rom閰嶇疆鐨勬护闀滆缃 - /// - /// rom瀵硅薄 - /// 姝ゅ厓缁勪换鎰忓唴浠绘剰鎴愬憳閮芥湁鍙兘涓虹┖ - public GetFilterSetting_result GetFilterSetting(RomFile rom) - { - var value = m_filterRomSetting.Get(rom); - Filter filter = null; - FilterPreset preset = null; - - //filter = Filters.FirstOrDefault(f => f.Name == value.filterName); - //if (filter != null) - //{ - // string presetName = value.presetName; - // preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); - //} - - filter = Filters.FirstOrDefault(f => f.Name == value.Item1); - if (filter != null) - { - string presetName = value.Item2; - preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); - } - - return new GetFilterSetting_result() - { - filter = filter, - preset = preset - }; - } - - public struct GetFilterSetting_result - { - public Filter filter; - public FilterPreset preset; - } - - public class Filter - { - public string Name => m_setting.Name; - public IReadOnlyCollection Paramerters => m_setting.EditableParam; - /// 婊ら暅棰勮 - public List Presets = new List(); - /// 婊ら暅榛樿棰勮 - public FilterPreset DefaultPreset = new FilterPreset("DEFAULT"); - - internal FilterEffect m_setting; - - public Filter(FilterEffect setting) - { - m_setting = setting; - - loadPresets(); - } - - private void loadPresets() - { - var json = PlayerPrefs.GetString($"Filter_{Name}_PresetList", string.Empty); - var loadedPresets = JsonUtility.FromJson(json); - if (loadedPresets == null) return; - else Presets = loadedPresets.presets; - } - - public void SavePresets() - { - var json = JsonUtility.ToJson(new FilterPresetList(Presets)); - PlayerPrefs.SetString($"Filter_{Name}_PresetList", json); - } - - public MsgBool CreatePreset(string presetName, out FilterPreset newPreset) - { - newPreset = null; - if (string.IsNullOrWhiteSpace(presetName)) return "鍚嶇О涓嶈兘涓虹┖"; - if (Presets.Count(p => p.Name == presetName) != 0) return "鍚嶇О閲嶅"; - - newPreset = new FilterPreset(presetName); - Presets.Add(newPreset); - - SavePresets(); - - return true; - } - - public void RemovePreset(FilterPreset preset) - { - if (!Presets.Remove(preset)) return; - SavePresets(); - - EventInvoker.RaiseFilterPresetRemoved(this, preset); - } - - public void ResetPreset() - { - foreach (var param in Paramerters) - { - param.ResetToDefault(); - } - } - - public void ApplyPreset(FilterPreset preset) - { - foreach (var param in Paramerters) - { - var value = preset.GetParamValue(param.Name, param.ValueType); - if (value == null) - param.ResetToDefault(); - else - param.Apply(value); - } - - } - - - } - - [Serializable] - private class FilterPresetList - { - public List presets; - - public FilterPresetList(List presets) - { - this.presets = presets; - foreach (var preset in presets) - { - preset.ReadyForJson(); - } - } - } - - [Serializable] - public class FilterPreset - { - [SerializeField] - public string Name; - [SerializeField] - private List m_paramName = new List(); - [SerializeField] - private List m_valueJson = new List(); - - private bool m_cacheReady = false; - private Dictionary m_paramName2ValueJson; - public FilterPreset(string presetName) - { - Name = presetName; - } - - public void ReadyForJson() - { - prepareCache(); - - m_paramName = m_paramName2ValueJson.Keys.ToList(); - m_valueJson = m_paramName2ValueJson.Values.ToList(); - } - - public string GetParamValueJson(string paramName) - { - prepareCache(); - string value; - m_paramName2ValueJson.TryGetValue(paramName, out value); - return value; - } - - public object GetParamValue(string paramName, Type valueType) - { - var rawStr = GetParamValueJson(paramName); - if (rawStr == null) return null; - - if (valueType == typeof(float)) - { - float floatVal; - float.TryParse(rawStr, out floatVal); - return floatVal; - } - else if (valueType.IsEnum) - { - var names = Enum.GetNames(valueType); - var values = Enum.GetValues(valueType); - - for (int i = 0; i < names.Length; i++) - { - if (names[i].Equals(rawStr)) - { - return values.GetValue(i); - } - } - return null; - } - else - { - App.log.Error($"灏氭湭鏀寔鐨勬护闀滃弬鏁扮被鍨媨valueType}"); - return null; - } - } - - public void SetParamValue(string paramName, Type valueType, object value) - { - prepareCache(); - m_paramName2ValueJson[paramName] = value.ToString(); - } - - private void prepareCache() - { - if (m_cacheReady) return; - - m_paramName2ValueJson = new Dictionary(); - for (int i = 0; i < m_paramName.Count; i++) - { - m_paramName2ValueJson[m_paramName[i]] = m_valueJson[i]; - } - - m_cacheReady = true; - } - } - - [Serializable] - public class FilterRomSetting - { - [SerializeField] - private List m_romID; - [SerializeField] - private List m_items; - - bool m_cacheReady = false; - Dictionary m_cache; - - public void Setup(RomFile rom, Filter filter, FilterPreset preset) - { - prepareCache(); - - if (filter == null) - m_cache.Remove(rom.ID); - else - m_cache[rom.ID] = new Item { FilterName = filter.Name, PresetName = preset != null ? preset.Name : null }; - } - - public string ToJson() - { - prepareCache(); - m_romID = m_cache.Keys.ToList(); - m_items = m_cache.Values.ToList(); - - return JsonUtility.ToJson(this); - } - - public ValueTuple Get(RomFile rom) - { - prepareCache(); - - Item item; - m_cache.TryGetValue(rom.ID, out item); - return new ValueTuple(item.FilterName, item.PresetName); - } - - private void prepareCache() - { - if (m_cacheReady) return; - - if (m_items == null) m_items = new List(); - if (m_romID == null) m_romID = new List(); - m_cache = new Dictionary(); - for (int i = 0; i < m_romID.Count && i < m_items.Count; i++) - { - m_cache[m_romID[i]] = m_items[i]; - } - - m_cacheReady = true; - } - - [Serializable] - struct Item - { - public string FilterName; - public string PresetName; - } - } - } -} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/HttpAPI.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/HttpAPI.cs index d59566a..a0b35c0 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/HttpAPI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/HttpAPI.cs @@ -2,6 +2,7 @@ using AxibugEmuOnline.Client.ClientCore; using System; using System.Collections; using System.Collections.Generic; +using System.Text; using UnityEngine; using UnityEngine.Networking; @@ -14,7 +15,27 @@ namespace AxibugEmuOnline.Client public delegate void GetRomListAPI(Action callback, int page, int pageSize = 10); public delegate void SearchRomListAPI(Action callback, string searchKey, int page, int pageSize = 10); + public static string UrlEncode(string str) + { + StringBuilder sb = new StringBuilder(); + foreach (char c in str) + { + if ((c >= '0' && c <= '9') || + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + c == '-' || c == '_' || c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || c == ')') + { + sb.Append(c); + } + else + { + sb.Append('%').Append(((int)c).ToString("X2")); + } + } + + return sb.ToString(); + } public void GetNesRomList(Action callback, int page, int pageSize = 10) { App.StartCoroutine(GetNesRomListFlow(page, pageSize, callback)); @@ -26,6 +47,13 @@ namespace AxibugEmuOnline.Client } private IEnumerator SearchNesRomListFlow(string searchKey, int page, int pageSize, Action callback) { + //閬垮厤鐗规畩瀛楃鍜屼釜鍒枃瀛楃紪鐮侀棶棰 + byte[] gb2312Bytes = Encoding.Default.GetBytes(searchKey); + byte[] utf8Bytes = Encoding.Convert(Encoding.Default, Encoding.UTF8, gb2312Bytes); + // 灏哢TF-8缂栫爜鐨勫瓧鑺傛暟缁勮浆鎹㈠洖瀛楃涓诧紙姝ゆ椂鏄疷TF-8缂栫爜鐨勫瓧绗︿覆锛 + string utf8String = Encoding.UTF8.GetString(utf8Bytes); + searchKey = UrlEncode(utf8String); + App.log.Info($"search->{utf8String} ->{searchKey}"); AxiHttpProxy.SendWebRequestProxy request = AxiHttpProxy.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}"); yield return request.SendWebRequest; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/CoreSupporter.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/CoreSupporter.cs index e5db677..ad32677 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/CoreSupporter.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/CoreSupporter.cs @@ -1,4 +1,4 @@ -using AxibugEmuOnline.Client.ClientCore; +锘縰sing AxibugEmuOnline.Client.ClientCore; using AxiReplay; using System; using System.IO; @@ -10,6 +10,12 @@ namespace AxibugEmuOnline.Client { public class CoreSupporter : ISupporterImpl { + private NesControllerMapper m_controllerMapper; + public CoreSupporter(NesControllerMapper conMapper) + { + m_controllerMapper = conMapper; + } + public Stream OpenRom(string fname) { try @@ -57,7 +63,6 @@ namespace AxibugEmuOnline.Client } public EmulatorConfig Config { get; private set; } = new EmulatorConfig(); - public NesControllerMapper ControllerMapper { get; private set; } = new NesControllerMapper(); public void PrepareDirectory(string directPath) { Directory.CreateDirectory($"{App.PersistentDataPath}/{directPath}"); @@ -116,7 +121,7 @@ namespace AxibugEmuOnline.Client } else m_sampledState = default(ControllerState); - var localState = ControllerMapper.CreateState(); + var localState = m_controllerMapper.CreateState(); var rawData = ToNet(localState); if (LastTestInput != rawData) { @@ -127,15 +132,10 @@ namespace AxibugEmuOnline.Client } else { - m_sampledState = ControllerMapper.CreateState(); + m_sampledState = m_controllerMapper.CreateState(); } } - public IControllerSetuper GetControllerSetuper() - { - return ControllerMapper; - } - public ControllerState FromNet(AxiReplay.ReplayStep step) { var temp = new ServerInputSnapShot(); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs index f60b903..ec7024c 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs @@ -1,4 +1,9 @@ -锘縰sing UnityEngine; +锘縰sing AxibugEmuOnline.Client.ClientCore; +using AxibugEmuOnline.Client.Common; +using AxibugEmuOnline.Client.Event; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; using VirtualNes.Core; namespace AxibugEmuOnline.Client @@ -17,18 +22,103 @@ namespace AxibugEmuOnline.Client m_states[0] = m_states[1] = m_states[2] = m_states[3] = 0; if (Controller0.ConnectSlot.HasValue) m_states[Controller0.ConnectSlot.Value] = Controller0.GetButtons(); + else if (Controller0.AnyButtonDown()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 0); + if (Controller1.ConnectSlot.HasValue) m_states[Controller1.ConnectSlot.Value] = Controller1.GetButtons(); + else if (Controller1.AnyButtonDown()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 1); + if (Controller2.ConnectSlot.HasValue) m_states[Controller2.ConnectSlot.Value] = Controller2.GetButtons(); + else if (Controller2.AnyButtonDown()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 2); + if (Controller3.ConnectSlot.HasValue) m_states[Controller3.ConnectSlot.Value] = Controller3.GetButtons(); + else if (Controller3.AnyButtonDown()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 3); var result = new ControllerState(m_states); return result; } + public void SetConnect(uint? con0ToSlot = null, + uint? con1ToSlot = null, + uint? con2ToSlot = null, + uint? con3ToSlot = null) + { + Controller0.ConnectSlot = con0ToSlot; + Controller1.ConnectSlot = con1ToSlot; + Controller2.ConnectSlot = con2ToSlot; + Controller3.ConnectSlot = con3ToSlot; + } + + public int? GetSlotConnectingControllerIndex(int slotIndex) + { + if (Controller0.ConnectSlot.HasValue && Controller0.ConnectSlot.Value == slotIndex) return 0; + else if (Controller1.ConnectSlot.HasValue && Controller1.ConnectSlot.Value == slotIndex) return 1; + else if (Controller2.ConnectSlot.HasValue && Controller2.ConnectSlot.Value == slotIndex) return 2; + else if (Controller3.ConnectSlot.HasValue && Controller3.ConnectSlot.Value == slotIndex) return 3; + else return null; + } + + public IController GetSlotConnectingController(int slotIndex) + { + if (Controller0.ConnectSlot.HasValue && Controller0.ConnectSlot.Value == slotIndex) return Controller0; + else if (Controller1.ConnectSlot.HasValue && Controller1.ConnectSlot.Value == slotIndex) return Controller1; + else if (Controller2.ConnectSlot.HasValue && Controller2.ConnectSlot.Value == slotIndex) return Controller2; + else if (Controller3.ConnectSlot.HasValue && Controller3.ConnectSlot.Value == slotIndex) return Controller3; + else return null; + } + + //static HashSet s_temp = new HashSet(4); + //浣庣増鏈笉鑳借繖鏍峰垵濮嬪寲 + static HashSet s_temp = new HashSet(); + public uint? GetFreeSlotIndex() + { + s_temp.Clear(); + s_temp.Add(0); + s_temp.Add(1); + s_temp.Add(2); + s_temp.Add(3); + + if (Controller0.ConnectSlot.HasValue) s_temp.Remove(Controller0.ConnectSlot.Value); + if (Controller1.ConnectSlot.HasValue) s_temp.Remove(Controller1.ConnectSlot.Value); + if (Controller2.ConnectSlot.HasValue) s_temp.Remove(Controller2.ConnectSlot.Value); + if (Controller3.ConnectSlot.HasValue) s_temp.Remove(Controller3.ConnectSlot.Value); + + if (s_temp.Count > 0) return s_temp.First(); + else return null; + } + + public void LetControllerConnect(int conIndex, uint slotIndex) + { + Controller targetController; + switch (conIndex) + { + case 0: targetController = Controller0;break; + case 1: targetController = Controller1; break; + case 2: targetController = Controller2; break; + case 3: targetController = Controller3; break; + default: + throw new System.Exception($"Not Allowed conIndex Range: {conIndex}"); + break; + } + //var targetController = conIndex switch + //{ + // 0 => Controller0, + // 1 => Controller1, + // 2 => Controller2, + // 3 => Controller3, + // _ => throw new System.Exception($"Not Allowed conIndex Range: {conIndex}") + //}; + + if (targetController.ConnectSlot.HasValue) return; + + targetController.ConnectSlot = slotIndex; + + Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged); + } + /// /// Nes鎺у埗鍣 /// - public class Controller + public class Controller : IController { /// /// 鎺у埗鍣ㄧ紪鍙 @@ -85,9 +175,30 @@ namespace AxibugEmuOnline.Client return res; } + public bool AnyButtonDown() + { + return + UP.IsDown || + DOWN.IsDown || + LEFT.IsDown || + RIGHT.IsDown || + A.IsDown || + B.IsDown || + SELECT.IsDown || + START.IsDown || + MIC.IsDown; + } + public static KeyListener GetKey(int controllerInput, EnumButtonType nesConBtnType) { - string configKey = $"NES_{controllerInput}_{nesConBtnType}"; + string configKey = $"NES_{controllerInput}_{nesConBtnType}"; + + //PSV骞冲彴鍥哄畾閿 + if (UnityEngine.Application.platform == RuntimePlatform.PSP2) + { + return KeyListener.GetPSVitaKey(controllerInput, nesConBtnType); + } + if (PlayerPrefs.HasKey(configKey)) { return new KeyListener(PlayerPrefs.GetString(configKey)); @@ -115,6 +226,11 @@ namespace AxibugEmuOnline.Client /// 鎸夐敭鐩戝惉鍣 KeyListener m_keyListener; + /// 鎸囩ず鎸夐挳鏄惁姝e湪鎸変笅鐘舵 + public bool IsPressing => m_keyListener.IsPressing(); + /// 鎸囩ず鎸夐挳鏄惁琚寜涓 + public bool IsDown => m_keyListener.IsDown(); + public Button(Controller controller, EnumButtonType buttonType) { m_hostController = controller; @@ -129,18 +245,18 @@ namespace AxibugEmuOnline.Client /// public EnumButtonType SampleKey() { - return m_keyListener.IsPressing() ? m_buttonType : 0; + return IsPressing ? m_buttonType : 0; } private void CreateListener() { m_keyListener = Controller.GetKey(m_hostController.ControllerIndex, m_buttonType); } - } - //low C# readonly - //public readonly struct KeyListener - - public struct KeyListener + } + //low C# readonly + //public readonly struct KeyListener + + public struct KeyListener { private readonly KeyCode m_key; @@ -154,8 +270,8 @@ namespace AxibugEmuOnline.Client { m_key = KeyCode.None; - int result; - if (int.TryParse(confStr, out result)) + int result; + if (int.TryParse(confStr, out result)) m_key = (KeyCode)result; } @@ -163,6 +279,10 @@ namespace AxibugEmuOnline.Client { return Input.GetKey(m_key); } + public bool IsDown() + { + return Input.GetKeyDown(m_key); + } public override string ToString() { @@ -173,7 +293,7 @@ namespace AxibugEmuOnline.Client { switch (controllerIndex) { - case 1: + case 0: switch (nesConBtnType) { case EnumButtonType.LEFT: @@ -197,7 +317,7 @@ namespace AxibugEmuOnline.Client } break; - case 2: + case 1: switch (nesConBtnType) { case EnumButtonType.LEFT: @@ -223,19 +343,40 @@ namespace AxibugEmuOnline.Client break; } + return default(KeyListener); + } + + + public static KeyListener GetPSVitaKey(int controllerIndex, EnumButtonType nesConBtnType) + { + switch (controllerIndex) + { + case 0: + switch (nesConBtnType) + { + case EnumButtonType.LEFT: + return new KeyListener(PSVitaKey.Left); + case EnumButtonType.RIGHT: + return new KeyListener(PSVitaKey.Right); + case EnumButtonType.UP: + return new KeyListener(PSVitaKey.Up); + case EnumButtonType.DOWN: + return new KeyListener(PSVitaKey.Down); + case EnumButtonType.START: + return new KeyListener(PSVitaKey.Start); + case EnumButtonType.SELECT: + return new KeyListener(PSVitaKey.Select); + case EnumButtonType.A: + return new KeyListener(PSVitaKey.Circle); + case EnumButtonType.B: + return new KeyListener(PSVitaKey.Cross); + case EnumButtonType.MIC: + return new KeyListener(PSVitaKey.Block); + } + break; + } return default(KeyListener); } - } - - public void SetConnect(uint? con0ToSlot = null, - uint? con1ToSlot = null, - uint? con2ToSlot = null, - uint? con3ToSlot = null) - { - Controller0.ConnectSlot = con0ToSlot; - Controller1.ConnectSlot = con1ToSlot; - Controller2.ConnectSlot = con2ToSlot; - Controller3.ConnectSlot = con3ToSlot; - } + } } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs index 085be65..3230330 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs @@ -16,12 +16,18 @@ namespace AxibugEmuOnline.Client { public VideoProvider VideoProvider; public AudioProvider AudioProvider; - + //妯℃嫙鍣ㄦ牳蹇冨疄渚嬪寲瀵硅薄 public NES NesCore { get; private set; } /// 鏄惁鏆傚仠 - public bool IsPause { get; private set; } + public bool IsPause { get; private set; } + public NesControllerMapper ControllerMapper { get; private set; } + + private void Awake() + { + ControllerMapper = new NesControllerMapper(); + } private void Start() { @@ -38,9 +44,7 @@ namespace AxibugEmuOnline.Client /// private unsafe void Update() { - if (IsPause) return; - - if (NesCore != null) + if (NesCore != null && !IsPause) { PushEmulatorFrame(); if (InGameUI.Instance.IsNetPlay) @@ -49,10 +53,12 @@ namespace AxibugEmuOnline.Client var screenBuffer = NesCore.ppu.GetScreenPtr(); VideoProvider.SetDrawData(screenBuffer); } + + VideoProvider.ApplyFilterEffect(); } public EnumPlatform Platform => EnumPlatform.NES; - + private CoreSupporter m_coreSupporter; /// /// 鎸囧畾ROM寮濮嬫父鎴 /// @@ -60,7 +66,8 @@ namespace AxibugEmuOnline.Client { StopGame(); - Supporter.Setup(new CoreSupporter()); + m_coreSupporter = new CoreSupporter(ControllerMapper); + Supporter.Setup(m_coreSupporter); Debuger.Setup(new CoreDebuger()); App.nesRomLib.AddRomFile(rom); @@ -140,7 +147,7 @@ namespace AxibugEmuOnline.Client NesCore = null; } - + #if UNITY_EDITOR private ControllerState m_lastState; #endif @@ -158,8 +165,8 @@ namespace AxibugEmuOnline.Client //鎺ㄨ繘甯 private bool PushEmulatorFrame() { - Supporter.SampleInput(NesCore.FrameCount); - var controlState = Supporter.GetControllerState(); + m_coreSupporter.SampleInput(NesCore.FrameCount); + var controlState = m_coreSupporter.GetControllerState(); //濡傛灉鏈敹鍒癐nput鏁版嵁,鏍稿績甯т笉鎺ㄨ繘 if (!controlState.valid) return false; @@ -204,8 +211,11 @@ namespace AxibugEmuOnline.Client EditorUtility.SetDirty(db); AssetDatabase.SaveAssets(); + } +#endif + public IControllerSetuper GetControllerSetuper() + { + return ControllerMapper; } - -#endif } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat index 1eb2c7a..d581fae 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat @@ -2,19 +2,24 @@ %TAG !u! tag:unity3d.com,2011: --- !u!21 &2100000 Material: - serializedVersion: 6 + serializedVersion: 8 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} m_Name: NesEmulator_Screen m_Shader: {fileID: 4800000, guid: b351396ff606116478d7f4412abe4e2e, type: 3} - m_ShaderKeywords: + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: -1 stringTagMap: {} disabledShaderPasses: [] + m_LockedProperties: m_SavedProperties: serializedVersion: 3 m_TexEnvs: @@ -58,6 +63,7 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + m_Ints: [] m_Floats: - _BumpScale: 1 - _ColorMask: 15 @@ -85,3 +91,5 @@ Material: m_Colors: - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.shader index aa024f6..6fcb64d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.shader +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.shader @@ -102,10 +102,10 @@ { float2 mapUV = IN.texcoord; - float start= 8.0/272.0; - float end = (272.0-8.0)/272.0; - + float start= 0.02941535; + float end = 0.970582; mapUV.x = lerp(start,end, mapUV.x); + //uv鏄犲皠鏀逛负ugui BaseMeshEffect 鏈哄埗瀹炵幇uv鏄犲皠,姣攕hader浠g爜鏇翠负骞虫粦 half4 color = tex2D(_MainTex,mapUV); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/PaletteDefine.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/PaletteDefine.cs index 1cfef39..bd1c78a 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/PaletteDefine.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/PaletteDefine.cs @@ -27,7 +27,7 @@ namespace AxibugEmuOnline.Client } // 銈广偔銉c兂銉┿偆銉炽偒銉┿兗 - private static int m_nScanlineColor => Supporter.Config.graphics.nScanlineColor; + private static int m_nScanlineColor => 75; //patternViewer璋冭瘯鍣ㄧ敤鐨,鍙傜収EmulatorConfig.graphics.nScanlineColor鐨勫 public static float[][] PalConvTbl = new float[8][] { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs index 4450f03..680a3d1 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs @@ -1,3 +1,4 @@ +锘縰sing AxibugEmuOnline.Client.ClientCore; using System; using System.Runtime.InteropServices; using UnityEngine; @@ -14,26 +15,27 @@ namespace AxibugEmuOnline.Client public RawImage Image; #endregion - #region GPU_TURBO - //图像数据字节数 + //鍥惧儚鏁版嵁瀛楄妭鏁 private int TexBufferSize_gpu; - //图像数据指针 + //鍥惧儚鏁版嵁鎸囬拡 private IntPtr wrapTexBufferPointer_gpu; - //Unity 2D纹理对象,用于UI上绘制最终输出画面 + //Unity 2D绾圭悊瀵硅薄,鐢ㄤ簬UI涓婄粯鍒舵渶缁堣緭鍑虹敾闈 private Texture2D wrapTex_gpu; - //nes调色板数据,已转换为unity纹理对象 + //nes璋冭壊鏉挎暟鎹,宸茶浆鎹负unity绾圭悊瀵硅薄 private Texture2D pPal_gpu; + [SerializeField] private Material GPUTurboMat_gpu; + private RenderTexture rt_gpu; #endregion #region CPU - //图像数据字节数 + //鍥惧儚鏁版嵁瀛楄妭鏁 private int TexBufferSize_cpu; - //图像数据指针 + //鍥惧儚鏁版嵁鎸囬拡 private GCHandle wrapTexBufferGH; private IntPtr wrapTexBufferPointer_cpu; - //Unity 2D纹理对象,用于UI上绘制最终输出画面 + //Unity 2D绾圭悊瀵硅薄,鐢ㄤ簬UI涓婄粯鍒舵渶缁堣緭鍑虹敾闈 private Texture2D wrapTex_cpu; #endregion @@ -42,25 +44,31 @@ namespace AxibugEmuOnline.Client private void Awake() { DrawCanvas.worldCamera = Camera.main; - GPUTurboMat_gpu = Image.material; } private void OnDestroy() { if (wrapTexBufferGH.IsAllocated) wrapTexBufferGH.Free(); + + if (rt_gpu != null) + { + RenderTexture.ReleaseTemporary(rt_gpu); + rt_gpu = null; + } } public unsafe void SetDrawData(uint* screenData) { PrepareUI(screenData); - if (GPUTurbo) PrepareForGPU(screenData);//判断使用GPU还是CPU - else PrepareForCPU(screenData);//使用CPU + if (GPUTurbo) PrepareForGPU(screenData);//鍒ゆ柇浣跨敤GPU杩樻槸CPU + else PrepareForCPU(screenData);//浣跨敤CPU if (GPUTurbo) { wrapTex_gpu.LoadRawTextureData(wrapTexBufferPointer_gpu, TexBufferSize_gpu); wrapTex_gpu.Apply(); + Graphics.Blit(wrapTex_gpu, rt_gpu, GPUTurboMat_gpu); } else { @@ -69,27 +77,32 @@ namespace AxibugEmuOnline.Client } } + public void ApplyFilterEffect() + { + Image.texture = App.filter.ExecuteFilterRender(rt_gpu); + } + private unsafe void PrepareUI(uint* screenData) { if (GPUTurbo) { - if (Image.material != GPUTurboMat_gpu) Image.material = GPUTurboMat_gpu; - if (wrapTex_gpu == null) { wrapTex_gpu = new Texture2D(PPU.SCREEN_WIDTH, PPU.SCREEN_HEIGHT, TextureFormat.RGBA32, false); wrapTex_gpu.filterMode = FilterMode.Point; wrapTexBufferPointer_gpu = (IntPtr)screenData; + rt_gpu = RenderTexture.GetTemporary(256, wrapTex_gpu.height, 0); + rt_gpu.filterMode = FilterMode.Point; + rt_gpu.anisoLevel = 0; + rt_gpu.antiAliasing = 1; TexBufferSize_gpu = wrapTex_gpu.width * wrapTex_gpu.height * 4; } - if (Image.texture != wrapTex_gpu) Image.texture = wrapTex_gpu; + if (Image.texture != rt_gpu) Image.texture = rt_gpu; } else { - if (Image.material == GPUTurboMat_gpu) Image.material = null; - if (wrapTex_cpu == null) { wrapTex_cpu = new Texture2D(PPU.SCREEN_WIDTH - 16, PPU.SCREEN_HEIGHT, TextureFormat.RGBA32, false); @@ -103,6 +116,7 @@ namespace AxibugEmuOnline.Client } if (Image.texture != wrapTex_cpu) Image.texture = wrapTex_cpu; } + } private unsafe void PrepareForGPU(uint* screenData) @@ -141,7 +155,7 @@ namespace AxibugEmuOnline.Client for (int line = 0; line < PPU.SCREEN_HEIGHT; line++) { - //PS:如果是CPU计算,宽度减少16的不必要部分,才能对齐 + //PS锛氬鏋滄槸CPU璁$畻锛屽搴﹀噺灏16鐨勪笉蹇呰閮ㄥ垎锛屾墠鑳藉榻 width = PPU.SCREEN_WIDTH - 16; while (width > 0) @@ -149,17 +163,17 @@ namespace AxibugEmuOnline.Client var edx = screenData[pScn + 8]; uint index = edx & 0xFF; - //按下标颜色查找表中真实颜色 + //鎸変笅鏍囬鑹叉煡鎵捐〃涓湡瀹為鑹 var colorData = palRaw[index]; - //dst中颜色排列为abgr,而colorData排列为argb - uint r = (colorData & 0x00FF0000) >> 16; // 提取Red通道 - uint g = (colorData & 0x0000FF00) >> 8; // 提取Green通道 - uint b = (colorData & 0x000000FF); // 提取Blue通道 + //dst涓鑹叉帓鍒椾负abgr,鑰宑olorData鎺掑垪涓篴rgb + uint r = (colorData & 0x00FF0000) >> 16; // 鎻愬彇Red閫氶亾 + uint g = (colorData & 0x0000FF00) >> 8; // 鎻愬彇Green閫氶亾 + uint b = (colorData & 0x000000FF); // 鎻愬彇Blue閫氶亾 - //用rgb构建颜色对象(如果非unity 可以用这个rgb 构建System.Drawing.Color 单个颜色对象) + //鐢╮gb鏋勫缓棰滆壊瀵硅薄锛堝鏋滈潪unity 鍙互鐢ㄨ繖涓猺gb 鏋勫缓System.Drawing.Color 鍗曚釜棰滆壊瀵硅薄锛 uint abgr = 0xFF000000 | (b << 16) | (g << 8) | (r << 0); - //放进颜色矩阵 + //鏀捐繘棰滆壊鐭╅樀 Dst[pDst] = abgr; pScn += 1; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Network/NetworkHelper.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Network/NetworkHelper.cs index c38657d..4a8babf 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Network/NetworkHelper.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Network/NetworkHelper.cs @@ -1,6 +1,7 @@ 锘縰sing AxibugEmuOnline.Client.ClientCore; +using AxibugEmuOnline.Client.Event; using AxibugProtobuf; -using HaoYueNet.ClientNetworkNet.Standard2; +using HaoYueNet.ClientNetwork; using System; using System.Net.Sockets; using System.Threading; @@ -99,6 +100,7 @@ namespace AxibugEmuOnline.Client.Network public void OnConnectClose() { NetworkDeBugLog("OnConnectClose"); + Eventer.Instance.PostEvent(EEvent.OnLossLoginState); App.user.LoginOutData(); diff --git a/AxibugEmuOnline.Client/Assets/Settings/Build Profiles.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita.meta similarity index 77% rename from AxibugEmuOnline.Client/Assets/Settings/Build Profiles.meta rename to AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita.meta index c98514c..ee12a21 100644 --- a/AxibugEmuOnline.Client/Assets/Settings/Build Profiles.meta +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 13795c31ef56b3648a06122c6b1864f3 +guid: 4a4a14412f1bcc844bbd2c9bccf50db2 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita/SonyVitaCommonDialog.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita/SonyVitaCommonDialog.cs new file mode 100644 index 0000000..dc1a0a8 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita/SonyVitaCommonDialog.cs @@ -0,0 +1,63 @@ +锘縰sing System; +using UnityEngine; +public class SonyVitaCommonDialog : MonoBehaviour +{ + static Action resultAct = null; + void Awake() + { +#if UNITY_PSP2 + Sony.Vita.Dialog.Ime.OnGotIMEDialogResult += OnGotIMEDialogResult; + Sony.Vita.Dialog.Main.Initialise(); +#endif + } + + public void ShowPSVitaIME(Action callback, string placeHolder, string defaultText) + { +#if UNITY_PSP2 + resultAct = callback; + Sony.Vita.Dialog.Ime.ImeDialogParams info = new Sony.Vita.Dialog.Ime.ImeDialogParams(); + + // Set supported languages, 'or' flags together or set to 0 to support all languages. + info.supportedLanguages = Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_SIMPLIFIED_CHINESE | + Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_JAPANESE | + Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_ENGLISH_GB | + Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_TRADITIONAL_CHINESE; + + info.languagesForced = true; + + info.type = Sony.Vita.Dialog.Ime.EnumImeDialogType.TYPE_DEFAULT; + info.option = 0; + info.canCancel = true; + info.textBoxMode = Sony.Vita.Dialog.Ime.FlagsTextBoxMode.TEXTBOX_MODE_WITH_CLEAR; + info.enterLabel = Sony.Vita.Dialog.Ime.EnumImeDialogEnterLabel.ENTER_LABEL_DEFAULT; + info.maxTextLength = 128; + info.title = placeHolder; + info.initialText = defaultText; + Sony.Vita.Dialog.Ime.Open(info); +#endif + } + +#if UNITY_PSP2 + void OnGotIMEDialogResult(Sony.Vita.Dialog.Messages.PluginMessage msg) + { + Sony.Vita.Dialog.Ime.ImeDialogResult result = Sony.Vita.Dialog.Ime.GetResult(); + Debug.Log("IME result: " + result.result); + Debug.Log("IME button: " + result.button); + Debug.Log("IME text: " + result.text); + if (result.result == Sony.Vita.Dialog.Ime.EnumImeDialogResult.RESULT_OK) + { + resultAct.Invoke(result.text); + resultAct = null; + } + } +#endif + + +#if UNITY_PSP2 + void Update () + { + Sony.Vita.Dialog.Main.Update(); + } +#endif + +} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita/SonyVitaCommonDialog.cs.meta similarity index 57% rename from AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs.meta rename to AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita/SonyVitaCommonDialog.cs.meta index d7ab243..6794921 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs.meta +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita/SonyVitaCommonDialog.cs.meta @@ -1,11 +1,8 @@ fileFormatVersion: 2 -guid: 5354e2e13dbff91438a04b9de2351645 +guid: 7bc72e9d59cc9134d8855521049ad788 MonoImporter: - externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs index dba3f0f..df91364 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs @@ -66,7 +66,7 @@ namespace AxibugEmuOnline.Client SetBaseInfo(m_romfile.Alias, m_romfile.Descript, m_romfile.GameTypeDes); App.CacheMgr.GetSpriteCache(m_romfile.ImageURL, (img, url) => { - if (url != m_romfile.ImageURL) return; + if (!m_romfile.InfoReady || url != m_romfile.ImageURL) return; m_romImage.sprite = img; }); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI.cs index dc772b0..42dd0ad 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI.cs @@ -2,6 +2,7 @@ using AxibugEmuOnline.Client.ClientCore; using AxibugEmuOnline.Client.Event; using AxibugProtobuf; +using VirtualNes.Core; namespace AxibugEmuOnline.Client { @@ -111,7 +112,19 @@ namespace AxibugEmuOnline.Client private void OnRoomCreated() { - m_delayCreateRoom = false; + if (m_delayCreateRoom) + { + m_delayCreateRoom = false; + //寤惰繜鍒涘缓鎴块棿鎴愬姛鍚,鍚屾鏈湴鎵嬫焺杩炴帴鐘舵 + Dictionary temp = new Dictionary(); + var setuper = App.emu.Core.GetControllerSetuper(); + for (int i = 0; i < 4; i++) + { + var joyIndex = setuper.GetSlotConnectingControllerIndex(i); + if (joyIndex != null) temp[(uint)i] = (uint)joyIndex.Value; + } + App.roomMgr.SendChangePlaySlotIdxWithJoyIdx(temp); + } } private void OnLoggedIn() diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/OverlayManager.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/OverlayManager.cs index a882544..8ea6da9 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/OverlayManager.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/OverlayManager.cs @@ -1,3 +1,4 @@ +using AxibugEmuOnline.Client.ClientCore; using System; using System.Collections.Generic; using UnityEngine; @@ -20,11 +21,13 @@ namespace AxibugEmuOnline.Client m_InputUI.gameObject.SetActive(false); } - public static InputUI Input(Action callback, string placeHolder, string defaultText) + public static void Input(Action callback, string placeHolder, string defaultText) { +#if UNITY_PSP2 && !UNITY_EDITOR + App.sonyVitaCommonDialog.ShowPSVitaIME(callback, placeHolder, defaultText); +#else s_ins.m_InputUI.Show(new ValueTuple, string, string>(callback, placeHolder, defaultText)); - - return s_ins.m_InputUI; +#endif } public static void PopSideBar(List menus, int defaultIndex = 0, Action onClose = null) where T : OptionMenu diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/RoomUI/RoomItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/RoomUI/RoomItem.cs index 1a04dbf..541a517 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/RoomUI/RoomItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/RoomUI/RoomItem.cs @@ -3,142 +3,143 @@ using AxibugEmuOnline.Client.Event; using AxibugEmuOnline.Client.Manager; using AxibugEmuOnline.Client.UI; using AxibugProtobuf; +using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using Debug = System.Diagnostics.Debug; namespace AxibugEmuOnline.Client -{ - public class RoomItem : MenuItem, IVirtualItem - { - [SerializeField] Image m_roomPreview; - [SerializeField] Slider m_downloadProgress; - [SerializeField] GameObject m_downloadingFlag; - [SerializeField] GameObject m_romReadyFlag; - - private RomFile m_romFile; - - public int Index { get; set; } - public int RoomID { get; private set; } - - protected override void Awake() - { - base.Awake(); - - Eventer.Instance.RegisterEvent(EEvent.OnRoomListSingleUpdate, OnRoomSignelUpdate); - } - - private void OnRoomSignelUpdate(int roomID) - { - if (this.RoomID != roomID) return; - - Protobuf_Room_MiniInfo roomInfo; - if (App.roomMgr.GetRoomListMiniInfo(roomID, out roomInfo)) - UpdateUI(roomInfo); - } - - public void SetData(object data) - { - Debug.Assert(data is Protobuf_Room_MiniInfo); - - var roomInfo = (Protobuf_Room_MiniInfo)data; - RoomID = roomInfo.RoomID; - - UpdateUI(roomInfo); - } - - public override bool OnEnterItem() - { - if (m_romFile == null) return false; - - if (!m_romFile.RomReady) - { - m_romFile.BeginDownload(); - return false; - } - else - { - Protobuf_Room_MiniInfo MiniInfo; - if (!App.roomMgr.GetRoomListMiniInfo(RoomID, out MiniInfo)) - { - OverlayManager.PopTip("鎴块棿涓嶅瓨鍦"); - return false; - } - int[] freeSlots; - if (!MiniInfo.GetFreeSlot(out freeSlots)) - { - OverlayManager.PopTip("鏃犵┖闂蹭綅缃"); - return false; - } - - App.roomMgr.SendJoinRoom(RoomID); - return true; - } - } - - private void UpdateUI(Protobuf_Room_MiniInfo roomInfo) - { - var hostNick = roomInfo.GetHostNickName(); - int cur; int max; - - roomInfo.GetRoomPlayers(out cur, out max); - SetBaseInfo("--", $"{hostNick}鐨勬埧闂", $"{cur}/{max}"); - SetIcon(null); - - roomInfo.FetchRomFileInRoomInfo(EnumPlatform.NES, (room, romFile) => - { - if (room.RoomID != RoomID) return; - - m_romFile = romFile; - Txt.text = romFile.Alias; - - UpdateRomInfoView(); - App.CacheMgr.GetSpriteCache(romFile.ImageURL, OnGetRomImage); - }); - } - - protected override void Update() - { - UpdateRomInfoView(); - base.Update(); - } - - private void UpdateRomInfoView() - { - float? downloadingProgress = null; - bool romReady = false; - - if (m_romFile != null) - { - if (m_romFile.IsDownloading) - downloadingProgress = m_romFile.Progress; - if (m_romFile.RomReady) - romReady = true; - } - - m_downloadingFlag.SetActiveEx(downloadingProgress.HasValue); - if (downloadingProgress.HasValue) - m_downloadProgress.value = downloadingProgress.Value; - - m_romReadyFlag.SetActiveEx(romReady); - } - - private void OnGetRomImage(Sprite sprite, string url) - { - if (m_romFile == null) return; - if (m_romFile.ImageURL != url) return; - - SetIcon(sprite); - } - - public void SetDependencyProperty(object data) - { - SetSelectState((data is ThirdMenuRoot && ((ThirdMenuRoot)data).SelectIndex == Index)); - } - - public void Release() - { - Reset(); - } - } +{ + public class RoomItem : MenuItem, IVirtualItem + { + [SerializeField] Image m_roomPreview; + [SerializeField] Slider m_downloadProgress; + [SerializeField] GameObject m_downloadingFlag; + [SerializeField] GameObject m_romReadyFlag; + + private RomFile m_romFile; + + public int Index { get; set; } + public int RoomID { get; private set; } + + protected override void Awake() + { + base.Awake(); + + Eventer.Instance.RegisterEvent(EEvent.OnRoomListSingleUpdate, OnRoomSignelUpdate); + } + + private void OnRoomSignelUpdate(int roomID) + { + if (this.RoomID != roomID) return; + + Protobuf_Room_MiniInfo roomInfo; + if (App.roomMgr.GetRoomListMiniInfo(roomID, out roomInfo)) + UpdateUI(roomInfo); + } + + public void SetData(object data) + { + Debug.Assert(data is Protobuf_Room_MiniInfo); + + var roomInfo = (Protobuf_Room_MiniInfo)data; + RoomID = roomInfo.RoomID; + + UpdateUI(roomInfo); + } + + public override bool OnEnterItem() + { + if (m_romFile == null) return false; + + if (!m_romFile.RomReady) + { + m_romFile.BeginDownload(); + return false; + } + else + { + Protobuf_Room_MiniInfo MiniInfo; + if (!App.roomMgr.GetRoomListMiniInfo(RoomID, out MiniInfo)) + { + OverlayManager.PopTip("鎴块棿涓嶅瓨鍦"); + return false; + } + List freeSlots = new List(); + if (!MiniInfo.GetFreeSlot(ref freeSlots)) + { + OverlayManager.PopTip("鏃犵┖闂蹭綅缃"); + return false; + } + + App.roomMgr.SendJoinRoom(RoomID); + return true; + } + } + + private void UpdateUI(Protobuf_Room_MiniInfo roomInfo) + { + var hostNick = roomInfo.GetHostNickName(); + int cur; int max; + + roomInfo.GetRoomPlayers(out cur, out max); + SetBaseInfo("--", $"{hostNick}鐨勬埧闂", $"{cur}/{max}"); + SetIcon(null); + + roomInfo.FetchRomFileInRoomInfo(EnumPlatform.NES, (room, romFile) => + { + if (room.RoomID != RoomID) return; + + m_romFile = romFile; + Txt.text = romFile.Alias; + + UpdateRomInfoView(); + App.CacheMgr.GetSpriteCache(romFile.ImageURL, OnGetRomImage); + }); + } + + protected override void Update() + { + UpdateRomInfoView(); + base.Update(); + } + + private void UpdateRomInfoView() + { + float? downloadingProgress = null; + bool romReady = false; + + if (m_romFile != null) + { + if (m_romFile.IsDownloading) + downloadingProgress = m_romFile.Progress; + if (m_romFile.RomReady) + romReady = true; + } + + m_downloadingFlag.SetActiveEx(downloadingProgress.HasValue); + if (downloadingProgress.HasValue) + m_downloadProgress.value = downloadingProgress.Value; + + m_romReadyFlag.SetActiveEx(romReady); + } + + private void OnGetRomImage(Sprite sprite, string url) + { + if (m_romFile == null) return; + if (m_romFile.ImageURL != url) return; + + SetIcon(sprite); + } + + public void SetDependencyProperty(object data) + { + SetSelectState((data is ThirdMenuRoot && ((ThirdMenuRoot)data).SelectIndex == Index)); + } + + public void Release() + { + Reset(); + } + } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfo.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfo.cs new file mode 100644 index 0000000..f8b1c77 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfo.cs @@ -0,0 +1,139 @@ +锘縰sing AxibugEmuOnline.Client; +using AxibugEmuOnline.Client.ClientCore; +using AxibugEmuOnline.Client.Event; +using DG.Tweening; +using System; +using UnityEngine; +using UnityEngine.UI; +using VirtualNes.Core; + +public class ControllerInfo : MonoBehaviour +{ + [Header("鎵嬫焺妲戒綅搴忓彿[0,3]")] + [SerializeField] + int m_slotIndex; + + [SerializeField] + GameObject m_connectInfoNode; + [SerializeField] + Image m_indexIcon; + [SerializeField] + Text m_playerName; + private bool m_islocal; + + public int SlotIndex + { + get => m_slotIndex; + set + { + if (m_slotIndex == value) return; + m_slotIndex = value; + UpdateIndexIcon(); + } + } + + private void Awake() + { + UpdateIndexIcon(); + } + + + private void OnEnable() + { + Eventer.Instance.RegisterEvent(EEvent.OnMineJoinRoom, OnJoinRoom); + Eventer.Instance.RegisterEvent(EEvent.OnMineRoomCreated, OnMineRoomCreated); + Eventer.Instance.RegisterEvent(EEvent.OnMineLeavnRoom, OnLeaveRoom); + Eventer.Instance.RegisterEvent(EEvent.OnLoginSucceed, OnLoginSuccess); + Eventer.Instance.RegisterEvent(EEvent.OnLossLoginState, OnLossLoginState); + Eventer.Instance.RegisterEvent(EEvent.OnControllerConnectChanged, OnControlConnectChanged); + UpdateConnectInfo(); + } + + private void OnDisable() + { + Eventer.Instance.UnregisterEvent(EEvent.OnMineJoinRoom, OnJoinRoom); + Eventer.Instance.UnregisterEvent(EEvent.OnMineRoomCreated, OnMineRoomCreated); + Eventer.Instance.UnregisterEvent(EEvent.OnMineLeavnRoom, OnLeaveRoom); + Eventer.Instance.UnregisterEvent(EEvent.OnLoginSucceed, OnLoginSuccess); + Eventer.Instance.UnregisterEvent(EEvent.OnLossLoginState, OnLossLoginState); + Eventer.Instance.UnregisterEvent(EEvent.OnControllerConnectChanged, OnControlConnectChanged); + } + + private void Update() + { + if (m_islocal) + { + var controller = App.emu.Core.GetControllerSetuper().GetSlotConnectingController(m_slotIndex); + if (controller == null) return; + if (!controller.AnyButtonDown()) return; + + m_indexIcon.rectTransform.DOShakePosition(0.1f); + } + } + + private void OnMineRoomCreated() => UpdateConnectInfo(); + private void OnJoinRoom() => UpdateConnectInfo(); + private void OnLeaveRoom() => UpdateConnectInfo(); + private void OnLoginSuccess() => UpdateConnectInfo(); + private void OnLossLoginState() => UpdateConnectInfo(); + private void OnControlConnectChanged() => UpdateConnectInfo(); + + private void UpdateConnectInfo() + { + if (App.roomMgr.InRoom) + { + var slotInfo = App.roomMgr.mineRoomMiniInfo.GamePlaySlotList[SlotIndex]; + if (slotInfo.PlayerUID <= 0) + SetDisconnect(); + else + UpdateStateView(App.user.userdata.UID == slotInfo.PlayerUID, slotInfo.PlayerNickName, slotInfo.PlayerLocalJoyIdx); + } + else + { + if (App.emu.Core.IsNull()) + { + SetDisconnect(); + return; + + } + var connecter = App.emu.Core.GetControllerSetuper(); + + var localControlIndex = connecter.GetSlotConnectingControllerIndex(SlotIndex); + if (localControlIndex == null) + SetDisconnect(); + else + { + if (App.user.IsLoggedIn) + UpdateStateView(true, App.user.userdata.NickName, localControlIndex.Value); + else + UpdateStateView(true, "Player", localControlIndex.Value); + } + } + } + + private void UpdateStateView(bool isLocal, string playerName, int slotIndex) + { + m_islocal = isLocal; + + m_connectInfoNode.SetActiveEx(true); + m_playerName.text = playerName; + } + + private void SetDisconnect() + { + m_connectInfoNode.SetActiveEx(false); + m_playerName.text = null; + m_islocal = false; + } + + private void UpdateIndexIcon() + { + switch (SlotIndex) + { + case 0: m_indexIcon.sprite = Resources.Load("UIImage/JoyImg/P1"); break; + case 1: m_indexIcon.sprite = Resources.Load("UIImage/JoyImg/P2"); break; + case 2: m_indexIcon.sprite = Resources.Load("UIImage/JoyImg/P3"); break; + case 3: m_indexIcon.sprite = Resources.Load("UIImage/JoyImg/P4"); break; + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfo.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfo.cs.meta new file mode 100644 index 0000000..2ce16b9 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfo.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1bfe4359a48b5c349b439e88eb53b8b1 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs new file mode 100644 index 0000000..137a6de --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs @@ -0,0 +1,45 @@ +锘縰sing AxibugEmuOnline.Client; +using AxibugEmuOnline.Client.ClientCore; +using AxibugEmuOnline.Client.Event; +using AxibugEmuOnline.Client.Manager; +using System; +using System.Collections.Generic; +using UnityEngine; +using VirtualNes.Core; + +public class ControllerInfoPanel : MonoBehaviour +{ + private void OnEnable() + { + Eventer.Instance.RegisterEvent(EEvent.OnLocalJoyDesireInvert, OnLocalJoyDesireInvert); + } + + private void OnDisable() + { + Eventer.Instance.UnregisterEvent(EEvent.OnLocalJoyDesireInvert, OnLocalJoyDesireInvert); + } + + static List s_freeSlots = new List(4); + private void OnLocalJoyDesireInvert(int joyIndex) + { + if (App.roomMgr.InRoom) + { + if (!App.roomMgr.mineRoomMiniInfo.GetFreeSlot(ref s_freeSlots)) return; + + //鎵惧埌绗竴涓┖闂叉墜鏌勬彃妲 + var freeSlotIndex = s_freeSlots[0]; + App.roomMgr.SendChangePlaySlotIdxWithJoyIdx((uint)joyIndex, (uint)freeSlotIndex); + } + else //涓嶅湪鎴块棿涓,鐩存帴璁剧疆 + { + if (App.emu.Core.IsNull()) return; + var setuper = App.emu.Core.GetControllerSetuper(); + if (setuper == null) return; + + var freeSlotIndex = setuper.GetFreeSlotIndex(); + if (freeSlotIndex == null) return; + + setuper.LetControllerConnect(joyIndex, freeSlotIndex.Value); + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs.meta new file mode 100644 index 0000000..69be886 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 909a5b71ba48a9c46a57d43017072837 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/XMBInfoBar.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/XMBInfoBar.cs index 264881f..58087c4 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/XMBInfoBar.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/XMBInfoBar.cs @@ -1,4 +1,4 @@ -using AxibugEmuOnline.Client; +锘縰sing AxibugEmuOnline.Client; using AxibugEmuOnline.Client.ClientCore; using System; using UnityEngine; @@ -14,6 +14,7 @@ public class XMBInfoBar : MonoBehaviour public Text DelayValue; public Text OnlinePlayerCount; public Text FPS; + public GameObject ControlSlotInfoNode; void OnEnable() { @@ -21,6 +22,11 @@ public class XMBInfoBar : MonoBehaviour RefreshAll(); } + private void Update() + { + ControlSlotInfoNode.SetActiveEx(!App.emu.Core.IsNull()); + } + void OnDisable() { TickLoop.LoopAction_1s -= RefreshAll; @@ -32,31 +38,31 @@ public class XMBInfoBar : MonoBehaviour RefreshPower(); RefreshDelay(); RefreshFps(); - } - - /// - /// (uint lastFrame, float lastTime) - /// - ValueTuple m_lastFrameInfo; + } + + /// + /// (uint lastFrame, float lastTime) + /// + ValueTuple m_lastFrameInfo; private void RefreshFps() { if (App.emu.Core.IsNull()) FPS.gameObject.SetActiveEx(false); else { - FPS.gameObject.SetActiveEx(true); - //var gap = App.emu.Core.Frame - m_lastFrameInfo.lastFrame; - //var time = Time.realtimeSinceStartup - m_lastFrameInfo.lastTime; - var gap = App.emu.Core.Frame - m_lastFrameInfo.Item1; - var time = Time.realtimeSinceStartup - m_lastFrameInfo.Item2; - var fps = gap / time; - FPS.text = $"FPS:{fps:.#}"; - - //m_lastFrameInfo.lastFrame = App.emu.Core.Frame; - //m_lastFrameInfo.lastTime = Time.realtimeSinceStartup; - m_lastFrameInfo.Item1 = App.emu.Core.Frame; - m_lastFrameInfo.Item2 = Time.realtimeSinceStartup; - } + FPS.gameObject.SetActiveEx(true); + //var gap = App.emu.Core.Frame - m_lastFrameInfo.lastFrame; + //var time = Time.realtimeSinceStartup - m_lastFrameInfo.lastTime; + var gap = App.emu.Core.Frame - m_lastFrameInfo.Item1; + var time = Time.realtimeSinceStartup - m_lastFrameInfo.Item2; + var fps = gap / time; + FPS.text = $"FPS:{fps:.#}"; + + //m_lastFrameInfo.lastFrame = App.emu.Core.Frame; + //m_lastFrameInfo.lastTime = Time.realtimeSinceStartup; + m_lastFrameInfo.Item1 = App.emu.Core.Frame; + m_lastFrameInfo.Item2 = Time.realtimeSinceStartup; + } } private void RefreshDelay() diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES.meta b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES.meta deleted file mode 100644 index eeda059..0000000 --- a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fc7102c34a9fa4148b4aa74d54e82b1f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms.meta b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms.meta deleted file mode 100644 index 97938b3..0000000 --- a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ac852e7a0b9604940b0f7e0180fd2707 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Kirby.nes b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Kirby.nes deleted file mode 100644 index f2ac915..0000000 Binary files a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Kirby.nes and /dev/null differ diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Kirby.nes.meta b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Kirby.nes.meta deleted file mode 100644 index 803c960..0000000 --- a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Kirby.nes.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 41cd7684d8de61f4499c3aa27a6c5b3a -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Mario.nes b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Mario.nes deleted file mode 100644 index 878ef21..0000000 Binary files a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Mario.nes and /dev/null differ diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Mario.nes.meta b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Mario.nes.meta deleted file mode 100644 index 66eb8f2..0000000 --- a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/Mario.nes.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 50dfce75937af2a44bafd221a0163501 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/ff1.NES b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/ff1.NES deleted file mode 100644 index 1665b6d..0000000 Binary files a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/ff1.NES and /dev/null differ diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/ff1.NES.meta b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/ff1.NES.meta deleted file mode 100644 index 2681206..0000000 --- a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/ff1.NES.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 091b4306faaa8fc4084836c5237b76c8 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/msg.nes b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/msg.nes deleted file mode 100644 index 3a5f57d..0000000 Binary files a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/msg.nes and /dev/null differ diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/msg.nes.meta b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/msg.nes.meta deleted file mode 100644 index 8a69b2d..0000000 --- a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/msg.nes.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: a5222bc76eba99e4c9fc92b70f4103bc -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tortoise4.nes b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tortoise4.nes deleted file mode 100644 index 46a85a0..0000000 Binary files a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tortoise4.nes and /dev/null differ diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tortoise4.nes.meta b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tortoise4.nes.meta deleted file mode 100644 index 206dbb7..0000000 --- a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tortoise4.nes.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 7abf09a3e3fd84648852e5d972dfd260 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tstd2.nes b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tstd2.nes deleted file mode 100644 index 68461fd..0000000 Binary files a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tstd2.nes and /dev/null differ diff --git a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tstd2.nes.meta b/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tstd2.nes.meta deleted file mode 100644 index 0d85e01..0000000 --- a/AxibugEmuOnline.Client/Assets/StreamingAssets/NES/Roms/tstd2.nes.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 0fcf57d6e248ead4a874daa51181ec5f -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/APU.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/APU.cs index eae930a..03ab741 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/APU.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/APU.cs @@ -73,7 +73,7 @@ namespace VirtualNes.Core public void Process(ISoundDataBuffer lpBuffer, uint dwSize) { - int nBits = Supporter.Config.sound.nBits; + int nBits = Supporter.S.Config.sound.nBits; uint dwLength = (uint)(dwSize / (nBits / 8)); int output; QUEUEDATA q = new QUEUEDATA(); @@ -82,11 +82,11 @@ namespace VirtualNes.Core var pSoundBuf = m_SoundBuffer; int nCcount = 0; - int nFilterType = Supporter.Config.sound.nFilterType; + int nFilterType = Supporter.S.Config.sound.nFilterType; - if (!Supporter.Config.sound.bEnable) + if (!Supporter.S.Config.sound.bEnable) { - byte empty = (byte)(Supporter.Config.sound.nRate == 8 ? 128 : 0); + byte empty = (byte)(Supporter.S.Config.sound.nRate == 8 ? 128 : 0); for (int i = 0; i < dwSize; i++) lpBuffer.WriteByte(empty); return; @@ -108,7 +108,7 @@ namespace VirtualNes.Core MemoryUtility.ZEROMEMORY(vol, vol.Length); var bMute = m_bMute; - var nVolume = Supporter.Config.sound.nVolume; + var nVolume = Supporter.S.Config.sound.nVolume; int nMasterVolume = bMute[0] ? nVolume[0] : 0; @@ -151,7 +151,7 @@ namespace VirtualNes.Core vol[23] = (int)(bMute[8] ? (FME7_VOL * nVolume[11] * nMasterVolume) / (100 * 100) : 0); // double cycle_rate = ((double)FRAME_CYCLES*60.0/12.0)/(double)Config.sound.nRate; - double cycle_rate = (nes.nescfg.FrameCycles * 60.0 / 12.0) / Supporter.Config.sound.nRate; + double cycle_rate = (nes.nescfg.FrameCycles * 60.0 / 12.0) / Supporter.S.Config.sound.nRate; // CPU銈点偆銈儷鏁般亴銉兗銉椼仐銇︺仐銇俱仯銇熸檪銇绛栧嚘鐞 if (elapsed_time > nes.cpu.GetTotalCycles()) @@ -253,7 +253,7 @@ namespace VirtualNes.Core // DC鎴愬垎銇偒銉冦儓(HPF TEST) { // static double cutoff = (2.0*3.141592653579*40.0/44100.0); - double cutoff = cutofftemp / Supporter.Config.sound.nRate; + double cutoff = cutofftemp / Supporter.S.Config.sound.nRate; double @in, @out; @in = output; @@ -436,7 +436,7 @@ namespace VirtualNes.Core public void SoundSetup() { float fClock = nes.nescfg.CpuClock; - int nRate = Supporter.Config.sound.nRate; + int nRate = Supporter.S.Config.sound.nRate; @internal.Setup(fClock, nRate); vrc6.Setup(fClock, nRate); @@ -460,7 +460,7 @@ namespace VirtualNes.Core elapsed_time = 0; float fClock = nes.nescfg.CpuClock; - int nRate = Supporter.Config.sound.nRate; + int nRate = Supporter.S.Config.sound.nRate; @internal.Reset(fClock, nRate); vrc6.Reset(fClock, nRate); diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/ApuEX/APU_INTERNAL.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/ApuEX/APU_INTERNAL.cs index 0fffa03..4f0a023 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/ApuEX/APU_INTERNAL.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/ApuEX/APU_INTERNAL.cs @@ -1,4 +1,4 @@ - +锘 using System; namespace VirtualNes.Core @@ -184,15 +184,15 @@ namespace VirtualNes.Core Setup(fClock, nRate); - // $4011は初期化しない + // $4011銇垵鏈熷寲銇椼仾銇 ushort addr; for (addr = 0x4000; addr <= 0x4010; addr++) { Write(addr, 0x00); SyncWrite(addr, 0x00); } - // Write( 0x4001, 0x08 ); // Reset時はincモードになる? - // Write( 0x4005, 0x08 ); // Reset時はincモードになる? + // Write( 0x4001, 0x08 ); // Reset鏅傘伅inc銉€兗銉夈伀銇倠? + // Write( 0x4005, 0x08 ); // Reset鏅傘伅inc銉€兗銉夈伀銇倠? Write(0x4012, 0x00); Write(0x4013, 0x00); Write(0x4015, 0x00); @@ -200,7 +200,7 @@ namespace VirtualNes.Core SyncWrite(0x4013, 0x00); SyncWrite(0x4015, 0x00); - // $4017は書き込みで初期化しない(初期モードが0であるのを期待したソフトがある為) + // $4017銇浉銇嶈炯銇裤仹鍒濇湡鍖栥仐銇亜(鍒濇湡銉€兗銉夈亴0銇с亗銈嬨伄銈掓湡寰呫仐銇熴偨銉曘儓銇屻亗銈嬬偤) FrameIRQ = 0xC0; FrameCycle = 0; FrameIRQoccur = 0; @@ -301,7 +301,7 @@ namespace VirtualNes.Core case 0x4017: break; - // VirtuaNES固有ポート + // VirtuaNES鍥烘湁銉濄兗銉 case 0x4018: UpdateRectangle(ch0, data); UpdateRectangle(ch1, data); @@ -635,7 +635,7 @@ namespace VirtualNes.Core } } - // インチキ臭いプチノイズカット(TEST) + // 銈ゃ兂銉併偔鑷亜銉椼儊銉庛偆銈恒偒銉冦儓(TEST) ch4.dpcm_output_real = ((ch4.reg[1] & 0x01) + ch4.dpcm_value * 2) - 0x40; if (Math.Abs(ch4.dpcm_output_real - ch4.dpcm_output_fake) <= 8) { @@ -712,7 +712,7 @@ namespace VirtualNes.Core private int RenderTriangle() { int vol; - if (Supporter.Config.sound.bDisableVolumeEffect) + if (Supporter.S.Config.sound.bDisableVolumeEffect) { vol = 256; } @@ -731,7 +731,7 @@ namespace VirtualNes.Core return ch2.nowvolume * vol / 256; } - if (!(Supporter.Config.sound.bChangeTone && ChannelTone[2, 0] != 0)) + if (!(Supporter.S.Config.sound.bChangeTone && ChannelTone[2, 0] != 0)) { ch2.phaseacc -= cycle_rate; if (ch2.phaseacc >= 0) @@ -756,7 +756,7 @@ namespace VirtualNes.Core return ch2.nowvolume * vol / 256; } - // 加重平均 + // 鍔犻噸骞冲潎 int num_times, total; num_times = total = 0; while (ch2.phaseacc < 0) @@ -799,7 +799,7 @@ namespace VirtualNes.Core return ch2.nowvolume * vol / 256; } - // 加重平均 + // 鍔犻噸骞冲潎 int num_times, total; num_times = total = 0; while (ch2.phaseacc < 0) @@ -832,9 +832,9 @@ namespace VirtualNes.Core } int volume = ch.nowvolume; - if (!(Supporter.Config.sound.bChangeTone && (ChannelTone[(ch.complement == 0) ? 0 : 1, ch.reg[0] >> 6]) != 0)) + if (!(Supporter.S.Config.sound.bChangeTone && (ChannelTone[(ch.complement == 0) ? 0 : 1, ch.reg[0] >> 6]) != 0)) { - // 補間処理 + // 瑁滈枔鍑︾悊 double total; double sample_weight = ch.phaseacc; if (sample_weight > cycle_rate) @@ -864,7 +864,7 @@ namespace VirtualNes.Core int x = ChannelTone[(ch.complement == 0) ? 0 : 1, ch.reg[0] >> 6] - 1; int pTone = 0; - // 更新無し + // 鏇存柊鐒°仐 ch.phaseacc -= cycle_rate * 2; if (ch.phaseacc >= 0) { @@ -872,7 +872,7 @@ namespace VirtualNes.Core return temp * volume / ((1 << RECTANGLE_VOL_SHIFT) / 2); } - // 1ステップだけ更新 + // 1銈广儐銉冦儣銇犮亼鏇存柊 int freq = INT2FIX(ch.freq + 1); if (freq > cycle_rate * 2) { @@ -882,7 +882,7 @@ namespace VirtualNes.Core return temp * volume / ((1 << RECTANGLE_VOL_SHIFT) / 2); } - // 加重平均 + // 鍔犻噸骞冲潎 int num_times, total; num_times = total = 0; while (ch.phaseacc < 0) @@ -1015,7 +1015,7 @@ namespace VirtualNes.Core SyncWrite4017(data); break; - // VirtuaNES屌桳億乕僩 + // VirtuaNES灞屾〕鍎勪箷鍍 case 0x4018: SyncUpdateRectangle(ch0, data); SyncUpdateRectangle(ch1, data); diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CPU.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CPU.cs index a17c7b9..db10544 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CPU.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CPU.cs @@ -1110,7 +1110,7 @@ namespace VirtualNes.Core case 0xD2: /* JAM */ case 0xF2: /* JAM */ default: - if (!Supporter.Config.emulator.bIllegalOp) + if (!Supporter.S.Config.emulator.bIllegalOp) { throw new Exception("IllegalOp"); } diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper072.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper072.cs index 9fc7dc3..4ee74d2 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper072.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper072.cs @@ -40,7 +40,7 @@ namespace VirtualNes.Core Debuger.Log($"SOUND CODE:{addr & 0x1F:X2}"); // OSD銇仚銈嬨伖銇嶃亱鈥 - if (Supporter.Config.sound.bExtraSoundEnable) + if (Supporter.S.Config.sound.bExtraSoundEnable) { //TODO : 浼间箮VirtuaNES鏈夌洿鎺ユ挱鏀炬煇涓煶棰戞枃浠剁殑鍔熻兘 //DirectSound.EsfAllStop(); diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper086.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper086.cs index 694e267..038da74 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper086.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper086.cs @@ -43,7 +43,7 @@ namespace VirtualNes.Core } // OSD銇仚銈嬨伖銇嶃亱鈥 - if (Supporter.Config.sound.bExtraSoundEnable) + if (Supporter.S.Config.sound.bExtraSoundEnable) { //TODO : 浼间箮VirtuaNES鏈夌洿鎺ユ挱鏀炬煇涓煶棰戞枃浠剁殑鍔熻兘 //DirectSound.EsfAllStop(); diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper092.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper092.cs index 89d244b..2dcb122 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper092.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper092.cs @@ -57,7 +57,7 @@ namespace VirtualNes.Core 9,10, 8,11,13,12,14,15 }; // OSD銇仚銈嬨伖銇嶃亱鈥 - if (Supporter.Config.sound.bExtraSoundEnable) + if (Supporter.S.Config.sound.bExtraSoundEnable) { //TODO : 浼间箮VirtuaNES鏈夌洿鎺ユ挱鏀炬煇涓煶棰戞枃浠剁殑鍔熻兘 Debuger.Log($"CODE {data:X2}"); diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/NES.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/NES.cs index 93276bb..e334a58 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/NES.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/NES.cs @@ -326,7 +326,7 @@ namespace VirtualNes.Core if (pad.GetExController() != (int)EXCONTROLLER.EXCONTROLLER_TURBOFILE) return; - var fp = Supporter.OpenFile(Supporter.Config.path.szSavePath, "TurboFile.vtf"); + var fp = Supporter.S.OpenFile(Supporter.S.Config.path.szSavePath, "TurboFile.vtf"); try { if (fp == null) @@ -367,10 +367,10 @@ namespace VirtualNes.Core if (!rom.IsSAVERAM()) return; - var saveFileDir = Supporter.Config.path.szSavePath; + var saveFileDir = Supporter.S.Config.path.szSavePath; var saveFileName = $"{rom.GetRomName()}.sav"; - var fp = Supporter.OpenFile(saveFileDir, saveFileName); + var fp = Supporter.S.OpenFile(saveFileDir, saveFileName); try { @@ -502,13 +502,13 @@ namespace VirtualNes.Core EmulationCPU(nescfg.ScanlineCycles); if (bDraw) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } else { if (pad.IsZapperMode() && scanline == ZapperY) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } else { @@ -518,7 +518,7 @@ namespace VirtualNes.Core } else { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } } } @@ -535,13 +535,13 @@ namespace VirtualNes.Core EmulationCPU(nescfg.HDrawCycles); if (bDraw) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } else { if (pad.IsZapperMode() && scanline == ZapperY) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } else { @@ -551,7 +551,7 @@ namespace VirtualNes.Core } else { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } } } @@ -658,7 +658,7 @@ namespace VirtualNes.Core // 鍍楀儖鍎曚箷鍎炴槫澶(Scanline 1涔239) if (bDraw) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); ppu.ScanlineNext(); EmulationCPU(FETCH_CYCLES * 10); mapper.HSync(scanline); @@ -670,7 +670,7 @@ namespace VirtualNes.Core { if (pad.IsZapperMode() && scanline == ZapperY) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); ppu.ScanlineNext(); EmulationCPU(FETCH_CYCLES * 10); mapper.HSync(scanline); @@ -694,7 +694,7 @@ namespace VirtualNes.Core } else { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); ppu.ScanlineNext(); EmulationCPU(FETCH_CYCLES * 10); mapper.HSync(scanline); @@ -1095,7 +1095,7 @@ namespace VirtualNes.Core Debuger.Log($"Saving SAVERAM...[{romName}]"); - Supporter.SaveSRAMToFile(MMU.WRAM, romName); + Supporter.S.SaveSRAMToFile(MMU.WRAM, romName); } } @@ -1143,7 +1143,7 @@ namespace VirtualNes.Core } } - Supporter.SaveDISKToFile(contents.ToArray(), rom.GetRomName()); + Supporter.S.SaveDISKToFile(contents.ToArray(), rom.GetRomName()); } catch (Exception ex) { @@ -1168,7 +1168,7 @@ namespace VirtualNes.Core { Debuger.Log("Saving TURBOFILE..."); - Supporter.SaveFile(MMU.ERAM, Supporter.Config.path.szSavePath, "TurboFile.vtf"); + Supporter.S.SaveFile(MMU.ERAM, Supporter.S.Config.path.szSavePath, "TurboFile.vtf"); } } diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/PAD.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/PAD.cs index 2b2e5b4..f0cc6b3 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/PAD.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/PAD.cs @@ -181,7 +181,7 @@ namespace VirtualNes.Core } else { - if (Supporter.Config.emulator.bFourPlayer) + if (Supporter.S.Config.emulator.bFourPlayer) { // NES type pad1bit = padbitsync[0] | ((uint)padbitsync[2] << 8) | 0x00080000; diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/ROM.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/ROM.cs index 718c08f..53a1005 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/ROM.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/ROM.cs @@ -50,7 +50,7 @@ namespace VirtualNes.Core try { - fp = Supporter.OpenRom(fname); + fp = Supporter.S.OpenRom(fname); if (fp == null) { throw new System.Exception($"Open Rom Failed:[{fname}]"); @@ -167,7 +167,7 @@ namespace VirtualNes.Core lpPRG[3] = 0x1A; lpPRG[4] = (byte)diskno; - fp = Supporter.OpenFile_DISKSYS(); + fp = Supporter.S.OpenFile_DISKSYS(); if (fp == null) { throw new Exception($"Not found DISKSYS.ROM for [{fname}]"); @@ -217,7 +217,7 @@ namespace VirtualNes.Core throw new Exception($"Unsupport format:[{fname}]"); } - Supporter.GetFilePathInfo(fname, out fullpath, out path); + Supporter.S.GetRomPathInfo(fname, out fullpath, out path); name = Path.GetFileNameWithoutExtension(fullpath); if (!bNSF) { @@ -244,7 +244,7 @@ namespace VirtualNes.Core FileNameCheck(fname); - if (Supporter.TryGetMapperNo(this, out int mapperNo)) + if (Supporter.S.TryGetMapperNo(this, out int mapperNo)) { Debuger.Log($"ROMDB Set Mapper #{mapper:000} to #{mapperNo:000}"); mapper = mapperNo; diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/ControllerState.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/ControllerState.cs index 22b7bcc..5de2b97 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/ControllerState.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/ControllerState.cs @@ -51,9 +51,25 @@ namespace VirtualNes.Core public override int GetHashCode() { + //return CombineHashCode(raw0, raw1, raw2, raw3, valid); return HashCode.Combine(raw0, raw1, raw2, raw3, valid); } - + + /// + /// .NetStandard2.0缂栬瘧澶囩敤鍑芥暟 + /// + /// + /// + /// + /// + /// + /// + static int CombineHashCode(uint raw0, uint raw1, uint raw2, uint raw3, bool valid) + { + uint validUInt = valid ? 1u : 0u; + uint combinedHash = (raw0 * 31 + raw1) * 31 + raw2 * 31 + raw3 * 31 + validUInt; + return (int)combinedHash; + } public static bool operator ==(ControllerState left, ControllerState right) { return diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/Supporter.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/Supporter.cs index 3701159..3287ab8 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/Supporter.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/Supporter.cs @@ -1,77 +1,16 @@ -using System.IO; +锘縰sing System.IO; namespace VirtualNes.Core { public static class Supporter { private static ISupporterImpl s_support; + internal static ISupporterImpl S => s_support; public static void Setup(ISupporterImpl supporter) { s_support = supporter; } - - public static Stream OpenRom(string fname) - { - return s_support.OpenRom(fname); - } - - public static void GetFilePathInfo(string fname, out string fullPath, out string directPath) - { - s_support.GetRomPathInfo(fname, out fullPath, out directPath); - } - - public static Stream OpenFile_DISKSYS() - { - return s_support.OpenFile_DISKSYS(); - } - - public static void SaveSRAMToFile(byte[] sramContent, string romName) - { - s_support.SaveSRAMToFile(sramContent, romName); - } - - public static void SaveDISKToFile(byte[] diskFileContent, string romName) - { - s_support.SaveDISKToFile(diskFileContent, romName); - } - - public static void PrepareDirectory(string directPath) - { - s_support.PrepareDirectory(directPath); - } - - public static void SaveFile(byte[] fileData, string directPath, string fileName) - { - s_support.SaveFile(fileData, directPath, fileName); - } - - public static Stream OpenFile(string directPath, string fileName) - { - return s_support.OpenFile(directPath, fileName); - } - - public static bool TryGetMapperNo(ROM rom, out int mapperNo) - { - return s_support.TryGetMapperNo(rom, out mapperNo); - } - - public static ControllerState GetControllerState() - { - return s_support.GetControllerState(); - } - - public static void SampleInput(uint frameCount) - { - s_support.SampleInput(frameCount); - } - - public static IControllerSetuper GetControllerSetuper() - { - return s_support.GetControllerSetuper(); - } - - public static EmulatorConfig Config => s_support.Config; } public interface ISupporterImpl @@ -82,28 +21,11 @@ namespace VirtualNes.Core void SaveSRAMToFile(byte[] sramContent, string romName); void SaveDISKToFile(byte[] diskFileContent, string romName); EmulatorConfig Config { get; } - void PrepareDirectory(string directPath); void SaveFile(byte[] fileData, string directPath, string fileName); Stream OpenFile(string directPath, string fileName); bool TryGetMapperNo(ROM rom, out int mapperNo); ControllerState GetControllerState(); void SampleInput(uint frameCount); - IControllerSetuper GetControllerSetuper(); - } - - /// - /// 璐熻矗绠$悊鏈湴鎺у埗鍣ㄤ笌鍏蜂綋娓告垙涔嬮棿鐨勬Ы浣嶅垎閰 - /// - public interface IControllerSetuper - { - /// - /// 璁剧疆鏈湴鎵嬫焺涓庢父鎴忔墜鏌勬Ы浣嶇殑鏄犲皠 - /// - void SetConnect( - uint? con0ToSlot = null, - uint? con1ToSlot = null, - uint? con2ToSlot = null, - uint? con3ToSlot = null); } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Packages/manifest.json b/AxibugEmuOnline.Client/Packages/manifest.json index 847db9d..a91a4da 100644 --- a/AxibugEmuOnline.Client/Packages/manifest.json +++ b/AxibugEmuOnline.Client/Packages/manifest.json @@ -2,7 +2,6 @@ "dependencies": { "com.unity.2d.sprite": "1.0.0", "com.unity.ide.visualstudio": "2.0.22", - "com.unity.postprocessing": "3.4.0", "com.unity.ugui": "2.0.0", "com.unity.modules.accessibility": "1.0.0", "com.unity.modules.ai": "1.0.0", diff --git a/AxibugEmuOnline.Client/Packages/packages-lock.json b/AxibugEmuOnline.Client/Packages/packages-lock.json index 0bd47a4..cfb1599 100644 --- a/AxibugEmuOnline.Client/Packages/packages-lock.json +++ b/AxibugEmuOnline.Client/Packages/packages-lock.json @@ -22,15 +22,6 @@ }, "url": "https://packages.unity.cn" }, - "com.unity.postprocessing": { - "version": "3.4.0", - "depth": 0, - "source": "registry", - "dependencies": { - "com.unity.modules.physics": "1.0.0" - }, - "url": "https://packages.unity.cn" - }, "com.unity.test-framework": { "version": "1.4.5", "depth": 1, diff --git a/AxibugEmuOnline.Server/Manager/RoomManager.cs b/AxibugEmuOnline.Server/Manager/RoomManager.cs index 401e7e5..ccb09b5 100644 --- a/AxibugEmuOnline.Server/Manager/RoomManager.cs +++ b/AxibugEmuOnline.Server/Manager/RoomManager.cs @@ -12,1197 +12,1208 @@ using System.Security.Policy; namespace AxibugEmuOnline.Server { - public class RoomManager - { - Dictionary mDictRoom = new Dictionary(); - List mKeyRoomList = new List(); - AutoResetEvent roomTickARE; - Thread threadRoomTick; + public class RoomManager + { + Dictionary mDictRoom = new Dictionary(); + List mKeyRoomList = new List(); + AutoResetEvent roomTickARE; + Thread threadRoomTick; - int RoomIDSeed = 1; - public RoomManager() - { - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomList, OnCmdRoomList); - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomGetScreen, CmdRoomGetScreen); - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomCreate, OnCmdRoomCreate); - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomJoin, OnCmdRoomJoin); - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomLeave, OnCmdRoomLeave); - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomChangePlayerWithJoy, OnCmdRoomChangePlayerWithJoy); - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomHostPlayerUpdateStateRaw, OnHostPlayerUpdateStateRaw); - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomPlayerReady, OnRoomPlayerReady); - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomSingelPlayerInput, OnSingelPlayerInput); + int RoomIDSeed = 1; + public RoomManager() + { + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomList, OnCmdRoomList); + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomGetScreen, CmdRoomGetScreen); + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomCreate, OnCmdRoomCreate); + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomJoin, OnCmdRoomJoin); + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomLeave, OnCmdRoomLeave); + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomChangePlayerWithJoy, OnCmdRoomChangePlayerWithJoy); + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomHostPlayerUpdateStateRaw, OnHostPlayerUpdateStateRaw); + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomPlayerReady, OnRoomPlayerReady); + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomSingelPlayerInput, OnSingelPlayerInput); - NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdScreen, OnCmdScreen); + NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdScreen, OnCmdScreen); - roomTickARE = AppSrv.g_Tick.AddNewARE(TickManager.TickType.Interval_16MS); - threadRoomTick = new Thread(UpdateLoopTick); - threadRoomTick.Start(); + roomTickARE = AppSrv.g_Tick.AddNewARE(TickManager.TickType.Interval_16MS); + threadRoomTick = new Thread(UpdateLoopTick); + threadRoomTick.Start(); - //System.Timers.Timer mTimer16ms = new System.Timers.Timer(16);//瀹炰緥鍖朤imer绫 - //mTimer16ms.Elapsed += new System.Timers.ElapsedEventHandler((source, e) => { UpdateAllRoomLogic(); });//鍒拌揪鏃堕棿鐨勬椂鍊欐墽琛屼簨浠讹紱 - //mTimer16ms.AutoReset = true;//璁剧疆鏄墽琛屼竴娆★紙false锛夎繕鏄竴鐩存墽琛(true)锛 - //mTimer16ms.Enabled = true;//鏄惁鎵цSystem.Timers.Timer.Elapsed浜嬩欢锛 - //mTimer16ms.Start(); - } + //System.Timers.Timer mTimer16ms = new System.Timers.Timer(16);//瀹炰緥鍖朤imer绫 + //mTimer16ms.Elapsed += new System.Timers.ElapsedEventHandler((source, e) => { UpdateAllRoomLogic(); });//鍒拌揪鏃堕棿鐨勬椂鍊欐墽琛屼簨浠讹紱 + //mTimer16ms.AutoReset = true;//璁剧疆鏄墽琛屼竴娆★紙false锛夎繕鏄竴鐩存墽琛(true)锛 + //mTimer16ms.Enabled = true;//鏄惁鎵цSystem.Timers.Timer.Elapsed浜嬩欢锛 + //mTimer16ms.Start(); + } - #region 鎴块棿绠$悊 + #region 鎴块棿绠$悊 - int GetNewRoomID() - { - return RoomIDSeed++; - } + int GetNewRoomID() + { + return RoomIDSeed++; + } - void AddRoom(Data_RoomData data) - { - lock (mDictRoom) - { - if (!mDictRoom.ContainsKey(data.RoomID)) - { - mDictRoom.Add(data.RoomID, data); - mKeyRoomList.Add(data.RoomID); - } - } - } + void AddRoom(Data_RoomData data) + { + lock (mDictRoom) + { + if (!mDictRoom.ContainsKey(data.RoomID)) + { + mDictRoom.Add(data.RoomID, data); + mKeyRoomList.Add(data.RoomID); + } + } + } - void RemoveRoom(int RoomID) - { - lock (mDictRoom) - { - if (mDictRoom.ContainsKey(RoomID)) - { - mDictRoom.Remove(RoomID); - mKeyRoomList.Remove(RoomID); - } - } - } + void RemoveRoom(int RoomID) + { + lock (mDictRoom) + { + if (mDictRoom.ContainsKey(RoomID)) + { + mDictRoom.Remove(RoomID); + mKeyRoomList.Remove(RoomID); + } + } + } - public Data_RoomData GetRoomData(int RoomID) - { - if (!mDictRoom.TryGetValue(RoomID, out Data_RoomData data)) - return null; - return data; - } + public Data_RoomData GetRoomData(int RoomID) + { + if (!mDictRoom.TryGetValue(RoomID, out Data_RoomData data)) + return null; + return data; + } - public List GetRoomList() - { - lock (mDictRoom) - { - List temp = new List(); - foreach (var room in mDictRoom) - { - temp.AddRange(mDictRoom.Values); - } - return temp; - } - } + public List GetRoomList() + { + lock (mDictRoom) + { + List temp = new List(); + foreach (var room in mDictRoom) + { + temp.AddRange(mDictRoom.Values); + } + return temp; + } + } - #endregion + #endregion - #region + #region - public enum RoomLogType - { - Create = 0, - Join = 1, - Leave = 2 - } - public void RoomLog(long uid, int platform, int RoomID, int RomID, RoomLogType state) - { - MySqlConnection conn = Haoyue_SQLPoolManager.DequeueSQLConn("RoomLog"); - try - { - string query = "INSERT INTO `haoyue_emu`.`room_log` (`uid`, `platform`, `romid`,`roomid`, `state`) VALUES ( ?uid, ?platform, ?romid, ?roomid, ?state);"; - using (var command = new MySqlCommand(query, conn)) - { - // 璁剧疆鍙傛暟鍊 - command.Parameters.AddWithValue("?uid", uid); - command.Parameters.AddWithValue("?platform", platform); - command.Parameters.AddWithValue("?romid", RomID); - command.Parameters.AddWithValue("?roomid", RoomID); - command.Parameters.AddWithValue("?state", state); - command.ExecuteNonQuery(); - } + public enum RoomLogType + { + Create = 0, + Join = 1, + Leave = 2 + } + public void RoomLog(long uid, int platform, int RoomID, int RomID, RoomLogType state) + { + MySqlConnection conn = Haoyue_SQLPoolManager.DequeueSQLConn("RoomLog"); + try + { + string query = "INSERT INTO `haoyue_emu`.`room_log` (`uid`, `platform`, `romid`,`roomid`, `state`) VALUES ( ?uid, ?platform, ?romid, ?roomid, ?state);"; + using (var command = new MySqlCommand(query, conn)) + { + // 璁剧疆鍙傛暟鍊 + command.Parameters.AddWithValue("?uid", uid); + command.Parameters.AddWithValue("?platform", platform); + command.Parameters.AddWithValue("?romid", RomID); + command.Parameters.AddWithValue("?roomid", RoomID); + command.Parameters.AddWithValue("?state", state); + command.ExecuteNonQuery(); + } - if (state == RoomLogType.Create) - { - query = "update romlist_nes set playcount = playcount + 1 where id = ?romid"; - using (var command = new MySqlCommand(query, conn)) - { - command.Parameters.AddWithValue("?romid", RomID); - command.ExecuteNonQuery(); - } - } - } - catch (Exception e) - { - } - Haoyue_SQLPoolManager.EnqueueSQLConn(conn); - } - #endregion + if (state == RoomLogType.Create) + { + query = "update romlist_nes set playcount = playcount + 1 where id = ?romid"; + using (var command = new MySqlCommand(query, conn)) + { + command.Parameters.AddWithValue("?romid", RomID); + command.ExecuteNonQuery(); + } + } + } + catch (Exception e) + { + } + Haoyue_SQLPoolManager.EnqueueSQLConn(conn); + } + #endregion - private Protobuf_Room_MiniInfo GetProtoDataRoom(Data_RoomData room) - { - Protobuf_Room_MiniInfo result = new Protobuf_Room_MiniInfo() - { - GameRomID = room.GameRomID, - RoomID = room.RoomID, - GameRomHash = room.RomHash, - ScreenProviderUID = room.ScreenProviderUID, - HostPlayerUID = room.HostUID, - GameState = room.GameState, - ObsUserCount = 0,//TODO - }; + private Protobuf_Room_MiniInfo GetProtoDataRoom(Data_RoomData room) + { + Protobuf_Room_MiniInfo result = new Protobuf_Room_MiniInfo() + { + GameRomID = room.GameRomID, + RoomID = room.RoomID, + GameRomHash = room.RomHash, + ScreenProviderUID = room.ScreenProviderUID, + HostPlayerUID = room.HostUID, + GameState = room.GameState, + ObsUserCount = 0,//TODO + }; - for (byte i = 0; i < room.PlayerSlot.Count(); i++) - { - Protobuf_Room_GamePlaySlot pbSlot = new Protobuf_Room_GamePlaySlot(); - Data_RoomSlot slot = room.PlayerSlot[i]; - if (slot.UID > 0) - { - pbSlot.PlayerUID = slot.UID; - pbSlot.PlayerLocalJoyIdx = (int)slot.LocalJoyIdx; - if (AppSrv.g_ClientMgr.GetClientByUID(pbSlot.PlayerUID, out ClientInfo _client)) - pbSlot.PlayerNickName = _client.NickName; - } - result.GamePlaySlotList.Add(pbSlot); - } + for (byte i = 0; i < room.PlayerSlot.Count(); i++) + { + Protobuf_Room_GamePlaySlot pbSlot = new Protobuf_Room_GamePlaySlot(); + Data_RoomSlot slot = room.PlayerSlot[i]; + if (slot.UID > 0) + { + pbSlot.PlayerUID = slot.UID; + pbSlot.PlayerLocalJoyIdx = (int)slot.LocalJoyIdx; + if (AppSrv.g_ClientMgr.GetClientByUID(pbSlot.PlayerUID, out ClientInfo _client)) + pbSlot.PlayerNickName = _client.NickName; + } + result.GamePlaySlotList.Add(pbSlot); + } - return result; - } + return result; + } - public void OnCmdRoomList(Socket sk, byte[] reqData) - { - AppSrv.g_Log.DebugCmd($"OnCmdRoomList"); - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - Protobuf_Room_List msg = ProtoBufHelper.DeSerizlize(reqData); + public void OnCmdRoomList(Socket sk, byte[] reqData) + { + AppSrv.g_Log.DebugCmd($"OnCmdRoomList"); + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + Protobuf_Room_List msg = ProtoBufHelper.DeSerizlize(reqData); - Protobuf_Room_List_RESP resp = new Protobuf_Room_List_RESP(); - List temp = GetRoomList(); - foreach (var room in temp) - resp.RoomMiniInfoList.Add(GetProtoDataRoom(room)); - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomList, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); - } - public void CmdRoomGetScreen(Socket sk, byte[] reqData) - { - AppSrv.g_Log.DebugCmd($"CmdRoomGetScreen"); - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - Protobuf_Room_Get_Screen msg = ProtoBufHelper.DeSerizlize(reqData); + Protobuf_Room_List_RESP resp = new Protobuf_Room_List_RESP(); + List temp = GetRoomList(); + foreach (var room in temp) + resp.RoomMiniInfoList.Add(GetProtoDataRoom(room)); + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomList, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); + } + public void CmdRoomGetScreen(Socket sk, byte[] reqData) + { + AppSrv.g_Log.DebugCmd($"CmdRoomGetScreen"); + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + Protobuf_Room_Get_Screen msg = ProtoBufHelper.DeSerizlize(reqData); - Data_RoomData room = GetRoomData(_c.RoomState.RoomID); - bool bHadRoomStateChange = false; - ErrorCode Errcode = ErrorCode.ErrorOk; - Protobuf_Room_Get_Screen_RESP resp = new Protobuf_Room_Get_Screen_RESP(); - if (room == null) - Errcode = ErrorCode.ErrorRoomNotFound; - else - { - resp.FrameID = (int)room.mCurrServerFrameId; - resp.RoomID = room.RoomID; - resp.RawBitmap = room.ScreenRaw; - } + Data_RoomData room = GetRoomData(_c.RoomState.RoomID); + bool bHadRoomStateChange = false; + ErrorCode Errcode = ErrorCode.ErrorOk; + Protobuf_Room_Get_Screen_RESP resp = new Protobuf_Room_Get_Screen_RESP(); + if (room == null) + Errcode = ErrorCode.ErrorRoomNotFound; + else + { + resp.FrameID = (int)room.mCurrServerFrameId; + resp.RoomID = room.RoomID; + resp.RawBitmap = room.ScreenRaw; + } - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomGetScreen, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); - } + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomGetScreen, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); + } - /// - /// - /// - /// - /// //[0] 鏇存柊鎴栨柊澧 [1] 鍒犻櫎 - public void SendRoomUpdateToAll(Data_RoomData room, int type) - { - if (room == null) - return; + /// + /// + /// + /// + /// //[0] 鏇存柊鎴栨柊澧 [1] 鍒犻櫎 + public void SendRoomUpdateToAll(Data_RoomData room, int type) + { + if (room == null) + return; - Protobuf_Room_Update_RESP resp = new Protobuf_Room_Update_RESP() - { - UpdateType = type, - RoomMiniInfo = GetProtoDataRoom(room) - }; + Protobuf_Room_Update_RESP resp = new Protobuf_Room_Update_RESP() + { + UpdateType = type, + RoomMiniInfo = GetProtoDataRoom(room) + }; - AppSrv.g_ClientMgr.ClientSendALL((int)CommandID.CmdRoomListUpdate, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); - } + AppSrv.g_ClientMgr.ClientSendALL((int)CommandID.CmdRoomListUpdate, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); + } - public void OnCmdRoomCreate(Socket sk, byte[] reqData) - { - AppSrv.g_Log.DebugCmd($"OnCmdRoomCreate"); - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - Protobuf_Room_Create msg = ProtoBufHelper.DeSerizlize(reqData); - Protobuf_Room_Create_RESP resp = new Protobuf_Room_Create_RESP(); + public void OnCmdRoomCreate(Socket sk, byte[] reqData) + { + AppSrv.g_Log.DebugCmd($"OnCmdRoomCreate"); + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + Protobuf_Room_Create msg = ProtoBufHelper.DeSerizlize(reqData); + Protobuf_Room_Create_RESP resp = new Protobuf_Room_Create_RESP(); - Data_RoomData newRoom = new Data_RoomData(); - newRoom.Init(GetNewRoomID(), msg.GameRomID, msg.GameRomHash, _c.UID); - AddRoom(newRoom); - ErrorCode joinErrcode = ErrorCode.ErrorOk; - //鍔犲叆 - if (newRoom.Join(0, 0, _c, out joinErrcode, out bool bHadRoomStateChange)) - { - //鍒涘缓鎴愬姛涓嬭 - resp.RoomMiniInfo = GetProtoDataRoom(newRoom); - } - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomCreate, (int)joinErrcode, ProtoBufHelper.Serizlize(resp)); + Data_RoomData newRoom = new Data_RoomData(); + newRoom.Init(GetNewRoomID(), msg.GameRomID, msg.GameRomHash, _c.UID); + AddRoom(newRoom); + ErrorCode joinErrcode = ErrorCode.ErrorOk; + //鍔犲叆 + if (newRoom.Join(0, 0, _c, out joinErrcode, out bool bHadRoomStateChange)) + { + //鍒涘缓鎴愬姛涓嬭 + resp.RoomMiniInfo = GetProtoDataRoom(newRoom); + } + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomCreate, (int)joinErrcode, ProtoBufHelper.Serizlize(resp)); - if (joinErrcode == ErrorCode.ErrorOk && bHadRoomStateChange) - SendRoomStepChange(newRoom); + if (joinErrcode == ErrorCode.ErrorOk && bHadRoomStateChange) + SendRoomStepChange(newRoom); - SendRoomUpdateToAll(newRoom, 0); + SendRoomUpdateToAll(newRoom, 0); - RoomLog(_c.UID, 1, newRoom.RoomID, newRoom.GameRomID, RoomLogType.Create); - } + RoomLog(_c.UID, 1, newRoom.RoomID, newRoom.GameRomID, RoomLogType.Create); + } - public void OnCmdRoomJoin(Socket sk, byte[] reqData) - { - AppSrv.g_Log.DebugCmd($"OnCmdRoomJoin"); - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - Protobuf_Room_Join msg = ProtoBufHelper.DeSerizlize(reqData); - Protobuf_Room_Join_RESP resp = new Protobuf_Room_Join_RESP(); - ErrorCode joinErrcode; - Data_RoomData room = GetRoomData(msg.RoomID); - bool bHadRoomStateChange = false; - if (room == null) - { - joinErrcode = ErrorCode.ErrorRoomNotFound; + public void OnCmdRoomJoin(Socket sk, byte[] reqData) + { + AppSrv.g_Log.DebugCmd($"OnCmdRoomJoin"); + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + Protobuf_Room_Join msg = ProtoBufHelper.DeSerizlize(reqData); + Protobuf_Room_Join_RESP resp = new Protobuf_Room_Join_RESP(); + ErrorCode joinErrcode; + Data_RoomData room = GetRoomData(msg.RoomID); + bool bHadRoomStateChange = false; + if (room == null) + { + joinErrcode = ErrorCode.ErrorRoomNotFound; - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomJoin, (int)joinErrcode, ProtoBufHelper.Serizlize(resp)); - return; - } + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomJoin, (int)joinErrcode, ProtoBufHelper.Serizlize(resp)); + return; + } lock (room) - { + { - if (!room.GetFreeSlot(out uint SlotIdx)) + if (!room.GetFreeSlot(out uint SlotIdx)) { joinErrcode = ErrorCode.ErrorRoomSlotAlreadlyHadPlayer; AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomJoin, (int)joinErrcode, ProtoBufHelper.Serizlize(resp)); - return; + return; } //鍔犲叆 if (room.Join(SlotIdx, (uint)0, _c, out joinErrcode, out bHadRoomStateChange)) - { - Data_RoomData roomData = GetRoomData(msg.RoomID); - resp.RoomMiniInfo = GetProtoDataRoom(roomData); - } + { + Data_RoomData roomData = GetRoomData(msg.RoomID); + resp.RoomMiniInfo = GetProtoDataRoom(roomData); + } - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomJoin, (int)joinErrcode, ProtoBufHelper.Serizlize(resp)); - Protobuf_Room_MyRoom_State_Change(msg.RoomID); + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomJoin, (int)joinErrcode, ProtoBufHelper.Serizlize(resp)); + Protobuf_Room_MyRoom_State_Change(msg.RoomID); - if (joinErrcode == ErrorCode.ErrorOk && bHadRoomStateChange) - SendRoomStepChange(room); + if (joinErrcode == ErrorCode.ErrorOk && bHadRoomStateChange) + SendRoomStepChange(room); - if (room != null) - { - SendRoomUpdateToAll(room, 0); - } - } - RoomLog(_c.UID, 1, room.RoomID, room.GameRomID, RoomLogType.Join); - } - public void OnCmdRoomLeave(Socket sk, byte[] reqData) - { - AppSrv.g_Log.DebugCmd($"OnCmdRoomLeave"); - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - Protobuf_Room_Leave msg = ProtoBufHelper.DeSerizlize(reqData); - LeaveRoom(_c, msg.RoomID); - //Protobuf_Room_Leave_RESP resp = new Protobuf_Room_Leave_RESP(); - //ErrorCode errcode; - //Data_RoomData room = GetRoomData(_c.RoomState.RoomID); - //bool bHadRoomStateChange = false; - //if (room == null) - // errcode = ErrorCode.ErrorRoomNotFound; - //else - //{ - // if (room.Leave(_c, out errcode, out bHadRoomStateChange)) - // { - // resp.RoomID = msg.RoomID; - // } - //} - //AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomLeave, (int)errcode, ProtoBufHelper.Serizlize(resp)); - //Protobuf_Room_MyRoom_State_Change(msg.RoomID); - - //if (errcode == ErrorCode.ErrorOk && bHadRoomStateChange) - // SendRoomStepChange(room); - - //SendRoomUpdateToAll(room.RoomID, 1); - //if (room.GetPlayerCount() < 1) - // RemoveRoom(room.RoomID); - } - public void LeaveRoom(ClientInfo _c, int RoomID) - { - AppSrv.g_Log.Debug($"LeaveRoom"); - if (RoomID < 0) - return; - Protobuf_Room_Leave_RESP resp = new Protobuf_Room_Leave_RESP(); - ErrorCode errcode; - Data_RoomData room = GetRoomData(_c.RoomState.RoomID); - bool bHadRoomStateChange = false; - if (room == null) - { - errcode = ErrorCode.ErrorRoomNotFound; - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomLeave, (int)errcode, ProtoBufHelper.Serizlize(resp)); - return; - } - - if (room.Leave(_c, out errcode, out bHadRoomStateChange)) - { - resp.RoomID = RoomID; - } - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomLeave, (int)errcode, ProtoBufHelper.Serizlize(resp)); - Protobuf_Room_MyRoom_State_Change(RoomID); - - if (errcode == ErrorCode.ErrorOk && bHadRoomStateChange) - SendRoomStepChange(room); - - if (room.GetPlayerCount() < 1) - { - SendRoomUpdateToAll(room, 1); - RemoveRoom(room.RoomID); - } - else - SendRoomUpdateToAll(room, 0); - - RoomLog(_c.UID, 1, room.RoomID, room.GameRomID, RoomLogType.Leave); - } - - public void OnCmdRoomChangePlayerWithJoy(Socket sk, byte[] reqData) - { - AppSrv.g_Log.DebugCmd($"OnCmdRoomChangePlayerjoySlot"); - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - Protobuf_Room_Change_PlaySlotWithJoy msg = ProtoBufHelper.DeSerizlize(reqData); - Protobuf_Room_Change_PlaySlotWithJoy_RESP resp = new Protobuf_Room_Change_PlaySlotWithJoy_RESP(); - ErrorCode errcode = ErrorCode.ErrorOk; - Data_RoomData room = GetRoomData(_c.RoomState.RoomID); - if (room == null) - errcode = ErrorCode.ErrorRoomNotFound; - - if (errcode == ErrorCode.ErrorOk) - { - Dictionary newSlotIdx2JoyIdx = new Dictionary(); - foreach (var slotinfo in msg.SlotWithJoy) - { - //濡傛灉鏈変换鎰忎竴涓Ы浣嶆湁浜 - if (room.GetPlayerUIDByIdx((uint)slotinfo.PlayerSlotIdx, out long UID)) - { - //涓斾汉涓嶆槸鑷繁锛屽垯涓嶅厑璁告崲浣 - if(UID != _c.UID) - errcode = ErrorCode.ErrorRoomSlotAlreadlyHadPlayer; break; - } - - newSlotIdx2JoyIdx[(uint)slotinfo.PlayerSlotIdx] = (uint)slotinfo.PlayerLocalJoyIdx; - } - - room.SetPlayerSlotData(_c,ref newSlotIdx2JoyIdx); - } - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomMyRoomStateChanged, (int)errcode, ProtoBufHelper.Serizlize(resp)); - } - - public void OnHostPlayerUpdateStateRaw(Socket sk, byte[] reqData) - { - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - AppSrv.g_Log.DebugCmd($"OnHostPlayerUpdateStateRaw 涓婃姤鍗虫椂瀛樻。 UID->{_c.UID}"); - Protobuf_Room_HostPlayer_UpdateStateRaw msg = ProtoBufHelper.DeSerizlize(reqData); - Protobuf_Room_HostPlayer_UpdateStateRaw_RESP resp = new Protobuf_Room_HostPlayer_UpdateStateRaw_RESP(); - ErrorCode errcode = ErrorCode.ErrorOk; - Data_RoomData room = GetRoomData(_c.RoomState.RoomID); - if (room == null) - errcode = ErrorCode.ErrorRoomNotFound; - else if (room.GameState != RoomGameState.WaitRawUpdate) - errcode = ErrorCode.ErrorRoomCantDoCurrState; - - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomHostPlayerUpdateStateRaw, (int)errcode, ProtoBufHelper.Serizlize(resp)); - - if (errcode == ErrorCode.ErrorOk) - { - room.SetLoadRaw(msg.LoadStateRaw, out bool bHadRoomStateChange); - if (bHadRoomStateChange) - SendRoomStepChange(room); - } - } - - public void OnRoomPlayerReady(Socket sk, byte[] reqData) - { - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - AppSrv.g_Log.DebugCmd($"OnRoomPlayerReady _c->{_c.UID}"); - Protobuf_Room_Player_Ready msg = ProtoBufHelper.DeSerizlize(reqData); - ErrorCode errcode = ErrorCode.ErrorOk; - Data_RoomData room = GetRoomData(_c.RoomState.RoomID); - if (room == null) - return; - lock (room) - { - AppSrv.g_Log.Debug($"SetRePlayerReady RoomID->{room.RoomID},UID->{_c.UID}"); - room.SetRePlayerReady(_c.UID, out errcode, out bool bHadRoomStateChange); - if (bHadRoomStateChange) - { - SendRoomStepChange(room); - } - } - } - - public void OnSingelPlayerInput(Socket sk, byte[] reqData) - { - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - Protobuf_Room_SinglePlayerInputData msg = ProtoBufHelper.DeSerizlize(reqData); - Data_RoomData room = GetRoomData(_c.RoomState.RoomID); - if (room == null) - return; - - //鍙栫帺瀹舵搷浣滄暟鎹腑鐨勭涓涓 - ServerInputSnapShot temp = new ServerInputSnapShot(); - temp.all = msg.InputData; - //room.SetPlayerInput(_c.RoomState.PlayerIdx, msg.FrameID, temp); - - //鏄惁闇瑕佹帹甯 - if (room.GetNeedForwardTick(msg.FrameID, out long forwaFrame)) - { - for (int i = 0; i < forwaFrame; i++) - { - if (i + 1 == forwaFrame)//鏈鍚庝竴甯 - { - //鍐欏叆鎿嶄綔鍓嶃佸皢缃戠粶娉㈠姩鍫嗙Н锛屽彲鑳介犳垚鐬椂澶氫釜杩炵画鎺ㄥ抚缁撴灉锛堟渶鍚庝竴甯ч櫎澶栵級绔嬪嵆骞挎挱锛屼笉绛16msTick - //if (forwaFrame > 1) - // room.SynInputData(); - - //鎺ㄥ抚杩囩▼涓紝鏈鍚庝竴甯ф墠鍐欏叆鎿嶄綔 - room.SetPlayerInput(_c.UID, msg.FrameID, temp); - } - //鎺ㄥ抚 - room.TakeFrame(); - } - } - else//涓嶉渶瑕佹帹甯 - { - //铏界劧涓嶆帹甯э紝浣嗘槸瀛樺叆Input - room.SetPlayerInput(_c.UID, msg.FrameID, temp); - } - - if (room.LastTestRecv != room.mCurrInputData.all) - { - room.LastTestRecv = room.mCurrInputData.all; - //AppSrv.g_Log.Debug($" {DateTime.Now.ToString("hh:mm:ss.fff")} SynTestRecv=> UID->{_c.UID} roomId->{room.mCurrServerFrameId} input->{msg.InputData}"); - } - } - - public void OnCmdScreen(Socket sk, byte[] reqData) - { - AppSrv.g_Log.DebugCmd($"OnCmdScreen lenght:{reqData.Length}"); - ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); - Protobuf_Screnn_Frame msg = ProtoBufHelper.DeSerizlize(reqData); - Data_RoomData room = AppSrv.g_Room.GetRoomData(msg.RoomID); - room.InputScreenData(msg.RawBitmap); - } - - /// - /// 骞挎挱鎴块棿鐘舵佸彉鍖 - /// - /// - public void Protobuf_Room_MyRoom_State_Change(int RoomID) - { - Data_RoomData room = GetRoomData(RoomID); - if (room == null) - return; - - Protobuf_Room_MyRoom_State_Change resp = new Protobuf_Room_MyRoom_State_Change() - { - RoomMiniInfo = GetProtoDataRoom(room) - }; - - List userlist = room.GetAllPlayerClientList(); - - foreach (ClientInfo _c in userlist) - { - AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomMyRoomStateChanged, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); - } - } - - /// - /// 骞挎挱鑱旀満Step - /// - /// - public void SendRoomStepChange(Data_RoomData room) - { - List roomClient = room.GetAllPlayerClientList(); - switch (room.GameState) - { - case RoomGameState.WaitRawUpdate: - { - Protobuf_Room_WaitStep_RESP resp = new Protobuf_Room_WaitStep_RESP() - { - WaitStep = 0 - }; - AppSrv.g_Log.DebugCmd($"Step:0 WaitRawUpdate 骞挎挱绛夊緟涓绘満涓婃姤鍗虫椂瀛樻。"); - AppSrv.g_ClientMgr.ClientSend(roomClient, (int)CommandID.CmdRoomWaitStep, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); - } - break; - case RoomGameState.WaitReady: - { - Protobuf_Room_WaitStep_RESP resp = new Protobuf_Room_WaitStep_RESP() - { - WaitStep = 1, - LoadStateRaw = room.NextStateRaw - }; - AppSrv.g_Log.DebugCmd($"Step:1 WaitReady 骞挎挱鍗虫椂瀛樻。"); - AppSrv.g_ClientMgr.ClientSend(roomClient, (int)CommandID.CmdRoomWaitStep, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); - } - break; - case RoomGameState.InOnlineGame: - { - Protobuf_Room_WaitStep_RESP resp = new Protobuf_Room_WaitStep_RESP() - { - WaitStep = 2, - }; - AppSrv.g_Log.DebugCmd($"Step:2 InOnlineGame 骞挎挱寮濮嬫父鎴"); - AppSrv.g_ClientMgr.ClientSend(roomClient, (int)CommandID.CmdRoomWaitStep, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); - } - break; - } - } - - #region 鎴块棿甯у惊鐜 - void UpdateLoopTick() - { - while (true) - { - roomTickARE.WaitOne(); - UpdateAllRoomLogic(); - } - } - void UpdateAllRoomLogic() - { - if (mKeyRoomList.Count < 1) - return; - for (int i = 0; i < mKeyRoomList.Count; i++) - { - int roomid = mKeyRoomList[i]; - if (!mDictRoom.TryGetValue(roomid, out Data_RoomData room) || room.GameState < RoomGameState.InOnlineGame) - continue; - //鏇存柊甯 - //room.TakeFrame(); - //骞挎挱 - room.SynInputData(); - } - } - #endregion - } - - public class Data_RoomData - { - public int RoomID { get; private set; } - public int GameRomID { get; private set; } - public string RomHash { get; private set; } - public long HostUID { get; private set; } - public long ScreenProviderUID { get; private set; } - public Data_RoomSlot[] PlayerSlot; - public long Player1_UID => PlayerSlot[0].UID; - public long Player2_UID => PlayerSlot[1].UID; - public long Player3_UID => PlayerSlot[2].UID; - public long Player4_UID => PlayerSlot[3].UID; - public Google.Protobuf.ByteString? NextStateRaw { get; private set; } - public Google.Protobuf.ByteString? ScreenRaw { get; private set; } - //public bool[] PlayerReadyState { get; private set; } - public List SynUIDs; - //public RoomPlayerState PlayerState => getPlayerState(); - private RoomGameState mGameState; - public uint mCurrServerFrameId = 0; - public ServerInputSnapShot mCurrInputData; - public Queue<(uint, ServerInputSnapShot)> mInputQueue; - object synInputLock = new object(); - //TODO - public Dictionary> mDictPlayerIdx2SendQueue; - public RoomGameState GameState - { - get { return mGameState; } - set - { - if (mGameState != value) - { - mGameState = value; - switch (value) - { - case RoomGameState.WaitRawUpdate: - NextStateRaw = null; - break; - case RoomGameState.WaitReady: - ClearAllSlotReadyState();//娓呯悊鐜╁鎵鏈夊噯澶囩姸鎬 - break; - } - } - } - } - /// - /// 鏈嶅姟鍣ㄦ彁鍓嶅抚鏁 - /// - public uint SrvForwardFrames { get; set; } - public void Init(int roomID, int gameRomID, string roomHash, long hostUId, bool bloadState = false) - { - RoomID = roomID; - GameRomID = gameRomID; - RomHash = roomHash; - HostUID = hostUId; - ScreenProviderUID = hostUId; - - if (PlayerSlot == null) - PlayerSlot = new Data_RoomSlot[4]; - - for (uint i = 0; i < PlayerSlot.Length; i++) - PlayerSlot[i].Init(i); - - //PlayerReadyState = new bool[4]; - SynUIDs = new List();//骞挎挱瑙掕壊鍒楄〃 - GameState = RoomGameState.NoneGameState; - mCurrInputData = new ServerInputSnapShot(); - mInputQueue = new Queue<(uint, ServerInputSnapShot)>(); - mDictPlayerIdx2SendQueue = new Dictionary>(); - } - public Dictionary GetSlotDataByUID(long uid) - { - Dictionary slotIdx2JoyIdx = new Dictionary(); - var dataarr = PlayerSlot.Where(w => w.UID == uid).ToArray(); - foreach (var slot in dataarr) - slotIdx2JoyIdx[slot.SlotIdx] = slot.LocalJoyIdx; - return slotIdx2JoyIdx; - } - /// - /// 鎸夌収SlotIdx璁剧疆Input - /// - /// - void SetInputDataBySlotIdx(uint slotIdx, byte val) - { - switch (slotIdx) - { - case 0: mCurrInputData.p1_byte = val; break; - case 1: mCurrInputData.p2_byte = val; break; - case 2: mCurrInputData.p3_byte = val; break; - case 4: mCurrInputData.p3_byte = val; break; - } - } - /// - /// 鎸夌収UID娓呯悊SlotData - /// - /// - void ClearSlotDataByUid(long uid) - { - var dataarr = PlayerSlot.Where(w => w.UID == uid).ToArray(); - foreach (var slot in dataarr) - { - dataarr[slot.SlotIdx].Init(slot.SlotIdx); - ClearInputDataBySlotIdx(slot.SlotIdx); - } - } - /// - /// 鎸夌収SlotIdx娓呯悊SlotData - /// - /// - void ClearSlotDataBySlotIdx(uint slotIdx) - { - PlayerSlot[slotIdx].Init(slotIdx); - ClearInputDataBySlotIdx(slotIdx); - } - /// - /// 鎸夌収SlotIdx娓呯悊Input - /// - /// - void ClearInputDataBySlotIdx(uint slotIdx) - { - switch (slotIdx) - { - case 0: mCurrInputData.p1_byte = 0; break; - case 1: mCurrInputData.p2_byte = 0; break; - case 2: mCurrInputData.p3_byte = 0; break; - case 4: mCurrInputData.p3_byte = 0; break; - } - } - /// - /// 鏇存柊鍚屾鍚嶅崟 - /// - void UpdateSynUIDs() - { - for (int i = SynUIDs.Count - 1; i >= 0; i--) - { - long uid = SynUIDs[i]; - - bool bHad = false; - if (Player1_UID == uid) bHad = true; - else if (Player2_UID == uid) bHad = true; - else if (Player3_UID == uid) bHad = true; - else if (Player4_UID == uid) bHad = true; - if (bHad) - SynUIDs.RemoveAt(i); - } - if (!SynUIDs.Contains(Player1_UID)) SynUIDs.Add(Player1_UID); - if (!SynUIDs.Contains(Player2_UID)) SynUIDs.Add(Player2_UID); - if (!SynUIDs.Contains(Player3_UID)) SynUIDs.Add(Player3_UID); - if (!SynUIDs.Contains(Player4_UID)) SynUIDs.Add(Player4_UID); - } - - #region 鍑嗗鐘舵佺鐞 - bool IsAllReady() - { - bool Ready = true; - if ( - (Player1_UID > 0 && !PlayerSlot[0].Ready) - || - (Player2_UID > 0 && !PlayerSlot[1].Ready) - || - (Player3_UID > 0 && !PlayerSlot[2].Ready) - || - (Player4_UID > 0 && !PlayerSlot[3].Ready) - ) - { - Ready = false; - } - return Ready; - } - /// - /// 娓呴櫎鎵鏈夋Ы浣嶅噯澶囩姸鎬 - /// - void ClearAllSlotReadyState() - { - for (var i = 0; i < PlayerSlot.Length; i++) - { - PlayerSlot[i].Ready = false; - } - } - /// - /// 鎸夌収UID璁剧疆Ready淇℃伅 - /// - /// - void SetReadyByUid(long uid) - { - for (var i = 0; i < PlayerSlot.Length; i++) - { - if (PlayerSlot[i].UID == uid) - PlayerSlot[i].Ready = true; - } - } - #endregion - - public void SetPlayerSlotData(ClientInfo _c, ref readonly Dictionary newSlotIdx2JoyIdx) - { - Dictionary oldSlotIdx2JoyIdx = GetSlotDataByUID(_c.UID); - HashSet diffSlotIdxs = new HashSet(); - foreach (var old in oldSlotIdx2JoyIdx) - { - uint old_slotIdx = old.Key; - //濡傛灉鏃т綅缃凡缁忎笉瀛樺湪浜庢柊浣嶇疆锛屽垯闇瑕佺畻浣渄iff - if (!newSlotIdx2JoyIdx.ContainsKey(old_slotIdx)) - { - diffSlotIdxs.Add(old_slotIdx); continue; - } - uint old_slotjoyIdx = old.Value; - //濡傛灉鏃т綅缃笉鍙橈紝浣嗗鎴风鏈湴JoyIdx鍙樺寲鍒欑畻浣渄iff - if (old_slotjoyIdx != newSlotIdx2JoyIdx[old_slotIdx]) - { - diffSlotIdxs.Add(old_slotIdx); continue; - } - } - //濡傛灉鏄湪鏃ф暟鎹腑涓嶅瓨鍦ㄧ殑浣嶇疆锛屽垯绠椾綔diff - foreach (var newdata in newSlotIdx2JoyIdx) - { - uint new_slotIdx = newdata.Key; - if (!oldSlotIdx2JoyIdx.ContainsKey(new_slotIdx)) - { - diffSlotIdxs.Add(new_slotIdx); continue; - } - } - //蹇呰鐨刣iff slot 娓呯悊閿兼暟鎹 - foreach (var diffSlotIdx in diffSlotIdxs) - { - ClearSlotDataBySlotIdx(diffSlotIdx); - } - //璁剧疆鏂扮殑妲戒綅 - foreach (var slotdata in newSlotIdx2JoyIdx) - { - PlayerSlot[slotdata.Key].LocalJoyIdx = slotdata.Value; - AppSrv.g_Log.Debug($"SetPlayerUID RoomID->{RoomID} _c.UID->{_c.UID} PlayerSlotIdx->{slotdata.Key} LocalJoyIdx->{slotdata.Value}"); - } - //鏇存柊闇瑕佸悓姝ョ殑UID - UpdateSynUIDs(); - _c.RoomState.SetRoomData(this.RoomID); - } - public void RemovePlayer(ClientInfo _c) - { - ClearSlotDataByUid(_c.UID); - UpdateSynUIDs(); - _c.RoomState.ClearRoomData(); - } - public bool GetPlayerUIDByIdx(uint Idx, out long UID) - { - switch (Idx) - { - case 0: UID = Player1_UID; break; - case 1: UID = Player2_UID; break; - case 2: UID = Player3_UID; break; - case 3: UID = Player4_UID; break; - default: UID = -1; break; - } - return UID > 0; - } - public bool GetFreeSlot(out uint SlotIdx) - { - for (uint i = 0; i < PlayerSlot.Length; i++) - { - if (PlayerSlot[i].UID < 0) - { - SlotIdx = i; - return true; - } - } - SlotIdx = 0; - return false; + if (room != null) + { + SendRoomUpdateToAll(room, 0); + } + } + RoomLog(_c.UID, 1, room.RoomID, room.GameRomID, RoomLogType.Join); } - public bool GetPlayerClientByIdx(uint Idx, out ClientInfo _c) - { - _c = null; - if (!GetPlayerUIDByIdx(Idx, out long UID)) - return false; + public void OnCmdRoomLeave(Socket sk, byte[] reqData) + { + AppSrv.g_Log.DebugCmd($"OnCmdRoomLeave"); + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + Protobuf_Room_Leave msg = ProtoBufHelper.DeSerizlize(reqData); + LeaveRoom(_c, msg.RoomID); + //Protobuf_Room_Leave_RESP resp = new Protobuf_Room_Leave_RESP(); + //ErrorCode errcode; + //Data_RoomData room = GetRoomData(_c.RoomState.RoomID); + //bool bHadRoomStateChange = false; + //if (room == null) + // errcode = ErrorCode.ErrorRoomNotFound; + //else + //{ + // if (room.Leave(_c, out errcode, out bHadRoomStateChange)) + // { + // resp.RoomID = msg.RoomID; + // } + //} + //AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomLeave, (int)errcode, ProtoBufHelper.Serizlize(resp)); + //Protobuf_Room_MyRoom_State_Change(msg.RoomID); - if (!AppSrv.g_ClientMgr.GetClientByUID(UID, out _c)) - return false; + //if (errcode == ErrorCode.ErrorOk && bHadRoomStateChange) + // SendRoomStepChange(room); - return true; - } - public List GetAllPlayerClientList() - { - List list = new List(); - List Uids = SynUIDs; - foreach (long uid in Uids) - { - if (!AppSrv.g_ClientMgr.GetClientByUID(uid, out ClientInfo _c, true)) - continue; - list.Add(_c); - } - return list; - } + //SendRoomUpdateToAll(room.RoomID, 1); + //if (room.GetPlayerCount() < 1) + // RemoveRoom(room.RoomID); + } + public void LeaveRoom(ClientInfo _c, int RoomID) + { + AppSrv.g_Log.Debug($"LeaveRoom"); + if (RoomID < 0) + return; + Protobuf_Room_Leave_RESP resp = new Protobuf_Room_Leave_RESP(); + ErrorCode errcode; + Data_RoomData room = GetRoomData(_c.RoomState.RoomID); + bool bHadRoomStateChange = false; + if (room == null) + { + errcode = ErrorCode.ErrorRoomNotFound; + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomLeave, (int)errcode, ProtoBufHelper.Serizlize(resp)); + return; + } - void SetInputBySlotIdxJoyIdx(uint SlotIdx, uint LocalJoyIdx, ServerInputSnapShot clieninput) - { - switch (LocalJoyIdx) - { - case 0: SetInputDataBySlotIdx(SlotIdx, clieninput.p1_byte); break; - case 1: SetInputDataBySlotIdx(SlotIdx, clieninput.p2_byte); break; - case 2: SetInputDataBySlotIdx(SlotIdx, clieninput.p3_byte); break; - case 3: SetInputDataBySlotIdx(SlotIdx, clieninput.p4_byte); break; - } - } - public int GetPlayerCount() - { - return SynUIDs.Count; - } - public void UpdateRoomForwardNum() - { - List playerlist = GetAllPlayerClientList(); - double maxNetDelay = 0; - for (int i = 0; i < playerlist.Count; i++) - { - ClientInfo player = playerlist[i]; - maxNetDelay = Math.Max(maxNetDelay, player.AveNetDelay); - } - float MustTaskFrame = 1; - SrvForwardFrames = (uint)((maxNetDelay / 0.016f) + MustTaskFrame); - if (SrvForwardFrames < 2) - SrvForwardFrames = 2; - //AppSrv.g_Log.Debug($"鏈嶅姟鍣ㄦ彁鍓嶈窇甯ф暟锛歁ax(2,({maxNetDelay} / {0.016f}) + {MustTaskFrame}) = {SrvForwardFrames}"); - } + if (room.Leave(_c, out errcode, out bHadRoomStateChange)) + { + resp.RoomID = RoomID; + } + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomLeave, (int)errcode, ProtoBufHelper.Serizlize(resp)); + Protobuf_Room_MyRoom_State_Change(RoomID); - #region 甯х浉鍏 - void StartNewTick() - { - mInputQueue.Clear(); - mDictPlayerIdx2SendQueue.Clear(); + if (errcode == ErrorCode.ErrorOk && bHadRoomStateChange) + SendRoomStepChange(room); - mCurrServerFrameId = 0; - mCurrInputData.all = 1; + if (room.GetPlayerCount() < 1) + { + SendRoomUpdateToAll(room, 1); + RemoveRoom(room.RoomID); + } + else + SendRoomUpdateToAll(room, 0); - UpdateRoomForwardNum(); + RoomLog(_c.UID, 1, room.RoomID, room.GameRomID, RoomLogType.Leave); + } - uint StartForwardFrames = (SrvForwardFrames * 2) + 5; - StartForwardFrames = Math.Min(10, StartForwardFrames); - //鏈嶅姟鍣ㄦ彁鍓嶈窇甯ф暟 - for (int i = 0; i < SrvForwardFrames; i++) - TakeFrame(); - AppSrv.g_Log.Info($"鎴块棿鍒濆鎻愬墠閲=>{StartForwardFrames}锛屽綋鍓嶅欢杩熸彁鍓嶉噺=>{SrvForwardFrames}"); - } - public void TakeFrame() - { - lock (synInputLock) - { - mInputQueue.Enqueue((mCurrServerFrameId, mCurrInputData)); - mCurrServerFrameId++; - if (mCurrServerFrameId % 60 == 0) - { - UpdateRoomForwardNum(); - } - } - } - #endregion + public void OnCmdRoomChangePlayerWithJoy(Socket sk, byte[] reqData) + { + AppSrv.g_Log.DebugCmd($"OnCmdRoomChangePlayerjoySlot"); + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + Protobuf_Room_Change_PlaySlotWithJoy msg = ProtoBufHelper.DeSerizlize(reqData); + Protobuf_Room_Change_PlaySlotWithJoy_RESP resp = new Protobuf_Room_Change_PlaySlotWithJoy_RESP(); + ErrorCode errcode = ErrorCode.ErrorOk; + Data_RoomData room = GetRoomData(_c.RoomState.RoomID); + if (room == null) + { + errcode = ErrorCode.ErrorRoomNotFound; + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomChangePlayerWithJoy, (int)errcode, ProtoBufHelper.Serizlize(resp)); + return; + } - ulong LastTestSend = 0; - internal ulong LastTestRecv; + Dictionary newSlotIdx2JoyIdx = new Dictionary(); + foreach (var slotinfo in msg.SlotWithJoy) + { + //濡傛灉鏈変换鎰忎竴涓Ы浣嶆湁浜 + if (room.GetPlayerUIDByIdx((uint)slotinfo.PlayerSlotIdx, out long UID)) + { + //涓斾汉涓嶆槸鑷繁锛屽垯涓嶅厑璁告崲浣 + if (UID != _c.UID) + { + errcode = ErrorCode.ErrorRoomSlotAlreadlyHadPlayer; + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomChangePlayerWithJoy, (int)errcode, ProtoBufHelper.Serizlize(resp)); + return; + } + } + newSlotIdx2JoyIdx[(uint)slotinfo.PlayerSlotIdx] = (uint)slotinfo.PlayerLocalJoyIdx; + } + room.SetPlayerSlotData(_c, ref newSlotIdx2JoyIdx); - public List send2time = new List(); - const int SynLimitOnSec = 63; + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomChangePlayerWithJoy, (int)errcode, ProtoBufHelper.Serizlize(resp)); - /// - /// 骞挎挱鏁版嵁 - /// - public void SynInputData() - { - List<(uint frameId, ServerInputSnapShot inputdata)> temp = null; - bool flagInitList = false; - lock (synInputLock) - { - double timeNow = AppSrv.g_Tick.timeNow; - while (mInputQueue.Count > 0) - { - if (send2time.Count >= SynLimitOnSec) - { - //AppSrv.g_Log.Info($"{timeNow} - {send2time[0]} =>{timeNow - send2time[0]}"); - if (timeNow - send2time[0] < 1f) //鏈鏃╃殑鍘嗗彶鍙戦佽繕鍦ㄤ竴绉掍箣鍐 - break; - else - send2time.RemoveAt(0); - } + Protobuf_Room_MyRoom_State_Change(room.RoomID); + } - if (!flagInitList) - { - flagInitList = true; - temp = new List<(uint frameId, ServerInputSnapShot inputdata)>(); - } - temp.Add(mInputQueue.Dequeue()); - send2time.Add(timeNow); - } - //while (mInputQueue.Count > 0) - //{ - // temp.Add(mInputQueue.Dequeue()); - //} - } + public void OnHostPlayerUpdateStateRaw(Socket sk, byte[] reqData) + { + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + AppSrv.g_Log.DebugCmd($"OnHostPlayerUpdateStateRaw 涓婃姤鍗虫椂瀛樻。 UID->{_c.UID}"); + Protobuf_Room_HostPlayer_UpdateStateRaw msg = ProtoBufHelper.DeSerizlize(reqData); + Protobuf_Room_HostPlayer_UpdateStateRaw_RESP resp = new Protobuf_Room_HostPlayer_UpdateStateRaw_RESP(); + ErrorCode errcode = ErrorCode.ErrorOk; + Data_RoomData room = GetRoomData(_c.RoomState.RoomID); + if (room == null) + errcode = ErrorCode.ErrorRoomNotFound; + else if (room.GameState != RoomGameState.WaitRawUpdate) + errcode = ErrorCode.ErrorRoomCantDoCurrState; - if (!flagInitList) - return; + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomHostPlayerUpdateStateRaw, (int)errcode, ProtoBufHelper.Serizlize(resp)); - for (int i = 0; i < temp.Count; i++) - { - (uint frameId, ServerInputSnapShot inputdata) data = temp[i]; + if (errcode == ErrorCode.ErrorOk) + { + room.SetLoadRaw(msg.LoadStateRaw, out bool bHadRoomStateChange); + if (bHadRoomStateChange) + SendRoomStepChange(room); + } + } - Protobuf_Room_Syn_RoomFrameAllInputData resp = new Protobuf_Room_Syn_RoomFrameAllInputData() - { - FrameID = data.frameId, - InputData = data.inputdata.all, - ServerFrameID = mCurrServerFrameId, - ServerForwardCount = this.SrvForwardFrames - }; - AppSrv.g_ClientMgr.ClientSend(SynUIDs, (int)CommandID.CmdRoomSynPlayerInput, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); - //if (LastTestSend != data.inputdata.all) - //{ - // LastTestSend = data.inputdata.all; - // AppSrv.g_Log.Debug($" {DateTime.Now.ToString("hh:mm:ss.fff")} SynInput=> RoomID->{RoomID} ServerFrameID->{mCurrServerFrameId} SynUIDs=>{string.Join(",", SynUIDs)} "); - //} - } - } + public void OnRoomPlayerReady(Socket sk, byte[] reqData) + { + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + AppSrv.g_Log.DebugCmd($"OnRoomPlayerReady _c->{_c.UID}"); + Protobuf_Room_Player_Ready msg = ProtoBufHelper.DeSerizlize(reqData); + ErrorCode errcode = ErrorCode.ErrorOk; + Data_RoomData room = GetRoomData(_c.RoomState.RoomID); + if (room == null) + return; + lock (room) + { + AppSrv.g_Log.Debug($"SetRePlayerReady RoomID->{room.RoomID},UID->{_c.UID}"); + room.SetRePlayerReady(_c.UID, out errcode, out bool bHadRoomStateChange); + if (bHadRoomStateChange) + { + SendRoomStepChange(room); + } + } + } - bool CheckRoomStateChange(int oldPlayerCount, int newPlayerCount) - { - bool bChanged = false; - bool bNewToOnlyHost = (oldPlayerCount != 1 && newPlayerCount == 1); - bool bMorePlayer = (oldPlayerCount < 2 && newPlayerCount >= 2) || (newPlayerCount > oldPlayerCount); - switch (this.GameState) - { - case RoomGameState.NoneGameState: - if (bNewToOnlyHost) - { - this.GameState = RoomGameState.OnlyHost; - bChanged = true; - } - break; - case RoomGameState.OnlyHost: - if (bMorePlayer)//鍔犲叆鏇村鐜╁ - { - this.GameState = RoomGameState.WaitRawUpdate; - bChanged = true; - break; - } - break; - case RoomGameState.WaitRawUpdate: - if (bMorePlayer)//鍔犲叆鏇村鐜╁ - { - this.GameState = RoomGameState.WaitRawUpdate; - bChanged = true; - break; - } - if (NextStateRaw != null)//宸茬粡涓婁紶鍗虫椂瀛樻。 - { - this.GameState = RoomGameState.WaitReady; - bChanged = true; - break; - } - break; - case RoomGameState.WaitReady: - if (bMorePlayer)//鍔犲叆鏇村鐜╁ - { - this.GameState = RoomGameState.WaitRawUpdate; - bChanged = true; - break; - } - //娌℃湁鏈噯澶囩殑 - bool bAllReady = IsAllReady(); - if (bAllReady) - { - this.GameState = RoomGameState.InOnlineGame; - //鏂板紑Tick - StartNewTick(); - bChanged = true; - break; - } - break; - case RoomGameState.Pause: - if (bMorePlayer)//鍔犲叆鏇村鐜╁ - { - this.GameState = RoomGameState.WaitRawUpdate; - bChanged = true; - break; - } - break; - case RoomGameState.InOnlineGame: - if (bMorePlayer)//鍔犲叆鏇村鐜╁ - { - this.GameState = RoomGameState.WaitRawUpdate; - bChanged = true; - break; - } - break; - } - return bChanged; - } + public void OnSingelPlayerInput(Socket sk, byte[] reqData) + { + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + Protobuf_Room_SinglePlayerInputData msg = ProtoBufHelper.DeSerizlize(reqData); + Data_RoomData room = GetRoomData(_c.RoomState.RoomID); + if (room == null) + return; + + //鍙栫帺瀹舵搷浣滄暟鎹腑鐨勭涓涓 + ServerInputSnapShot temp = new ServerInputSnapShot(); + temp.all = msg.InputData; + //room.SetPlayerInput(_c.RoomState.PlayerIdx, msg.FrameID, temp); + + //鏄惁闇瑕佹帹甯 + if (room.GetNeedForwardTick(msg.FrameID, out long forwaFrame)) + { + for (int i = 0; i < forwaFrame; i++) + { + if (i + 1 == forwaFrame)//鏈鍚庝竴甯 + { + //鍐欏叆鎿嶄綔鍓嶃佸皢缃戠粶娉㈠姩鍫嗙Н锛屽彲鑳介犳垚鐬椂澶氫釜杩炵画鎺ㄥ抚缁撴灉锛堟渶鍚庝竴甯ч櫎澶栵級绔嬪嵆骞挎挱锛屼笉绛16msTick + //if (forwaFrame > 1) + // room.SynInputData(); + + //鎺ㄥ抚杩囩▼涓紝鏈鍚庝竴甯ф墠鍐欏叆鎿嶄綔 + room.SetPlayerInput(_c.UID, msg.FrameID, temp); + } + //鎺ㄥ抚 + room.TakeFrame(); + } + } + else//涓嶉渶瑕佹帹甯 + { + //铏界劧涓嶆帹甯э紝浣嗘槸瀛樺叆Input + room.SetPlayerInput(_c.UID, msg.FrameID, temp); + } + + if (room.LastTestRecv != room.mCurrInputData.all) + { + room.LastTestRecv = room.mCurrInputData.all; + //AppSrv.g_Log.Debug($" {DateTime.Now.ToString("hh:mm:ss.fff")} SynTestRecv=> UID->{_c.UID} roomId->{room.mCurrServerFrameId} input->{msg.InputData}"); + } + } + + public void OnCmdScreen(Socket sk, byte[] reqData) + { + AppSrv.g_Log.DebugCmd($"OnCmdScreen lenght:{reqData.Length}"); + ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); + Protobuf_Screnn_Frame msg = ProtoBufHelper.DeSerizlize(reqData); + Data_RoomData room = AppSrv.g_Room.GetRoomData(msg.RoomID); + room.InputScreenData(msg.RawBitmap); + } + + /// + /// 骞挎挱鎴块棿鐘舵佸彉鍖 + /// + /// + public void Protobuf_Room_MyRoom_State_Change(int RoomID) + { + Data_RoomData room = GetRoomData(RoomID); + if (room == null) + return; + + Protobuf_Room_MyRoom_State_Change resp = new Protobuf_Room_MyRoom_State_Change() + { + RoomMiniInfo = GetProtoDataRoom(room) + }; + + List userlist = room.GetAllPlayerClientList(); + + foreach (ClientInfo _c in userlist) + { + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomMyRoomStateChanged, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); + } + } + + /// + /// 骞挎挱鑱旀満Step + /// + /// + public void SendRoomStepChange(Data_RoomData room) + { + List roomClient = room.GetAllPlayerClientList(); + switch (room.GameState) + { + case RoomGameState.WaitRawUpdate: + { + Protobuf_Room_WaitStep_RESP resp = new Protobuf_Room_WaitStep_RESP() + { + WaitStep = 0 + }; + AppSrv.g_Log.DebugCmd($"Step:0 WaitRawUpdate 骞挎挱绛夊緟涓绘満涓婃姤鍗虫椂瀛樻。"); + AppSrv.g_ClientMgr.ClientSend(roomClient, (int)CommandID.CmdRoomWaitStep, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); + } + break; + case RoomGameState.WaitReady: + { + Protobuf_Room_WaitStep_RESP resp = new Protobuf_Room_WaitStep_RESP() + { + WaitStep = 1, + LoadStateRaw = room.NextStateRaw + }; + AppSrv.g_Log.DebugCmd($"Step:1 WaitReady 骞挎挱鍗虫椂瀛樻。"); + AppSrv.g_ClientMgr.ClientSend(roomClient, (int)CommandID.CmdRoomWaitStep, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); + } + break; + case RoomGameState.InOnlineGame: + { + Protobuf_Room_WaitStep_RESP resp = new Protobuf_Room_WaitStep_RESP() + { + WaitStep = 2, + }; + AppSrv.g_Log.DebugCmd($"Step:2 InOnlineGame 骞挎挱寮濮嬫父鎴"); + AppSrv.g_ClientMgr.ClientSend(roomClient, (int)CommandID.CmdRoomWaitStep, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); + } + break; + } + } + + #region 鎴块棿甯у惊鐜 + void UpdateLoopTick() + { + while (true) + { + roomTickARE.WaitOne(); + UpdateAllRoomLogic(); + } + } + void UpdateAllRoomLogic() + { + if (mKeyRoomList.Count < 1) + return; + for (int i = 0; i < mKeyRoomList.Count; i++) + { + int roomid = mKeyRoomList[i]; + if (!mDictRoom.TryGetValue(roomid, out Data_RoomData room) || room.GameState < RoomGameState.InOnlineGame) + continue; + //鏇存柊甯 + //room.TakeFrame(); + //骞挎挱 + room.SynInputData(); + } + } + #endregion + } + + public class Data_RoomData + { + public int RoomID { get; private set; } + public int GameRomID { get; private set; } + public string RomHash { get; private set; } + public long HostUID { get; private set; } + public long ScreenProviderUID { get; private set; } + public Data_RoomSlot[] PlayerSlot; + public long Player1_UID => PlayerSlot[0].UID; + public long Player2_UID => PlayerSlot[1].UID; + public long Player3_UID => PlayerSlot[2].UID; + public long Player4_UID => PlayerSlot[3].UID; + public Google.Protobuf.ByteString? NextStateRaw { get; private set; } + public Google.Protobuf.ByteString? ScreenRaw { get; private set; } + //public bool[] PlayerReadyState { get; private set; } + public List SynUIDs; + //public RoomPlayerState PlayerState => getPlayerState(); + private RoomGameState mGameState; + public uint mCurrServerFrameId = 0; + public ServerInputSnapShot mCurrInputData; + public Queue<(uint, ServerInputSnapShot)> mInputQueue; + object synInputLock = new object(); + //TODO + public Dictionary> mDictPlayerIdx2SendQueue; + public RoomGameState GameState + { + get { return mGameState; } + set + { + if (mGameState != value) + { + mGameState = value; + switch (value) + { + case RoomGameState.WaitRawUpdate: + NextStateRaw = null; + break; + case RoomGameState.WaitReady: + ClearAllSlotReadyState();//娓呯悊鐜╁鎵鏈夊噯澶囩姸鎬 + break; + } + } + } + } + /// + /// 鏈嶅姟鍣ㄦ彁鍓嶅抚鏁 + /// + public uint SrvForwardFrames { get; set; } + public void Init(int roomID, int gameRomID, string roomHash, long hostUId, bool bloadState = false) + { + RoomID = roomID; + GameRomID = gameRomID; + RomHash = roomHash; + HostUID = hostUId; + ScreenProviderUID = hostUId; + + if (PlayerSlot == null) + { + PlayerSlot = new Data_RoomSlot[4]; + for (uint i = 0; i < PlayerSlot.Length; i++) + PlayerSlot[i] = new Data_RoomSlot(); + } + + for (uint i = 0; i < PlayerSlot.Length; i++) + PlayerSlot[i].Init(i); + + //PlayerReadyState = new bool[4]; + SynUIDs = new List();//骞挎挱瑙掕壊鍒楄〃 + GameState = RoomGameState.NoneGameState; + mCurrInputData = new ServerInputSnapShot(); + mInputQueue = new Queue<(uint, ServerInputSnapShot)>(); + mDictPlayerIdx2SendQueue = new Dictionary>(); + } + public Dictionary GetSlotDataByUID(long uid) + { + Dictionary slotIdx2JoyIdx = new Dictionary(); + var dataarr = PlayerSlot.Where(w => w.UID == uid).ToArray(); + foreach (var slot in dataarr) + slotIdx2JoyIdx[slot.SlotIdx] = slot.LocalJoyIdx; + return slotIdx2JoyIdx; + } + /// + /// 鎸夌収SlotIdx璁剧疆Input + /// + /// + void SetInputDataBySlotIdx(uint slotIdx, byte val) + { + switch (slotIdx) + { + case 0: mCurrInputData.p1_byte = val; break; + case 1: mCurrInputData.p2_byte = val; break; + case 2: mCurrInputData.p3_byte = val; break; + case 4: mCurrInputData.p3_byte = val; break; + } + } + /// + /// 鎸夌収UID娓呯悊SlotData + /// + /// + void ClearSlotDataByUid(long uid) + { + var dataarr = PlayerSlot.Where(w => w.UID == uid).ToArray(); + foreach (var slot in dataarr) + { + dataarr[slot.SlotIdx].Init(slot.SlotIdx); + ClearInputDataBySlotIdx(slot.SlotIdx); + } + } + /// + /// 鎸夌収SlotIdx娓呯悊SlotData + /// + /// + void ClearSlotDataBySlotIdx(uint slotIdx) + { + PlayerSlot[slotIdx].Init(slotIdx); + ClearInputDataBySlotIdx(slotIdx); + } + /// + /// 鎸夌収SlotIdx娓呯悊Input + /// + /// + void ClearInputDataBySlotIdx(uint slotIdx) + { + switch (slotIdx) + { + case 0: mCurrInputData.p1_byte = 0; break; + case 1: mCurrInputData.p2_byte = 0; break; + case 2: mCurrInputData.p3_byte = 0; break; + case 4: mCurrInputData.p3_byte = 0; break; + } + } + /// + /// 鏇存柊鍚屾鍚嶅崟 + /// + void UpdateSynUIDs() + { + for (int i = SynUIDs.Count - 1; i >= 0; i--) + { + long uid = SynUIDs[i]; + + bool bHad = false; + if (Player1_UID == uid) bHad = true; + else if (Player2_UID == uid) bHad = true; + else if (Player3_UID == uid) bHad = true; + else if (Player4_UID == uid) bHad = true; + if (bHad) + SynUIDs.RemoveAt(i); + } + if (!SynUIDs.Contains(Player1_UID)) SynUIDs.Add(Player1_UID); + if (!SynUIDs.Contains(Player2_UID)) SynUIDs.Add(Player2_UID); + if (!SynUIDs.Contains(Player3_UID)) SynUIDs.Add(Player3_UID); + if (!SynUIDs.Contains(Player4_UID)) SynUIDs.Add(Player4_UID); + } + + #region 鍑嗗鐘舵佺鐞 + bool IsAllReady() + { + bool Ready = true; + if ( + (Player1_UID > 0 && !PlayerSlot[0].Ready) + || + (Player2_UID > 0 && !PlayerSlot[1].Ready) + || + (Player3_UID > 0 && !PlayerSlot[2].Ready) + || + (Player4_UID > 0 && !PlayerSlot[3].Ready) + ) + { + Ready = false; + } + return Ready; + } + /// + /// 娓呴櫎鎵鏈夋Ы浣嶅噯澶囩姸鎬 + /// + void ClearAllSlotReadyState() + { + for (var i = 0; i < PlayerSlot.Length; i++) + { + PlayerSlot[i].Ready = false; + } + } + /// + /// 鎸夌収UID璁剧疆Ready淇℃伅 + /// + /// + void SetReadyByUid(long uid) + { + for (var i = 0; i < PlayerSlot.Length; i++) + { + if (PlayerSlot[i].UID == uid) + PlayerSlot[i].Ready = true; + } + } + #endregion + + public void SetPlayerSlotData(ClientInfo _c, ref readonly Dictionary newSlotIdx2JoyIdx) + { + Dictionary oldSlotIdx2JoyIdx = GetSlotDataByUID(_c.UID); + HashSet diffSlotIdxs = new HashSet(); + foreach (var old in oldSlotIdx2JoyIdx) + { + uint old_slotIdx = old.Key; + //濡傛灉鏃т綅缃凡缁忎笉瀛樺湪浜庢柊浣嶇疆锛屽垯闇瑕佺畻浣渄iff + if (!newSlotIdx2JoyIdx.ContainsKey(old_slotIdx)) + { + diffSlotIdxs.Add(old_slotIdx); continue; + } + uint old_slotjoyIdx = old.Value; + //濡傛灉鏃т綅缃笉鍙橈紝浣嗗鎴风鏈湴JoyIdx鍙樺寲鍒欑畻浣渄iff + if (old_slotjoyIdx != newSlotIdx2JoyIdx[old_slotIdx]) + { + diffSlotIdxs.Add(old_slotIdx); continue; + } + } + //濡傛灉鏄湪鏃ф暟鎹腑涓嶅瓨鍦ㄧ殑浣嶇疆锛屽垯绠椾綔diff + foreach (var newdata in newSlotIdx2JoyIdx) + { + uint new_slotIdx = newdata.Key; + if (!oldSlotIdx2JoyIdx.ContainsKey(new_slotIdx)) + { + diffSlotIdxs.Add(new_slotIdx); continue; + } + } + //蹇呰鐨刣iff slot 娓呯悊閿兼暟鎹 + foreach (var diffSlotIdx in diffSlotIdxs) + { + ClearSlotDataBySlotIdx(diffSlotIdx); + } + //璁剧疆鏂扮殑妲戒綅 + foreach (var slotdata in newSlotIdx2JoyIdx) + { + PlayerSlot[slotdata.Key].LocalJoyIdx = slotdata.Value; + PlayerSlot[slotdata.Key].UID = _c.UID; + AppSrv.g_Log.DebugCmd($"SetPlayerSlot RoomID->{RoomID} _c.UID->{_c.UID} PlayerSlotIdx->{slotdata.Key} LocalJoyIdx->{slotdata.Value}"); + } + //鏇存柊闇瑕佸悓姝ョ殑UID + UpdateSynUIDs(); + _c.RoomState.SetRoomData(this.RoomID); + } + public void RemovePlayer(ClientInfo _c) + { + ClearSlotDataByUid(_c.UID); + UpdateSynUIDs(); + _c.RoomState.ClearRoomData(); + } + public bool GetPlayerUIDByIdx(uint Idx, out long UID) + { + switch (Idx) + { + case 0: UID = Player1_UID; break; + case 1: UID = Player2_UID; break; + case 2: UID = Player3_UID; break; + case 3: UID = Player4_UID; break; + default: UID = -1; break; + } + return UID > 0; + } + public bool GetFreeSlot(out uint SlotIdx) + { + for (uint i = 0; i < PlayerSlot.Length; i++) + { + if (PlayerSlot[i].UID < 0) + { + SlotIdx = i; + return true; + } + } + SlotIdx = 0; + return false; + } + public bool GetPlayerClientByIdx(uint Idx, out ClientInfo _c) + { + _c = null; + if (!GetPlayerUIDByIdx(Idx, out long UID)) + return false; + + if (!AppSrv.g_ClientMgr.GetClientByUID(UID, out _c)) + return false; + + return true; + } + public List GetAllPlayerClientList() + { + List list = new List(); + List Uids = SynUIDs; + foreach (long uid in Uids) + { + if (!AppSrv.g_ClientMgr.GetClientByUID(uid, out ClientInfo _c, true)) + continue; + list.Add(_c); + } + return list; + } + + void SetInputBySlotIdxJoyIdx(uint SlotIdx, uint LocalJoyIdx, ServerInputSnapShot clieninput) + { + switch (LocalJoyIdx) + { + case 0: SetInputDataBySlotIdx(SlotIdx, clieninput.p1_byte); break; + case 1: SetInputDataBySlotIdx(SlotIdx, clieninput.p2_byte); break; + case 2: SetInputDataBySlotIdx(SlotIdx, clieninput.p3_byte); break; + case 3: SetInputDataBySlotIdx(SlotIdx, clieninput.p4_byte); break; + } + } + public int GetPlayerCount() + { + return SynUIDs.Count; + } + public void UpdateRoomForwardNum() + { + List playerlist = GetAllPlayerClientList(); + double maxNetDelay = 0; + for (int i = 0; i < playerlist.Count; i++) + { + ClientInfo player = playerlist[i]; + maxNetDelay = Math.Max(maxNetDelay, player.AveNetDelay); + } + float MustTaskFrame = 1; + SrvForwardFrames = (uint)((maxNetDelay / 0.016f) + MustTaskFrame); + if (SrvForwardFrames < 2) + SrvForwardFrames = 2; + //AppSrv.g_Log.Debug($"鏈嶅姟鍣ㄦ彁鍓嶈窇甯ф暟锛歁ax(2,({maxNetDelay} / {0.016f}) + {MustTaskFrame}) = {SrvForwardFrames}"); + } + + #region 甯х浉鍏 + void StartNewTick() + { + mInputQueue.Clear(); + mDictPlayerIdx2SendQueue.Clear(); + + mCurrServerFrameId = 0; + mCurrInputData.all = 1; + + UpdateRoomForwardNum(); + + uint StartForwardFrames = (SrvForwardFrames * 2) + 5; + StartForwardFrames = Math.Min(10, StartForwardFrames); + //鏈嶅姟鍣ㄦ彁鍓嶈窇甯ф暟 + for (int i = 0; i < SrvForwardFrames; i++) + TakeFrame(); + AppSrv.g_Log.Info($"鎴块棿鍒濆鎻愬墠閲=>{StartForwardFrames}锛屽綋鍓嶅欢杩熸彁鍓嶉噺=>{SrvForwardFrames}"); + } + public void TakeFrame() + { + lock (synInputLock) + { + mInputQueue.Enqueue((mCurrServerFrameId, mCurrInputData)); + mCurrServerFrameId++; + if (mCurrServerFrameId % 60 == 0) + { + UpdateRoomForwardNum(); + } + } + } + #endregion + + ulong LastTestSend = 0; + internal ulong LastTestRecv; + + public List send2time = new List(); + const int SynLimitOnSec = 63; + + /// + /// 骞挎挱鏁版嵁 + /// + public void SynInputData() + { + List<(uint frameId, ServerInputSnapShot inputdata)> temp = null; + bool flagInitList = false; + lock (synInputLock) + { + double timeNow = AppSrv.g_Tick.timeNow; + while (mInputQueue.Count > 0) + { + if (send2time.Count >= SynLimitOnSec) + { + //AppSrv.g_Log.Info($"{timeNow} - {send2time[0]} =>{timeNow - send2time[0]}"); + if (timeNow - send2time[0] < 1f) //鏈鏃╃殑鍘嗗彶鍙戦佽繕鍦ㄤ竴绉掍箣鍐 + break; + else + send2time.RemoveAt(0); + } + + if (!flagInitList) + { + flagInitList = true; + temp = new List<(uint frameId, ServerInputSnapShot inputdata)>(); + } + temp.Add(mInputQueue.Dequeue()); + send2time.Add(timeNow); + } + //while (mInputQueue.Count > 0) + //{ + // temp.Add(mInputQueue.Dequeue()); + //} + } + + if (!flagInitList) + return; + + for (int i = 0; i < temp.Count; i++) + { + (uint frameId, ServerInputSnapShot inputdata) data = temp[i]; + + Protobuf_Room_Syn_RoomFrameAllInputData resp = new Protobuf_Room_Syn_RoomFrameAllInputData() + { + FrameID = data.frameId, + InputData = data.inputdata.all, + ServerFrameID = mCurrServerFrameId, + ServerForwardCount = this.SrvForwardFrames + }; + AppSrv.g_ClientMgr.ClientSend(SynUIDs, (int)CommandID.CmdRoomSynPlayerInput, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp)); + //if (LastTestSend != data.inputdata.all) + //{ + // LastTestSend = data.inputdata.all; + // AppSrv.g_Log.Debug($" {DateTime.Now.ToString("hh:mm:ss.fff")} SynInput=> RoomID->{RoomID} ServerFrameID->{mCurrServerFrameId} SynUIDs=>{string.Join(",", SynUIDs)} "); + //} + } + } + + bool CheckRoomStateChange(int oldPlayerCount, int newPlayerCount) + { + bool bChanged = false; + bool bNewToOnlyHost = (oldPlayerCount != 1 && newPlayerCount == 1); + bool bMorePlayer = (oldPlayerCount < 2 && newPlayerCount >= 2) || (newPlayerCount > oldPlayerCount); + switch (this.GameState) + { + case RoomGameState.NoneGameState: + if (bNewToOnlyHost) + { + this.GameState = RoomGameState.OnlyHost; + bChanged = true; + } + break; + case RoomGameState.OnlyHost: + if (bMorePlayer)//鍔犲叆鏇村鐜╁ + { + this.GameState = RoomGameState.WaitRawUpdate; + bChanged = true; + break; + } + break; + case RoomGameState.WaitRawUpdate: + if (bMorePlayer)//鍔犲叆鏇村鐜╁ + { + this.GameState = RoomGameState.WaitRawUpdate; + bChanged = true; + break; + } + if (NextStateRaw != null)//宸茬粡涓婁紶鍗虫椂瀛樻。 + { + this.GameState = RoomGameState.WaitReady; + bChanged = true; + break; + } + break; + case RoomGameState.WaitReady: + if (bMorePlayer)//鍔犲叆鏇村鐜╁ + { + this.GameState = RoomGameState.WaitRawUpdate; + bChanged = true; + break; + } + //娌℃湁鏈噯澶囩殑 + bool bAllReady = IsAllReady(); + if (bAllReady) + { + this.GameState = RoomGameState.InOnlineGame; + //鏂板紑Tick + StartNewTick(); + bChanged = true; + break; + } + break; + case RoomGameState.Pause: + if (bMorePlayer)//鍔犲叆鏇村鐜╁ + { + this.GameState = RoomGameState.WaitRawUpdate; + bChanged = true; + break; + } + break; + case RoomGameState.InOnlineGame: + if (bMorePlayer)//鍔犲叆鏇村鐜╁ + { + this.GameState = RoomGameState.WaitRawUpdate; + bChanged = true; + break; + } + break; + } + return bChanged; + } - #region 瀵瑰寮鏀惧嚱鏁 + #region 瀵瑰寮鏀惧嚱鏁 - #region 鎴块棿杩涘嚭 - /// - /// 杩涘叆鎴块棿 - /// - /// - /// - /// - /// - /// - public bool Join(uint slotIdx, uint joyIdx, ClientInfo _c, out ErrorCode errcode, out bool bHadRoomStateChange) - { - bHadRoomStateChange = false; - int oldPlayerCount = GetPlayerCount(); - if (GetPlayerUIDByIdx(slotIdx, out long hadUID)) - { - errcode = ErrorCode.ErrorRoomSlotAlreadlyHadPlayer; - return false; - } - AppSrv.g_Log.Debug($"Join _c.UID->{_c.UID} RoomID->{RoomID}"); - Dictionary slotInfo = new Dictionary(); - slotInfo[slotIdx] = joyIdx; - SetPlayerSlotData(_c, ref slotInfo); - int newPlayerCount = GetPlayerCount(); - errcode = ErrorCode.ErrorOk; - bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount); - return true; - } + #region 鎴块棿杩涘嚭 + /// + /// 杩涘叆鎴块棿 + /// + /// + /// + /// + /// + /// + public bool Join(uint slotIdx, uint joyIdx, ClientInfo _c, out ErrorCode errcode, out bool bHadRoomStateChange) + { + bHadRoomStateChange = false; + int oldPlayerCount = GetPlayerCount(); + if (GetPlayerUIDByIdx(slotIdx, out long hadUID)) + { + errcode = ErrorCode.ErrorRoomSlotAlreadlyHadPlayer; + return false; + } + AppSrv.g_Log.Debug($"Join _c.UID->{_c.UID} RoomID->{RoomID}"); + Dictionary slotInfo = new Dictionary(); + slotInfo[slotIdx] = joyIdx; + SetPlayerSlotData(_c, ref slotInfo); + int newPlayerCount = GetPlayerCount(); + errcode = ErrorCode.ErrorOk; + bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount); + return true; + } - /// - /// 绂诲紑鎴块棿 - /// - /// - /// - /// - /// - public bool Leave(ClientInfo _c, out ErrorCode errcode, out bool bHadRoomStateChange) - { - int oldPlayerCount = GetPlayerCount(); - RemovePlayer(_c); - int newPlayerCount = GetPlayerCount(); - errcode = ErrorCode.ErrorOk; - bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount); - return true; - } - #endregion - public void SetPlayerInput(long UID, uint LocalJoyIdx, ServerInputSnapShot clieninput) - { - for (uint i = 0; i < PlayerSlot.Count(); i++) - { - Data_RoomSlot slotData = PlayerSlot[i]; - if (slotData.UID != UID) - continue; - SetInputBySlotIdxJoyIdx(slotData.SlotIdx, slotData.LocalJoyIdx, clieninput); - } - } - public bool SetRePlayerReady(long UID, out ErrorCode errcode, out bool bHadRoomStateChange) - { - int oldPlayerCount = GetPlayerCount(); - SetReadyByUid(UID); - int newPlayerCount = GetPlayerCount(); - errcode = ErrorCode.ErrorOk; - bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount); - return true; - } - public void SetLoadRaw(Google.Protobuf.ByteString NextStateRaw, out bool bHadRoomStateChange) - { - int oldPlayerCount = GetPlayerCount(); - AppSrv.g_Log.Debug($"SetLoadRaw proto Lenght->{NextStateRaw.Length}"); - this.NextStateRaw = NextStateRaw; - int newPlayerCount = GetPlayerCount(); - bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount); - } - public void InputScreenData(Google.Protobuf.ByteString screenRaw) - { - this.ScreenRaw = NextStateRaw; - } - public bool GetNeedForwardTick(uint clientFrame, out long forwaFrame) - { - forwaFrame = 0; - //鐩爣甯э紝瀹㈡埛绔+鏈嶅姟鍣ㄦ彁鍓嶉噺 - long targetFrame = clientFrame + SrvForwardFrames; - if (targetFrame > mCurrServerFrameId)//鏇撮潬鍓 - forwaFrame = targetFrame - mCurrServerFrameId; - return forwaFrame > 0; - } - #endregion - } + /// + /// 绂诲紑鎴块棿 + /// + /// + /// + /// + /// + public bool Leave(ClientInfo _c, out ErrorCode errcode, out bool bHadRoomStateChange) + { + int oldPlayerCount = GetPlayerCount(); + RemovePlayer(_c); + int newPlayerCount = GetPlayerCount(); + errcode = ErrorCode.ErrorOk; + bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount); + return true; + } + #endregion + public void SetPlayerInput(long UID, uint LocalJoyIdx, ServerInputSnapShot clieninput) + { + for (uint i = 0; i < PlayerSlot.Count(); i++) + { + Data_RoomSlot slotData = PlayerSlot[i]; + if (slotData.UID != UID) + continue; + SetInputBySlotIdxJoyIdx(slotData.SlotIdx, slotData.LocalJoyIdx, clieninput); + } + } + public bool SetRePlayerReady(long UID, out ErrorCode errcode, out bool bHadRoomStateChange) + { + int oldPlayerCount = GetPlayerCount(); + SetReadyByUid(UID); + int newPlayerCount = GetPlayerCount(); + errcode = ErrorCode.ErrorOk; + bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount); + return true; + } + public void SetLoadRaw(Google.Protobuf.ByteString NextStateRaw, out bool bHadRoomStateChange) + { + int oldPlayerCount = GetPlayerCount(); + AppSrv.g_Log.Debug($"SetLoadRaw proto Lenght->{NextStateRaw.Length}"); + this.NextStateRaw = NextStateRaw; + int newPlayerCount = GetPlayerCount(); + bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount); + } + public void InputScreenData(Google.Protobuf.ByteString screenRaw) + { + this.ScreenRaw = NextStateRaw; + } + public bool GetNeedForwardTick(uint clientFrame, out long forwaFrame) + { + forwaFrame = 0; + //鐩爣甯э紝瀹㈡埛绔+鏈嶅姟鍣ㄦ彁鍓嶉噺 + long targetFrame = clientFrame + SrvForwardFrames; + if (targetFrame > mCurrServerFrameId)//鏇撮潬鍓 + forwaFrame = targetFrame - mCurrServerFrameId; + return forwaFrame > 0; + } + #endregion + } - public class Data_RoomSlot - { - public uint SlotIdx { get; set; } - public long UID { get; set; } - public uint LocalJoyIdx { get; set; } - public bool Ready = false; - public void Init(uint SlotIdx) - { - this.SlotIdx = SlotIdx; - UID = -1; - LocalJoyIdx = 0; - Ready = false; - } - } + public class Data_RoomSlot + { + public uint SlotIdx { get; set; } + public long UID { get; set; } + public uint LocalJoyIdx { get; set; } + public bool Ready = false; + public void Init(uint SlotIdx) + { + this.SlotIdx = SlotIdx; + UID = -1; + LocalJoyIdx = 0; + Ready = false; + } + } - [StructLayout(LayoutKind.Explicit, Size = 8)] - public struct ServerInputSnapShot - { - [FieldOffset(0)] - public UInt64 all; + [StructLayout(LayoutKind.Explicit, Size = 8)] + public struct ServerInputSnapShot + { + [FieldOffset(0)] + public UInt64 all; - [FieldOffset(0)] - public byte p1_byte; - [FieldOffset(1)] - public byte p2_byte; - [FieldOffset(2)] - public byte p3_byte; - [FieldOffset(3)] - public byte p4_byte; + [FieldOffset(0)] + public byte p1_byte; + [FieldOffset(1)] + public byte p2_byte; + [FieldOffset(2)] + public byte p3_byte; + [FieldOffset(3)] + public byte p4_byte; - [FieldOffset(0)] - public ushort p1_ushort; - [FieldOffset(2)] - public ushort p2_ushort; - [FieldOffset(4)] - public ushort p3_ushort; - [FieldOffset(6)] - public ushort p4_ushort; - } + [FieldOffset(0)] + public ushort p1_ushort; + [FieldOffset(2)] + public ushort p2_ushort; + [FieldOffset(4)] + public ushort p3_ushort; + [FieldOffset(6)] + public ushort p4_ushort; + } } \ No newline at end of file diff --git a/AxibugEmuOnline.sln b/AxibugEmuOnline.sln index 43bce0f..ad51608 100644 --- a/AxibugEmuOnline.sln +++ b/AxibugEmuOnline.sln @@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxibugEmuOnline.Web", "Axib EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxibugEmuOnline.Server", "AxibugEmuOnline.Server\AxibugEmuOnline.Server.csproj", "{9F509DB4-CDB4-4CDB-9C10-805C5E644EEF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualNes.Core", "VirtualNes.Core\VirtualNes.Core.csproj", "{8A4771D6-74B9-453C-9932-6B774280E325}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualNes.Core", "Core\VirtualNes.Core\VirtualNes.Core.csproj", "{637EB35A-4D1A-41EA-9A7B-459E17E93981}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -23,10 +23,10 @@ Global {9F509DB4-CDB4-4CDB-9C10-805C5E644EEF}.Debug|Any CPU.Build.0 = Debug|Any CPU {9F509DB4-CDB4-4CDB-9C10-805C5E644EEF}.Release|Any CPU.ActiveCfg = Release|Any CPU {9F509DB4-CDB4-4CDB-9C10-805C5E644EEF}.Release|Any CPU.Build.0 = Release|Any CPU - {8A4771D6-74B9-453C-9932-6B774280E325}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A4771D6-74B9-453C-9932-6B774280E325}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A4771D6-74B9-453C-9932-6B774280E325}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A4771D6-74B9-453C-9932-6B774280E325}.Release|Any CPU.Build.0 = Release|Any CPU + {637EB35A-4D1A-41EA-9A7B-459E17E93981}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {637EB35A-4D1A-41EA-9A7B-459E17E93981}.Debug|Any CPU.Build.0 = Debug|Any CPU + {637EB35A-4D1A-41EA-9A7B-459E17E93981}.Release|Any CPU.ActiveCfg = Release|Any CPU + {637EB35A-4D1A-41EA-9A7B-459E17E93981}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Core/VirtualNes.Core/APU.cs b/Core/VirtualNes.Core/APU.cs index b0e608a..ef317c9 100644 --- a/Core/VirtualNes.Core/APU.cs +++ b/Core/VirtualNes.Core/APU.cs @@ -73,7 +73,7 @@ namespace VirtualNes.Core public void Process(ISoundDataBuffer lpBuffer, uint dwSize) { - int nBits = Supporter.Config.sound.nBits; + int nBits = Supporter.S.Config.sound.nBits; uint dwLength = (uint)(dwSize / (nBits / 8)); int output; QUEUEDATA q = new QUEUEDATA(); @@ -82,11 +82,11 @@ namespace VirtualNes.Core var pSoundBuf = m_SoundBuffer; int nCcount = 0; - int nFilterType = Supporter.Config.sound.nFilterType; + int nFilterType = Supporter.S.Config.sound.nFilterType; - if (!Supporter.Config.sound.bEnable) + if (!Supporter.S.Config.sound.bEnable) { - byte empty = (byte)(Supporter.Config.sound.nRate == 8 ? 128 : 0); + byte empty = (byte)(Supporter.S.Config.sound.nRate == 8 ? 128 : 0); for (int i = 0; i < dwSize; i++) lpBuffer.WriteByte(empty); return; @@ -108,7 +108,7 @@ namespace VirtualNes.Core MemoryUtility.ZEROMEMORY(vol, vol.Length); var bMute = m_bMute; - var nVolume = Supporter.Config.sound.nVolume; + var nVolume = Supporter.S.Config.sound.nVolume; int nMasterVolume = bMute[0] ? nVolume[0] : 0; @@ -151,7 +151,7 @@ namespace VirtualNes.Core vol[23] = (int)(bMute[8] ? (FME7_VOL * nVolume[11] * nMasterVolume) / (100 * 100) : 0); // double cycle_rate = ((double)FRAME_CYCLES*60.0/12.0)/(double)Config.sound.nRate; - double cycle_rate = (nes.nescfg.FrameCycles * 60.0 / 12.0) / Supporter.Config.sound.nRate; + double cycle_rate = (nes.nescfg.FrameCycles * 60.0 / 12.0) / Supporter.S.Config.sound.nRate; // CPU銈点偆銈儷鏁般亴銉兗銉椼仐銇︺仐銇俱仯銇熸檪銇绛栧嚘鐞 if (elapsed_time > nes.cpu.GetTotalCycles()) @@ -253,7 +253,7 @@ namespace VirtualNes.Core // DC鎴愬垎銇偒銉冦儓(HPF TEST) { // static double cutoff = (2.0*3.141592653579*40.0/44100.0); - double cutoff = cutofftemp / Supporter.Config.sound.nRate; + double cutoff = cutofftemp / Supporter.S.Config.sound.nRate; double @in, @out; @in = output; @@ -436,7 +436,7 @@ namespace VirtualNes.Core public void SoundSetup() { float fClock = nes.nescfg.CpuClock; - int nRate = Supporter.Config.sound.nRate; + int nRate = Supporter.S.Config.sound.nRate; @internal.Setup(fClock, nRate); vrc6.Setup(fClock, nRate); @@ -460,7 +460,7 @@ namespace VirtualNes.Core elapsed_time = 0; float fClock = nes.nescfg.CpuClock; - int nRate = Supporter.Config.sound.nRate; + int nRate = Supporter.S.Config.sound.nRate; @internal.Reset(fClock, nRate); vrc6.Reset(fClock, nRate); diff --git a/Core/VirtualNes.Core/ApuEX/APU_INTERNAL.cs b/Core/VirtualNes.Core/ApuEX/APU_INTERNAL.cs index 5ea318a..f286bdb 100644 --- a/Core/VirtualNes.Core/ApuEX/APU_INTERNAL.cs +++ b/Core/VirtualNes.Core/ApuEX/APU_INTERNAL.cs @@ -1,4 +1,4 @@ - +锘 using System; namespace VirtualNes.Core @@ -184,15 +184,15 @@ namespace VirtualNes.Core Setup(fClock, nRate); - // $4011は初期化しない + // $4011銇垵鏈熷寲銇椼仾銇 ushort addr; for (addr = 0x4000; addr <= 0x4010; addr++) { Write(addr, 0x00); SyncWrite(addr, 0x00); } - // Write( 0x4001, 0x08 ); // Reset時はincモードになる? - // Write( 0x4005, 0x08 ); // Reset時はincモードになる? + // Write( 0x4001, 0x08 ); // Reset鏅傘伅inc銉€兗銉夈伀銇倠? + // Write( 0x4005, 0x08 ); // Reset鏅傘伅inc銉€兗銉夈伀銇倠? Write(0x4012, 0x00); Write(0x4013, 0x00); Write(0x4015, 0x00); @@ -200,7 +200,7 @@ namespace VirtualNes.Core SyncWrite(0x4013, 0x00); SyncWrite(0x4015, 0x00); - // $4017は書き込みで初期化しない(初期モードが0であるのを期待したソフトがある為) + // $4017銇浉銇嶈炯銇裤仹鍒濇湡鍖栥仐銇亜(鍒濇湡銉€兗銉夈亴0銇с亗銈嬨伄銈掓湡寰呫仐銇熴偨銉曘儓銇屻亗銈嬬偤) FrameIRQ = 0xC0; FrameCycle = 0; FrameIRQoccur = 0; @@ -301,7 +301,7 @@ namespace VirtualNes.Core case 0x4017: break; - // VirtuaNES固有ポート + // VirtuaNES鍥烘湁銉濄兗銉 case 0x4018: UpdateRectangle(ch0, data); UpdateRectangle(ch1, data); @@ -635,7 +635,7 @@ namespace VirtualNes.Core } } - // インチキ臭いプチノイズカット(TEST) + // 銈ゃ兂銉併偔鑷亜銉椼儊銉庛偆銈恒偒銉冦儓(TEST) ch4.dpcm_output_real = ((ch4.reg[1] & 0x01) + ch4.dpcm_value * 2) - 0x40; if (Math.Abs(ch4.dpcm_output_real - ch4.dpcm_output_fake) <= 8) { @@ -712,7 +712,7 @@ namespace VirtualNes.Core private int RenderTriangle() { int vol; - if (Supporter.Config.sound.bDisableVolumeEffect) + if (Supporter.S.Config.sound.bDisableVolumeEffect) { vol = 256; } @@ -731,7 +731,7 @@ namespace VirtualNes.Core return ch2.nowvolume * vol / 256; } - if (!(Supporter.Config.sound.bChangeTone && ChannelTone[2, 0] != 0)) + if (!(Supporter.S.Config.sound.bChangeTone && ChannelTone[2, 0] != 0)) { ch2.phaseacc -= cycle_rate; if (ch2.phaseacc >= 0) @@ -756,7 +756,7 @@ namespace VirtualNes.Core return ch2.nowvolume * vol / 256; } - // 加重平均 + // 鍔犻噸骞冲潎 int num_times, total; num_times = total = 0; while (ch2.phaseacc < 0) @@ -799,7 +799,7 @@ namespace VirtualNes.Core return ch2.nowvolume * vol / 256; } - // 加重平均 + // 鍔犻噸骞冲潎 int num_times, total; num_times = total = 0; while (ch2.phaseacc < 0) @@ -832,9 +832,9 @@ namespace VirtualNes.Core } int volume = ch.nowvolume; - if (!(Supporter.Config.sound.bChangeTone && (ChannelTone[(ch.complement == 0) ? 0 : 1, ch.reg[0] >> 6]) != 0)) + if (!(Supporter.S.Config.sound.bChangeTone && (ChannelTone[(ch.complement == 0) ? 0 : 1, ch.reg[0] >> 6]) != 0)) { - // 補間処理 + // 瑁滈枔鍑︾悊 double total; double sample_weight = ch.phaseacc; if (sample_weight > cycle_rate) @@ -864,7 +864,7 @@ namespace VirtualNes.Core int x = ChannelTone[(ch.complement == 0) ? 0 : 1, ch.reg[0] >> 6] - 1; int pTone = 0; - // 更新無し + // 鏇存柊鐒°仐 ch.phaseacc -= cycle_rate * 2; if (ch.phaseacc >= 0) { @@ -872,7 +872,7 @@ namespace VirtualNes.Core return temp * volume / ((1 << RECTANGLE_VOL_SHIFT) / 2); } - // 1ステップだけ更新 + // 1銈广儐銉冦儣銇犮亼鏇存柊 int freq = INT2FIX(ch.freq + 1); if (freq > cycle_rate * 2) { @@ -882,7 +882,7 @@ namespace VirtualNes.Core return temp * volume / ((1 << RECTANGLE_VOL_SHIFT) / 2); } - // 加重平均 + // 鍔犻噸骞冲潎 int num_times, total; num_times = total = 0; while (ch.phaseacc < 0) @@ -1015,7 +1015,7 @@ namespace VirtualNes.Core SyncWrite4017(data); break; - // VirtuaNES屌桳億乕僩 + // VirtuaNES灞屾〕鍎勪箷鍍 case 0x4018: SyncUpdateRectangle(ch0, data); SyncUpdateRectangle(ch1, data); diff --git a/Core/VirtualNes.Core/CPU.cs b/Core/VirtualNes.Core/CPU.cs index ef9acbb..b791646 100644 --- a/Core/VirtualNes.Core/CPU.cs +++ b/Core/VirtualNes.Core/CPU.cs @@ -1110,7 +1110,7 @@ namespace VirtualNes.Core case 0xD2: /* JAM */ case 0xF2: /* JAM */ default: - if (!Supporter.Config.emulator.bIllegalOp) + if (!Supporter.S.Config.emulator.bIllegalOp) { throw new Exception("IllegalOp"); } diff --git a/Core/VirtualNes.Core/Mapper/Mapper072.cs b/Core/VirtualNes.Core/Mapper/Mapper072.cs index c4495d5..005e286 100644 --- a/Core/VirtualNes.Core/Mapper/Mapper072.cs +++ b/Core/VirtualNes.Core/Mapper/Mapper072.cs @@ -40,7 +40,7 @@ namespace VirtualNes.Core Debuger.Log($"SOUND CODE:{addr & 0x1F:X2}"); // OSD銇仚銈嬨伖銇嶃亱鈥 - if (Supporter.Config.sound.bExtraSoundEnable) + if (Supporter.S.Config.sound.bExtraSoundEnable) { //TODO : 浼间箮VirtuaNES鏈夌洿鎺ユ挱鏀炬煇涓煶棰戞枃浠剁殑鍔熻兘 //DirectSound.EsfAllStop(); diff --git a/Core/VirtualNes.Core/Mapper/Mapper086.cs b/Core/VirtualNes.Core/Mapper/Mapper086.cs index 267de95..cebcb15 100644 --- a/Core/VirtualNes.Core/Mapper/Mapper086.cs +++ b/Core/VirtualNes.Core/Mapper/Mapper086.cs @@ -43,7 +43,7 @@ namespace VirtualNes.Core } // OSD銇仚銈嬨伖銇嶃亱鈥 - if (Supporter.Config.sound.bExtraSoundEnable) + if (Supporter.S.Config.sound.bExtraSoundEnable) { //TODO : 浼间箮VirtuaNES鏈夌洿鎺ユ挱鏀炬煇涓煶棰戞枃浠剁殑鍔熻兘 //DirectSound.EsfAllStop(); diff --git a/Core/VirtualNes.Core/Mapper/Mapper092.cs b/Core/VirtualNes.Core/Mapper/Mapper092.cs index 5b8a774..abce788 100644 --- a/Core/VirtualNes.Core/Mapper/Mapper092.cs +++ b/Core/VirtualNes.Core/Mapper/Mapper092.cs @@ -57,7 +57,7 @@ namespace VirtualNes.Core 9,10, 8,11,13,12,14,15 }; // OSD銇仚銈嬨伖銇嶃亱鈥 - if (Supporter.Config.sound.bExtraSoundEnable) + if (Supporter.S.Config.sound.bExtraSoundEnable) { //TODO : 浼间箮VirtuaNES鏈夌洿鎺ユ挱鏀炬煇涓煶棰戞枃浠剁殑鍔熻兘 Debuger.Log($"CODE {data:X2}"); diff --git a/Core/VirtualNes.Core/NES.cs b/Core/VirtualNes.Core/NES.cs index 91cb521..3ce368d 100644 --- a/Core/VirtualNes.Core/NES.cs +++ b/Core/VirtualNes.Core/NES.cs @@ -1,4 +1,4 @@ -using System; +锘縰sing System; using System.Collections.Generic; using System.IO; using System.Text; @@ -249,7 +249,7 @@ namespace VirtualNes.Core LoadDISK(); { - // Padクラス内だと初期化タイミングが遅いのでここで + // Pad銈儵銈瑰唴銇犮仺鍒濇湡鍖栥偪銈ゃ儫銉炽偘銇岄亝銇勩伄銇с亾銇撱仹 uint crc = rom.GetPROM_CRC(); if ( crc == 0xe792de94 // Best Play - Pro Yakyuu (New) (J) @@ -275,7 +275,7 @@ namespace VirtualNes.Core LoadTurboFile(); - // VS-Unisystemのデフォルト設定 + // VS-Unisystem銇儑銉曘偐銉儓瑷畾 if (rom.IsVSUNISYSTEM()) { uint crc = rom.GetPROM_CRC(); @@ -286,13 +286,13 @@ namespace VirtualNes.Core Reset(); - // ゲーム固有のデフォルトオプションを設定(設定戻す時に使う為) + // 銈层兗銉犲浐鏈夈伄銉囥儠銈┿儷銉堛偑銉椼偡銉с兂銈掕ō瀹(瑷畾鎴汇仚鏅傘伀浣裤亞鐐) GameOption.defRenderMethod = (int)GetRenderMethod(); GameOption.defIRQtype = GetIrqType(); GameOption.defFrameIRQ = GetFrameIRQmode(); GameOption.defVideoMode = GetVideoMode(); - // 設定をロードして設定する(エントリが無ければデフォルトが入る) + // 瑷畾銈掋儹銉笺儔銇椼仸瑷畾銇欍倠(銈ㄣ兂銉堛儶銇岀劇銇戙倢銇般儑銉曘偐銉儓銇屽叆銈) if (rom.GetMapperNo() != 20) { GameOption.Load(rom.GetPROM_CRC()); @@ -326,17 +326,17 @@ namespace VirtualNes.Core if (pad.GetExController() != (int)EXCONTROLLER.EXCONTROLLER_TURBOFILE) return; - var fp = Supporter.OpenFile(Supporter.Config.path.szSavePath, "TurboFile.vtf"); + var fp = Supporter.S.OpenFile(Supporter.S.Config.path.szSavePath, "TurboFile.vtf"); try { if (fp == null) { - // xxx ファイルを開けません + // xxx 銉曘偂銈ゃ儷銈掗枊銇戙伨銇涖倱 throw new Exception($"Can Not Open File [TurboFile.vtf]"); } long size = fp.Length; - // ファイルサイズ取得 + // 銉曘偂銈ゃ儷銈点偆銈哄彇寰 if (size > 32 * 1024) { size = 32 * 1024; @@ -354,7 +354,7 @@ namespace VirtualNes.Core private void LoadDISK() { - //todo : 磁碟机读取支持 + //todo : 纾佺鏈鸿鍙栨敮鎸 } private void LoadSRAM() @@ -367,10 +367,10 @@ namespace VirtualNes.Core if (!rom.IsSAVERAM()) return; - var saveFileDir = Supporter.Config.path.szSavePath; + var saveFileDir = Supporter.S.Config.path.szSavePath; var saveFileName = $"{rom.GetRomName()}.sav"; - var fp = Supporter.OpenFile(saveFileDir, saveFileName); + var fp = Supporter.S.OpenFile(saveFileDir, saveFileName); try { @@ -400,7 +400,7 @@ namespace VirtualNes.Core { int i; - // 儊儌儕僋儕傾 + // 鍎婂剬鍎曞儖鍎曞偩 MemoryUtility.ZEROMEMORY(MMU.RAM, MMU.RAM.Length); MemoryUtility.ZEROMEMORY(MMU.WRAM, MMU.WRAM.Length); MemoryUtility.ZEROMEMORY(MMU.DRAM, MMU.DRAM.Length); @@ -420,11 +420,11 @@ namespace VirtualNes.Core MMU.PROM = MMU.VROM = null; - // 0 彍嶼杊巭懳嶔 + // 0 褰嶅都鏉婂翻鎳冲稊 MMU.PROM_8K_SIZE = MMU.PROM_16K_SIZE = MMU.PROM_32K_SIZE = 1; MMU.VROM_1K_SIZE = MMU.VROM_2K_SIZE = MMU.VROM_4K_SIZE = MMU.VROM_8K_SIZE = 1; - // 僨僼僅儖僩僶儞僋愝掕 + // 鍍ㄥ兗鍍呭剸鍍╁兌鍎炲儖鎰濇帟 for (i = 0; i < 8; i++) { MMU.CPU_MEM_BANK[i] = null; @@ -432,11 +432,11 @@ namespace VirtualNes.Core MMU.CPU_MEM_PAGE[i] = 0; } - // 撪憻RAM/WRAM + // 鎾喕RAM/WRAM MMU.SetPROM_Bank(0, MMU.RAM, MMU.BANKTYPE_RAM); MMU.SetPROM_Bank(3, MMU.WRAM, MMU.BANKTYPE_RAM); - // 僟儈乕 + // 鍍熷剤涔 MMU.SetPROM_Bank(1, MMU.XRAM, MMU.BANKTYPE_ROM); MMU.SetPROM_Bank(2, MMU.XRAM, MMU.BANKTYPE_ROM); @@ -502,13 +502,13 @@ namespace VirtualNes.Core EmulationCPU(nescfg.ScanlineCycles); if (bDraw) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } else { if (pad.IsZapperMode() && scanline == ZapperY) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } else { @@ -518,11 +518,11 @@ namespace VirtualNes.Core } else { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } } } - ppu.ScanlineNext(); // 偙傟偺埵抲偱儔僗僞乕宯偼夋柺偑堘偆 + ppu.ScanlineNext(); // 鍋欏偀鍋哄煹鎶插伇鍎斿儣鍍炰箷瀹伡澶嬫熀鍋戝牁鍋 if (RenderMethod == EnumRenderMethod.PRE_ALL_RENDER) EmulationCPU(nescfg.ScanlineCycles); @@ -535,13 +535,13 @@ namespace VirtualNes.Core EmulationCPU(nescfg.HDrawCycles); if (bDraw) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } else { if (pad.IsZapperMode() && scanline == ZapperY) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } else { @@ -551,7 +551,7 @@ namespace VirtualNes.Core } else { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); } } } @@ -583,7 +583,7 @@ namespace VirtualNes.Core { pad.VSync(); - // VBLANK婜娫 + // VBLANK濠滃ǐ if (scanline == nescfg.TotalScanlines - 1) { ppu.VBlankEnd(); @@ -642,7 +642,7 @@ namespace VirtualNes.Core if (scanline == 0) { - // 僟儈乕僗僉儍儞儔僀儞 + // 鍍熷剤涔曞儣鍍夊剭鍎炲剶鍍鍎 // H-Draw (4fetches*32) EmulationCPU(FETCH_CYCLES * 128); ppu.FrameStart(); @@ -655,10 +655,10 @@ namespace VirtualNes.Core } else if (scanline < 240) { - // 僗僋儕乕儞昤夋(Scanline 1乣239) + // 鍍楀儖鍎曚箷鍎炴槫澶(Scanline 1涔239) if (bDraw) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); ppu.ScanlineNext(); EmulationCPU(FETCH_CYCLES * 10); mapper.HSync(scanline); @@ -670,7 +670,7 @@ namespace VirtualNes.Core { if (pad.IsZapperMode() && scanline == ZapperY) { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); ppu.ScanlineNext(); EmulationCPU(FETCH_CYCLES * 10); mapper.HSync(scanline); @@ -694,7 +694,7 @@ namespace VirtualNes.Core } else { - ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip); + ppu.Scanline(scanline, Supporter.S.Config.graphics.bAllSprite, Supporter.S.Config.graphics.bLeftClip); ppu.ScanlineNext(); EmulationCPU(FETCH_CYCLES * 10); mapper.HSync(scanline); @@ -707,7 +707,7 @@ namespace VirtualNes.Core } else if (scanline == 240) { - // 僟儈乕僗僉儍儞儔僀儞 (Scanline 240) + // 鍍熷剤涔曞儣鍍夊剭鍎炲剶鍍鍎 (Scanline 240) mapper.VSync(); EmulationCPU(nescfg.HDrawCycles); @@ -720,7 +720,7 @@ namespace VirtualNes.Core { pad.VSync(); - // VBLANK婜娫 + // VBLANK濠滃ǐ if (scanline == nescfg.TotalScanlines - 1) { ppu.VBlankEnd(); @@ -864,7 +864,7 @@ namespace VirtualNes.Core MMU.VROM_4K_SIZE = rom.GetVROM_SIZE() * 2; MMU.VROM_8K_SIZE = rom.GetVROM_SIZE(); - // 僨僼僅儖僩僶儞僋 + // 鍍ㄥ兗鍍呭剸鍍╁兌鍎炲儖 if (MMU.VROM_8K_SIZE != 0) { MMU.SetVROM_8K_Bank(0); @@ -874,7 +874,7 @@ namespace VirtualNes.Core MMU.SetCRAM_8K_Bank(0); } - // 儈儔乕 + // 鍎堝剶涔 if (rom.Is4SCREEN()) { MMU.SetVRAM_Mirror(MMU.VRAM_MIRROR4); @@ -976,13 +976,13 @@ namespace VirtualNes.Core reg.S = 0xFF; reg.P = CPU.Z_FLAG | CPU.R_FLAG | CPU.I_FLAG; - // 埨慡懳嶔傪寭偹偰偁偊偰儖乕僾偵(1昩暘) + // 鍩ㄦ叀鎳冲稊鍌鍋瑰伆鍋佸亰鍋板剸涔曞兙鍋(1鏄╂殬) for (int i = 0; i < nescfg.TotalScanlines * 60; i++) { EmulationCPU(nescfg.ScanlineCycles); cpu.GetContext(ref reg); - // 柍尷儖乕僾偵擖偭偨偙偲傪妋擣偟偨傜敳偗傞 + // 鏌嶅胺鍎栦箷鍍惧伒鎿栧伃鍋ㄥ仚鍋插偑濡嬫摚鍋熷仺鍌滄暢鍋楀倿 if (reg.PC == 0x4700) { break; @@ -993,7 +993,7 @@ namespace VirtualNes.Core } cpu.GetContext(ref reg); - // 柍尷儖乕僾偵擖偭偰偄偨傜嵞愝掕偡傞 + // 鏌嶅胺鍎栦箷鍍惧伒鎿栧伃鍋板亜鍋ㄥ倻宓炴劃鎺曞仭鍌 if (reg.PC == 0x4700) { reg.PC = 0x4720; // Play Address @@ -1009,7 +1009,7 @@ namespace VirtualNes.Core else { cpu.GetContext(ref reg); - reg.PC = 0x4700; // 柍尷儖乕僾 + reg.PC = 0x4700; // 鏌嶅胺鍎栦箷鍍 reg.S = 0xFF; EmulationCPU(nescfg.ScanlineCycles * nescfg.TotalScanlines); @@ -1095,7 +1095,7 @@ namespace VirtualNes.Core Debuger.Log($"Saving SAVERAM...[{romName}]"); - Supporter.SaveSRAMToFile(MMU.WRAM, romName); + Supporter.S.SaveSRAMToFile(MMU.WRAM, romName); } } @@ -1143,7 +1143,7 @@ namespace VirtualNes.Core } } - Supporter.SaveDISKToFile(contents.ToArray(), rom.GetRomName()); + Supporter.S.SaveDISKToFile(contents.ToArray(), rom.GetRomName()); } catch (Exception ex) { @@ -1168,7 +1168,7 @@ namespace VirtualNes.Core { Debuger.Log("Saving TURBOFILE..."); - Supporter.SaveFile(MMU.ERAM, Supporter.Config.path.szSavePath, "TurboFile.vtf"); + Supporter.S.SaveFile(MMU.ERAM, Supporter.S.Config.path.szSavePath, "TurboFile.vtf"); } } @@ -1186,7 +1186,7 @@ namespace VirtualNes.Core if (m_BarcodeCycles > 1000) { m_BarcodeCycles = 0; - // 掆巭丠 + // 鎺嗗翻涓 if (m_BarcodeData[m_BarcodePtr] != 0xFF) { m_BarcodeOut = m_BarcodeData[m_BarcodePtr++]; @@ -1227,7 +1227,7 @@ namespace VirtualNes.Core return; m_TapeCycles += (nescfg.CpuClock / 32000.0); - // m_TapeCycles += (nescfg.CpuClock / 22050.0); // 抶偡偓偰僟儊偭傐偄 + // m_TapeCycles += (nescfg.CpuClock / 22050.0); // 鎶跺仭鍋撳伆鍍熷剨鍋倫鍋 if (m_bTapePlay) { @@ -1293,7 +1293,7 @@ namespace VirtualNes.Core return MMU.CPU_MEM_BANK[addr >> 13][addr & 0x1FFF]; } - return 0x00; // Warning梊杊 + return 0x00; // Warning姊婃潑 } private byte ReadReg(ushort addr) @@ -1504,7 +1504,7 @@ namespace VirtualNes.Core pad.Write(addr, data); apu.Write(addr, data); break; - // VirtuaNES屌桳億乕僩 + // VirtuaNES灞屾〕鍎勪箷鍍 case 0x18: apu.Write(addr, data); break; @@ -1596,7 +1596,7 @@ namespace VirtualNes.Core ref state.reg.cpureg.FrameIRQ_type, ref state.reg.cpureg.FrameIRQ, ref state.reg.cpureg.FrameIRQ_occur); - state.reg.cpureg.FrameIRQ_cycles = cycles; // 参照がINTな為(ぉ + state.reg.cpureg.FrameIRQ_cycles = cycles; // 鍙傜収銇孖NT銇偤锛堛亯 state.reg.cpureg.DMA_cycles = cpu.GetDmaCycles(); state.reg.cpureg.emul_cycles = emul_cycles; @@ -1625,7 +1625,7 @@ namespace VirtualNes.Core MemoryUtility.memcpy(state.ram.SPPAL, MMU.SPPAL, state.ram.SPPAL.Length); MemoryUtility.memcpy(state.ram.SPRAM, MMU.SPRAM, state.ram.SPRAM.Length); - // S-RAM STATE(使用/未使用に関わらず存在すればセーブする) + // S-RAM STATE(浣跨敤/鏈娇鐢ㄣ伀闁€倧銈夈仛瀛樺湪銇欍倢銇般偦銉笺儢銇欍倠) if (rom.IsSAVERAM()) { size = (uint)SAVERAM_SIZE; @@ -1649,9 +1649,9 @@ namespace VirtualNes.Core uint size = 0; // SAVE CPU MEMORY BANK DATA - // BANK0,1,2はバンクセーブに関係なし - // VirtuaNES0.30から - // バンク3はSRAM使用に関わらずセーブ + // BANK0,1,2銇儛銉炽偗銈汇兗銉栥伀闁總銇仐 + // VirtuaNES0.30銇嬨倝 + // 銉愩兂銈紦銇疭RAM浣跨敤銇枹銈忋倝銇氥偦銉笺儢 for (int i = 3; i < 8; i++) { state.mmu.CPU_MEM_TYPE[i] = MMU.CPU_MEM_TYPE[i]; @@ -1696,7 +1696,7 @@ namespace VirtualNes.Core } } - // WRITE VRAM MEMORY(常に4K分すべて書き込む) + // WRITE VRAM MEMORY(甯搞伀4K鍒嗐仚銇广仸鏇搞亶杈笺個) state.VRAM = new byte[4 * 1024]; Array.Copy(MMU.VRAM, state.VRAM, state.VRAM.Length); @@ -1764,7 +1764,7 @@ namespace VirtualNes.Core int DiskSize = 16 + 65500 * rom.GetDiskNo(); - // 相違数をカウント + // 鐩搁仌鏁般倰銈偊銉炽儓 for (int i = 16; i < DiskSize; i++) { if (lpWrite[i] != 0) @@ -1874,9 +1874,9 @@ namespace VirtualNes.Core //BANK STATE { // SAVE CPU MEMORY BANK DATA - // BANK0,1,2はバンクセーブに関係なし - // VirtuaNES0.30から - // バンク3はSRAM使用に関わらずセーブ + // BANK0,1,2銇儛銉炽偗銈汇兗銉栥伀闁總銇仐 + // VirtuaNES0.30銇嬨倝 + // 銉愩兂銈紦銇疭RAM浣跨敤銇枹銈忋倝銇氥偦銉笺儢 for (byte i = 3; i < 8; i++) { MMU.CPU_MEM_TYPE[i] = state.mmu.CPU_MEM_TYPE[i]; diff --git a/Core/VirtualNes.Core/PAD.cs b/Core/VirtualNes.Core/PAD.cs index f8e7fdd..b228388 100644 --- a/Core/VirtualNes.Core/PAD.cs +++ b/Core/VirtualNes.Core/PAD.cs @@ -181,7 +181,7 @@ namespace VirtualNes.Core } else { - if (Supporter.Config.emulator.bFourPlayer) + if (Supporter.S.Config.emulator.bFourPlayer) { // NES type pad1bit = padbitsync[0] | ((uint)padbitsync[2] << 8) | 0x00080000; diff --git a/Core/VirtualNes.Core/ROM.cs b/Core/VirtualNes.Core/ROM.cs index 2f5966c..fa19d45 100644 --- a/Core/VirtualNes.Core/ROM.cs +++ b/Core/VirtualNes.Core/ROM.cs @@ -50,7 +50,7 @@ namespace VirtualNes.Core try { - fp = Supporter.OpenRom(fname); + fp = Supporter.S.OpenRom(fname); if (fp == null) { throw new System.Exception($"Open Rom Failed:[{fname}]"); @@ -167,7 +167,7 @@ namespace VirtualNes.Core lpPRG[3] = 0x1A; lpPRG[4] = (byte)diskno; - fp = Supporter.OpenFile_DISKSYS(); + fp = Supporter.S.OpenFile_DISKSYS(); if (fp == null) { throw new Exception($"Not found DISKSYS.ROM for [{fname}]"); @@ -217,7 +217,7 @@ namespace VirtualNes.Core throw new Exception($"Unsupport format:[{fname}]"); } - Supporter.GetFilePathInfo(fname, out fullpath, out path); + Supporter.S.GetRomPathInfo(fname, out fullpath, out path); name = Path.GetFileNameWithoutExtension(fullpath); if (!bNSF) { @@ -244,7 +244,7 @@ namespace VirtualNes.Core FileNameCheck(fname); - if (Supporter.TryGetMapperNo(this, out int mapperNo)) + if (Supporter.S.TryGetMapperNo(this, out int mapperNo)) { Debuger.Log($"ROMDB Set Mapper #{mapper:000} to #{mapperNo:000}"); mapper = mapperNo; diff --git a/Core/VirtualNes.Core/Supporter/ControllerState.cs b/Core/VirtualNes.Core/Supporter/ControllerState.cs index 409ba18..611c5a2 100644 --- a/Core/VirtualNes.Core/Supporter/ControllerState.cs +++ b/Core/VirtualNes.Core/Supporter/ControllerState.cs @@ -2,7 +2,7 @@ namespace VirtualNes.Core { - public struct ControllerState + public struct ControllerState : IEquatable { public uint raw0; public uint raw1; @@ -11,18 +11,56 @@ namespace VirtualNes.Core public bool valid; - public ControllerState( - EnumButtonType player0_buttons, - EnumButtonType player1_buttons, - EnumButtonType player2_buttons, - EnumButtonType player3_buttons) + public ControllerState(EnumButtonType[] states) { - raw0 = (uint)player0_buttons; - raw1 = (uint)player1_buttons; - raw2 = (uint)player2_buttons; - raw3 = (uint)player3_buttons; + raw0 = (uint)states[0]; + raw1 = (uint)states[1]; + raw2 = (uint)states[2]; + raw3 = (uint)states[3]; valid = true; } + + public bool HasButton(int player, EnumButtonType button) + { + uint raw = player switch + { + 0 => raw0, + 1 => raw1, + 2 => raw2, + 3 => raw3, + _ => 0 + }; + return (raw & (uint)button) == (uint)button; + } + + public override string ToString() + { + return $"{raw0}|{raw1}|{raw2}|{raw3}"; + } + + #region Impl_Equals + public bool Equals(ControllerState other) + { + return raw0 == other.raw0 && raw1 == other.raw1 && raw2 == other.raw2 && raw3 == other.raw3 && valid == other.valid; + } + + public override bool Equals(object obj) + { + return obj is ControllerState other && Equals(other); + } + + public override int GetHashCode() + { + return CombineHashCode(raw0, raw1, raw2, raw3, valid); + //return HashCode.Combine(raw0, raw1, raw2, raw3, valid); + } + + static int CombineHashCode(uint raw0, uint raw1, uint raw2, uint raw3, bool valid) + { + uint validUInt = valid ? 1u : 0u; + uint combinedHash = (raw0 * 31 + raw1) * 31 + raw2 * 31 + raw3 * 31 + validUInt; + return (int)combinedHash; + } public static bool operator ==(ControllerState left, ControllerState right) { @@ -37,24 +75,7 @@ namespace VirtualNes.Core { return !(left == right); } - - public override string ToString() - { - return $"{raw0}|{raw1}|{raw2}|{raw3}"; - } - - public bool HasButton(int player, EnumButtonType button) - { - uint raw = 0; - switch (player) - { - case 0: raw = raw0; break; - case 1: raw = raw1; break; - case 2: raw = raw2; break; - case 3: raw = raw3; break; - } - return (raw & (uint)button) == (uint)button; - } + #endregion } [Flags] diff --git a/Core/VirtualNes.Core/Supporter/Supporter.cs b/Core/VirtualNes.Core/Supporter/Supporter.cs index 41ec222..126fdec 100644 --- a/Core/VirtualNes.Core/Supporter/Supporter.cs +++ b/Core/VirtualNes.Core/Supporter/Supporter.cs @@ -1,70 +1,16 @@ -using System.IO; +锘縰sing System.IO; namespace VirtualNes.Core { public static class Supporter { private static ISupporterImpl s_support; + internal static ISupporterImpl S => s_support; + public static void Setup(ISupporterImpl supporter) { s_support = supporter; } - - public static Stream OpenRom(string fname) - { - return s_support.OpenRom(fname); - } - - public static void GetFilePathInfo(string fname, out string fullPath, out string directPath) - { - s_support.GetRomPathInfo(fname, out fullPath, out directPath); - } - - public static Stream OpenFile_DISKSYS() - { - return s_support.OpenFile_DISKSYS(); - } - - public static void SaveSRAMToFile(byte[] sramContent, string romName) - { - s_support.SaveSRAMToFile(sramContent, romName); - } - - public static void SaveDISKToFile(byte[] diskFileContent, string romName) - { - s_support.SaveDISKToFile(diskFileContent, romName); - } - - public static void PrepareDirectory(string directPath) - { - s_support.PrepareDirectory(directPath); - } - - public static void SaveFile(byte[] fileData, string directPath, string fileName) - { - s_support.SaveFile(fileData, directPath, fileName); - } - public static Stream OpenFile(string directPath, string fileName) - { - return s_support.OpenFile(directPath, fileName); - } - - public static bool TryGetMapperNo(ROM rom, out int mapperNo) - { - return s_support.TryGetMapperNo(rom, out mapperNo); - } - - public static ControllerState GetControllerState() - { - return s_support.GetControllerState(); - } - - public static void SampleInput(uint frameCount) - { - s_support.SampleInput(frameCount); - } - - public static EmulatorConfig Config => s_support.Config; } public interface ISupporterImpl @@ -75,7 +21,6 @@ namespace VirtualNes.Core void SaveSRAMToFile(byte[] sramContent, string romName); void SaveDISKToFile(byte[] diskFileContent, string romName); EmulatorConfig Config { get; } - void PrepareDirectory(string directPath); void SaveFile(byte[] fileData, string directPath, string fileName); Stream OpenFile(string directPath, string fileName); @@ -83,4 +28,4 @@ namespace VirtualNes.Core ControllerState GetControllerState(); void SampleInput(uint frameCount); } -} +} \ No newline at end of file