Read daemon command context from typed reactive docs
This commit is contained in:
parent
5d405b312a
commit
5a5fb748a9
4 changed files with 86 additions and 10 deletions
|
|
@ -3282,8 +3282,10 @@ static void RequireEveRuntimeBootstrap(string root)
|
|||
"EveSurfaceCommandRequest request",
|
||||
"request.ProviderId, \"aetheria.daemon\"",
|
||||
"AetheriaClient",
|
||||
"client.State.ReactiveObservedDaemon()",
|
||||
"observedState.TryCurrent(out var current)",
|
||||
"using var frame = client.State.ReactiveDaemonFrame();",
|
||||
"using var soaView = TryReactiveDaemonSoaView(client);",
|
||||
"using var zoneRender = client.State.ReactiveZoneRender();",
|
||||
"AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)",
|
||||
"new AetheriaRuntimeDaemonOperationClient(",
|
||||
"AetheriaRuntimeDaemonSurfaceCommandCatalog.TrySubmitArgumentless(",
|
||||
"AetheriaRuntimeDaemonSurfaceCommandCatalog.CommandPrefix"
|
||||
|
|
@ -3298,10 +3300,12 @@ static void RequireEveRuntimeBootstrap(string root)
|
|||
string.Join(", ", missingDaemonSurfaceCommandSymbols));
|
||||
}
|
||||
|
||||
if (daemonSurfaceCommands.Contains("AetheriaRuntimeStateReader.TryReadObservedDaemonState", StringComparison.Ordinal))
|
||||
if (daemonSurfaceCommands.Contains("AetheriaRuntimeStateReader.TryReadObservedDaemonState", StringComparison.Ordinal) ||
|
||||
daemonSurfaceCommands.Contains("client.State.ReactiveObservedDaemon()", StringComparison.Ordinal) ||
|
||||
daemonSurfaceCommands.Contains("observedState.TryCurrent(out var current)", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Daemon Eve surface command routing still reads observed daemon state through the runtime file reader instead of the Verse client.");
|
||||
"Daemon Eve surface command routing still reads observed daemon state through an aggregate reader instead of direct managed typed documents.");
|
||||
}
|
||||
|
||||
if (daemonSurfaceCommands.Contains(".ReadAsync(client.State)", StringComparison.Ordinal))
|
||||
|
|
@ -15082,8 +15086,10 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
{
|
||||
"public AetheriaClientState State => _state;",
|
||||
"public AetheriaClientState Aetheria() => State;",
|
||||
"using var observedState = State.ReactiveObservedDaemon();",
|
||||
"observedState.TryCurrent(out var current)"
|
||||
"using var frame = State.ReactiveDaemonFrame();",
|
||||
"using var soaView = TryReactiveDaemonSoaView();",
|
||||
"using var zoneRender = State.ReactiveZoneRender();",
|
||||
"AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)"
|
||||
};
|
||||
var missingManagedClientConnectionSymbols = requiredManagedClientConnectionSymbols
|
||||
.Where(symbol => !aetheriaClient.Contains(symbol, StringComparison.Ordinal))
|
||||
|
|
@ -15095,6 +15101,13 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
string.Join(", ", missingManagedClientConnectionSymbols));
|
||||
}
|
||||
|
||||
if (aetheriaClient.Contains("State.ReactiveObservedDaemon()", StringComparison.Ordinal) ||
|
||||
aetheriaClient.Contains("observedState.TryCurrent(out var current)", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"AetheriaClient command submission still samples observed daemon state through an aggregate reactive wrapper instead of direct managed typed documents.");
|
||||
}
|
||||
|
||||
var requiredManagedStateAccessSymbols = new[]
|
||||
{
|
||||
"public CultMeshDocumentHandle<TDocument> Document<TDocument>()",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
@ -161,8 +163,10 @@ namespace GameCult.Aetheria.State.Verse
|
|||
ThrowIfDisposed();
|
||||
if (submit == null) throw new ArgumentNullException(nameof(submit));
|
||||
|
||||
using var observedState = State.ReactiveObservedDaemon();
|
||||
var observed = observedState.TryCurrent(out var current)
|
||||
using var frame = State.ReactiveDaemonFrame();
|
||||
using var soaView = TryReactiveDaemonSoaView();
|
||||
using var zoneRender = State.ReactiveZoneRender();
|
||||
var observed = AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)
|
||||
? current
|
||||
: null;
|
||||
var operationClient = new AetheriaRuntimeDaemonOperationClient(
|
||||
|
|
@ -177,6 +181,18 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return submit(operationClient, observed);
|
||||
}
|
||||
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? TryReactiveDaemonSoaView()
|
||||
{
|
||||
try
|
||||
{
|
||||
return State.ReactiveDaemonSoaView();
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void ThrowIfDisposed()
|
||||
{
|
||||
if (_disposed)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
@ -21,8 +23,10 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return false;
|
||||
}
|
||||
|
||||
using var observedState = client.State.ReactiveObservedDaemon();
|
||||
var observed = observedState.TryCurrent(out var current)
|
||||
using var frame = client.State.ReactiveDaemonFrame();
|
||||
using var soaView = TryReactiveDaemonSoaView(client);
|
||||
using var zoneRender = client.State.ReactiveZoneRender();
|
||||
var observed = AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)
|
||||
? current
|
||||
: null;
|
||||
var operationClient = new AetheriaRuntimeDaemonOperationClient(
|
||||
|
|
@ -37,6 +41,19 @@ namespace GameCult.Aetheria.State.Verse
|
|||
out envelope);
|
||||
}
|
||||
|
||||
private static CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? TryReactiveDaemonSoaView(
|
||||
AetheriaClient client)
|
||||
{
|
||||
try
|
||||
{
|
||||
return client.State.ReactiveDaemonSoaView();
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool TryResolveKind(EveSurfaceCommandRequest request, out AetheriaRuntimeDaemonCommandKinds kind)
|
||||
{
|
||||
kind = AetheriaRuntimeDaemonCommandKinds.None;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,36 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public bool IsAuthoritative => Frame.IsAuthoritative;
|
||||
public AetheriaRuntimeRunCheckpointCommit Run => Frame.Run;
|
||||
|
||||
public static bool TryCreateCurrent(
|
||||
CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> frame,
|
||||
CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? soaView,
|
||||
CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument> zoneRender,
|
||||
out AetheriaRuntimeObservedDaemonState? observed)
|
||||
{
|
||||
observed = null;
|
||||
try
|
||||
{
|
||||
var currentFrame = frame?.Current;
|
||||
var currentZoneRender = zoneRender?.Current;
|
||||
if (currentFrame == null || currentZoneRender == null)
|
||||
return false;
|
||||
|
||||
var currentSoaView = soaView?.Current;
|
||||
if (currentSoaView == null ||
|
||||
!string.Equals(currentSoaView.Schema, AetheriaRuntimeDaemonSchemas.SoaView, StringComparison.Ordinal))
|
||||
{
|
||||
currentSoaView = null;
|
||||
}
|
||||
|
||||
observed = new AetheriaRuntimeObservedDaemonState(currentFrame, currentSoaView, currentZoneRender);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<AetheriaRuntimeObservedDaemonState?> ReadAsync(
|
||||
AetheriaClientState state)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue