Promote composed reactive state accessors
This commit is contained in:
parent
c2bda39adc
commit
ca92227ec2
10 changed files with 70 additions and 47 deletions
|
|
@ -164,7 +164,7 @@ public sealed class AetheriaUnityObservedDockingIndex : IDisposable
|
|||
snapshot = null;
|
||||
try
|
||||
{
|
||||
_dockingState ??= _resolveClient()?.Aetheria().DockingState.Reactive();
|
||||
_dockingState ??= _resolveClient()?.Aetheria().ReactiveDockingState();
|
||||
return _dockingState?.TryCurrent(out snapshot) == true;
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -203,19 +203,15 @@ public class DaemonRuntimeDocumentTests
|
|||
.GetResult();
|
||||
using var zoneRenderReactive = client.State
|
||||
.Reactive<AetheriaRuntimeZoneRenderDocument>();
|
||||
var observed = AetheriaRuntimeObservedDaemonState
|
||||
.ReadAsync(client.State)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
var observed = client.State.LatestObservedDaemon();
|
||||
var observedAuthoritativeFrame = client.State.Daemon.LatestFrameDocument();
|
||||
var gameSurface = client.State.Daemon.LatestGameSurface();
|
||||
var gameTuiSurface = client.State.Daemon.LatestGameTuiSurface();
|
||||
var editorSurface = client.State.Daemon.LatestEditorSurface();
|
||||
var editorTuiSurface = client.State.Daemon.LatestEditorTuiSurface();
|
||||
var authorityStatus = client.State.Daemon.LatestAuthorityPolicy();
|
||||
var dockingState = client.Aetheria()
|
||||
.DockingState
|
||||
.Latest();
|
||||
var dockingState = client.State.LatestDockingState();
|
||||
using var reactiveDockingState = client.State.ReactiveDockingState();
|
||||
|
||||
Assert.AreEqual("aetheria.current.entity", client.State.Current.Entity.DocumentId);
|
||||
Assert.AreSame(client.State.Current.Entity, client.State.Document<AetheriaRuntimeCurrentEntityDocument>());
|
||||
|
|
@ -296,6 +292,7 @@ public class DaemonRuntimeDocumentTests
|
|||
Assert.AreEqual(currentEntity.EntityKey, currentEntityByType.EntityKey);
|
||||
Assert.AreEqual(currentEntity.EntityKey, currentEntityFromClientType.EntityKey);
|
||||
Assert.AreEqual(currentEntity.EntityKey, dockingState.CurrentEntityKey);
|
||||
Assert.AreEqual(currentEntity.EntityKey, reactiveDockingState.Current.CurrentEntityKey);
|
||||
Assert.AreEqual("", dockingState.DockParentEntityKey);
|
||||
Assert.AreEqual(-1, dockingState.DockingBayIndex);
|
||||
Assert.IsTrue(client.State.Current.Entity.Sources.Any(source =>
|
||||
|
|
@ -2163,10 +2160,7 @@ public class DaemonRuntimeDocumentTests
|
|||
.OpenAsync(statePath, "unity-observer-test", pullOnOpen: true)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
var observed = AetheriaRuntimeObservedDaemonState
|
||||
.ReadAsync(client.State)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
var observed = client.State.LatestObservedDaemon();
|
||||
|
||||
Assert.IsNotNull(observed);
|
||||
Assert.IsTrue(observed.IsAuthoritative);
|
||||
|
|
@ -2257,10 +2251,7 @@ public class DaemonRuntimeDocumentTests
|
|||
.OpenAsync(statePath, "unity-frame-only-observer-test", pullOnOpen: true)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
var observed = AetheriaRuntimeObservedDaemonState
|
||||
.ReadAsync(client.State)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
var observed = client.State.LatestObservedDaemon();
|
||||
|
||||
Assert.IsNotNull(observed);
|
||||
Assert.IsTrue(observed.IsAuthoritative);
|
||||
|
|
|
|||
|
|
@ -781,7 +781,7 @@ public class InventoryMenu : MonoBehaviour
|
|||
|
||||
private AetheriaClientDockingSnapshot ResolveDockingState()
|
||||
{
|
||||
_reactiveDockingState ??= ResolveClient().Aetheria().DockingState.Reactive();
|
||||
_reactiveDockingState ??= ResolveClient().Aetheria().ReactiveDockingState();
|
||||
if (_reactiveDockingState.TryCurrent(out var docking))
|
||||
return docking;
|
||||
|
||||
|
|
|
|||
|
|
@ -1167,7 +1167,7 @@ private void Update()
|
|||
|
||||
private AetheriaClientDockingSnapshot ResolveDockingState()
|
||||
{
|
||||
_reactiveDockingState ??= ResolveClient().Aetheria().DockingState.Reactive();
|
||||
_reactiveDockingState ??= ResolveClient().Aetheria().ReactiveDockingState();
|
||||
if (_reactiveDockingState.TryCurrent(out var docking))
|
||||
return docking;
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ public class LocalMenu : MonoBehaviour
|
|||
|
||||
private bool TryResolveDockingState(out AetheriaClientDockingSnapshot dockingState)
|
||||
{
|
||||
_dockingState ??= ResolveClient().Aetheria().DockingState.Reactive();
|
||||
_dockingState ??= ResolveClient().Aetheria().ReactiveDockingState();
|
||||
var resolved = _dockingState.TryCurrent(out dockingState);
|
||||
if (!resolved)
|
||||
Debug.LogWarning("Failed to read Aetheria docking state for local story surface.");
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ public class MenuPanel : MonoBehaviour
|
|||
|
||||
private AetheriaClientDockingSnapshot ResolveCurrentDocking()
|
||||
{
|
||||
_dockingState ??= ResolveClient().Aetheria().DockingState.Reactive();
|
||||
_dockingState ??= ResolveClient().Aetheria().ReactiveDockingState();
|
||||
if (_dockingState.TryCurrent(out var docking))
|
||||
return docking;
|
||||
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ public class TradeMenu : MonoBehaviour
|
|||
if (_dockingState != null)
|
||||
return _dockingState;
|
||||
|
||||
_reactiveDockingState ??= ResolveClient().Aetheria().DockingState.Reactive();
|
||||
_reactiveDockingState ??= ResolveClient().Aetheria().ReactiveDockingState();
|
||||
if (!_reactiveDockingState.TryCurrent(out _dockingState))
|
||||
{
|
||||
Debug.LogWarning("Failed to read Aetheria docking state for trade menu.");
|
||||
|
|
|
|||
Loading…
Reference in a new issue