Add named Eve surface document access

This commit is contained in:
Meta Vens 2026-06-29 07:09:34 +01:00
commit 8a1f981f97
4 changed files with 72 additions and 31 deletions

View file

@ -170,31 +170,10 @@ namespace GameCult.Aetheria.EveRuntime
private CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>? CreateReactiveDaemonSurfaceState(
AetheriaRuntimeStateBootReport stateBoot)
{
if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, StringComparison.Ordinal))
return AetheriaUnityRuntimeClientProvider.Reactive<global::Aetheria.State.Documents.EveSurfaceState>(
stateBoot,
AetheriaClientEveSurface.Game,
"unity-eve-surface-presenter");
if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal))
return AetheriaUnityRuntimeClientProvider.Reactive<global::Aetheria.State.Documents.EveSurfaceState>(
stateBoot,
AetheriaClientEveSurface.GameTui,
"unity-eve-surface-presenter");
if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, StringComparison.Ordinal))
return AetheriaUnityRuntimeClientProvider.Reactive<global::Aetheria.State.Documents.EveSurfaceState>(
stateBoot,
AetheriaClientEveSurface.Editor,
"unity-eve-surface-presenter");
if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal))
return AetheriaUnityRuntimeClientProvider.Reactive<global::Aetheria.State.Documents.EveSurfaceState>(
stateBoot,
AetheriaClientEveSurface.EditorTui,
"unity-eve-surface-presenter");
return null;
return AetheriaUnityRuntimeClientProvider.ReactiveEveSurface(
stateBoot,
surfaceId,
"unity-eve-surface-presenter");
}
private UIDocument ResolveDocument()

View file

@ -193,6 +193,52 @@ namespace GameCult.Aetheria.State.Verse
return Document<TDocument>().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<global::Aetheria.State.Documents.EveSurfaceState>? EveSurfaceDocument(
string? surfaceId)
{
return TryResolveEveSurface(surfaceId, out var surface)
? Document<global::Aetheria.State.Documents.EveSurfaceState>(surface)
: null;
}
public CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>? ReactiveEveSurface(
string? surfaceId)
{
return EveSurfaceDocument(surfaceId)?.Reactive();
}
public CultMeshDocumentHandle<TDocument> Document<TDocument>(AetheriaClientEveSurface surface)
where TDocument : class
{