diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 495f5aaca..776067e43 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -3213,14 +3213,10 @@ static void RequireEveRuntimeBootstrap(string root) { "private string surfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId", "ReadDaemonSurface(stateBoot)", - "AetheriaUnityRuntimeClientProvider.Reactive(", + "AetheriaUnityRuntimeClientProvider.ReactiveEveSurface(", "AetheriaUnityRuntimeClientProvider.EveSurfaceStateRefResolver(", "CultMeshReactiveDocument", "ResolveReactiveDaemonSurfaceState(", - "AetheriaClientEveSurface.Game", - "AetheriaClientEveSurface.GameTui", - "AetheriaClientEveSurface.Editor", - "AetheriaClientEveSurface.EditorTui", "DisposeReactiveSurfaceState()", "AetheriaRuntimeEveSurfaceAdapter.ToEveSurfaceDocument(", "private bool ShouldMountSurface(", @@ -3273,6 +3269,7 @@ static void RequireEveRuntimeBootstrap(string root) if (presenter.Contains("ResolveClient(", StringComparison.Ordinal) || presenter.Contains("AetheriaRuntimeDaemonSurfaceCommands.TrySubmit(", StringComparison.Ordinal) || + presenter.Contains("AetheriaClientEveSurface.", StringComparison.Ordinal) || presenter.Contains("client.State.", StringComparison.Ordinal) || presenter.Contains("client.Ui.", StringComparison.Ordinal)) { @@ -8330,6 +8327,9 @@ static void RequireAetheriaManagedStateAccessorsCoverDomainDocuments(string root { "public CultMeshDocumentHandle Document()", "public enum AetheriaClientEveSurface", + "public static bool TryResolveEveSurface(", + "public CultMeshDocumentHandle? EveSurfaceDocument(", + "public CultMeshReactiveDocument? ReactiveEveSurface(", "public CultMeshDocumentHandle Document(AetheriaClientEveSurface surface)", "public CultMeshDocumentHandle Document(AetheriaRuntimeRtsViewportBounds viewport)", "public CultMeshDocumentHandle Document(int index)", @@ -16343,6 +16343,7 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) "public static CultMeshReactiveDocument Reactive(string runtimeId = \"\")", "public static CultMeshReactiveDocument Reactive(", "AetheriaClientEveSurface surface", + "public static CultMeshReactiveDocument ReactiveEveSurface(", "public static CultMeshStateRefResolver EveSurfaceStateRefResolver(string runtimeId = \"\")", "public static CultMeshStateRefResolver EveSurfaceStateRefResolver(", "private static readonly Dictionary RuntimeClients", @@ -16900,7 +16901,7 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) string.Join(", ", mainMenuReaderHits)); } - if (!eveSurfacePresenter.Contains("AetheriaUnityRuntimeClientProvider.Reactive(", StringComparison.Ordinal) || + if (!eveSurfacePresenter.Contains("AetheriaUnityRuntimeClientProvider.ReactiveEveSurface(", StringComparison.Ordinal) || !eveSurfacePresenter.Contains("ReadDaemonSurface(stateBoot)", StringComparison.Ordinal)) { throw new InvalidOperationException( diff --git a/Assets/Scripts/Gameplay/AetheriaUnityRuntimeClientProvider.cs b/Assets/Scripts/Gameplay/AetheriaUnityRuntimeClientProvider.cs index 6b0faae12..5db376524 100644 --- a/Assets/Scripts/Gameplay/AetheriaUnityRuntimeClientProvider.cs +++ b/Assets/Scripts/Gameplay/AetheriaUnityRuntimeClientProvider.cs @@ -136,6 +136,21 @@ public static class AetheriaUnityRuntimeClientProvider return RuntimeState(stateBoot, runtimeId).Reactive(surface); } + public static CultMeshReactiveDocument ReactiveEveSurface( + string surfaceId, + string runtimeId = "") + { + return RuntimeState(runtimeId).ReactiveEveSurface(surfaceId); + } + + public static CultMeshReactiveDocument ReactiveEveSurface( + AetheriaRuntimeStateBootReport stateBoot, + string surfaceId, + string runtimeId = "") + { + return RuntimeState(stateBoot, runtimeId).ReactiveEveSurface(surfaceId); + } + public static CultMeshReactiveDocument Reactive( AetheriaRuntimeRtsViewportBounds viewport, string runtimeId = "") diff --git a/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs b/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs index f59b47d5c..eb7dc62f5 100644 --- a/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs +++ b/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs @@ -170,31 +170,10 @@ namespace GameCult.Aetheria.EveRuntime private CultMeshReactiveDocument? CreateReactiveDaemonSurfaceState( AetheriaRuntimeStateBootReport stateBoot) { - if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, StringComparison.Ordinal)) - return AetheriaUnityRuntimeClientProvider.Reactive( - stateBoot, - AetheriaClientEveSurface.Game, - "unity-eve-surface-presenter"); - - if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal)) - return AetheriaUnityRuntimeClientProvider.Reactive( - stateBoot, - AetheriaClientEveSurface.GameTui, - "unity-eve-surface-presenter"); - - if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, StringComparison.Ordinal)) - return AetheriaUnityRuntimeClientProvider.Reactive( - stateBoot, - AetheriaClientEveSurface.Editor, - "unity-eve-surface-presenter"); - - if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal)) - return AetheriaUnityRuntimeClientProvider.Reactive( - stateBoot, - AetheriaClientEveSurface.EditorTui, - "unity-eve-surface-presenter"); - - return null; + return AetheriaUnityRuntimeClientProvider.ReactiveEveSurface( + stateBoot, + surfaceId, + "unity-eve-surface-presenter"); } private UIDocument ResolveDocument() diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs index eee30eb4b..1399ed435 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs @@ -193,6 +193,52 @@ namespace GameCult.Aetheria.State.Verse return Document().Reactive(); } + public static bool TryResolveEveSurface( + string? surfaceId, + out AetheriaClientEveSurface surface) + { + if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, StringComparison.Ordinal)) + { + surface = AetheriaClientEveSurface.Game; + return true; + } + + if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal)) + { + surface = AetheriaClientEveSurface.GameTui; + return true; + } + + if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, StringComparison.Ordinal)) + { + surface = AetheriaClientEveSurface.Editor; + return true; + } + + if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal)) + { + surface = AetheriaClientEveSurface.EditorTui; + return true; + } + + surface = default; + return false; + } + + public CultMeshDocumentHandle? EveSurfaceDocument( + string? surfaceId) + { + return TryResolveEveSurface(surfaceId, out var surface) + ? Document(surface) + : null; + } + + public CultMeshReactiveDocument? ReactiveEveSurface( + string? surfaceId) + { + return EveSurfaceDocument(surfaceId)?.Reactive(); + } + public CultMeshDocumentHandle Document(AetheriaClientEveSurface surface) where TDocument : class {