diff --git a/Runtime/ABase/Base/Service/Core/AppServices.cs b/Runtime/ABase/Base/Service/Core/AppServices.cs index 79879d6..b6ed168 100644 --- a/Runtime/ABase/Base/Service/Core/AppServices.cs +++ b/Runtime/ABase/Base/Service/Core/AppServices.cs @@ -7,67 +7,90 @@ namespace AlicizaX private static ServiceWorld _world; public static bool HasWorld => _world != null; - public static bool HasScene => _world != null && _world.HasScene; - public static bool HasGameplay => _world != null && _world.HasGameplay; + public static bool HasScene => _world is { HasScene: true }; + public static bool HasGameplay => _world is { HasGameplay: true }; - public static ServiceWorld World - { - get - { - if (_world == null) - throw new InvalidOperationException("ServiceWorld has not been created yet."); - return _world; - } - } - - public static ServiceScope App => World.App; - - public static ServiceScope Scene => World.Scene; - - public static ServiceScope Gameplay => World.Gameplay; - - public static ServiceWorld EnsureWorld(int appScopeOrder = ServiceDomainOrder.App) + internal static ServiceWorld EnsureWorld(int appScopeOrder = ServiceDomainOrder.App) { if (_world == null) _world = new ServiceWorld(appScopeOrder); return _world; } - public static ServiceScope EnsureScene(int order = ServiceDomainOrder.Scene) - => World.EnsureScene(order); - - public static bool TryGetScene(out ServiceScope scope) + internal static ServiceWorld RequireWorld() { - if (_world == null) { scope = null; return false; } - return _world.TryGetScene(out scope); + if (_world == null) + throw new InvalidOperationException("ServiceWorld has not been created yet."); + return _world; } - public static ServiceScope ResetScene(int order = ServiceDomainOrder.Scene) - => World.ResetScene(order); + public static T RegisterApp(T service, params Type[] extraContracts) where T : class, IService + => RequireWorld().App.Register(service, extraContracts); - public static bool DestroyScene() - => _world != null && _world.DestroyScene(); - - public static ServiceScope EnsureGameplay(int order = ServiceDomainOrder.Gameplay) - => World.EnsureGameplay(order); - - public static bool TryGetGameplay(out ServiceScope scope) + public static bool TryGetApp(out T service) where T : class, IService { - if (_world == null) { scope = null; return false; } - return _world.TryGetGameplay(out scope); + if (_world == null) + { + service = null; + return false; + } + + return _world.App.TryGet(out service); } - public static bool DestroyGameplay() - => _world != null && _world.DestroyGameplay(); + public static T RequireApp() where T : class, IService + => RequireWorld().App.Require(); public static bool TryGet(out T service) where T : class, IService { - if (_world == null) { service = null; return false; } + if (_world == null) + { + service = null; + return false; + } + return _world.TryGet(out service); } public static T Require() where T : class, IService - => World.Require(); + => RequireWorld().Require(); + + internal static ServiceScope EnsureScene(int order = ServiceDomainOrder.Scene) + => RequireWorld().EnsureScene(order); + + internal static bool TryGetScene(out ServiceScope scope) + { + if (_world == null) + { + scope = null; + return false; + } + + return _world.TryGetScene(out scope); + } + + internal static ServiceScope ResetScene(int order = ServiceDomainOrder.Scene) + => RequireWorld().ResetScene(order); + + internal static bool DestroyScene() + => _world != null && _world.DestroyScene(); + + internal static ServiceScope EnsureGameplay(int order = ServiceDomainOrder.Gameplay) + => RequireWorld().EnsureGameplay(order); + + internal static bool TryGetGameplay(out ServiceScope scope) + { + if (_world == null) + { + scope = null; + return false; + } + + return _world.TryGetGameplay(out scope); + } + + internal static bool DestroyGameplay() + => _world != null && _world.DestroyGameplay(); public static void Shutdown() { diff --git a/Runtime/ABase/Base/Service/Core/IService.cs b/Runtime/ABase/Base/Service/Core/IService.cs index 49b71e9..87b974f 100644 --- a/Runtime/ABase/Base/Service/Core/IService.cs +++ b/Runtime/ABase/Base/Service/Core/IService.cs @@ -2,7 +2,5 @@ namespace AlicizaX { public interface IService { - void Initialize(ServiceContext context); - void Destroy(); } } diff --git a/Runtime/ABase/Base/Service/Core/IServiceRegistry.cs b/Runtime/ABase/Base/Service/Core/IServiceRegistry.cs new file mode 100644 index 0000000..651ec14 --- /dev/null +++ b/Runtime/ABase/Base/Service/Core/IServiceRegistry.cs @@ -0,0 +1,11 @@ +using System; + +namespace AlicizaX +{ + public interface IServiceRegistry + { + T Register(T service, params Type[] extraContracts) where T : class, IService; + bool TryGet(out T service) where T : class, IService; + T Require() where T : class, IService; + } +} diff --git a/Runtime/ABase/Base/Service/Core/IServiceRegistry.cs.meta b/Runtime/ABase/Base/Service/Core/IServiceRegistry.cs.meta new file mode 100644 index 0000000..b365db5 --- /dev/null +++ b/Runtime/ABase/Base/Service/Core/IServiceRegistry.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d190bfd76bea7644b922ec06f1be6b26 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/ABase/Base/Service/Core/ServiceBase.cs b/Runtime/ABase/Base/Service/Core/ServiceBase.cs index c35d012..53fce49 100644 --- a/Runtime/ABase/Base/Service/Core/ServiceBase.cs +++ b/Runtime/ABase/Base/Service/Core/ServiceBase.cs @@ -1,16 +1,18 @@ namespace AlicizaX { - public abstract class ServiceBase : IService + internal interface IServiceLifecycle { - public ServiceContext Context { get; private set; } + void Initialize(ServiceContext context); + void Destroy(); + } - public bool IsInitialized { get; private set; } + public abstract class ServiceBase : IService, IServiceLifecycle + { + protected ServiceContext Context { get; private set; } - protected ServiceWorld World => Context.World; + protected bool IsInitialized { get; private set; } - protected ServiceScope Scope => Context.Scope; - - void IService.Initialize(ServiceContext context) + void IServiceLifecycle.Initialize(ServiceContext context) { if (IsInitialized) throw new System.InvalidOperationException($"{GetType().FullName} is already initialized."); @@ -20,7 +22,7 @@ namespace AlicizaX OnInitialize(); } - void IService.Destroy() + void IServiceLifecycle.Destroy() { if (!IsInitialized) return; diff --git a/Runtime/ABase/Base/Service/Core/ServiceContext.cs b/Runtime/ABase/Base/Service/Core/ServiceContext.cs index 1a179a0..f7253a2 100644 --- a/Runtime/ABase/Base/Service/Core/ServiceContext.cs +++ b/Runtime/ABase/Base/Service/Core/ServiceContext.cs @@ -2,56 +2,48 @@ namespace AlicizaX { public readonly struct ServiceContext { - public ServiceContext(ServiceWorld world, ServiceScope scope) + internal ServiceContext(ServiceWorld world, ServiceScope scope) { World = world; Scope = scope; } - public ServiceWorld World { get; } + internal ServiceWorld World { get; } - public ServiceScope Scope { get; } - - public ServiceScope App => World.App; - - public ServiceScope AppScope => App; + internal ServiceScope Scope { get; } public bool HasScene => World.HasScene; public bool HasGameplay => World.HasGameplay; - public ServiceScope Scene => World.Scene; - - public ServiceScope Gameplay => World.Gameplay; - public T Require() where T : class, IService => World.Require(Scope); public bool TryGet(out T service) where T : class, IService => World.TryGet(Scope, out service); - public ServiceScope EnsureScene(int order = ServiceDomainOrder.Scene) + internal ServiceScope EnsureScene(int order = ServiceDomainOrder.Scene) => World.EnsureScene(order); - public bool TryGetScene(out ServiceScope scope) + internal bool TryGetScene(out ServiceScope scope) => World.TryGetScene(out scope); - public ServiceScope ResetScene(int order = ServiceDomainOrder.Scene) + internal ServiceScope ResetScene(int order = ServiceDomainOrder.Scene) => World.ResetScene(order); - public ServiceScope EnsureGameplay(int order = ServiceDomainOrder.Gameplay) + internal ServiceScope EnsureGameplay(int order = ServiceDomainOrder.Gameplay) => World.EnsureGameplay(order); - public bool TryGetGameplay(out ServiceScope scope) + internal bool TryGetGameplay(out ServiceScope scope) => World.TryGetGameplay(out scope); public T RequireApp() where T : class, IService - => App.Require(); + => World.App.Require(); public T RequireScene() where T : class, IService - => Scene.Require(); + => World.Scene.Require(); public T RequireGameplay() where T : class, IService - => Gameplay.Require(); + => World.Gameplay.Require(); } } diff --git a/Runtime/ABase/Base/Service/Core/ServiceContractUtility.cs b/Runtime/ABase/Base/Service/Core/ServiceContractUtility.cs index 18a29aa..dbce33b 100644 --- a/Runtime/ABase/Base/Service/Core/ServiceContractUtility.cs +++ b/Runtime/ABase/Base/Service/Core/ServiceContractUtility.cs @@ -8,11 +8,13 @@ namespace AlicizaX private static readonly HashSet ExcludedContracts = new HashSet { typeof(IService), + typeof(IMonoService), typeof(IServiceTickable), typeof(IServiceLateTickable), typeof(IServiceFixedTickable), typeof(IServiceGizmoDrawable), typeof(IServiceOrder), + typeof(IServiceLifecycle), }; // Cache for the common no-extraContracts path — contracts per concrete type never change. diff --git a/Runtime/ABase/Base/Service/Core/ServiceScope.cs b/Runtime/ABase/Base/Service/Core/ServiceScope.cs index f929c23..9283c53 100644 --- a/Runtime/ABase/Base/Service/Core/ServiceScope.cs +++ b/Runtime/ABase/Base/Service/Core/ServiceScope.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace AlicizaX { - public sealed class ServiceScope : IDisposable + internal sealed class ServiceScope : IDisposable, IServiceRegistry { private readonly Dictionary _servicesByContract = new Dictionary(); private readonly Dictionary> _contractsByService = new Dictionary>(ReferenceComparer.Instance); @@ -31,13 +31,13 @@ namespace AlicizaX Order = order; } - public ServiceWorld World { get; } + internal ServiceWorld World { get; } public string Name { get; } - public int Order { get; } + internal int Order { get; } - public bool IsDisposed { get; private set; } + internal bool IsDisposed { get; private set; } public T Register(T service, params Type[] extraContracts) where T : class, IService @@ -47,6 +47,9 @@ namespace AlicizaX if (service == null) throw new ArgumentNullException(nameof(service)); + if (service is not IServiceLifecycle lifecycle) + throw new InvalidOperationException($"Service {service.GetType().FullName} must implement {nameof(IServiceLifecycle)}."); + ValidateService(service); if (_contractsByService.ContainsKey(service)) @@ -70,7 +73,7 @@ namespace AlicizaX try { - service.Initialize(new ServiceContext(World, this)); + lifecycle.Initialize(new ServiceContext(World, this)); AddToLifecycleLists(service); } catch @@ -94,9 +97,12 @@ namespace AlicizaX if (service == null || !_contractsByService.ContainsKey(service)) return false; + if (service is not IServiceLifecycle lifecycle) + throw new InvalidOperationException($"Service {service.GetType().FullName} must implement {nameof(IServiceLifecycle)}."); + RemoveFromLifecycleLists(service); RemoveBindings(service); - service.Destroy(); + lifecycle.Destroy(); return true; } @@ -155,9 +161,11 @@ namespace AlicizaX { var service = snapshot[i]; if (!_contractsByService.ContainsKey(service)) continue; + if (service is not IServiceLifecycle lifecycle) + throw new InvalidOperationException($"Service {service.GetType().FullName} must implement {nameof(IServiceLifecycle)}."); RemoveFromLifecycleLists(service); RemoveContractBindings(service); // skip _registrationOrder.Remove — we clear below - service.Destroy(); + lifecycle.Destroy(); } _registrationOrder.Clear(); diff --git a/Runtime/ABase/Base/Service/Core/ServiceWorld.cs b/Runtime/ABase/Base/Service/Core/ServiceWorld.cs index 8535df6..214552d 100644 --- a/Runtime/ABase/Base/Service/Core/ServiceWorld.cs +++ b/Runtime/ABase/Base/Service/Core/ServiceWorld.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace AlicizaX { - public sealed class ServiceWorld : IDisposable + internal sealed class ServiceWorld : IDisposable { private readonly List _scopes = new List(); private readonly Dictionary _scopesByType = new Dictionary(); @@ -13,20 +13,20 @@ namespace AlicizaX private ServiceScope _sceneScope; private ServiceScope _gameplayScope; - public ServiceWorld(int appScopeOrder = ServiceDomainOrder.App) + internal ServiceWorld(int appScopeOrder = ServiceDomainOrder.App) { App = CreateScopeInternal(typeof(AppScope), nameof(AppScope), appScopeOrder); } - public ServiceScope App { get; } + internal ServiceScope App { get; } - public ServiceScope AppScope => App; + internal ServiceScope AppScope => App; - public bool HasScene => _sceneScope != null && !_sceneScope.IsDisposed; + internal bool HasScene => _sceneScope != null && !_sceneScope.IsDisposed; - public bool HasGameplay => _gameplayScope != null && !_gameplayScope.IsDisposed; + internal bool HasGameplay => _gameplayScope != null && !_gameplayScope.IsDisposed; - public ServiceScope Scene + internal ServiceScope Scene { get { @@ -36,7 +36,7 @@ namespace AlicizaX } } - public ServiceScope Gameplay + internal ServiceScope Gameplay { get { @@ -46,24 +46,24 @@ namespace AlicizaX } } - public ServiceScope EnsureScene(int order = ServiceDomainOrder.Scene) + internal ServiceScope EnsureScene(int order = ServiceDomainOrder.Scene) => _sceneScope is { IsDisposed: false } ? _sceneScope : _sceneScope = CreateScopeInternal(typeof(SceneScope), nameof(SceneScope), order); - public bool TryGetScene(out ServiceScope scope) + internal bool TryGetScene(out ServiceScope scope) { scope = HasScene ? _sceneScope : null; return scope != null; } - public ServiceScope ResetScene(int order = ServiceDomainOrder.Scene) + internal ServiceScope ResetScene(int order = ServiceDomainOrder.Scene) { DestroyScene(); return EnsureScene(order); } - public bool DestroyScene() + internal bool DestroyScene() { if (!HasScene) return false; @@ -73,18 +73,18 @@ namespace AlicizaX return DestroyScope(scope, typeof(SceneScope)); } - public ServiceScope EnsureGameplay(int order = ServiceDomainOrder.Gameplay) + internal ServiceScope EnsureGameplay(int order = ServiceDomainOrder.Gameplay) => _gameplayScope is { IsDisposed: false } ? _gameplayScope : _gameplayScope = CreateScopeInternal(typeof(GameplayScope), nameof(GameplayScope), order); - public bool TryGetGameplay(out ServiceScope scope) + internal bool TryGetGameplay(out ServiceScope scope) { scope = HasGameplay ? _gameplayScope : null; return scope != null; } - public bool DestroyGameplay() + internal bool DestroyGameplay() { if (!HasGameplay) return false; @@ -94,10 +94,10 @@ namespace AlicizaX return DestroyScope(scope, typeof(GameplayScope)); } - public bool TryGet(out T service) where T : class, IService + internal bool TryGet(out T service) where T : class, IService => TryGet(null, out service); - public bool TryGet(ServiceScope preferredScope, out T service) where T : class, IService + internal bool TryGet(ServiceScope preferredScope, out T service) where T : class, IService { if (preferredScope != null && !preferredScope.IsDisposed && preferredScope.TryGet(out service)) return true; @@ -114,33 +114,33 @@ namespace AlicizaX return false; } - public T Require() where T : class, IService => Require(null); + internal T Require() where T : class, IService => Require(null); - public T Require(ServiceScope preferredScope) where T : class, IService + internal T Require(ServiceScope preferredScope) where T : class, IService { if (TryGet(preferredScope, out T service)) return service; throw new InvalidOperationException($"Service {typeof(T).FullName} was not found in any active scope."); } - public void Tick(float deltaTime) + internal void Tick(float deltaTime) { var snapshot = GetScopeSnapshot(); for (var i = 0; i < snapshot.Length; i++) snapshot[i].Tick(deltaTime); } - public void LateTick(float deltaTime) + internal void LateTick(float deltaTime) { var snapshot = GetScopeSnapshot(); for (var i = 0; i < snapshot.Length; i++) snapshot[i].LateTick(deltaTime); } - public void FixedTick(float fixedDeltaTime) + internal void FixedTick(float fixedDeltaTime) { var snapshot = GetScopeSnapshot(); for (var i = 0; i < snapshot.Length; i++) snapshot[i].FixedTick(fixedDeltaTime); } - public void DrawGizmos() + internal void DrawGizmos() { var snapshot = GetScopeSnapshot(); for (var i = 0; i < snapshot.Length; i++) snapshot[i].DrawGizmos(); diff --git a/Runtime/ABase/Base/Service/Unity/AppServiceRoot.cs b/Runtime/ABase/Base/Service/Unity/AppServiceRoot.cs index 44e337e..53fec15 100644 --- a/Runtime/ABase/Base/Service/Unity/AppServiceRoot.cs +++ b/Runtime/ABase/Base/Service/Unity/AppServiceRoot.cs @@ -37,22 +37,22 @@ namespace AlicizaX protected virtual void Update() { - if (AppServices.HasWorld) AppServices.World.Tick(Time.deltaTime); + if (AppServices.HasWorld) AppServices.RequireWorld().Tick(Time.deltaTime); } protected virtual void LateUpdate() { - if (AppServices.HasWorld) AppServices.World.LateTick(Time.deltaTime); + if (AppServices.HasWorld) AppServices.RequireWorld().LateTick(Time.deltaTime); } protected virtual void FixedUpdate() { - if (AppServices.HasWorld) AppServices.World.FixedTick(Time.fixedDeltaTime); + if (AppServices.HasWorld) AppServices.RequireWorld().FixedTick(Time.fixedDeltaTime); } protected virtual void OnDrawGizmos() { - if (AppServices.HasWorld) AppServices.World.DrawGizmos(); + if (AppServices.HasWorld) AppServices.RequireWorld().DrawGizmos(); } protected virtual async void OnDestroy() @@ -68,6 +68,6 @@ namespace AlicizaX } - protected virtual void RegisterAppServices(ServiceScope appScope) { } + protected virtual void RegisterAppServices(IServiceRegistry appServices) { } } } diff --git a/Runtime/ABase/Base/Service/Unity/MonoServiceBehaviour.cs b/Runtime/ABase/Base/Service/Unity/MonoServiceBehaviour.cs index 69c6d02..79c09f6 100644 --- a/Runtime/ABase/Base/Service/Unity/MonoServiceBehaviour.cs +++ b/Runtime/ABase/Base/Service/Unity/MonoServiceBehaviour.cs @@ -2,17 +2,13 @@ using UnityEngine; namespace AlicizaX { - public abstract class MonoServiceBehaviour : MonoBehaviour, IMonoService + public abstract class MonoServiceBehaviour : MonoBehaviour, IMonoService, IServiceLifecycle { - public ServiceContext Context { get; private set; } + protected ServiceContext Context { get; private set; } - public bool IsInitialized { get; private set; } + protected bool IsInitialized { get; private set; } - protected ServiceWorld World => Context.World; - - protected ServiceScope Scope => Context.Scope; - - void IService.Initialize(ServiceContext context) + void IServiceLifecycle.Initialize(ServiceContext context) { if (IsInitialized) throw new System.InvalidOperationException($"{GetType().FullName} is already initialized."); @@ -22,7 +18,7 @@ namespace AlicizaX OnInitialize(); } - void IService.Destroy() + void IServiceLifecycle.Destroy() { if (!IsInitialized) return; @@ -74,7 +70,7 @@ namespace AlicizaX private static ServiceScope ResolveOrCreateScope() { if (typeof(TScope) == typeof(AppScope)) - return AppServices.App; + return AppServices.RequireWorld().App; if (typeof(TScope) == typeof(SceneScope)) return AppServices.EnsureScene(); @@ -89,7 +85,7 @@ namespace AlicizaX { if (typeof(TScope) == typeof(AppScope)) { - scope = AppServices.App; + scope = AppServices.RequireWorld().App; return true; } diff --git a/Runtime/ABase/ObjectPool/IObjectPoolService.cs b/Runtime/ABase/ObjectPool/IObjectPoolService.cs index e3f242b..a00b635 100644 --- a/Runtime/ABase/ObjectPool/IObjectPoolService.cs +++ b/Runtime/ABase/ObjectPool/IObjectPoolService.cs @@ -42,7 +42,7 @@ namespace AlicizaX.ObjectPool /// /// 对象池管理器。 /// - public interface IObjectPoolService : IService, IServiceTickable + public interface IObjectPoolService : IService { int Count { get; } diff --git a/Runtime/ABase/ObjectPool/ObjectPoolComponent.cs b/Runtime/ABase/ObjectPool/ObjectPoolComponent.cs index f112ae5..9671b48 100644 --- a/Runtime/ABase/ObjectPool/ObjectPoolComponent.cs +++ b/Runtime/ABase/ObjectPool/ObjectPoolComponent.cs @@ -4,14 +4,14 @@ using UnityEngine; namespace AlicizaX { /// - /// + /// 对象池组件。 /// public sealed class ObjectPoolComponent : MonoBehaviour { private IObjectPoolService _mObjectPoolService = null; /// - /// ȡ + /// 获取对象池数量。 /// public int Count { @@ -20,7 +20,7 @@ namespace AlicizaX private void Awake() { - _mObjectPoolService = AppServices.App.Register(new ObjectPoolService()); + _mObjectPoolService = AppServices.RegisterApp(new ObjectPoolService()); } private void OnDestroy() @@ -29,10 +29,10 @@ namespace AlicizaX } /// - /// ȡжء + /// 获取所有对象池。 /// - /// Ƿݶصȼ - /// жء + /// 是否根据对象池的优先级排序。 + /// 所有对象池。 public ObjectPoolBase[] GetAllObjectPools(bool sort) { return _mObjectPoolService.GetAllObjectPools(sort); diff --git a/Runtime/ABase/ObjectPool/ObjectPoolService.cs b/Runtime/ABase/ObjectPool/ObjectPoolService.cs index 4d61776..1eb194f 100644 --- a/Runtime/ABase/ObjectPool/ObjectPoolService.cs +++ b/Runtime/ABase/ObjectPool/ObjectPoolService.cs @@ -9,7 +9,7 @@ namespace AlicizaX.ObjectPool /// 对象池管理器。 /// [UnityEngine.Scripting.Preserve] - internal sealed partial class ObjectPoolService : ServiceBase, IObjectPoolService + internal sealed partial class ObjectPoolService : ServiceBase, IObjectPoolService, IServiceTickable { private const int DefaultCapacity = int.MaxValue; private const float DefaultExpireTime = float.MaxValue; diff --git a/Runtime/ABase/Utility/Utility.Http.cs b/Runtime/ABase/Utility/Utility.Http.cs index 40ec2b7..75c8e1b 100644 --- a/Runtime/ABase/Utility/Utility.Http.cs +++ b/Runtime/ABase/Utility/Utility.Http.cs @@ -77,7 +77,7 @@ namespace AlicizaX catch (UnityWebRequestException e) { HandleRequestError(request, url); - return string.Empty; + return e.Message; } } diff --git a/Runtime/ABase/Utility/Utility.Platform.cs b/Runtime/ABase/Utility/Utility.Platform.cs index bba8649..550e57e 100644 --- a/Runtime/ABase/Utility/Utility.Platform.cs +++ b/Runtime/ABase/Utility/Utility.Platform.cs @@ -81,9 +81,9 @@ namespace AlicizaX { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; - return; -#endif +#else Application.Quit(); +#endif } #if UNITY_IOS @@ -98,9 +98,7 @@ namespace AlicizaX { #if UNITY_EDITOR Application.OpenURL(url); - return; -#endif -#if UNITY_IOS +#elif UNITY_IOS open_url(url); #else Application.OpenURL(url); diff --git a/Runtime/ABase/Utility/Utility.Unity.cs b/Runtime/ABase/Utility/Utility.Unity.cs index 8a1a5dd..c1fcc27 100644 --- a/Runtime/ABase/Utility/Utility.Unity.cs +++ b/Runtime/ABase/Utility/Utility.Unity.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using UnityEngine; using UnityEngine.Events; @@ -286,7 +286,7 @@ namespace AlicizaX return; } - _loopService = AppServices.App.Register(new UtilityLoopService()); + _loopService = AppServices.RegisterApp(new UtilityLoopService()); } private static UtilityLoopService EnsureLoopService() diff --git a/Runtime/Audio/AudioComponent.cs b/Runtime/Audio/AudioComponent.cs index ec621f0..24ff0d4 100644 --- a/Runtime/Audio/AudioComponent.cs +++ b/Runtime/Audio/AudioComponent.cs @@ -5,9 +5,9 @@ using UnityEngine.Audio; namespace AlicizaX.Audio.Runtime { /// - /// ЧΪϷṩͳһЧŽӿڡ + /// 音效管理,为游戏提供统一的音效播放接口。 /// - /// 3DЧҵ3DЧҵЧϣAudioSourceOutputöӦAudioMixerGroup + /// 场景3D音效挂到场景物件、技能3D音效挂到技能特效上,并在AudioSource的Output上设置对应分类的AudioMixerGroup [DisallowMultipleComponent] [AddComponentMenu("Game Framework/Audio")] public sealed class AudioComponent : MonoBehaviour @@ -22,11 +22,11 @@ namespace AlicizaX.Audio.Runtime private void Awake() { - _audioService = AppServices.App.Register(new AudioService()); + _audioService = AppServices.RegisterApp(new AudioService()); } /// - /// ʼƵģ顣 + /// 初始化音频模块。 /// void Start() { diff --git a/Runtime/Audio/AudioService.cs b/Runtime/Audio/AudioService.cs index b7df2a4..ca1b5b9 100644 --- a/Runtime/Audio/AudioService.cs +++ b/Runtime/Audio/AudioService.cs @@ -12,7 +12,7 @@ using AudioType = AlicizaX.Audio.Runtime.AudioType; namespace AlicizaX.Audio.Runtime { - internal class AudioService : ServiceBase, IAudioService + internal class AudioService : ServiceBase, IAudioService, IServiceTickable { public const string MUSIC_VOLUME_NAME = "MusicVolume"; public const string UI_SOUND_VOLUME_NAME = "UISoundVolume"; diff --git a/Runtime/Audio/IAudioService.cs b/Runtime/Audio/IAudioService.cs index 92fce10..639d9aa 100644 --- a/Runtime/Audio/IAudioService.cs +++ b/Runtime/Audio/IAudioService.cs @@ -6,7 +6,7 @@ using YooAsset; namespace AlicizaX.Audio.Runtime { - public interface IAudioService:IService, IServiceTickable + public interface IAudioService : IService { /// /// 总音量控制。 diff --git a/Runtime/Debugger/DebuggerComponent.cs b/Runtime/Debugger/DebuggerComponent.cs index 98517c7..aa2a348 100644 --- a/Runtime/Debugger/DebuggerComponent.cs +++ b/Runtime/Debugger/DebuggerComponent.cs @@ -6,7 +6,7 @@ using Object = UnityEngine.Object; namespace AlicizaX.Debugger.Runtime { /// - /// 调试器组件? + /// 璋冭瘯鍣ㄧ粍浠躲€? /// [DisallowMultipleComponent] [AddComponentMenu("Game Framework/Debugger")] @@ -28,17 +28,17 @@ namespace AlicizaX.Debugger.Runtime } /// - /// 默认调试器漂浮框大小? + /// 榛樿璋冭瘯鍣ㄦ紓娴澶у皬銆? /// internal static readonly Rect DefaultIconRect = new Rect(10f, 10f, 60f, 60f); /// - /// 默认调试器窗口大小? + /// 榛樿璋冭瘯鍣ㄧ獥鍙eぇ灏忋€? /// internal static readonly Rect DefaultWindowRect = new Rect(10f, 10f, 640f, 480f); /// - /// 默认调试器窗口缩放比例? + /// 榛樿璋冭瘯鍣ㄧ獥鍙g缉鏀炬瘮渚嬨€? /// internal static readonly float DefaultWindowScale = 1f; @@ -95,7 +95,7 @@ namespace AlicizaX.Debugger.Runtime private FpsCounter m_FpsCounter = null; /// - /// 获取或设置调试器窗口是否激活? + /// 鑾峰彇鎴栬缃皟璇曞櫒绐楀彛鏄惁婵€娲汇€? /// public bool ActiveWindow { @@ -108,7 +108,7 @@ namespace AlicizaX.Debugger.Runtime } /// - /// 获取或设置是否显示完整调试器界面? + /// 鑾峰彇鎴栬缃槸鍚︽樉绀哄畬鏁磋皟璇曞櫒鐣岄潰銆? /// public bool ShowFullWindow { @@ -117,7 +117,7 @@ namespace AlicizaX.Debugger.Runtime } /// - /// 获取或设置调试器漂浮框大小? + /// 鑾峰彇鎴栬缃皟璇曞櫒婕傛诞妗嗗ぇ灏忋€? /// public Rect IconRect { @@ -126,7 +126,7 @@ namespace AlicizaX.Debugger.Runtime } /// - /// 获取或设置调试器窗口大小? + /// 鑾峰彇鎴栬缃皟璇曞櫒绐楀彛澶у皬銆? /// public Rect WindowRect { @@ -135,7 +135,7 @@ namespace AlicizaX.Debugger.Runtime } /// - /// 获取或设置调试器窗口缩放比例? + /// 鑾峰彇鎴栬缃皟璇曞櫒绐楀彛缂╂斁姣斾緥銆? /// public float WindowScale { @@ -144,12 +144,12 @@ namespace AlicizaX.Debugger.Runtime } /// - /// 游戏框架组件初始化? + /// 娓告垙妗嗘灦缁勪欢鍒濆鍖栥€? /// private void Awake() { _instance = this; - _mDebuggerService = AppServices.App.Register(new DebuggerService()); + _mDebuggerService = AppServices.RegisterApp(new DebuggerService()); if (_mDebuggerService == null) { Log.Error("Debugger manager is invalid."); @@ -256,48 +256,48 @@ namespace AlicizaX.Debugger.Runtime } /// - /// 注册调试器窗口? + /// 娉ㄥ唽璋冭瘯鍣ㄧ獥鍙c€? /// - /// 调试器窗口路径?/param> - /// 要注册的调试器窗口?/param> - /// 初始化调试器窗口参数?/param> + /// 璋冭瘯鍣ㄧ獥鍙h矾寰勩€?/param> + /// 瑕佹敞鍐岀殑璋冭瘯鍣ㄧ獥鍙c€?/param> + /// 鍒濆鍖栬皟璇曞櫒绐楀彛鍙傛暟銆?/param> public void RegisterDebuggerWindow(string path, IDebuggerWindow debuggerWindow, params object[] args) { _mDebuggerService.RegisterDebuggerWindow(path, debuggerWindow, args); } /// - /// 解除注册调试器窗口? + /// 瑙i櫎娉ㄥ唽璋冭瘯鍣ㄧ獥鍙c€? /// - /// 调试器窗口路径?/param> - /// 是否解除注册调试器窗口成功?/returns> + /// 璋冭瘯鍣ㄧ獥鍙h矾寰勩€?/param> + /// 鏄惁瑙i櫎娉ㄥ唽璋冭瘯鍣ㄧ獥鍙f垚鍔熴€?/returns> public bool UnregisterDebuggerWindow(string path) { return _mDebuggerService.UnregisterDebuggerWindow(path); } /// - /// 获取调试器窗口? + /// 鑾峰彇璋冭瘯鍣ㄧ獥鍙c€? /// - /// 调试器窗口路径?/param> - /// 要获取的调试器窗口?/returns> + /// 璋冭瘯鍣ㄧ獥鍙h矾寰勩€?/param> + /// 瑕佽幏鍙栫殑璋冭瘯鍣ㄧ獥鍙c€?/returns> public IDebuggerWindow GetDebuggerWindow(string path) { return _mDebuggerService.GetDebuggerWindow(path); } /// - /// 选中调试器窗口? + /// 閫変腑璋冭瘯鍣ㄧ獥鍙c€? /// - /// 调试器窗口路径?/param> - /// 是否成功选中调试器窗口?/returns> + /// 璋冭瘯鍣ㄧ獥鍙h矾寰勩€?/param> + /// 鏄惁鎴愬姛閫変腑璋冭瘯鍣ㄧ獥鍙c€?/returns> public bool SelectDebuggerWindow(string path) { return _mDebuggerService.SelectDebuggerWindow(path); } /// - /// 还原调试器窗口布局? + /// 杩樺師璋冭瘯鍣ㄧ獥鍙e竷灞€銆? /// public void ResetLayout() { @@ -307,19 +307,19 @@ namespace AlicizaX.Debugger.Runtime } /// - /// 获取记录的所有日志? + /// 鑾峰彇璁板綍鐨勬墍鏈夋棩蹇椼€? /// - /// 要获取的日志?/param> + /// 瑕佽幏鍙栫殑鏃ュ織銆?/param> public void GetRecentLogs(List results) { m_ConsoleWindow.GetRecentLogs(results); } /// - /// 获取记录的最近日志? + /// 鑾峰彇璁板綍鐨勬渶杩戞棩蹇椼€? /// - /// 要获取的日志?/param> - /// 要获取最近日志的数量?/param> + /// 瑕佽幏鍙栫殑鏃ュ織銆?/param> + /// 瑕佽幏鍙栨渶杩戞棩蹇楃殑鏁伴噺銆?/param> public void GetRecentLogs(List results, int count) { m_ConsoleWindow.GetRecentLogs(results, count); diff --git a/Runtime/Debugger/DebuggerService.cs b/Runtime/Debugger/DebuggerService.cs index a9fd2a7..aa42dc5 100644 --- a/Runtime/Debugger/DebuggerService.cs +++ b/Runtime/Debugger/DebuggerService.cs @@ -7,7 +7,7 @@ namespace AlicizaX.Debugger.Runtime /// 调试器管理器。 /// [UnityEngine.Scripting.Preserve] - internal sealed partial class DebuggerService : ServiceBase, IDebuggerService + internal sealed partial class DebuggerService : ServiceBase, IDebuggerService, IServiceTickable { private readonly DebuggerWindowGroup m_DebuggerWindowRoot; private bool m_ActiveWindow; diff --git a/Runtime/Debugger/IDebuggerService.cs b/Runtime/Debugger/IDebuggerService.cs index 1bbd262..c70f10a 100644 --- a/Runtime/Debugger/IDebuggerService.cs +++ b/Runtime/Debugger/IDebuggerService.cs @@ -6,7 +6,7 @@ using AlicizaX; namespace AlicizaX.Debugger.Runtime { /// 调试器管理器接口。 - public interface IDebuggerService:IService, IServiceTickable + public interface IDebuggerService : IService { /// 获取或设置调试器窗口是否激活。 bool ActiveWindow { get; set; } diff --git a/Runtime/GameApp.cs b/Runtime/GameApp.cs index bea9658..47c68b4 100644 --- a/Runtime/GameApp.cs +++ b/Runtime/GameApp.cs @@ -23,7 +23,7 @@ public static partial class GameApp { if (_audio == null) { - _audio = AppServices.App.Require(); + _audio = AppServices.RequireApp(); } return _audio; @@ -42,7 +42,7 @@ public static partial class GameApp { if (_localization == null) { - _localization = AppServices.App.Require(); + _localization = AppServices.RequireApp(); } return _localization; @@ -60,7 +60,7 @@ public static partial class GameApp { if (_objectPool == null) { - _objectPool = AppServices.App.Require(); + _objectPool = AppServices.RequireApp(); } return _objectPool; @@ -79,7 +79,7 @@ public static partial class GameApp { if (_procedure == null) { - _procedure = AppServices.App.Require(); + _procedure = AppServices.RequireApp(); } return _procedure; @@ -98,7 +98,7 @@ public static partial class GameApp { if (_resource == null) { - _resource = AppServices.App.Require(); + _resource = AppServices.RequireApp(); } return _resource; @@ -116,7 +116,7 @@ public static partial class GameApp { if (_scene == null) { - _scene = AppServices.App.Require(); + _scene = AppServices.RequireApp(); } return _scene; @@ -134,7 +134,7 @@ public static partial class GameApp { if (_timer == null) { - _timer = AppServices.App.Require(); + _timer = AppServices.RequireApp(); } return _timer; @@ -153,7 +153,7 @@ public static partial class GameApp { if (_ui == null) { - _ui = AppServices.App.Require(); + _ui = AppServices.RequireApp(); } return _ui; diff --git a/Runtime/Localization/LocalizationComponent.cs b/Runtime/Localization/LocalizationComponent.cs index 04e6627..b225cec 100644 --- a/Runtime/Localization/LocalizationComponent.cs +++ b/Runtime/Localization/LocalizationComponent.cs @@ -53,9 +53,9 @@ namespace AlicizaX.Localization.Runtime private void Start() { - if (!AppServices.App.TryGet(out _mLocalizationService)) + if (!AppServices.TryGetApp(out _mLocalizationService)) { - _mLocalizationService = AppServices.App.Register(new LocalizationService()); + _mLocalizationService = AppServices.RegisterApp(new LocalizationService()); } if (_mLocalizationService == null) diff --git a/Runtime/Procedure/IProcedureService.cs b/Runtime/Procedure/IProcedureService.cs index d46f68b..893273a 100644 --- a/Runtime/Procedure/IProcedureService.cs +++ b/Runtime/Procedure/IProcedureService.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace AlicizaX { - public interface IProcedureService : IService, IServiceTickable + public interface IProcedureService : IService { Type CurrentProcedureType { get; } void InitializeProcedure(IEnumerable availableProcedures, Type defaultProcedureType); diff --git a/Runtime/Procedure/ProcedureComponent.cs b/Runtime/Procedure/ProcedureComponent.cs index 17382c5..c85efd7 100644 --- a/Runtime/Procedure/ProcedureComponent.cs +++ b/Runtime/Procedure/ProcedureComponent.cs @@ -8,7 +8,7 @@ namespace AlicizaX { private void Awake() { - AppServices.App.Register(new ProcedureService()); + AppServices.RegisterApp(new ProcedureService()); } } } diff --git a/Runtime/Procedure/ProcedureService.cs b/Runtime/Procedure/ProcedureService.cs index 109decd..1cfae19 100644 --- a/Runtime/Procedure/ProcedureService.cs +++ b/Runtime/Procedure/ProcedureService.cs @@ -4,7 +4,7 @@ using UnityEngine; namespace AlicizaX { - internal class ProcedureService : ServiceBase, IProcedureService + internal class ProcedureService : ServiceBase, IProcedureService, IServiceTickable { private readonly Dictionary _procedures = new Dictionary(); private IProcedure _currentProcedure; diff --git a/Runtime/Resource/Resource/ResourceComponent.cs b/Runtime/Resource/Resource/ResourceComponent.cs index 50a0340..ed81ea1 100644 --- a/Runtime/Resource/Resource/ResourceComponent.cs +++ b/Runtime/Resource/Resource/ResourceComponent.cs @@ -6,9 +6,6 @@ using YooAsset; namespace AlicizaX.Resource.Runtime { - /// - /// 资源组件�? - /// [DisallowMultipleComponent] public class ResourceComponent : MonoBehaviour { @@ -40,26 +37,14 @@ namespace AlicizaX.Resource.Runtime [SerializeField] private string decryptionServices = ""; - /// - /// 自动释放资源引用计数�?的资源包 - /// [SerializeField] public bool autoUnloadBundleWhenUnused = false; [SerializeField] private EPlayMode _playMode = EPlayMode.EditorSimulateMode; - /// - /// 当前最新的包裹版本�? - /// public string PackageVersion { set; get; } - /// - /// 资源包名称�? - /// [SerializeField] private string packageName = "DefaultPackage"; - /// - /// 资源包名称�? - /// public string PackageName { get => packageName; @@ -67,16 +52,11 @@ namespace AlicizaX.Resource.Runtime } - /// - /// 设置异步系统参数,每帧执行消耗的最大时间切片(单位:毫秒) - /// [SerializeField] public long milliseconds = 30; public int downloadingMaxNum = 10; - /// - /// 获取或设置同时最大下载数目�? - /// + public int DownloadingMaxNum { get => downloadingMaxNum; @@ -91,46 +71,31 @@ namespace AlicizaX.Resource.Runtime set => failedTryAgain = value; } - /// - /// 获取当前资源适用的游戏版本号�? - /// + public string ApplicableGameVersion => _resourceService.ApplicableGameVersion; - /// - /// 获取当前内部资源版本号�? - /// + public int InternalResourceVersion => _resourceService.InternalResourceVersion; - /// - /// 获取或设置无用资源释放的最小间隔时间,以秒为单位�? - /// public float MinUnloadUnusedAssetsInterval { get => minUnloadUnusedAssetsInterval; set => minUnloadUnusedAssetsInterval = value; } - /// - /// 获取或设置无用资源释放的最大间隔时间,以秒为单位�? - /// public float MaxUnloadUnusedAssetsInterval { get => maxUnloadUnusedAssetsInterval; set => maxUnloadUnusedAssetsInterval = value; } - /// - /// 使用系统释放无用资源策略�? - /// + public bool UseSystemUnloadUnusedAssets { get => useSystemUnloadUnusedAssets; set => useSystemUnloadUnusedAssets = value; } - /// - /// 获取无用资源释放的等待时长,以秒为单位�? - /// public float LastUnloadUnusedAssetsOperationElapseSeconds => _lastUnloadUnusedAssetsOperationElapseSeconds; [SerializeField] private float assetAutoReleaseInterval = 60f; @@ -141,36 +106,28 @@ namespace AlicizaX.Resource.Runtime [SerializeField] private int assetPriority = 0; - /// - /// 获取或设置资源对象池自动释放可释放对象的间隔秒数�? - /// + public float AssetAutoReleaseInterval { get => _resourceService.AssetAutoReleaseInterval; set => _resourceService.AssetAutoReleaseInterval = assetAutoReleaseInterval = value; } - /// - /// 获取或设置资源对象池的容量�? - /// + public int AssetCapacity { get => _resourceService.AssetCapacity; set => _resourceService.AssetCapacity = assetCapacity = value; } - /// - /// 获取或设置资源对象池对象过期秒数�? - /// + public float AssetExpireTime { get => _resourceService.AssetExpireTime; set => _resourceService.AssetExpireTime = assetExpireTime = value; } - /// - /// 获取或设置资源对象池的优先级�? - /// + public int AssetPriority { get => _resourceService.AssetPriority; @@ -191,7 +148,7 @@ namespace AlicizaX.Resource.Runtime private void Awake() { - _resourceService = AppServices.App.Register(new ResourceService()); + _resourceService = AppServices.RegisterApp(new ResourceService()); Application.lowMemory += OnLowMemory; } @@ -216,7 +173,7 @@ namespace AlicizaX.Resource.Runtime _resourceService.AssetExpireTime = assetExpireTime; _resourceService.AssetPriority = assetPriority; _resourceService.SetForceUnloadUnusedAssetsAction(ForceUnloadUnusedAssets); - Log.Info($"ResourceModule Run Mode:{_playMode}"); + Log.Info($"ResourceModule Run Mode {_playMode}"); } private void OnApplicationQuit() @@ -224,12 +181,8 @@ namespace AlicizaX.Resource.Runtime Application.lowMemory -= OnLowMemory; } - #region 释放资源 + #region 閲婃斁璧勬簮 - /// - /// 强制执行释放未被使用的资源�? - /// - /// 是否使用垃圾回收�?/param> public void ForceUnloadUnusedAssets(bool performGCCollect) { _forceUnloadUnusedAssets = true; diff --git a/Runtime/Resource/Resource/ResourceService.cs b/Runtime/Resource/Resource/ResourceService.cs index 6719a2d..eadb03e 100644 --- a/Runtime/Resource/Resource/ResourceService.cs +++ b/Runtime/Resource/Resource/ResourceService.cs @@ -37,12 +37,6 @@ namespace AlicizaX.Resource.Runtime /// public long Milliseconds { get; set; } = 30; - - public int Priority - { - get => 2; - } - private string _applicableGameVersion; private int _internalResourceVersion; diff --git a/Runtime/Scene/SceneComponent.cs b/Runtime/Scene/SceneComponent.cs index 5b69994..fa9ba90 100644 --- a/Runtime/Scene/SceneComponent.cs +++ b/Runtime/Scene/SceneComponent.cs @@ -9,9 +9,9 @@ namespace AlicizaX.Scene.Runtime { private void Awake() { - if (!AppServices.App.TryGet(out _)) + if (!AppServices.TryGetApp(out _)) { - AppServices.App.Register(new SceneService()); + AppServices.RegisterApp(new SceneService()); } AppServices.EnsureScene(); diff --git a/Runtime/Timer/ITimerService.cs b/Runtime/Timer/ITimerService.cs index fa1a492..509c20e 100644 --- a/Runtime/Timer/ITimerService.cs +++ b/Runtime/Timer/ITimerService.cs @@ -3,7 +3,7 @@ using System; namespace AlicizaX { [UnityEngine.Scripting.Preserve] - public interface ITimerService : IService, IServiceTickable + public interface ITimerService : IService { int AddTimer(TimerHandler callback, float time, bool isLoop = false, bool isUnscaled = false, params object[] args); int AddTimer(TimerHandlerNoArgs callback, float time, bool isLoop = false, bool isUnscaled = false); diff --git a/Runtime/Timer/TimerComponent.cs b/Runtime/Timer/TimerComponent.cs index 9155008..fcdc5ac 100644 --- a/Runtime/Timer/TimerComponent.cs +++ b/Runtime/Timer/TimerComponent.cs @@ -10,7 +10,7 @@ namespace AlicizaX.Timer.Runtime { private void Awake() { - AppServices.App.Register(new TimerService()); + AppServices.RegisterApp(new TimerService()); } } } diff --git a/Runtime/Timer/TimerService.cs b/Runtime/Timer/TimerService.cs index 6e91821..e89a8b1 100644 --- a/Runtime/Timer/TimerService.cs +++ b/Runtime/Timer/TimerService.cs @@ -77,7 +77,7 @@ namespace AlicizaX [UnityEngine.Scripting.Preserve] [Il2CppSetOption(Option.NullChecks, false)] [Il2CppSetOption(Option.ArrayBoundsChecks, false)] - internal sealed class TimerService : ServiceBase, ITimerService + internal sealed class TimerService : ServiceBase, ITimerService, IServiceTickable { private const float TimeWheelSlotInterval = 0.001f; diff --git a/Runtime/UI/Constant/UIMetaRegistry.cs b/Runtime/UI/Constant/UIMetaRegistry.cs index d3fcd82..a479041 100644 --- a/Runtime/UI/Constant/UIMetaRegistry.cs +++ b/Runtime/UI/Constant/UIMetaRegistry.cs @@ -87,6 +87,7 @@ namespace AlicizaX.UI.Runtime try { Type baseType = uiType; +#pragma warning disable CS8632 Type? holderType = null; var genericArgs = baseType.GetGenericArguments(); diff --git a/Runtime/UI/Manager/IUIService.cs b/Runtime/UI/Manager/IUIService.cs index 1e66db0..f4d2d1c 100644 --- a/Runtime/UI/Manager/IUIService.cs +++ b/Runtime/UI/Manager/IUIService.cs @@ -9,7 +9,7 @@ namespace AlicizaX.UI.Runtime /// UI 模块接口:负责 UI 的创建、显示、关闭与查询。 /// 支持异步与同步(预加载)两种打开方式。 /// - public interface IUIService : IService, IServiceTickable + public interface IUIService : IService { /// /// 初始化 UI 模块。 diff --git a/Runtime/UI/Manager/UIService.cs b/Runtime/UI/Manager/UIService.cs index 8206d01..56a071f 100644 --- a/Runtime/UI/Manager/UIService.cs +++ b/Runtime/UI/Manager/UIService.cs @@ -7,10 +7,8 @@ using UnityEngine; namespace AlicizaX.UI.Runtime { - internal sealed partial class UIService : ServiceBase, IUIService + internal sealed partial class UIService : ServiceBase, IUIService, IServiceTickable { - public int Priority { get; } - private ITimerService _timerService; protected override void OnInitialize() diff --git a/Runtime/UI/UIComponent.cs b/Runtime/UI/UIComponent.cs index 05544df..70f4eac 100644 --- a/Runtime/UI/UIComponent.cs +++ b/Runtime/UI/UIComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Runtime.CompilerServices; @@ -29,7 +29,7 @@ namespace AlicizaX.UI.Runtime private void Awake() { - _uiService = AppServices.App.Register(new UIService()); + _uiService = AppServices.RegisterApp(new UIService()); if (uiRoot == null) { throw new GameFrameworkException("UIRoot Prefab is invalid.");