Expose docking target through managed snapshot
This commit is contained in:
parent
2d8432ad27
commit
a873a31043
6 changed files with 29 additions and 19 deletions
|
|
@ -4773,8 +4773,8 @@ static void RequireRuntimeMenuTabsUseEveSurface(string root)
|
|||
"private bool TryResolveDockedLocalStory(out LocationStory story)",
|
||||
"SetObservedFacadeIndex(AetheriaUnityObservedFacadeIndex observedFacadeIndex)",
|
||||
"_observedFacadeIndex.TryResolveDockingBayByRecordKey(",
|
||||
"dockingState.CurrentDocking.DockParentEntityKey",
|
||||
"dockingState.CurrentDocking.DockingBayIndex",
|
||||
"dockingState.DockParentEntityKey",
|
||||
"dockingState.DockingBayIndex",
|
||||
"dockingBay?.Entity is not OrbitalEntity { Story: { } dockedStory }",
|
||||
"AetheriaRuntimeLocalStorySurfaceBuilder.Build(ProjectStorySurface())",
|
||||
"AetheriaRuntimeLocalStorySurfaceBuilder.Project(",
|
||||
|
|
|
|||
|
|
@ -75,11 +75,11 @@ public sealed class AetheriaUnityObservedDockingIndex
|
|||
dockingBay = null;
|
||||
if (!TryResolveCurrentDockingSnapshot(out var snapshot) ||
|
||||
snapshot.CurrentDockingBay == null ||
|
||||
snapshot.StationRefit == null ||
|
||||
string.IsNullOrWhiteSpace(snapshot.StationRefit.DockParentEntityKey) ||
|
||||
string.IsNullOrWhiteSpace(snapshot.DockParentEntityKey) ||
|
||||
snapshot.DockingBayIndex < 0 ||
|
||||
!_observedFacadeIndex.TryResolveDockingBayByRecordKey(
|
||||
snapshot.StationRefit.DockParentEntityKey,
|
||||
snapshot.CurrentDockingBay.DockingBayIndex,
|
||||
snapshot.DockParentEntityKey,
|
||||
snapshot.DockingBayIndex,
|
||||
out dockingBay))
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -215,6 +215,11 @@ public class DaemonRuntimeDocumentTests
|
|||
using var zoneRenderReactive = client.State
|
||||
.Reactive<AetheriaRuntimeZoneRenderDocument>();
|
||||
var legacyCurrentEntity = client.CurrentEntityAsync().GetAwaiter().GetResult();
|
||||
var dockingState = client.Aetheria()
|
||||
.DockingState
|
||||
.LatestAsync()
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
|
||||
Assert.AreEqual("aetheria.current.entity", client.State.Current.Entity.DocumentId);
|
||||
Assert.AreSame(client.State.Current.Entity, client.State.Document<AetheriaRuntimeCurrentEntityDocument>());
|
||||
|
|
@ -260,6 +265,9 @@ public class DaemonRuntimeDocumentTests
|
|||
Assert.AreEqual(currentEntity.EntityKey, currentEntityByType.EntityKey);
|
||||
Assert.AreEqual(currentEntity.EntityKey, currentEntityFromClientType.EntityKey);
|
||||
Assert.AreEqual(legacyCurrentEntity.EntityKey, currentEntity.EntityKey);
|
||||
Assert.AreEqual(currentEntity.EntityKey, dockingState.CurrentEntityKey);
|
||||
Assert.AreEqual("", dockingState.DockParentEntityKey);
|
||||
Assert.AreEqual(-1, dockingState.DockingBayIndex);
|
||||
Assert.IsTrue(client.State.Current.Entity.Sources.Any(source =>
|
||||
source.SourceId == AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest.ToString()));
|
||||
Assert.IsTrue(client.State.StationRefit.Sources.Any(source =>
|
||||
|
|
|
|||
|
|
@ -231,10 +231,11 @@ public class LocalMenu : MonoBehaviour
|
|||
if (_observedFacadeIndex == null ||
|
||||
!TryResolveDockingState(out var dockingState) ||
|
||||
dockingState?.IsDocked != true ||
|
||||
dockingState.CurrentDocking == null ||
|
||||
string.IsNullOrWhiteSpace(dockingState.DockParentEntityKey) ||
|
||||
dockingState.DockingBayIndex < 0 ||
|
||||
!_observedFacadeIndex.TryResolveDockingBayByRecordKey(
|
||||
dockingState.CurrentDocking.DockParentEntityKey,
|
||||
dockingState.CurrentDocking.DockingBayIndex,
|
||||
dockingState.DockParentEntityKey,
|
||||
dockingState.DockingBayIndex,
|
||||
out var dockingBay) ||
|
||||
dockingBay?.Entity is not OrbitalEntity { Story: { } dockedStory })
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,16 +58,14 @@ public class TradeMenu : MonoBehaviour
|
|||
private void OnEnable()
|
||||
{
|
||||
var dockingState = ResolveDockingState();
|
||||
var docking = dockingState?.CurrentDocking;
|
||||
if (dockingState?.IsDocked != true ||
|
||||
docking == null ||
|
||||
string.IsNullOrWhiteSpace(docking.DockParentEntityKey) ||
|
||||
docking.DockingBayIndex < 0)
|
||||
string.IsNullOrWhiteSpace(dockingState.DockParentEntityKey) ||
|
||||
dockingState.DockingBayIndex < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetTargetCargo(docking.DockParentEntityKey, docking.DockingBayIndex, "Docking Bay");
|
||||
SetTargetCargo(dockingState.DockParentEntityKey, dockingState.DockingBayIndex, "Docking Bay");
|
||||
HideCargoSelectorSurface();
|
||||
HideFilterSurface();
|
||||
HideRowActionSurface();
|
||||
|
|
@ -517,15 +515,14 @@ public class TradeMenu : MonoBehaviour
|
|||
private bool TryResolveCurrentDockingTargetEntityKey(out string targetEntityKey)
|
||||
{
|
||||
targetEntityKey = "";
|
||||
var docking = ResolveDockingState()?.CurrentDocking;
|
||||
if (docking == null ||
|
||||
!docking.IsDocked ||
|
||||
string.IsNullOrWhiteSpace(docking.DockParentEntityKey))
|
||||
var dockingState = ResolveDockingState();
|
||||
if (dockingState?.IsDocked != true ||
|
||||
string.IsNullOrWhiteSpace(dockingState.DockParentEntityKey))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
targetEntityKey = docking.DockParentEntityKey;
|
||||
targetEntityKey = dockingState.DockParentEntityKey;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -278,6 +278,10 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
public string CurrentEntityKey => CurrentEntity?.EntityKey ?? CurrentDocking?.CurrentEntityKey ?? "";
|
||||
|
||||
public string DockParentEntityKey => StationRefit?.DockParentEntityKey ?? CurrentDocking?.DockParentEntityKey ?? "";
|
||||
|
||||
public int DockingBayIndex => CurrentDockingBay?.DockingBayIndex ?? StationRefit?.DockingBayIndex ?? CurrentDocking?.DockingBayIndex ?? -1;
|
||||
|
||||
public bool IsDocked => StationRefit?.IsDocked == true && CurrentDockingBay != null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue