diff --git a/Client/Assets/.claude/settings.local.json b/Client/Assets/.claude/settings.local.json index 2fa1be9..f319bb8 100644 --- a/Client/Assets/.claude/settings.local.json +++ b/Client/Assets/.claude/settings.local.json @@ -2,7 +2,9 @@ "permissions": { "allow": [ "Bash(cd InputGlyph && ls -la *.cs)", - "Bash(ls -la InputGlyph/*.cs | grep -v Editor)" + "Bash(ls -la InputGlyph/*.cs | grep -v Editor)", + "Bash(cd ../Packages/com.alicizax.unity.ui.extension && wc -l Runtime/**/*.cs | sort -n | tail -20)", + "Bash(cd ../Packages/com.alicizax.unity.ui.extension && find Runtime -name \"*.cs\" -exec wc -l {} + | sort -n | tail -20)" ] } } diff --git a/Client/Assets/Scripts/CustomeModule.meta b/Client/Assets/Scripts/CustomeModule.meta new file mode 100644 index 0000000..a402214 --- /dev/null +++ b/Client/Assets/Scripts/CustomeModule.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f2a23416e80d6df41a157dc645840eb1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/InputGlyph.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph.meta similarity index 100% rename from Client/Assets/InputGlyph.meta rename to Client/Assets/Scripts/CustomeModule/InputGlyph.meta diff --git a/Client/Assets/Scripts/CustomeModule/InputGlyph/Editor.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/Editor.meta new file mode 100644 index 0000000..3f1f5cc --- /dev/null +++ b/Client/Assets/Scripts/CustomeModule/InputGlyph/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 241d5382b2b4f274596c73f14a40cb8d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/InputGlyph/InputGlyphDatabaseEditor.cs b/Client/Assets/Scripts/CustomeModule/InputGlyph/Editor/InputGlyphDatabaseEditor.cs similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphDatabaseEditor.cs rename to Client/Assets/Scripts/CustomeModule/InputGlyph/Editor/InputGlyphDatabaseEditor.cs diff --git a/Client/Assets/InputGlyph/InputGlyphDatabaseEditor.cs.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/Editor/InputGlyphDatabaseEditor.cs.meta similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphDatabaseEditor.cs.meta rename to Client/Assets/Scripts/CustomeModule/InputGlyph/Editor/InputGlyphDatabaseEditor.cs.meta diff --git a/Client/Assets/InputGlyph/GlyphService.cs b/Client/Assets/Scripts/CustomeModule/InputGlyph/GlyphService.cs similarity index 100% rename from Client/Assets/InputGlyph/GlyphService.cs rename to Client/Assets/Scripts/CustomeModule/InputGlyph/GlyphService.cs diff --git a/Client/Assets/InputGlyph/GlyphService.cs.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/GlyphService.cs.meta similarity index 100% rename from Client/Assets/InputGlyph/GlyphService.cs.meta rename to Client/Assets/Scripts/CustomeModule/InputGlyph/GlyphService.cs.meta diff --git a/Client/Assets/InputGlyph/InputBindingManager.cs b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputBindingManager.cs similarity index 100% rename from Client/Assets/InputGlyph/InputBindingManager.cs rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputBindingManager.cs diff --git a/Client/Assets/InputGlyph/InputBindingManager.cs.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputBindingManager.cs.meta similarity index 100% rename from Client/Assets/InputGlyph/InputBindingManager.cs.meta rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputBindingManager.cs.meta diff --git a/Client/Assets/Scripts/CustomeModule/InputGlyph/InputDeviceWatcher.cs b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputDeviceWatcher.cs new file mode 100644 index 0000000..b184865 --- /dev/null +++ b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputDeviceWatcher.cs @@ -0,0 +1,242 @@ +using System; +using System.Text.RegularExpressions; +using AlicizaX; +using UnityEditor; +using UnityEngine; +using UnityEngine.InputSystem; + +public static class InputDeviceWatcher +{ + public enum InputDeviceCategory + { + Keyboard, + Xbox, + PlayStation, + Other + } + + static readonly float DebounceWindow = 1f; + public static InputDeviceCategory CurrentCategory = InputDeviceCategory.Keyboard; + public static string CurrentDeviceName = ""; + + private static InputAction _anyInputAction; + private static int _lastDeviceId = -1; + private static float _lastInputTime = -Mathf.Infinity; + + private static InputDeviceCategory _lastEmittedCategory = InputDeviceCategory.Keyboard; + + public static event Action OnDeviceChanged; + + private static bool initialized = false; + + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] + public static void Initialize() + { + if (initialized) return; + initialized = true; + + CurrentCategory = InputDeviceCategory.Keyboard; + CurrentDeviceName = ""; + _lastEmittedCategory = CurrentCategory; // 初始化同步 + + _anyInputAction = new InputAction("AnyDevice", InputActionType.PassThrough); + _anyInputAction.AddBinding("/anyKey"); + _anyInputAction.AddBinding("/*"); + _anyInputAction.AddBinding("/*"); + + _anyInputAction.performed += OnAnyInputPerformed; + _anyInputAction.Enable(); + + InputSystem.onDeviceChange += OnDeviceChange; +#if UNITY_EDITOR + EditorApplication.playModeStateChanged += OnPlayModeStateChanged; +#endif + } + +#if UNITY_EDITOR + static void OnPlayModeStateChanged(PlayModeStateChange state) + { + if (state == PlayModeStateChange.ExitingPlayMode) + { + Dispose(); + } + + EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + } +#endif + + public static void Dispose() + { + if (!initialized) return; + CurrentCategory = InputDeviceCategory.Keyboard; + _anyInputAction.performed -= OnAnyInputPerformed; + _anyInputAction.Disable(); + _anyInputAction.Dispose(); + + InputSystem.onDeviceChange -= OnDeviceChange; + + OnDeviceChanged = null; + initialized = false; + + _lastEmittedCategory = InputDeviceCategory.Keyboard; + } + + private static void OnAnyInputPerformed(InputAction.CallbackContext ctx) + { + if (ctx.control == null || ctx.control.device == null) return; + + var device = ctx.control.device; + + if (!IsRelevantDevice(device)) return; + + int curId = device.deviceId; + float now = Time.realtimeSinceStartup; + + if (curId == _lastDeviceId) return; + if (DebounceWindow > 0f && (now - _lastInputTime) < DebounceWindow) return; + + _lastInputTime = now; + _lastDeviceId = curId; + + CurrentCategory = DetermineCategoryFromDevice(device); + CurrentDeviceName = device.displayName ?? $"Device_{curId}"; + + EmitChange(); + } + + private static void OnDeviceChange(InputDevice device, InputDeviceChange change) + { + if (change == InputDeviceChange.Removed || change == InputDeviceChange.Disconnected) + { + if (device.deviceId == _lastDeviceId) + { + _lastDeviceId = -1; + _lastInputTime = -Mathf.Infinity; + CurrentDeviceName = ""; + CurrentCategory = InputDeviceCategory.Keyboard; + EmitChange(); + } + } + } + + // ------------------ 分类逻辑 -------------------- + private static InputDeviceCategory DetermineCategoryFromDevice(InputDevice device) + { + if (device == null) return InputDeviceCategory.Keyboard; + // 重要:鼠标不再被视为键盘类(避免鼠标触发时回退到 Keyboard) + if (device is Keyboard) return InputDeviceCategory.Keyboard; + if (device is Mouse) return InputDeviceCategory.Other; // 明确忽略鼠标 + if (IsGamepadLike(device)) return GetGamepadCategory(device); + + string combined = $"{device.description.interfaceName} {device.layout} {device.description.product} {device.description.manufacturer} {device.displayName}".ToLower(); + + if (combined.Contains("xbox") || combined.Contains("xinput")) return InputDeviceCategory.Xbox; + if (combined.Contains("dualshock") || combined.Contains("dualsense") || combined.Contains("playstation")) return InputDeviceCategory.PlayStation; + + return InputDeviceCategory.Other; + } + + private static bool IsGamepadLike(InputDevice device) + { + if (device is Gamepad) return true; + if (device is Joystick) return true; + + var layout = (device.layout ?? "").ToLower(); + // 这里保留 controller/gamepad/joystick 的识别,但忽略 mouse/touch 等 + if (layout.Contains("mouse") || layout.Contains("touch") || layout.Contains("pen")) return false; + return layout.Contains("gamepad") || layout.Contains("controller") || layout.Contains("joystick"); + } + + private static bool IsRelevantDevice(InputDevice device) + { + if (device == null) return false; + if (device is Keyboard) return true; + if (IsGamepadLike(device)) return true; + return false; + } + + private static InputDeviceCategory GetGamepadCategory(InputDevice device) + { + if (device == null) return InputDeviceCategory.Other; + + var iface = (device.description.interfaceName ?? "").ToLower(); + if (iface.Contains("xinput")) return InputDeviceCategory.Xbox; + + if (TryParseVidPidFromCapabilities(device.description.capabilities, out int vendorId, out int _)) + { + if (vendorId == 0x045E || vendorId == 1118) return InputDeviceCategory.Xbox; + if (vendorId == 0x054C || vendorId == 1356) return InputDeviceCategory.PlayStation; + } + + string combined = $"{device.description.interfaceName} {device.layout} {device.description.product} {device.description.manufacturer} {device.displayName}".ToLower(); + if (combined.Contains("xbox")) return InputDeviceCategory.Xbox; + if (combined.Contains("dualshock") || combined.Contains("playstation")) return InputDeviceCategory.PlayStation; + + return InputDeviceCategory.Other; + } + + // ------------------ VID/PID 解析 -------------------- + private static bool TryParseVidPidFromCapabilities(string capabilities, out int vendorId, out int productId) + { + vendorId = 0; + productId = 0; + if (string.IsNullOrEmpty(capabilities)) return false; + + try + { + var decVendor = Regex.Match(capabilities, "\"vendorId\"\\s*:\\s*(\\d+)", RegexOptions.IgnoreCase); + var decProduct = Regex.Match(capabilities, "\"productId\"\\s*:\\s*(\\d+)", RegexOptions.IgnoreCase); + + if (decVendor.Success) int.TryParse(decVendor.Groups[1].Value, out vendorId); + if (decProduct.Success) int.TryParse(decProduct.Groups[1].Value, out productId); + + return vendorId != 0 || productId != 0; + } + catch + { + return false; + } + } + + private static void EmitChange() + { + if (CurrentCategory == _lastEmittedCategory) + { + return; + } + + int vid = GetVendorId(); + int pid = GetProductId(); + +#if UNITY_EDITOR + Log.Info($"输入设备变更 -> {CurrentCategory} 触发设备: {CurrentDeviceName} vid=0x{vid:X} pid=0x{pid:X}"); +#endif + + OnDeviceChanged?.Invoke(CurrentCategory); + _lastEmittedCategory = CurrentCategory; + } + + private static int GetVendorId() + { + foreach (var d in InputSystem.devices) + { + if ((d.displayName ?? "") == CurrentDeviceName && + TryParseVidPidFromCapabilities(d.description.capabilities, out int v, out int _)) + return v; + } + + return 0; + } + + private static int GetProductId() + { + foreach (var d in InputSystem.devices) + { + if ((d.displayName ?? "") == CurrentDeviceName && + TryParseVidPidFromCapabilities(d.description.capabilities, out int _, out int p)) + return p; + } + + return 0; + } +} diff --git a/Client/Assets/Scripts/CustomeModule/InputGlyph/InputDeviceWatcher.cs.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputDeviceWatcher.cs.meta new file mode 100644 index 0000000..ac22b49 --- /dev/null +++ b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputDeviceWatcher.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e78f6224467e13742a70115f1942d941 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/InputGlyph/InputGlyphDatabase.cs b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphDatabase.cs similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphDatabase.cs rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphDatabase.cs diff --git a/Client/Assets/InputGlyph/InputGlyphDatabase.cs.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphDatabase.cs.meta similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphDatabase.cs.meta rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphDatabase.cs.meta diff --git a/Client/Assets/InputGlyph/InputGlyphImage.cs b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphImage.cs similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphImage.cs rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphImage.cs diff --git a/Client/Assets/InputGlyph/InputGlyphImage.cs.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphImage.cs.meta similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphImage.cs.meta rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphImage.cs.meta diff --git a/Client/Assets/InputGlyph/InputGlyphText.cs b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphText.cs similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphText.cs rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphText.cs diff --git a/Client/Assets/InputGlyph/InputGlyphText.cs.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphText.cs.meta similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphText.cs.meta rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphText.cs.meta diff --git a/Client/Assets/InputGlyph/InputGlyphUXButton.cs b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphUXButton.cs similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphUXButton.cs rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphUXButton.cs diff --git a/Client/Assets/InputGlyph/InputGlyphUXButton.cs.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphUXButton.cs.meta similarity index 100% rename from Client/Assets/InputGlyph/InputGlyphUXButton.cs.meta rename to Client/Assets/Scripts/CustomeModule/InputGlyph/InputGlyphUXButton.cs.meta diff --git a/Client/Assets/InputGlyph/TestRebindScript.cs b/Client/Assets/Scripts/CustomeModule/InputGlyph/TestRebindScript.cs similarity index 100% rename from Client/Assets/InputGlyph/TestRebindScript.cs rename to Client/Assets/Scripts/CustomeModule/InputGlyph/TestRebindScript.cs diff --git a/Client/Assets/InputGlyph/TestRebindScript.cs.meta b/Client/Assets/Scripts/CustomeModule/InputGlyph/TestRebindScript.cs.meta similarity index 100% rename from Client/Assets/InputGlyph/TestRebindScript.cs.meta rename to Client/Assets/Scripts/CustomeModule/InputGlyph/TestRebindScript.cs.meta diff --git a/Client/Assets/Scripts/Startup/HttpHelper.cs b/Client/Assets/Scripts/Startup/HttpHelper.cs deleted file mode 100644 index 73ba501..0000000 --- a/Client/Assets/Scripts/Startup/HttpHelper.cs +++ /dev/null @@ -1,22 +0,0 @@ -using AlicizaX; -using Cysharp.Threading.Tasks; -using Newtonsoft.Json.Linq; -using UnityEngine; - -public static class HttpHelper -{ - public const string versionApi = "http://localhost:5000/api/Version?channel=Standlone"; - public static string Version = string.Empty; - public static string CDNUrl = string.Empty; - public static string AppDownloadUrl = string.Empty; - - public static async UniTask GetRemoteVersion() - { - var updateDataStr = await Utility.Http.Get(HttpHelper.versionApi); - JObject json = JObject.Parse(updateDataStr); - Version = json["version"].ToString(); - CDNUrl = json["cdnUrl"].ToString(); - AppDownloadUrl = json["appDownloadUrl"].ToString(); - Debug.Log(updateDataStr); - } -} diff --git a/Client/Assets/Scripts/Startup/HttpHelper.cs.meta b/Client/Assets/Scripts/Startup/HttpHelper.cs.meta deleted file mode 100644 index fe5c3d0..0000000 --- a/Client/Assets/Scripts/Startup/HttpHelper.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 775a37fe679f423c86216603cf2b6dfc -timeCreated: 1679996053 \ No newline at end of file diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater.meta b/Client/Assets/Scripts/Startup/Procedure/PatchUpdater.meta deleted file mode 100644 index 0c4ec2c..0000000 --- a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f5a87a5da8854428ac9a14fc863b911a -timeCreated: 1679996055 \ No newline at end of file diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureDownloadBundleState.cs b/Client/Assets/Scripts/Startup/Procedure/ProcedureDownloadBundleState.cs similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureDownloadBundleState.cs rename to Client/Assets/Scripts/Startup/Procedure/ProcedureDownloadBundleState.cs diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureDownloadBundleState.cs.meta b/Client/Assets/Scripts/Startup/Procedure/ProcedureDownloadBundleState.cs.meta similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureDownloadBundleState.cs.meta rename to Client/Assets/Scripts/Startup/Procedure/ProcedureDownloadBundleState.cs.meta diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureEntryState.cs b/Client/Assets/Scripts/Startup/Procedure/ProcedureEntryState.cs similarity index 91% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureEntryState.cs rename to Client/Assets/Scripts/Startup/Procedure/ProcedureEntryState.cs index f3b4eb6..5c034e5 100644 --- a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureEntryState.cs +++ b/Client/Assets/Scripts/Startup/Procedure/ProcedureEntryState.cs @@ -30,7 +30,7 @@ namespace Unity.Startup.Procedure if (GameApp.Resource.PlayMode == EPlayMode.WebPlayMode) { - HttpHelper.CDNUrl = "http://127.0.0.1:8080/CDN/WebGL"; + StartupSetting.CDNUrl = "http://127.0.0.1:8080/CDN/WebGL"; SwitchProcedure(); return; } @@ -42,7 +42,7 @@ namespace Unity.Startup.Procedure { try { - await HttpHelper.GetRemoteVersion(); + await StartupSetting.GetRemoteVersion(); SwitchProcedure(); } catch (Exception e) diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureEntryState.cs.meta b/Client/Assets/Scripts/Startup/Procedure/ProcedureEntryState.cs.meta similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureEntryState.cs.meta rename to Client/Assets/Scripts/Startup/Procedure/ProcedureEntryState.cs.meta diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureGetAppVersionInfoState.cs b/Client/Assets/Scripts/Startup/Procedure/ProcedureGetAppVersionInfoState.cs similarity index 84% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureGetAppVersionInfoState.cs rename to Client/Assets/Scripts/Startup/Procedure/ProcedureGetAppVersionInfoState.cs index 13aa6f2..21b41b6 100644 --- a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureGetAppVersionInfoState.cs +++ b/Client/Assets/Scripts/Startup/Procedure/ProcedureGetAppVersionInfoState.cs @@ -22,13 +22,13 @@ namespace Unity.Startup.Procedure { try { - if (HttpHelper.Version != AppVersion.GameVersion) + if (StartupSetting.Version != AppVersion.GameVersion) { - Log.Warning($"Version inconsistency : {AppVersion.GameVersion}->{HttpHelper.Version} "); + Log.Warning($"Version inconsistency : {AppVersion.GameVersion}->{StartupSetting.Version} "); #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else - Application.OpenURL(HttpHelper.AppDownloadUrl); + Application.OpenURL(StartupSetting.AppDownloadUrl); Application.Quit(); #endif diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureGetAppVersionInfoState.cs.meta b/Client/Assets/Scripts/Startup/Procedure/ProcedureGetAppVersionInfoState.cs.meta similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureGetAppVersionInfoState.cs.meta rename to Client/Assets/Scripts/Startup/Procedure/ProcedureGetAppVersionInfoState.cs.meta diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureInitPackageState.cs b/Client/Assets/Scripts/Startup/Procedure/ProcedureInitPackageState.cs similarity index 98% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureInitPackageState.cs rename to Client/Assets/Scripts/Startup/Procedure/ProcedureInitPackageState.cs index d480000..ce9e658 100644 --- a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureInitPackageState.cs +++ b/Client/Assets/Scripts/Startup/Procedure/ProcedureInitPackageState.cs @@ -18,7 +18,7 @@ namespace Unity.Startup.Procedure string hostUrl = string.Empty; if (GameApp.Resource.PlayMode == EPlayMode.HostPlayMode || GameApp.Resource.PlayMode == EPlayMode.WebPlayMode) { - hostUrl = HttpHelper.CDNUrl; + hostUrl = StartupSetting.CDNUrl; } await GameApp.Resource.InitPackageAsync(string.Empty, hostUrl, hostUrl); await UniTask.DelayFrame(); diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureInitPackageState.cs.meta b/Client/Assets/Scripts/Startup/Procedure/ProcedureInitPackageState.cs.meta similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureInitPackageState.cs.meta rename to Client/Assets/Scripts/Startup/Procedure/ProcedureInitPackageState.cs.meta diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureLoadAssembly.cs b/Client/Assets/Scripts/Startup/Procedure/ProcedureLoadAssembly.cs similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureLoadAssembly.cs rename to Client/Assets/Scripts/Startup/Procedure/ProcedureLoadAssembly.cs diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureLoadAssembly.cs.meta b/Client/Assets/Scripts/Startup/Procedure/ProcedureLoadAssembly.cs.meta similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureLoadAssembly.cs.meta rename to Client/Assets/Scripts/Startup/Procedure/ProcedureLoadAssembly.cs.meta diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedurePatchDoneState.cs b/Client/Assets/Scripts/Startup/Procedure/ProcedurePatchDoneState.cs similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedurePatchDoneState.cs rename to Client/Assets/Scripts/Startup/Procedure/ProcedurePatchDoneState.cs diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedurePatchDoneState.cs.meta b/Client/Assets/Scripts/Startup/Procedure/ProcedurePatchDoneState.cs.meta similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedurePatchDoneState.cs.meta rename to Client/Assets/Scripts/Startup/Procedure/ProcedurePatchDoneState.cs.meta diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureUpdateFinishState.cs b/Client/Assets/Scripts/Startup/Procedure/ProcedureUpdateFinishState.cs similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureUpdateFinishState.cs rename to Client/Assets/Scripts/Startup/Procedure/ProcedureUpdateFinishState.cs diff --git a/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureUpdateFinishState.cs.meta b/Client/Assets/Scripts/Startup/Procedure/ProcedureUpdateFinishState.cs.meta similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureUpdateFinishState.cs.meta rename to Client/Assets/Scripts/Startup/Procedure/ProcedureUpdateFinishState.cs.meta diff --git a/Client/Assets/Scripts/Startup/Procedure/ProcedureEntry.cs b/Client/Assets/Scripts/Startup/ProcedureEntry.cs similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/ProcedureEntry.cs rename to Client/Assets/Scripts/Startup/ProcedureEntry.cs diff --git a/Client/Assets/Scripts/Startup/Procedure/ProcedureEntry.cs.meta b/Client/Assets/Scripts/Startup/ProcedureEntry.cs.meta similarity index 100% rename from Client/Assets/Scripts/Startup/Procedure/ProcedureEntry.cs.meta rename to Client/Assets/Scripts/Startup/ProcedureEntry.cs.meta diff --git a/Client/Assets/Scripts/Startup/StartupSetting.cs b/Client/Assets/Scripts/Startup/StartupSetting.cs index ef2b772..cb2173b 100644 --- a/Client/Assets/Scripts/Startup/StartupSetting.cs +++ b/Client/Assets/Scripts/Startup/StartupSetting.cs @@ -1,5 +1,9 @@ using System.Collections.Generic; +using AlicizaX; using AlicizaX.Resource.Runtime; +using Cysharp.Threading.Tasks; +using Newtonsoft.Json.Linq; +using UnityEngine; using YooAsset; public static class StartupSetting @@ -10,4 +14,21 @@ public static class StartupSetting public static readonly List HotUpdateAssemblies = new List() { "GameLib.dll", "GameProto.dll", "GameBase.dll", "GameLogic.dll" }; + + + + public const string VersionApi = "http://localhost:5000/api/Version?channel=Standlone"; + public static string Version = string.Empty; + public static string CDNUrl = string.Empty; + public static string AppDownloadUrl = string.Empty; + + public static async UniTask GetRemoteVersion() + { + var updateDataStr = await Utility.Http.Get(VersionApi); + JObject json = JObject.Parse(updateDataStr); + Version = json["version"].ToString(); + CDNUrl = json["cdnUrl"].ToString(); + AppDownloadUrl = json["appDownloadUrl"].ToString(); + Debug.Log(updateDataStr); + } } diff --git a/Client/Assets/Test.meta b/Client/Assets/Test.meta new file mode 100644 index 0000000..b21a43e --- /dev/null +++ b/Client/Assets/Test.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 120be4f03dcf52a4c827a44807402f14 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Test/GameBase.dll.bytes b/Client/Assets/Test/GameBase.dll.bytes new file mode 100644 index 0000000..6a37b71 Binary files /dev/null and b/Client/Assets/Test/GameBase.dll.bytes differ diff --git a/Client/Assets/Test/GameBase.dll.bytes.meta b/Client/Assets/Test/GameBase.dll.bytes.meta new file mode 100644 index 0000000..945e4c8 --- /dev/null +++ b/Client/Assets/Test/GameBase.dll.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fece5a979e9f6ad489f077bad6fb358c +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Test/GameBase.pdb.bytes b/Client/Assets/Test/GameBase.pdb.bytes new file mode 100644 index 0000000..bb25158 Binary files /dev/null and b/Client/Assets/Test/GameBase.pdb.bytes differ diff --git a/Client/Assets/Test/GameBase.pdb.bytes.meta b/Client/Assets/Test/GameBase.pdb.bytes.meta new file mode 100644 index 0000000..5e510a2 --- /dev/null +++ b/Client/Assets/Test/GameBase.pdb.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d7fad1223ee359940a43eccb1814103f +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Test/GameLib.dll.bytes b/Client/Assets/Test/GameLib.dll.bytes new file mode 100644 index 0000000..dbb4ce4 Binary files /dev/null and b/Client/Assets/Test/GameLib.dll.bytes differ diff --git a/Client/Assets/Test/GameLib.dll.bytes.meta b/Client/Assets/Test/GameLib.dll.bytes.meta new file mode 100644 index 0000000..2b7fc7c --- /dev/null +++ b/Client/Assets/Test/GameLib.dll.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 66312dfa5dc7a594fa239d5e23983099 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Test/GameLib.pdb.bytes b/Client/Assets/Test/GameLib.pdb.bytes new file mode 100644 index 0000000..d6d2b6f Binary files /dev/null and b/Client/Assets/Test/GameLib.pdb.bytes differ diff --git a/Client/Assets/Test/GameLib.pdb.bytes.meta b/Client/Assets/Test/GameLib.pdb.bytes.meta new file mode 100644 index 0000000..4cc89f5 --- /dev/null +++ b/Client/Assets/Test/GameLib.pdb.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0be83be7a9ef27d4a98952a568da1bc4 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Test/GameLogic.dll.bytes b/Client/Assets/Test/GameLogic.dll.bytes new file mode 100644 index 0000000..a18bfcc Binary files /dev/null and b/Client/Assets/Test/GameLogic.dll.bytes differ diff --git a/Client/Assets/Test/GameLogic.dll.bytes.meta b/Client/Assets/Test/GameLogic.dll.bytes.meta new file mode 100644 index 0000000..7a44ef8 --- /dev/null +++ b/Client/Assets/Test/GameLogic.dll.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ca9087bc37b3f8d48b90396b79b283f3 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Test/GameLogic.pdb.bytes b/Client/Assets/Test/GameLogic.pdb.bytes new file mode 100644 index 0000000..275de1e Binary files /dev/null and b/Client/Assets/Test/GameLogic.pdb.bytes differ diff --git a/Client/Assets/Test/GameLogic.pdb.bytes.meta b/Client/Assets/Test/GameLogic.pdb.bytes.meta new file mode 100644 index 0000000..2291e05 --- /dev/null +++ b/Client/Assets/Test/GameLogic.pdb.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 200d1a5604e5e984e89a9bf9f4317d22 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Test/GameProto.dll.bytes b/Client/Assets/Test/GameProto.dll.bytes new file mode 100644 index 0000000..8fa3200 Binary files /dev/null and b/Client/Assets/Test/GameProto.dll.bytes differ diff --git a/Client/Assets/Test/GameProto.dll.bytes.meta b/Client/Assets/Test/GameProto.dll.bytes.meta new file mode 100644 index 0000000..c08ece8 --- /dev/null +++ b/Client/Assets/Test/GameProto.dll.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3bd16e6ed56d37c448334a4fe1a0fec3 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Test/GameProto.pdb.bytes b/Client/Assets/Test/GameProto.pdb.bytes new file mode 100644 index 0000000..1be991b Binary files /dev/null and b/Client/Assets/Test/GameProto.pdb.bytes differ diff --git a/Client/Assets/Test/GameProto.pdb.bytes.meta b/Client/Assets/Test/GameProto.pdb.bytes.meta new file mode 100644 index 0000000..c478f8e --- /dev/null +++ b/Client/Assets/Test/GameProto.pdb.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9eb4e0f52fdd98d4dafef1d7c14a07fb +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Packages/com.alicizax.unity.ui.extension b/Client/Packages/com.alicizax.unity.ui.extension index b3f3f26..2471317 160000 --- a/Client/Packages/com.alicizax.unity.ui.extension +++ b/Client/Packages/com.alicizax.unity.ui.extension @@ -1 +1 @@ -Subproject commit b3f3f268bf27686916f963b219ffda4e8392b914 +Subproject commit 247131780105020317e8d31c5f81a60bbbb0cc18