Split inventory docking state access
This commit is contained in:
parent
64a97d2f0a
commit
d25b9c959c
3 changed files with 51 additions and 35 deletions
|
|
@ -4959,8 +4959,9 @@ static void RequireInventoryShipSettingsUseEveSurface(string root)
|
|||
"RequestEntityShutdownPerformance(",
|
||||
"latestCurrentEntity.EntityKey",
|
||||
"(float)latestCurrentEntity.ShutdownPerformance",
|
||||
"TryResolveObservedDockingIndex(out var dockingIndex)",
|
||||
"dockingIndex.TryResolveCurrentEntityDocument(out currentEntity)"
|
||||
"AetheriaRuntimeCurrentEntitySession _currentEntity",
|
||||
"ResolveCurrentEntity()",
|
||||
"currentEntity = ResolveCurrentEntity();"
|
||||
};
|
||||
|
||||
var missingSymbols = requiredSymbols
|
||||
|
|
@ -6285,8 +6286,8 @@ static void RequireInventoryDropdownUseEveSurface(string root)
|
|||
"_observedEntityIndex.TryResolveEntityByRecordKey",
|
||||
"TryResolveObservedDockingIndex(out var dockingIndex)",
|
||||
"dockingIndex.TryResolveCurrentDockingBay(out var resolvedDockingBay)",
|
||||
"dockingIndex.ResolveStationRefit()",
|
||||
"dockingIndex.TryResolveCurrentEntityKey(out currentEntityKey)",
|
||||
"ResolveStationRefitDocument()",
|
||||
"currentEntityKey = ResolveCurrentEntity()?.EntityKey ?? \"\"",
|
||||
"LoadoutRestoreOptions"
|
||||
};
|
||||
|
||||
|
|
@ -6345,9 +6346,9 @@ static void RequireInventoryDropdownUseEveSurface(string root)
|
|||
!source.Contains("TryResolveCurrentDockingBayRow(out var currentDockingBay)", StringComparison.Ordinal) ||
|
||||
!source.Contains("TryResolveObservedDockingIndex(out var dockingIndex)", StringComparison.Ordinal) ||
|
||||
!source.Contains("TryResolveCurrentDockingBay(out var dockingBay)", StringComparison.Ordinal) ||
|
||||
!source.Contains("dockingIndex.TryResolveCurrentDockingBayRow(out dockingBay)", StringComparison.Ordinal) ||
|
||||
!source.Contains("dockingIndex.ResolveStationRefit()", StringComparison.Ordinal) ||
|
||||
!source.Contains("dockingIndex.TryResolveCurrentEntityKey(out currentEntityKey)", StringComparison.Ordinal) ||
|
||||
!source.Contains("dockingIndex.TryResolveCurrentDockingBay(out var resolvedDockingBay)", StringComparison.Ordinal) ||
|
||||
!source.Contains("ResolveStationRefitDocument()", StringComparison.Ordinal) ||
|
||||
!source.Contains("currentEntityKey = ResolveCurrentEntity()?.EntityKey ?? \"\"", StringComparison.Ordinal) ||
|
||||
!source.Contains("currentDockingBay.DockingBayIndex", StringComparison.Ordinal) ||
|
||||
!source.Contains("ResolveStationRefit()?.DockParentEntityKey", StringComparison.Ordinal) ||
|
||||
source.Contains("var hasDockingBay = TryGetTypedCurrentDockingBayFacade", StringComparison.Ordinal) ||
|
||||
|
|
@ -6363,9 +6364,9 @@ static void RequireInventoryDropdownUseEveSurface(string root)
|
|||
!inventoryMenu.Contains("TryResolveCurrentDockingBay(out var dockingBay)", StringComparison.Ordinal) ||
|
||||
!inventoryMenu.Contains("TryResolveObservedDockingIndex(out var dockingIndex)", StringComparison.Ordinal) ||
|
||||
!inventoryMenu.Contains("dockingIndex.TryResolveCurrentDockingBay(out var resolvedDockingBay)", StringComparison.Ordinal) ||
|
||||
!inventoryMenu.Contains("dockingIndex.TryResolveCurrentEntityKey(out currentEntityKey)", StringComparison.Ordinal) ||
|
||||
!inventoryMenu.Contains("dockingIndex.TryResolveCurrentEntityDocument(out currentEntity)", StringComparison.Ordinal) ||
|
||||
!inventoryMenu.Contains("dockingIndex.ResolveStationRefit()", StringComparison.Ordinal) ||
|
||||
!inventoryMenu.Contains("currentEntityKey = ResolveCurrentEntity()?.EntityKey ?? \"\"", StringComparison.Ordinal) ||
|
||||
!inventoryMenu.Contains("currentEntity = ResolveCurrentEntity();", StringComparison.Ordinal) ||
|
||||
!inventoryMenu.Contains("ResolveStationRefitDocument()", StringComparison.Ordinal) ||
|
||||
inventoryMenu.Contains("TryGetTypedCurrentDockingBayFacade", StringComparison.Ordinal) ||
|
||||
inventoryMenu.Contains("TryResolveCurrentEntityFacade", StringComparison.Ordinal) ||
|
||||
inventoryMenu.Contains("ResolveDockingState()?.CurrentDocking", StringComparison.Ordinal) ||
|
||||
|
|
@ -6375,7 +6376,7 @@ static void RequireInventoryDropdownUseEveSurface(string root)
|
|||
inventoryMenu.Contains("GameManager.DockingBay", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"InventoryMenu must resolve typed current-docking state through the shared observed docking index before adapting to Unity facades.");
|
||||
"InventoryMenu must resolve typed current entity/refit state through managed sessions before adapting docking state to Unity objects.");
|
||||
}
|
||||
|
||||
var requiredBuilderSymbols = new[]
|
||||
|
|
@ -6530,8 +6531,8 @@ static void RequireStationRefitDockingBaysUseTypedProjection(string root)
|
|||
{
|
||||
"TryResolveCurrentDockingBayRow(out var currentDockingBay)",
|
||||
"AetheriaRuntimeStationDockingBayRow dockingBay",
|
||||
"TryResolveObservedDockingIndex(out var dockingIndex)",
|
||||
"dockingIndex.TryResolveCurrentDockingBayRow(out dockingBay)",
|
||||
"ResolveStationRefitDocument()",
|
||||
"refit.DockingBays ?? Array.Empty<AetheriaRuntimeStationDockingBayRow>()",
|
||||
"currentDockingBay.DockingBayIndex"
|
||||
};
|
||||
var missingPanelSymbols = requiredPanelSymbols
|
||||
|
|
@ -6549,8 +6550,8 @@ static void RequireStationRefitDockingBaysUseTypedProjection(string root)
|
|||
{
|
||||
"TryResolveCurrentDockingBayRow(out AetheriaRuntimeStationDockingBayRow dockingBay)",
|
||||
"AetheriaRuntimeStationDockingBayRow dockingBay",
|
||||
"TryResolveObservedDockingIndex(out var dockingIndex)",
|
||||
"dockingIndex.TryResolveCurrentDockingBayRow(out dockingBay)"
|
||||
"ResolveStationRefitDocument()",
|
||||
"refit.DockingBays ?? Array.Empty<AetheriaRuntimeStationDockingBayRow>()"
|
||||
};
|
||||
var missingMenuSymbols = requiredMenuSymbols
|
||||
.Where(symbol => !inventoryMenu.Contains(symbol, StringComparison.Ordinal))
|
||||
|
|
@ -17644,7 +17645,7 @@ static void RequireDockedCurrentShipRequestAuthority(string root)
|
|||
}
|
||||
|
||||
if (!inventoryPanel.Contains("TryResolveCurrentEntityKey(out var currentEntityKey)", StringComparison.Ordinal) ||
|
||||
!inventoryPanel.Contains("dockingIndex.TryResolveCurrentEntityKey(out currentEntityKey)", StringComparison.Ordinal) ||
|
||||
!inventoryPanel.Contains("currentEntityKey = ResolveCurrentEntity()?.EntityKey ?? \"\"", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains("AetheriaClientReactiveDockingState _reactiveDockingState", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains("GameManager.CurrentEntity", StringComparison.Ordinal))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,6 +65,12 @@ public class InventoryMenu : MonoBehaviour
|
|||
|
||||
public void SetObservedEntityIndex(AetheriaUnityObservedEntityIndex observedEntityIndex)
|
||||
{
|
||||
if (!ReferenceEquals(_observedEntityIndex, observedEntityIndex))
|
||||
{
|
||||
_observedDockingIndex?.Dispose();
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
_observedEntityIndex = observedEntityIndex;
|
||||
}
|
||||
// private int2 _dragCellOffset;
|
||||
|
|
@ -729,22 +735,25 @@ public class InventoryMenu : MonoBehaviour
|
|||
private bool TryResolveCurrentDockingBayRow(out AetheriaRuntimeStationDockingBayRow dockingBay)
|
||||
{
|
||||
dockingBay = null;
|
||||
return TryResolveObservedDockingIndex(out var dockingIndex) &&
|
||||
dockingIndex.TryResolveCurrentDockingBayRow(out dockingBay);
|
||||
var refit = ResolveStationRefitDocument();
|
||||
if (refit?.IsDocked != true || refit.DockingBayIndex < 0)
|
||||
return false;
|
||||
|
||||
dockingBay = (refit.DockingBays ?? Array.Empty<AetheriaRuntimeStationDockingBayRow>())
|
||||
.FirstOrDefault(row => row != null && row.DockingBayIndex == refit.DockingBayIndex);
|
||||
return dockingBay != null;
|
||||
}
|
||||
|
||||
private bool TryResolveCurrentEntityKey(out string currentEntityKey)
|
||||
{
|
||||
currentEntityKey = "";
|
||||
return TryResolveObservedDockingIndex(out var dockingIndex) &&
|
||||
dockingIndex.TryResolveCurrentEntityKey(out currentEntityKey);
|
||||
currentEntityKey = ResolveCurrentEntity()?.EntityKey ?? "";
|
||||
return !string.IsNullOrWhiteSpace(currentEntityKey);
|
||||
}
|
||||
|
||||
private bool TryResolveCurrentEntityDocument(out AetheriaRuntimeCurrentEntityDocument currentEntity)
|
||||
{
|
||||
currentEntity = null;
|
||||
if (!TryResolveObservedDockingIndex(out var dockingIndex) ||
|
||||
!dockingIndex.TryResolveCurrentEntityDocument(out currentEntity))
|
||||
currentEntity = ResolveCurrentEntity();
|
||||
if (currentEntity == null)
|
||||
{
|
||||
Debug.LogWarning("Failed to read Aetheria current entity for inventory ship settings.");
|
||||
return false;
|
||||
|
|
@ -755,9 +764,7 @@ public class InventoryMenu : MonoBehaviour
|
|||
|
||||
private AetheriaRuntimeStationRefitDocument ResolveStationRefit()
|
||||
{
|
||||
return TryResolveObservedDockingIndex(out var dockingIndex)
|
||||
? dockingIndex.ResolveStationRefit()
|
||||
: null;
|
||||
return ResolveStationRefitDocument();
|
||||
}
|
||||
|
||||
private bool TryResolveCurrentEntity(out Entity currentEntity)
|
||||
|
|
|
|||
|
|
@ -88,6 +88,12 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
|||
|
||||
public void SetObservedEntityIndex(AetheriaUnityObservedEntityIndex observedEntityIndex)
|
||||
{
|
||||
if (!ReferenceEquals(_observedEntityIndex, observedEntityIndex))
|
||||
{
|
||||
_observedDockingIndex?.Dispose();
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
_observedEntityIndex = observedEntityIndex;
|
||||
}
|
||||
|
||||
|
|
@ -1123,16 +1129,20 @@ private void Update()
|
|||
|
||||
private bool TryResolveCurrentEntityKey(out string currentEntityKey)
|
||||
{
|
||||
currentEntityKey = "";
|
||||
return TryResolveObservedDockingIndex(out var dockingIndex) &&
|
||||
dockingIndex.TryResolveCurrentEntityKey(out currentEntityKey);
|
||||
currentEntityKey = ResolveCurrentEntity()?.EntityKey ?? "";
|
||||
return !string.IsNullOrWhiteSpace(currentEntityKey);
|
||||
}
|
||||
|
||||
private bool TryResolveCurrentDockingBayRow(out AetheriaRuntimeStationDockingBayRow dockingBay)
|
||||
{
|
||||
dockingBay = null;
|
||||
return TryResolveObservedDockingIndex(out var dockingIndex) &&
|
||||
dockingIndex.TryResolveCurrentDockingBayRow(out dockingBay);
|
||||
var refit = ResolveStationRefitDocument();
|
||||
if (refit?.IsDocked != true || refit.DockingBayIndex < 0)
|
||||
return false;
|
||||
|
||||
dockingBay = (refit.DockingBays ?? Array.Empty<AetheriaRuntimeStationDockingBayRow>())
|
||||
.FirstOrDefault(row => row != null && row.DockingBayIndex == refit.DockingBayIndex);
|
||||
return dockingBay != null;
|
||||
}
|
||||
|
||||
private bool TryResolveCurrentDockingBay(out EquippedCargoBay dockingBay)
|
||||
|
|
@ -1150,9 +1160,7 @@ private void Update()
|
|||
|
||||
private AetheriaRuntimeStationRefitDocument ResolveStationRefit()
|
||||
{
|
||||
return TryResolveObservedDockingIndex(out var dockingIndex)
|
||||
? dockingIndex.ResolveStationRefit()
|
||||
: null;
|
||||
return ResolveStationRefitDocument();
|
||||
}
|
||||
|
||||
private bool TryResolveObservedDockingIndex(out AetheriaUnityObservedDockingIndex dockingIndex)
|
||||
|
|
|
|||
Loading…
Reference in a new issue