Map inventory docking from typed state
This commit is contained in:
parent
ca8b5858a2
commit
8b718d0da9
3 changed files with 30 additions and 61 deletions
|
|
@ -74,7 +74,6 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
|||
private RectTransform _firstRect;
|
||||
private AetheriaUnityDragSession _dragSession;
|
||||
private AetheriaUnityObservedEntityIndex _observedEntityIndex;
|
||||
private AetheriaUnityObservedDockingIndex _observedDockingIndex;
|
||||
|
||||
public ItemInstance FakeItem;
|
||||
public Shape FakeOccupancy;
|
||||
|
|
@ -88,11 +87,6 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
|||
|
||||
public void SetObservedEntityIndex(AetheriaUnityObservedEntityIndex observedEntityIndex)
|
||||
{
|
||||
if (!ReferenceEquals(_observedEntityIndex, observedEntityIndex))
|
||||
{
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
_observedEntityIndex = observedEntityIndex;
|
||||
}
|
||||
|
||||
|
|
@ -1139,26 +1133,22 @@ private void Update()
|
|||
private bool TryResolveCurrentDockingBay(out EquippedCargoBay dockingBay)
|
||||
{
|
||||
dockingBay = null;
|
||||
if (!TryResolveObservedDockingIndex(out var dockingIndex) ||
|
||||
!dockingIndex.TryResolveCurrentDockingBay(out var resolvedDockingBay))
|
||||
var refit = StationRefitSnapshot();
|
||||
if (refit?.IsDocked != true ||
|
||||
refit.DockingBayIndex < 0 ||
|
||||
string.IsNullOrWhiteSpace(refit.DockParentEntityKey) ||
|
||||
_observedEntityIndex == null ||
|
||||
!_observedEntityIndex.TryResolveDockingBayByRecordKey(
|
||||
refit.DockParentEntityKey,
|
||||
refit.DockingBayIndex,
|
||||
out dockingBay))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dockingBay = resolvedDockingBay;
|
||||
return dockingBay != null;
|
||||
}
|
||||
|
||||
private bool TryResolveObservedDockingIndex(out AetheriaUnityObservedDockingIndex dockingIndex)
|
||||
{
|
||||
dockingIndex = null;
|
||||
if (_observedEntityIndex == null)
|
||||
return false;
|
||||
|
||||
dockingIndex = _observedDockingIndex ??= new AetheriaUnityObservedDockingIndex(_observedEntityIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryResolveStationRefitEntity(string entityKey, int optionIndex, out Entity entity)
|
||||
{
|
||||
entity = null;
|
||||
|
|
@ -1450,11 +1440,6 @@ private void Update()
|
|||
}
|
||||
}
|
||||
|
||||
private void ClearClientCaches()
|
||||
{
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
private AetheriaRuntimeCurrentEntityDocument CurrentEntitySnapshot()
|
||||
{
|
||||
try
|
||||
|
|
@ -1625,8 +1610,6 @@ private void Update()
|
|||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ClearClientCaches();
|
||||
|
||||
if (_dropdownSurfaceDocument != null)
|
||||
{
|
||||
AetheriaEveUnitySurfaceHost.DestroyDocument(_dropdownSurfaceDocument);
|
||||
|
|
|
|||
Loading…
Reference in a new issue