Use reactive daemon Eve surfaces
This commit is contained in:
parent
03295ad7a9
commit
64459c444f
3 changed files with 113 additions and 10 deletions
|
|
@ -3195,10 +3195,13 @@ static void RequireEveRuntimeBootstrap(string root)
|
|||
"ReadDaemonSurface(statePath)",
|
||||
"ReadDaemonSurface(stateBoot.StateFilePath)",
|
||||
"AetheriaUnityRuntimeClientProvider.ResolveClient(",
|
||||
"client.State.Daemon.GameSurface.LatestAsync()",
|
||||
"client.State.Daemon.GameTuiSurface.LatestAsync()",
|
||||
"client.State.Daemon.EditorSurface.LatestAsync()",
|
||||
"client.State.Daemon.EditorTuiSurface.LatestAsync()",
|
||||
"CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>",
|
||||
"ResolveReactiveDaemonSurfaceState(",
|
||||
"client.State.Daemon.ReactiveGameSurface()",
|
||||
"client.State.Daemon.ReactiveGameTuiSurface()",
|
||||
"client.State.Daemon.ReactiveEditorSurface()",
|
||||
"client.State.Daemon.ReactiveEditorTuiSurface()",
|
||||
"DisposeReactiveSurfaceState()",
|
||||
"AetheriaRuntimeEveSurfaceAdapter.ToEveSurfaceDocument(",
|
||||
"private bool ShouldMountSurface(",
|
||||
"_mountedSurfaceVersion != surface.Version",
|
||||
|
|
@ -3228,10 +3231,14 @@ static void RequireEveRuntimeBootstrap(string root)
|
|||
if (presenter.Contains(".DaemonGameSurfaceAsync()", StringComparison.Ordinal) ||
|
||||
presenter.Contains(".DaemonGameTuiSurfaceAsync()", StringComparison.Ordinal) ||
|
||||
presenter.Contains(".DaemonEditorSurfaceAsync()", StringComparison.Ordinal) ||
|
||||
presenter.Contains(".DaemonEditorTuiSurfaceAsync()", StringComparison.Ordinal))
|
||||
presenter.Contains(".DaemonEditorTuiSurfaceAsync()", StringComparison.Ordinal) ||
|
||||
presenter.Contains("client.State.Daemon.GameSurface.LatestAsync()", StringComparison.Ordinal) ||
|
||||
presenter.Contains("client.State.Daemon.GameTuiSurface.LatestAsync()", StringComparison.Ordinal) ||
|
||||
presenter.Contains("client.State.Daemon.EditorSurface.LatestAsync()", StringComparison.Ordinal) ||
|
||||
presenter.Contains("client.State.Daemon.EditorTuiSurface.LatestAsync()", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Aetheria Eve presenter still reads daemon surfaces through AetheriaClient compatibility helpers instead of managed document handles.");
|
||||
"Aetheria Eve presenter still reads daemon surfaces through one-shot compatibility helpers instead of managed reactive document handles.");
|
||||
}
|
||||
|
||||
if (presenter.Contains("new EveUiToolkitSurfaceLowerer", StringComparison.Ordinal))
|
||||
|
|
@ -7598,6 +7605,10 @@ static void RequireAetheriaManagedStateAccessorsCoverDomainDocuments(string root
|
|||
"public global::Aetheria.State.Documents.EveSurfaceState LatestGameTuiSurface()",
|
||||
"public global::Aetheria.State.Documents.EveSurfaceState LatestEditorSurface()",
|
||||
"public global::Aetheria.State.Documents.EveSurfaceState LatestEditorTuiSurface()",
|
||||
"public CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState> ReactiveGameSurface(",
|
||||
"public CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState> ReactiveGameTuiSurface(",
|
||||
"public CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState> ReactiveEditorSurface(",
|
||||
"public CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState> ReactiveEditorTuiSurface(",
|
||||
"public AetheriaRuntimeRtsViewportDocument LatestMap(AetheriaRuntimeRtsViewportBounds viewport)",
|
||||
"public AetheriaRuntimeGravityViewportDocument LatestGravity(AetheriaRuntimeRtsViewportBounds viewport)",
|
||||
"public AetheriaRuntimeSelectedObjectDocument LatestSelectedObject(int entityIndex)",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
|
|
@ -33,6 +34,9 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
private string _mountedSurfaceId = "";
|
||||
private long _mountedSurfaceVersion = -1;
|
||||
private string _mountedSurfaceUpdatedAtUtc = "";
|
||||
private CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>? _reactiveSurfaceState;
|
||||
private string _reactiveSurfaceStatePath = "";
|
||||
private string _reactiveSurfaceId = "";
|
||||
private static readonly AetheriaEveUnitySurfaceChrome RootOnlyChrome = new AetheriaEveUnitySurfaceChrome
|
||||
{
|
||||
UseShell = false,
|
||||
|
|
@ -96,6 +100,11 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
Mount();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
DisposeReactiveSurfaceState();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!refreshInUpdate || Time.unscaledTime < _nextRefreshTime)
|
||||
|
|
@ -130,18 +139,46 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
}
|
||||
|
||||
private global::Aetheria.State.Documents.EveSurfaceState? ReadDaemonSurfaceState(AetheriaClient client)
|
||||
{
|
||||
var reactive = ResolveReactiveDaemonSurfaceState(client);
|
||||
return reactive?.Current;
|
||||
}
|
||||
|
||||
private CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>? ResolveReactiveDaemonSurfaceState(
|
||||
AetheriaClient client)
|
||||
{
|
||||
if (_reactiveSurfaceState != null &&
|
||||
string.Equals(_reactiveSurfaceStatePath, client.StatePath, StringComparison.Ordinal) &&
|
||||
string.Equals(_reactiveSurfaceId, surfaceId, StringComparison.Ordinal))
|
||||
{
|
||||
return _reactiveSurfaceState;
|
||||
}
|
||||
|
||||
DisposeReactiveSurfaceState();
|
||||
_reactiveSurfaceState = CreateReactiveDaemonSurfaceState(client);
|
||||
if (_reactiveSurfaceState != null)
|
||||
{
|
||||
_reactiveSurfaceStatePath = client.StatePath;
|
||||
_reactiveSurfaceId = surfaceId ?? "";
|
||||
}
|
||||
|
||||
return _reactiveSurfaceState;
|
||||
}
|
||||
|
||||
private CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>? CreateReactiveDaemonSurfaceState(
|
||||
AetheriaClient client)
|
||||
{
|
||||
if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, StringComparison.Ordinal))
|
||||
return client.State.Daemon.GameSurface.LatestAsync().GetAwaiter().GetResult();
|
||||
return client.State.Daemon.ReactiveGameSurface();
|
||||
|
||||
if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal))
|
||||
return client.State.Daemon.GameTuiSurface.LatestAsync().GetAwaiter().GetResult();
|
||||
return client.State.Daemon.ReactiveGameTuiSurface();
|
||||
|
||||
if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, StringComparison.Ordinal))
|
||||
return client.State.Daemon.EditorSurface.LatestAsync().GetAwaiter().GetResult();
|
||||
return client.State.Daemon.ReactiveEditorSurface();
|
||||
|
||||
if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal))
|
||||
return client.State.Daemon.EditorTuiSurface.LatestAsync().GetAwaiter().GetResult();
|
||||
return client.State.Daemon.ReactiveEditorTuiSurface();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -229,5 +266,12 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
}
|
||||
}
|
||||
|
||||
private void DisposeReactiveSurfaceState()
|
||||
{
|
||||
_reactiveSurfaceState?.Dispose();
|
||||
_reactiveSurfaceState = null;
|
||||
_reactiveSurfaceStatePath = "";
|
||||
_reactiveSurfaceId = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -511,6 +511,18 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return LatestGameSurfaceAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public Task<CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>> ReactiveGameSurfaceAsync(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return GameSurface.ReactiveAsync(options);
|
||||
}
|
||||
|
||||
public CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState> ReactiveGameSurface(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return GameSurface.Reactive(options);
|
||||
}
|
||||
|
||||
public Task<global::Aetheria.State.Documents.EveSurfaceState> LatestGameTuiSurfaceAsync()
|
||||
{
|
||||
return GameTuiSurface.LatestAsync();
|
||||
|
|
@ -521,6 +533,18 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return LatestGameTuiSurfaceAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public Task<CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>> ReactiveGameTuiSurfaceAsync(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return GameTuiSurface.ReactiveAsync(options);
|
||||
}
|
||||
|
||||
public CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState> ReactiveGameTuiSurface(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return GameTuiSurface.Reactive(options);
|
||||
}
|
||||
|
||||
public Task<global::Aetheria.State.Documents.EveSurfaceState> LatestEditorSurfaceAsync()
|
||||
{
|
||||
return EditorSurface.LatestAsync();
|
||||
|
|
@ -531,6 +555,18 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return LatestEditorSurfaceAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public Task<CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>> ReactiveEditorSurfaceAsync(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return EditorSurface.ReactiveAsync(options);
|
||||
}
|
||||
|
||||
public CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState> ReactiveEditorSurface(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return EditorSurface.Reactive(options);
|
||||
}
|
||||
|
||||
public Task<global::Aetheria.State.Documents.EveSurfaceState> LatestEditorTuiSurfaceAsync()
|
||||
{
|
||||
return EditorTuiSurface.LatestAsync();
|
||||
|
|
@ -540,6 +576,18 @@ namespace GameCult.Aetheria.State.Verse
|
|||
{
|
||||
return LatestEditorTuiSurfaceAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public Task<CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>> ReactiveEditorTuiSurfaceAsync(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return EditorTuiSurface.ReactiveAsync(options);
|
||||
}
|
||||
|
||||
public CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState> ReactiveEditorTuiSurface(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return EditorTuiSurface.Reactive(options);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class AetheriaClientCurrentState
|
||||
|
|
|
|||
Loading…
Reference in a new issue