diff --git a/Editor/AlicizaX.Editor.asmdef b/Editor/AlicizaX.Editor.asmdef index 4a5c9e3..593690c 100644 --- a/Editor/AlicizaX.Editor.asmdef +++ b/Editor/AlicizaX.Editor.asmdef @@ -2,8 +2,7 @@ "name": "AlicizaX.Editor", "rootNamespace": "", "references": [ - "GUID:75b6f2078d190f14dbda4a5b747d709c", - "GUID:2373f786d14518f44b0f475db77ba4de" + "GUID:75b6f2078d190f14dbda4a5b747d709c" ], "includePlatforms": [ "Editor" diff --git a/Editor/HybridCLR.meta b/Editor/HybridCLR.meta deleted file mode 100644 index 4ca6d5a..0000000 --- a/Editor/HybridCLR.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 596231b03a2cf834d8b2833300d9f524 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/HybridCLR/BuilderGenerate.cs b/Editor/HybridCLR/BuilderGenerate.cs deleted file mode 100644 index c9c29ba..0000000 --- a/Editor/HybridCLR/BuilderGenerate.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.IO; -using AlicizaX; -using UnityEditor; - -namespace AlicizaX.Editor -{ - public static class BuilderGenerate - { - - public static void GeneratAppBuilderSetting(Language language, bool debugMode, int resMode) - { - const string AppBuilderSettingPath = "Assets/Resources/AppBuilderSetting.bytes"; - AppBuilderSetting appBuilderSetting = new AppBuilderSetting(); - appBuilderSetting.Language = language; - appBuilderSetting.DebugMode = debugMode; - appBuilderSetting.ResMode = resMode; - File.WriteAllText(AppBuilderSettingPath, Utility.Json.ToJson(appBuilderSetting)); - } - } -} diff --git a/Editor/HybridCLR/BuilderGenerate.cs.meta b/Editor/HybridCLR/BuilderGenerate.cs.meta deleted file mode 100644 index a618038..0000000 --- a/Editor/HybridCLR/BuilderGenerate.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c08b751d385441058a634280266803eb -timeCreated: 1737524480 \ No newline at end of file diff --git a/Runtime/AlicizaX.Runtime.asmdef b/Runtime/AlicizaX.Runtime.asmdef index c9e2dcf..e4dc82d 100644 --- a/Runtime/AlicizaX.Runtime.asmdef +++ b/Runtime/AlicizaX.Runtime.asmdef @@ -12,6 +12,12 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [], + "versionDefines": [ + { + "name": "com.alicizax.unity.cysharp.zstring", + "expression": "2.3.0", + "define": "ZSTRING_SUPPORT" + } + ], "noEngineReferences": false } \ No newline at end of file diff --git a/Runtime/Base/Event.meta b/Runtime/Base/Event.meta deleted file mode 100644 index db935f2..0000000 --- a/Runtime/Base/Event.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 71df78781abe4068a2c8a8fbedca8acf -timeCreated: 1736415662 \ No newline at end of file diff --git a/Runtime/Base/Event/IEventBase.cs b/Runtime/Base/Event/IEventBase.cs deleted file mode 100644 index 3f0ed50..0000000 --- a/Runtime/Base/Event/IEventBase.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace AlicizaX -{ - public interface IEvent - { - } -} diff --git a/Runtime/Base/Event/IEventBase.cs.meta b/Runtime/Base/Event/IEventBase.cs.meta deleted file mode 100644 index 2d78e96..0000000 --- a/Runtime/Base/Event/IEventBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 421f7c10db9f44f4ba100040ad0baabc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Base/EventPool.meta b/Runtime/Base/EventPool.meta deleted file mode 100644 index 8f77143..0000000 --- a/Runtime/Base/EventPool.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 48751c35576345908f4dda6ef1133f4a -timeCreated: 1737376697 \ No newline at end of file diff --git a/Runtime/Base/EventPool/BaseEventArgs.cs b/Runtime/Base/EventPool/BaseEventArgs.cs deleted file mode 100644 index 2109224..0000000 --- a/Runtime/Base/EventPool/BaseEventArgs.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace AlicizaX -{ - /// - /// 事件基类。 - /// - public abstract class BaseEventArgs : GameFrameworkEventArgs - { - /// - /// 获取事件ID。 - /// - public abstract string Id - { - get; - } - } -} diff --git a/Runtime/Base/EventPool/BaseEventArgs.cs.meta b/Runtime/Base/EventPool/BaseEventArgs.cs.meta deleted file mode 100644 index d51a9f9..0000000 --- a/Runtime/Base/EventPool/BaseEventArgs.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dd577b63758c544d7878cb56583ace8b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Base/EventPool/EventPool.EventNode.cs b/Runtime/Base/EventPool/EventPool.EventNode.cs deleted file mode 100644 index 7b013f1..0000000 --- a/Runtime/Base/EventPool/EventPool.EventNode.cs +++ /dev/null @@ -1,50 +0,0 @@ -namespace AlicizaX -{ - public sealed partial class EventPool where T : BaseEventArgs - { - /// - /// 事件结点。 - /// - private sealed class EventNode : IMemory - { - private object _sender = null; - private T _eventArgs = null; - - /// - /// 发送者 - /// - public object Sender - { - get { return _sender; } - } - - /// - /// 事件参数 - /// - public T EventArgs - { - get { return _eventArgs; } - } - - /// - /// 创建事件节点 - /// - /// - /// - /// - public static EventNode Create(object sender, T eventArgs) - { - EventNode eventNodeNode = MemoryPool.Acquire(); - eventNodeNode._sender = sender; - eventNodeNode._eventArgs = eventArgs; - return eventNodeNode; - } - - public void Clear() - { - _sender = null; - _eventArgs = null; - } - } - } -} diff --git a/Runtime/Base/EventPool/EventPool.EventNode.cs.meta b/Runtime/Base/EventPool/EventPool.EventNode.cs.meta deleted file mode 100644 index 475eb25..0000000 --- a/Runtime/Base/EventPool/EventPool.EventNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1c00abe73a3d34fd7a8c24ea2a6ff6ae -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Base/EventPool/EventPool.cs b/Runtime/Base/EventPool/EventPool.cs deleted file mode 100644 index 65a019b..0000000 --- a/Runtime/Base/EventPool/EventPool.cs +++ /dev/null @@ -1,319 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace AlicizaX -{ - /// - /// 事件池。 - /// - /// 事件类型。 - public sealed partial class EventPool where T : BaseEventArgs - { - private readonly object _lock = new object(); - private readonly GameFrameworkMultiDictionary> _eventHandlers; - private readonly Queue _events; - private readonly Dictionary>> _cachedNodes; - private readonly Dictionary>> _tempNodes; - private readonly EventPoolMode _eventPoolMode; - private EventHandler _defaultHandler; - - /// - /// 初始化事件池的新实例。 - /// - /// 事件池模式。 - public EventPool(EventPoolMode mode) - { - _eventHandlers = new GameFrameworkMultiDictionary>(); - _events = new Queue(); - _cachedNodes = new Dictionary>>(); - _tempNodes = new Dictionary>>(); - _eventPoolMode = mode; - _defaultHandler = null; - } - - /// - /// 获取事件处理函数的数量。 - /// - public int EventHandlerCount - { - get - { - lock (_lock) - { - return _eventHandlers.Count; - } - } - } - - /// - /// 获取事件数量。 - /// - public int EventCount - { - get - { - lock (_lock) - { - return _events.Count; - } - } - } - - /// - /// 事件池轮询。 - /// - /// 逻辑流逝时间,以秒为单位。 - /// 真实流逝时间,以秒为单位。 - public void Update(float elapseSeconds, float realElapseSeconds) - { - lock (_lock) - { - while (_events.Count > 0) - { - EventNode eventNodeNode = _events.Dequeue(); - HandleEvent(eventNodeNode.Sender, eventNodeNode.EventArgs); - MemoryPool.Release(eventNodeNode); - } - } - } - - /// - /// 关闭并清理事件池。 - /// - public void Shutdown() - { - Clear(); - _eventHandlers.Clear(); - _cachedNodes.Clear(); - _tempNodes.Clear(); - _defaultHandler = null; - } - - /// - /// 清理事件。 - /// - public void Clear() - { - lock (_lock) - { - _events.Clear(); - } - } - - /// - /// 获取事件处理函数的数量。 - /// - /// 事件类型编号。 - /// 事件处理函数的数量。 - public int Count(string id) - { - lock (_lock) - { - if (_eventHandlers.TryGetValue(id, out var listRange)) - { - return listRange.Count; - } - - return 0; - } - } - - /// - /// 检查是否存在事件处理函数。 - /// - /// 事件类型编号。 - /// 要检查的事件处理函数。 - /// 是否存在事件处理函数。 - public bool Check(string id, EventHandler handler) - { - lock (_lock) - { - if (handler == null) - { - throw new GameFrameworkException("Event handler is invalid."); - } - - return _eventHandlers.Contains(id, handler); - } - } - - /// - /// 订阅事件处理函数。 - /// - /// 事件类型编号。 - /// 要订阅的事件处理函数。 - public void Subscribe(string id, EventHandler handler) - { - lock (_lock) - { - if (handler == null) - { - throw new GameFrameworkException("Event handler is invalid."); - } - - if (!_eventHandlers.Contains(id)) - { - _eventHandlers.Add(id, handler); - } - else if ((_eventPoolMode & EventPoolMode.AllowMultiHandler) != EventPoolMode.AllowMultiHandler) - { - throw new GameFrameworkException(Utility.Text.Format("Event '{0}' not allow multi handler.", id)); - } - else if ((_eventPoolMode & EventPoolMode.AllowDuplicateHandler) != EventPoolMode.AllowDuplicateHandler && Check(id, handler)) - { - throw new GameFrameworkException(Utility.Text.Format("Event '{0}' not allow duplicate handler.", id)); - } - else - { - _eventHandlers.Add(id, handler); - } - } - } - - /// - /// 取消订阅事件处理函数。 - /// - /// 事件类型编号。 - /// 要取消订阅的事件处理函数。 - public void Unsubscribe(string id, EventHandler handler) - { - lock (_lock) - { - if (handler == null) - { - throw new GameFrameworkException("Event handler is invalid."); - } - - if (_cachedNodes.Count > 0) - { - foreach (KeyValuePair>> cachedNode in _cachedNodes) - { - if (cachedNode.Value != null && cachedNode.Value.Value == handler) - { - _tempNodes.Add(cachedNode.Key, cachedNode.Value.Next); - } - } - - if (_tempNodes.Count > 0) - { - foreach (KeyValuePair>> cachedNode in _tempNodes) - { - _cachedNodes[cachedNode.Key] = cachedNode.Value; - } - - _tempNodes.Clear(); - } - } - - if (!_eventHandlers.Remove(id, handler)) - { - throw new GameFrameworkException(Utility.Text.Format("Event '{0}' not exists specified handler.", id)); - } - } - } - - /// - /// 设置默认事件处理函数。 - /// - /// 要设置的默认事件处理函数。 - public void SetDefaultHandler(EventHandler handler) - { - _defaultHandler = handler; - } - - /// - /// 抛出事件,这个操作是线程安全的,即使不在主线程中抛出,也可保证在主线程中回调事件处理函数,但事件会在抛出后的下一帧分发。 - /// - /// 事件源。 - /// 事件参数。 - public void Fire(object sender, T e) - { - lock (_lock) - { - if (e == null) - { - throw new GameFrameworkException("Event is invalid."); - } - - var eventNodeNode = EventNode.Create(sender, e); - lock (_events) - { - _events.Enqueue(eventNodeNode); - } - } - } - - /// - /// 抛出事件立即模式,这个操作不是线程安全的,事件会立刻分发。 - /// - /// 事件源。 - /// 事件参数。 - public void FireNow(object sender, T e) - { - lock (_lock) - { - if (e == null) - { - throw new GameFrameworkException("Event is invalid."); - } - - HandleEvent(sender, e); - } - } - - /// - /// 处理事件结点。 - /// - /// 事件源。 - /// 事件参数。 - private void HandleEvent(object sender, T e) - { - lock (_lock) - { - bool noHandlerException = false; - if (_eventHandlers.TryGetValue(e.Id, out var range)) - { - LinkedListNode> current = range.First; - while (current != null && current != range.Terminal) - { - _cachedNodes[e] = current.Next != range.Terminal ? current.Next : null; - try - { - current.Value?.Invoke(sender, e); - } - catch (Exception exception) - { - Log.Exception(exception); - } - - current = _cachedNodes[e]; - } - - _cachedNodes.Remove(e); - } - else if (_defaultHandler != null) - { - try - { - _defaultHandler(sender, e); - } - catch (Exception exception) - { - Log.Exception(exception); - } - } - else if ((_eventPoolMode & EventPoolMode.AllowNoHandler) == 0) - { - noHandlerException = true; - } - - MemoryPool.Release(e); - - if (noHandlerException) - { - throw new GameFrameworkException(Utility.Text.Format("Event '{0}' not allow no handler.", e.Id)); - } - } - } - } -} diff --git a/Runtime/Base/EventPool/EventPool.cs.meta b/Runtime/Base/EventPool/EventPool.cs.meta deleted file mode 100644 index e32bb26..0000000 --- a/Runtime/Base/EventPool/EventPool.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eb4fb50ba60224c5180bc2aed4efeb71 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Base/EventPool/EventPoolMode.cs b/Runtime/Base/EventPool/EventPoolMode.cs deleted file mode 100644 index 1657cde..0000000 --- a/Runtime/Base/EventPool/EventPoolMode.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; - -namespace AlicizaX -{ - /// - /// 事件池模式。 - /// - [Flags] - public enum EventPoolMode : byte - { - /// - /// 默认事件池模式,即必须存在有且只有一个事件处理函数。 - /// - Default = 0, - - /// - /// 允许不存在事件处理函数。 - /// - AllowNoHandler = 1, - - /// - /// 允许存在多个事件处理函数。 - /// - AllowMultiHandler = 2, - - /// - /// 允许存在重复的事件处理函数。 - /// - AllowDuplicateHandler = 4 - } -} diff --git a/Runtime/Base/EventPool/EventPoolMode.cs.meta b/Runtime/Base/EventPool/EventPoolMode.cs.meta deleted file mode 100644 index 09d3a23..0000000 --- a/Runtime/Base/EventPool/EventPoolMode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 10e1e3652121149a3becb11f91f7211c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Base/EventPool/GameFrameworkEventArgs.cs b/Runtime/Base/EventPool/GameFrameworkEventArgs.cs deleted file mode 100644 index f4afa02..0000000 --- a/Runtime/Base/EventPool/GameFrameworkEventArgs.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace AlicizaX -{ - /// - /// 游戏框架中包含事件数据的类的基类。 - /// - public abstract class GameFrameworkEventArgs : EventArgs, IMemory - { - /// - /// 初始化游戏框架中包含事件数据的类的新实例。 - /// - protected GameFrameworkEventArgs() - { - } - - /// - /// 清理引用。 - /// - public abstract void Clear(); - } -} diff --git a/Runtime/Base/EventPool/GameFrameworkEventArgs.cs.meta b/Runtime/Base/EventPool/GameFrameworkEventArgs.cs.meta deleted file mode 100644 index 594bc1f..0000000 --- a/Runtime/Base/EventPool/GameFrameworkEventArgs.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e79b33a9fb1f45dc8a82b3e4c0a73560 -timeCreated: 1737376755 \ No newline at end of file diff --git a/Runtime/Constant/Constant.cs b/Runtime/Constant/Constant.cs deleted file mode 100644 index 0f880e7..0000000 --- a/Runtime/Constant/Constant.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace AlicizaX -{ - /// - /// 常用设置相关常量。 - /// - public static partial class PrefsKey - { - public static class Setting - { - public const string WirtedSetting = "WirtedSetting"; - public const string Language = "Setting.Language"; - public const string SoundGroupMuted = "Setting.{0}Muted"; - public const string SoundGroupVolume = "Setting.{0}Volume"; - public const string MusicMuted = "Setting.MusicMuted"; - public const string MusicVolume = "Setting.MusicVolume"; - public const string SoundMuted = "Setting.SoundMuted"; - public const string SoundVolume = "Setting.SoundVolume"; - public const string UISoundMuted = "Setting.UISoundMuted"; - public const string UISoundVolume = "Setting.UISoundVolume"; - } - } -} diff --git a/Runtime/Constant/Constant.cs.meta b/Runtime/Constant/Constant.cs.meta deleted file mode 100644 index 344622b..0000000 --- a/Runtime/Constant/Constant.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 91862a61e413450eacc144e834e5a35b -timeCreated: 1737623610 \ No newline at end of file diff --git a/Runtime/Utility/Utility.Http.cs b/Runtime/Utility/Utility.Http.cs index 11924ae..85f0b71 100644 --- a/Runtime/Utility/Utility.Http.cs +++ b/Runtime/Utility/Utility.Http.cs @@ -1,6 +1,6 @@ -using System; +#if ZSTRING_SUPPORT + using System.Collections.Generic; -using System.Threading; using Cysharp.Threading.Tasks; using UnityEngine; using UnityEngine.Networking; @@ -104,3 +104,4 @@ namespace AlicizaX } } } +#endif