Route observed daemon through managed sessions
This commit is contained in:
parent
8a14dd74ee
commit
08c4fc190e
3 changed files with 42 additions and 27 deletions
|
|
@ -277,9 +277,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public AetheriaRuntimeObservedDaemonState? CurrentObservedDaemon(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
using var frame = ReactiveDaemonFrame(options);
|
||||
using var soaView = TryReactiveDaemonSoaView(options);
|
||||
using var zoneRender = ReactiveZoneRender(options);
|
||||
using var frame = ObserveDaemonFrame(options);
|
||||
using var soaView = TryObserveDaemonSoaView(options);
|
||||
using var zoneRender = ObserveZoneRender(options);
|
||||
return AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)
|
||||
? current
|
||||
: null;
|
||||
|
|
@ -288,13 +288,13 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public AetheriaRuntimeObservedDaemonSession ObserveDaemon(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
var frame = ReactiveDaemonFrame(options);
|
||||
CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? soaView = null;
|
||||
CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument>? zoneRender = null;
|
||||
var frame = ObserveDaemonFrame(options);
|
||||
AetheriaRuntimeDaemonSoaViewSession? soaView = null;
|
||||
AetheriaRuntimeZoneRenderSession? zoneRender = null;
|
||||
try
|
||||
{
|
||||
soaView = TryReactiveDaemonSoaView(options);
|
||||
zoneRender = ReactiveZoneRender(options);
|
||||
soaView = TryObserveDaemonSoaView(options);
|
||||
zoneRender = ObserveZoneRender(options);
|
||||
return new AetheriaRuntimeObservedDaemonSession(frame, soaView, zoneRender);
|
||||
}
|
||||
catch
|
||||
|
|
@ -338,12 +338,12 @@ namespace GameCult.Aetheria.State.Verse
|
|||
}
|
||||
}
|
||||
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? TryReactiveDaemonSoaView(
|
||||
private AetheriaRuntimeDaemonSoaViewSession? TryObserveDaemonSoaView(
|
||||
CultMeshReactiveDocumentOptions? options)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ReactiveDaemonSoaView(options);
|
||||
return ObserveDaemonSoaView(options);
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using GameCult.Mesh;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
@ -27,9 +26,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public AetheriaRuntimeRunCheckpointCommit Run => Frame.Run;
|
||||
|
||||
public static bool TryCreateCurrent(
|
||||
CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> frame,
|
||||
CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? soaView,
|
||||
CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument> zoneRender,
|
||||
AetheriaRuntimeDaemonFrameSession frame,
|
||||
AetheriaRuntimeDaemonSoaViewSession? soaView,
|
||||
AetheriaRuntimeZoneRenderSession zoneRender,
|
||||
out AetheriaRuntimeObservedDaemonState? observed)
|
||||
{
|
||||
observed = null;
|
||||
|
|
@ -60,14 +59,14 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
public sealed class AetheriaRuntimeObservedDaemonSession : IDisposable
|
||||
{
|
||||
private readonly CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> _frame;
|
||||
private readonly CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? _soaView;
|
||||
private readonly CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument> _zoneRender;
|
||||
private readonly AetheriaRuntimeDaemonFrameSession _frame;
|
||||
private readonly AetheriaRuntimeDaemonSoaViewSession? _soaView;
|
||||
private readonly AetheriaRuntimeZoneRenderSession _zoneRender;
|
||||
|
||||
public AetheriaRuntimeObservedDaemonSession(
|
||||
CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> frame,
|
||||
CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? soaView,
|
||||
CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument> zoneRender)
|
||||
AetheriaRuntimeDaemonFrameSession frame,
|
||||
AetheriaRuntimeDaemonSoaViewSession? soaView,
|
||||
AetheriaRuntimeZoneRenderSession zoneRender)
|
||||
{
|
||||
_frame = frame ?? throw new ArgumentNullException(nameof(frame));
|
||||
_soaView = soaView;
|
||||
|
|
|
|||
Loading…
Reference in a new issue