优化Service模块
This commit is contained in:
parent
5849de3a42
commit
e7a4150495
@ -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)
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user