Sample inventory panel through current typed access
This commit is contained in:
parent
f47b0f2d7d
commit
6497636bb2
2 changed files with 81 additions and 162 deletions
|
|
@ -7255,15 +7255,12 @@ static void RequireInventoryValidationUsesManagedTypedDocuments(string root)
|
|||
foreach (var (name, source) in sources)
|
||||
{
|
||||
var compact = CompactSource(source);
|
||||
var currentEntityAccess = name == "InventoryMenu.cs"
|
||||
? ".RuntimeState(\"unity-inventory-menu\").CurrentEntityState()"
|
||||
: ".ReactiveCurrentEntity(\"unity-inventory\")";
|
||||
var stationRefitAccess = name == "InventoryMenu.cs"
|
||||
? ".RuntimeState(\"unity-inventory-menu\").CurrentStationRefit()"
|
||||
: ".ReactiveStationRefit(\"unity-inventory\")";
|
||||
var inventoryAccess = name == "InventoryMenu.cs"
|
||||
? ".RuntimeState(\"unity-inventory-menu\").CurrentInventory(entityIndex)"
|
||||
: ".ReactiveInventory(entityIndex)";
|
||||
var runtimeId = name == "InventoryMenu.cs"
|
||||
? "unity-inventory-menu"
|
||||
: "unity-inventory";
|
||||
var currentEntityAccess = $".RuntimeState(\"{runtimeId}\").CurrentEntityState()";
|
||||
var stationRefitAccess = $".RuntimeState(\"{runtimeId}\").CurrentStationRefit()";
|
||||
var inventoryAccess = $".RuntimeState(\"{runtimeId}\").CurrentInventory(entityIndex)";
|
||||
var requiredSymbols = new[]
|
||||
{
|
||||
"CurrentEntitySnapshot()",
|
||||
|
|
@ -7279,12 +7276,6 @@ static void RequireInventoryValidationUsesManagedTypedDocuments(string root)
|
|||
stationRefitAccess,
|
||||
inventoryAccess
|
||||
};
|
||||
if (name == "InventoryPanel.cs")
|
||||
{
|
||||
missingSymbols = missingSymbols
|
||||
.Concat(new[] { "_inventory?.Current" }.Where(symbol => !source.Contains(symbol, StringComparison.Ordinal)))
|
||||
.ToArray();
|
||||
}
|
||||
missingSymbols = missingSymbols
|
||||
.Concat(requiredCompactedSymbols.Where(symbol => !compact.Contains(symbol, StringComparison.Ordinal)))
|
||||
.ToArray();
|
||||
|
|
@ -7321,53 +7312,23 @@ static void RequireInventoryValidationUsesManagedTypedDocuments(string root)
|
|||
$"{name} still routes inventory validation through session wrappers instead of direct managed reactive typed documents.");
|
||||
}
|
||||
|
||||
if (name == "InventoryMenu.cs")
|
||||
var forbiddenCurrentDocumentSymbols = new[]
|
||||
{
|
||||
var forbiddenMenuSymbols = new[]
|
||||
{
|
||||
"CultMeshReactiveDocument<",
|
||||
".ReactiveCurrentEntity(\"unity-inventory-menu\")",
|
||||
".ReactiveStationRefit(\"unity-inventory-menu\")",
|
||||
".ReactiveInventory(entityIndex)",
|
||||
"_currentEntity?.Dispose()",
|
||||
"_stationRefit?.Dispose()",
|
||||
"_inventory?.Dispose()"
|
||||
}
|
||||
.Where(symbol => source.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (forbiddenMenuSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"InventoryMenu should sample inventory validation state through current typed documents instead of owning reactive handles: " +
|
||||
string.Join(", ", forbiddenMenuSymbols));
|
||||
}
|
||||
"CultMeshReactiveDocument<",
|
||||
$".ReactiveCurrentEntity(\"{runtimeId}\")",
|
||||
$".ReactiveStationRefit(\"{runtimeId}\")",
|
||||
".ReactiveInventory(entityIndex)",
|
||||
"_currentEntity?.Dispose()",
|
||||
"_stationRefit?.Dispose()",
|
||||
"_inventory?.Dispose()"
|
||||
}
|
||||
else
|
||||
.Where(symbol => source.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (forbiddenCurrentDocumentSymbols.Length > 0)
|
||||
{
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
source,
|
||||
name,
|
||||
"AetheriaRuntimeCurrentEntityDocument",
|
||||
"_currentEntity",
|
||||
currentEntityAccess,
|
||||
"AetheriaRuntimeCurrentEntitySession",
|
||||
".ObserveEntity()");
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
source,
|
||||
name,
|
||||
"AetheriaRuntimeStationRefitDocument",
|
||||
"_stationRefit",
|
||||
stationRefitAccess,
|
||||
"AetheriaRuntimeStationRefitSession",
|
||||
".ObserveStationRefit()");
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
source,
|
||||
name,
|
||||
"AetheriaRuntimeInventoryDocument",
|
||||
"_inventory",
|
||||
".ReactiveInventory(entityIndex)",
|
||||
"AetheriaRuntimeInventorySession",
|
||||
".ObserveInventory(entityIndex)");
|
||||
throw new InvalidOperationException(
|
||||
$"{name} should sample inventory validation state through current typed documents instead of owning reactive handles: " +
|
||||
string.Join(", ", forbiddenCurrentDocumentSymbols));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8046,36 +8007,44 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
"UI",
|
||||
"Menu",
|
||||
"InventoryPanel.cs"));
|
||||
var compactInventoryPanel = CompactSource(inventoryPanel);
|
||||
var requiredInventoryPanelSharedDocumentSymbols = new[]
|
||||
{
|
||||
".RuntimeState(\"unity-inventory\").CurrentCatalog()",
|
||||
".RuntimeState(\"unity-inventory\").CurrentPlayerSettings()",
|
||||
"private void OnDestroy()"
|
||||
};
|
||||
var missingInventoryPanelSharedDocumentSymbols = requiredInventoryPanelSharedDocumentSymbols
|
||||
.Where(symbol => !inventoryPanel.Contains(symbol, StringComparison.Ordinal))
|
||||
.Where(symbol => !compactInventoryPanel.Contains(symbol, StringComparison.Ordinal) &&
|
||||
!inventoryPanel.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (missingInventoryPanelSharedDocumentSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"InventoryPanel should bind shared catalog/settings through managed reactive Aetheria documents with panel lifetime disposal: " +
|
||||
"InventoryPanel should sample shared catalog/settings through named current typed Aetheria documents: " +
|
||||
string.Join(", ", missingInventoryPanelSharedDocumentSymbols));
|
||||
}
|
||||
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
inventoryPanel,
|
||||
"InventoryPanel",
|
||||
"AetheriaRuntimeCatalogSnapshot",
|
||||
"_catalog",
|
||||
var forbiddenInventoryPanelSharedDocumentSymbols = new[]
|
||||
{
|
||||
"CultMeshReactiveDocument<",
|
||||
".ReactiveCatalogSnapshot(\"unity-inventory\")",
|
||||
"AetheriaRuntimeCatalogSession",
|
||||
"ResolveClient().State.ObserveCatalog()");
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
inventoryPanel,
|
||||
"InventoryPanel",
|
||||
"AetheriaRuntimePlayerSettingsDocument",
|
||||
"_playerSettings",
|
||||
".ReactivePlayerSettingsDocument(\"unity-inventory\")",
|
||||
"AetheriaRuntimeCatalogSession",
|
||||
"AetheriaRuntimePlayerSettingsSession",
|
||||
".ObservePlayer()");
|
||||
"ResolveClient().State.ObserveCatalog()",
|
||||
".ObservePlayer()",
|
||||
"_catalog?.Dispose()",
|
||||
"_playerSettings?.Dispose()"
|
||||
}
|
||||
.Where(symbol => inventoryPanel.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (forbiddenInventoryPanelSharedDocumentSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"InventoryPanel still routes catalog/settings through wrapper/session/reactive handles instead of current typed documents: " +
|
||||
string.Join(", ", forbiddenInventoryPanelSharedDocumentSymbols));
|
||||
}
|
||||
|
||||
var sectorRenderer = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
|
|
@ -17989,7 +17958,7 @@ static void RequireInventoryDoubleClickTransferRequestAuthority(string root)
|
|||
string.Join(", ", missingTypedSlotValidationSymbols));
|
||||
}
|
||||
var requiredMenuInventoryAccess = ".CurrentInventory(entityIndex)";
|
||||
var requiredPanelInventoryAccess = ".ReactiveInventory(entityIndex)";
|
||||
var requiredPanelInventoryAccess = ".CurrentInventory(entityIndex)";
|
||||
if (!inventoryMenu.Contains(requiredMenuInventoryAccess, StringComparison.Ordinal) ||
|
||||
!inventoryPanel.Contains(requiredPanelInventoryAccess, StringComparison.Ordinal))
|
||||
{
|
||||
|
|
@ -18531,49 +18500,42 @@ static void RequireInventoryLoadoutSaveRequestAuthority(string root)
|
|||
{
|
||||
"RequestLoadoutTemplateSave(Entity entity)",
|
||||
"TryResolveEntityRecordKey(entity, out var targetEntityKey)",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> _loadoutFrame",
|
||||
"CreateLoadoutTemplate(targetEntityKey)",
|
||||
".CreateLoadoutTemplate(targetEntityKey ?? \"\")",
|
||||
".ReactiveDaemonFrame(\"unity-inventory\")",
|
||||
"_loadoutFrame?.Dispose()",
|
||||
".Ui(\"unity-inventory\")",
|
||||
".SaveLoadoutTemplateAsync(loadout, \"unity-inventory\")"
|
||||
};
|
||||
var missingInventoryPanelSymbols = requiredInventoryPanelSymbols
|
||||
.Where(symbol => !inventoryPanel.Contains(symbol, StringComparison.Ordinal))
|
||||
.Concat(new[] { ".RuntimeState(\"unity-inventory\").CurrentDaemonFrame()" }
|
||||
.Where(symbol => !CompactSource(inventoryPanel).Contains(symbol, StringComparison.Ordinal)))
|
||||
.ToArray();
|
||||
if (missingInventoryPanelSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"InventoryPanel no longer sends a typed Eve loadout-template command from the managed reactive daemon frame: " +
|
||||
"InventoryPanel no longer sends a typed Eve loadout-template command from the managed current daemon frame: " +
|
||||
string.Join(", ", missingInventoryPanelSymbols));
|
||||
}
|
||||
|
||||
if (inventoryPanel.Contains("AetheriaRuntimeDaemonFrameSession _loadoutFrame", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains("CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> _loadoutFrame", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains(".ReactiveDaemonFrame(\"unity-inventory\")", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains("_loadoutFrame?.Dispose()", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains(".ObserveDaemonFrame()", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains("AetheriaUnityRuntimeClientProvider.RuntimeClient(\"unity-inventory\")", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains(".Ui.SaveLoadoutTemplateAsync(loadout, \"unity-inventory\")", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"InventoryPanel must use managed reactive typed daemon-frame state and the provider-native UI command handle.");
|
||||
"InventoryPanel must use managed current typed daemon-frame state and the provider-native UI command handle.");
|
||||
}
|
||||
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
inventoryPanel,
|
||||
"InventoryPanel",
|
||||
"AetheriaRuntimeDaemonFrameDocument",
|
||||
"_loadoutFrame",
|
||||
".ReactiveDaemonFrame(\"unity-inventory\")",
|
||||
"AetheriaRuntimeDaemonFrameSession",
|
||||
".ObserveDaemonFrame()");
|
||||
|
||||
if (inventoryPanel.Contains(".LoadoutTemplateAsync(", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains(".ProjectLoadoutTemplateAsync(client.State, targetEntityKey)", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains("AetheriaRuntimeReactiveLoadoutSnapshotProjector", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains(".ReactiveLoadoutSnapshotProjector()", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"InventoryPanel still asks an aggregate compatibility helper for loadout templates instead of caching the managed reactive daemon frame.");
|
||||
"InventoryPanel still asks an aggregate compatibility helper for loadout templates instead of reading the managed current daemon frame.");
|
||||
}
|
||||
|
||||
if (File.Exists(loadoutSnapshotProjectorPath))
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ using System.Linq;
|
|||
using GameCult.Aetheria.EveRuntime;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UniRx.Triggers;
|
||||
|
|
@ -107,13 +106,6 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
|||
private int _clickCount;
|
||||
private InventoryCell _clickCell;
|
||||
private float _clickTime;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument> _currentEntity;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeStationRefitDocument> _stationRefit;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> _loadoutFrame;
|
||||
private int _inventoryEntityIndex = -1;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeInventoryDocument> _inventory;
|
||||
private AetheriaRuntimeStationRefitEntityOption[] _dropdownStationRefitEntities =
|
||||
Array.Empty<AetheriaRuntimeStationRefitEntityOption>();
|
||||
private AetheriaRuntimeStationLoadoutRestoreOption[] _dropdownStationRefitLoadouts =
|
||||
|
|
@ -1460,56 +1452,37 @@ private void Update()
|
|||
|
||||
private void ClearClientCaches()
|
||||
{
|
||||
_catalog?.Dispose();
|
||||
_playerSettings?.Dispose();
|
||||
_currentEntity?.Dispose();
|
||||
_stationRefit?.Dispose();
|
||||
_loadoutFrame?.Dispose();
|
||||
_inventory?.Dispose();
|
||||
_catalog = null;
|
||||
_playerSettings = null;
|
||||
_currentEntity = null;
|
||||
_stationRefit = null;
|
||||
_loadoutFrame = null;
|
||||
_observedDockingIndex = null;
|
||||
_inventory = null;
|
||||
_inventoryEntityIndex = -1;
|
||||
}
|
||||
|
||||
private AetheriaRuntimeCurrentEntityDocument CurrentEntitySnapshot()
|
||||
{
|
||||
if (_currentEntity != null)
|
||||
return _currentEntity.Current;
|
||||
|
||||
try
|
||||
{
|
||||
_currentEntity = AetheriaUnityRuntimeClientProvider
|
||||
.ReactiveCurrentEntity("unity-inventory");
|
||||
return AetheriaUnityRuntimeClientProvider
|
||||
.RuntimeState("unity-inventory")
|
||||
.CurrentEntityState();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria current entity for inventory panel: {ex.Message}");
|
||||
Debug.LogWarning($"Failed to read Aetheria current entity for inventory panel: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return _currentEntity?.Current;
|
||||
}
|
||||
|
||||
private AetheriaRuntimeStationRefitDocument StationRefitSnapshot()
|
||||
{
|
||||
if (_stationRefit != null)
|
||||
return _stationRefit.Current;
|
||||
|
||||
try
|
||||
{
|
||||
_stationRefit = AetheriaUnityRuntimeClientProvider
|
||||
.ReactiveStationRefit("unity-inventory");
|
||||
return AetheriaUnityRuntimeClientProvider
|
||||
.RuntimeState("unity-inventory")
|
||||
.CurrentStationRefit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria station refit for inventory panel: {ex.Message}");
|
||||
Debug.LogWarning($"Failed to read Aetheria station refit for inventory panel: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return _stationRefit?.Current;
|
||||
}
|
||||
|
||||
private AetheriaRuntimeLoadoutTemplateCommit CreateLoadoutTemplate(string targetEntityKey)
|
||||
|
|
@ -1521,78 +1494,62 @@ private void Update()
|
|||
|
||||
private AetheriaRuntimeDaemonFrameDocument ResolveLoadoutFrame()
|
||||
{
|
||||
if (_loadoutFrame != null)
|
||||
return _loadoutFrame.Current;
|
||||
|
||||
try
|
||||
{
|
||||
_loadoutFrame = AetheriaUnityRuntimeClientProvider
|
||||
.ReactiveDaemonFrame("unity-inventory");
|
||||
return AetheriaUnityRuntimeClientProvider
|
||||
.RuntimeState("unity-inventory")
|
||||
.CurrentDaemonFrame();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria daemon frame for loadout template save: {ex.Message}");
|
||||
Debug.LogWarning($"Failed to read Aetheria daemon frame for loadout template save: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return _loadoutFrame?.Current;
|
||||
}
|
||||
|
||||
private AetheriaRuntimeInventoryDocument InventorySnapshot(int entityIndex)
|
||||
{
|
||||
if (_inventory != null && _inventoryEntityIndex == entityIndex)
|
||||
return _inventory.Current;
|
||||
|
||||
try
|
||||
{
|
||||
var nextInventory = AetheriaUnityRuntimeClientProvider
|
||||
return AetheriaUnityRuntimeClientProvider
|
||||
.RuntimeState("unity-inventory")
|
||||
.ReactiveInventory(entityIndex);
|
||||
_inventory?.Dispose();
|
||||
_inventoryEntityIndex = entityIndex;
|
||||
_inventory = nextInventory;
|
||||
.CurrentInventory(entityIndex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria typed inventory document for entity {entityIndex}: {ex.Message}");
|
||||
Debug.LogWarning($"Failed to read Aetheria typed inventory document for entity {entityIndex}: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return _inventory?.Current;
|
||||
}
|
||||
|
||||
private AetheriaRuntimeCatalogSnapshot CatalogSnapshot()
|
||||
{
|
||||
if (_catalog != null)
|
||||
return _catalog.Current;
|
||||
|
||||
try
|
||||
{
|
||||
_catalog = AetheriaUnityRuntimeClientProvider
|
||||
.ReactiveCatalogSnapshot("unity-inventory");
|
||||
return AetheriaUnityRuntimeClientProvider
|
||||
.RuntimeState("unity-inventory")
|
||||
.CurrentCatalog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria runtime catalog for inventory panel: {ex.Message}");
|
||||
Debug.LogWarning($"Failed to read Aetheria runtime catalog for inventory panel: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return _catalog?.Current;
|
||||
}
|
||||
|
||||
private AetheriaRuntimePlayerSettingsDocument PlayerSettingsSnapshot()
|
||||
{
|
||||
if (_playerSettings != null)
|
||||
return _playerSettings.Current;
|
||||
|
||||
try
|
||||
{
|
||||
_playerSettings = AetheriaUnityRuntimeClientProvider
|
||||
.ReactivePlayerSettingsDocument("unity-inventory");
|
||||
return AetheriaUnityRuntimeClientProvider
|
||||
.RuntimeState("unity-inventory")
|
||||
.CurrentPlayerSettings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria player settings for inventory panel: {ex.Message}");
|
||||
Debug.LogWarning($"Failed to read Aetheria player settings for inventory panel: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return _playerSettings?.Current;
|
||||
}
|
||||
|
||||
private string FormatValue(float value)
|
||||
|
|
|
|||
Loading…
Reference in a new issue