优化Service模块

This commit is contained in:
陈思海 2026-04-20 13:57:11 +08:00
parent 5849de3a42
commit e7a4150495
3 changed files with 1 additions and 9 deletions

View File

@ -7,9 +7,6 @@ namespace AlicizaX
private static ServiceWorld _world; private static ServiceWorld _world;
public static bool HasWorld => _world != null; public static bool HasWorld => _world != null;
public static bool HasScene => _world is { HasScene: true };
public static bool HasGameplay => _world is { HasGameplay: true };
internal static ServiceWorld EnsureWorld(int appScopeOrder = ServiceDomainOrder.App) internal static ServiceWorld EnsureWorld(int appScopeOrder = ServiceDomainOrder.App)
{ {
if (_world == null) if (_world == null)

View File

@ -12,9 +12,6 @@ namespace AlicizaX
internal ServiceScope Scope { get; } internal ServiceScope Scope { get; }
public bool HasScene => World.HasScene;
public bool HasGameplay => World.HasGameplay;
public T Require<T>() where T : class, IService public T Require<T>() where T : class, IService
=> World.Require<T>(Scope); => World.Require<T>(Scope);

View File

@ -15,13 +15,11 @@ namespace AlicizaX
internal ServiceWorld(int appScopeOrder = ServiceDomainOrder.App) internal ServiceWorld(int appScopeOrder = ServiceDomainOrder.App)
{ {
App = CreateScopeInternal(typeof(AppScope), nameof(AppScope), appScopeOrder); App = CreateScopeInternal(typeof(AppScope), nameof(App), appScopeOrder);
} }
internal ServiceScope App { get; } internal ServiceScope App { get; }
internal ServiceScope AppScope => App;
internal bool HasScene => _sceneScope != null && !_sceneScope.IsDisposed; internal bool HasScene => _sceneScope != null && !_sceneScope.IsDisposed;
internal bool HasGameplay => _gameplayScope != null && !_gameplayScope.IsDisposed; internal bool HasGameplay => _gameplayScope != null && !_gameplayScope.IsDisposed;