From b3faf12fd6dcd1929e6120f0a85ac8e54c508254 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 28 Jun 2026 23:00:02 +0100 Subject: [PATCH] Use reactive documents in inventory UI --- Aetheria.State.Verify/Program.cs | 76 +++++++++++++++++------- Assets/Scripts/UI/Menu/InventoryMenu.cs | 12 ++-- Assets/Scripts/UI/Menu/InventoryPanel.cs | 16 ++--- 3 files changed, 69 insertions(+), 35 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index eaa4bd347..f64122278 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -5009,7 +5009,7 @@ static void RequireInventoryShipSettingsUseEveSurface(string root) "RequestEntityShutdownPerformance(", "latestCurrentEntity.EntityKey", "(float)latestCurrentEntity.ShutdownPerformance", - "AetheriaRuntimeCurrentEntitySession _currentEntity", + "CultMeshReactiveDocument _currentEntity", "ResolveCurrentEntity()", "currentEntity = ResolveCurrentEntity();" }; @@ -7025,12 +7025,12 @@ static void RequireInventoryValidationUsesManagedTypedDocuments(string root) } var clientState = File.ReadAllText(clientStatePath); - if (!clientState.Contains("public AetheriaRuntimeCurrentEntitySession ObserveEntity(", StringComparison.Ordinal) || - !clientState.Contains("public AetheriaRuntimeStationRefitSession ObserveStationRefit(", StringComparison.Ordinal) || - !clientState.Contains("public AetheriaRuntimeInventorySession ObserveInventory(", StringComparison.Ordinal)) + if (!clientState.Contains("public CultMeshReactiveDocument ReactiveEntity(", StringComparison.Ordinal) || + !clientState.Contains("public CultMeshReactiveDocument ReactiveStationRefit(", StringComparison.Ordinal) || + !clientState.Contains("public CultMeshReactiveDocument ReactiveInventory(", StringComparison.Ordinal)) { throw new InvalidOperationException( - "AetheriaClientState must expose managed session access for current entity, station refit, and indexed inventory documents."); + "AetheriaClientState must expose direct managed reactive typed access for current entity, station refit, and indexed inventory documents."); } var sources = new Dictionary @@ -7044,11 +7044,11 @@ static void RequireInventoryValidationUsesManagedTypedDocuments(string root) var requiredSymbols = new[] { "ResolveCurrentEntity()", - ".ObserveEntity()", + ".ReactiveEntity()", "ResolveStationRefitDocument()", - ".ObserveStationRefit()", + ".ReactiveStationRefit()", "ResolveInventory(entityIndex)", - ".ObserveInventory(entityIndex)", + ".ReactiveInventory(entityIndex)", "_inventory?.Current" }; var missingSymbols = requiredSymbols @@ -7063,12 +7063,12 @@ static void RequireInventoryValidationUsesManagedTypedDocuments(string root) var forbiddenCompactedSymbols = new[] { - "CultMeshReactiveDocument", - "CultMeshReactiveDocument", - "CultMeshReactiveDocument", - ".ReactiveEntity()", - ".ReactiveStationRefit()", - ".ReactiveInventory(entityIndex)", + "AetheriaRuntimeCurrentEntitySession", + "AetheriaRuntimeStationRefitSession", + "AetheriaRuntimeInventorySession", + ".ObserveEntity()", + ".ObserveStationRefit()", + ".ObserveInventory(entityIndex)", ".Latest()", ".Latest()", ".Details.LatestInventory(entityIndex)", @@ -7084,8 +7084,33 @@ static void RequireInventoryValidationUsesManagedTypedDocuments(string root) if (hits.Length > 0) { throw new InvalidOperationException( - $"{name} still walks CultMesh document handles manually instead of using managed typed client state."); + $"{name} still routes inventory validation through session wrappers instead of direct managed reactive typed documents."); } + + RequireReactiveTypedDocumentAccess( + source, + name, + "AetheriaRuntimeCurrentEntityDocument", + "_currentEntity", + ".ReactiveEntity()", + "AetheriaRuntimeCurrentEntitySession", + ".ObserveEntity()"); + RequireReactiveTypedDocumentAccess( + source, + name, + "AetheriaRuntimeStationRefitDocument", + "_stationRefit", + ".ReactiveStationRefit()", + "AetheriaRuntimeStationRefitSession", + ".ObserveStationRefit()"); + RequireReactiveTypedDocumentAccess( + source, + name, + "AetheriaRuntimeInventoryDocument", + "_inventory", + ".ReactiveInventory(entityIndex)", + "AetheriaRuntimeInventorySession", + ".ObserveInventory(entityIndex)"); } Console.WriteLine("Inventory validation: cargo/equipment checks read managed typed client documents instead of manual handle walks"); @@ -16768,7 +16793,7 @@ static void RequireInventoryDoubleClickTransferRequestAuthority(string root) "TryValidateTypedCargoSlot(", "TryValidateTypedEquipmentSlot(", ".Details", - ".ObserveInventory(entityIndex)", + ".ReactiveInventory(entityIndex)", "origin.Cargo.TryGetValue(item, out var originPosition)", "SourceIndex == cargoIndex", "SourceIndex == equipmentIndex", @@ -17312,10 +17337,10 @@ static void RequireInventoryLoadoutSaveRequestAuthority(string root) { "RequestLoadoutTemplateSave(Entity entity)", "TryResolveEntityRecordKey(entity, out var targetEntityKey)", - "AetheriaRuntimeDaemonFrameSession _loadoutFrame", + "CultMeshReactiveDocument _loadoutFrame", "ProjectLoadoutTemplate(targetEntityKey)", "AetheriaRuntimeLoadoutSnapshotProjector.ProjectLoadoutTemplate(", - ".ObserveDaemonFrame()", + ".ReactiveDaemonFrame()", "_loadoutFrame?.Dispose()", ".Ui.SaveLoadoutTemplateAsync(loadout, \"unity-inventory\")" }; @@ -17329,13 +17354,22 @@ static void RequireInventoryLoadoutSaveRequestAuthority(string root) string.Join(", ", missingInventoryPanelSymbols)); } - if (inventoryPanel.Contains("CultMeshReactiveDocument _loadoutFrame", StringComparison.Ordinal) || - inventoryPanel.Contains(".ReactiveDaemonFrame()", StringComparison.Ordinal)) + if (inventoryPanel.Contains("AetheriaRuntimeDaemonFrameSession _loadoutFrame", StringComparison.Ordinal) || + inventoryPanel.Contains(".ObserveDaemonFrame()", StringComparison.Ordinal)) { throw new InvalidOperationException( - "InventoryPanel still owns a raw daemon-frame CultMesh document instead of AetheriaRuntimeDaemonFrameSession."); + "InventoryPanel still routes loadout snapshots through AetheriaRuntimeDaemonFrameSession instead of a managed reactive typed daemon-frame document."); } + RequireReactiveTypedDocumentAccess( + inventoryPanel, + "InventoryPanel", + "AetheriaRuntimeDaemonFrameDocument", + "_loadoutFrame", + ".ReactiveDaemonFrame()", + "AetheriaRuntimeDaemonFrameSession", + ".ObserveDaemonFrame()"); + if (inventoryPanel.Contains(".LoadoutTemplateAsync(", StringComparison.Ordinal) || inventoryPanel.Contains(".ProjectLoadoutTemplateAsync(client.State, targetEntityKey)", StringComparison.Ordinal) || inventoryPanel.Contains("AetheriaRuntimeReactiveLoadoutSnapshotProjector", StringComparison.Ordinal) || diff --git a/Assets/Scripts/UI/Menu/InventoryMenu.cs b/Assets/Scripts/UI/Menu/InventoryMenu.cs index dbbc277da..f53fa9563 100644 --- a/Assets/Scripts/UI/Menu/InventoryMenu.cs +++ b/Assets/Scripts/UI/Menu/InventoryMenu.cs @@ -34,10 +34,10 @@ public class InventoryMenu : MonoBehaviour private string _clientStatePath = ""; private CultMeshReactiveDocument _catalog; private CultMeshReactiveDocument _playerSettings; - private AetheriaRuntimeCurrentEntitySession _currentEntity; - private AetheriaRuntimeStationRefitSession _stationRefit; + private CultMeshReactiveDocument _currentEntity; + private CultMeshReactiveDocument _stationRefit; private int _inventoryEntityIndex = -1; - private AetheriaRuntimeInventorySession _inventory; + private CultMeshReactiveDocument _inventory; private AetheriaUnityActionBarPresentation _actionBarPresentation; private AetheriaUnityObservedEntityIndex _observedEntityIndex; private AetheriaUnityObservedDockingIndex _observedDockingIndex; @@ -967,7 +967,7 @@ public class InventoryMenu : MonoBehaviour _currentEntity = ResolveClient() .State .Current - .ObserveEntity(); + .ReactiveEntity(); } catch (Exception ex) { @@ -986,7 +986,7 @@ public class InventoryMenu : MonoBehaviour { _stationRefit = ResolveClient() .State - .ObserveStationRefit(); + .ReactiveStationRefit(); } catch (Exception ex) { @@ -1006,7 +1006,7 @@ public class InventoryMenu : MonoBehaviour var nextInventory = ResolveClient() .State .Details - .ObserveInventory(entityIndex); + .ReactiveInventory(entityIndex); _inventory?.Dispose(); _inventoryEntityIndex = entityIndex; _inventory = nextInventory; diff --git a/Assets/Scripts/UI/Menu/InventoryPanel.cs b/Assets/Scripts/UI/Menu/InventoryPanel.cs index b8b13b068..ef59303a6 100644 --- a/Assets/Scripts/UI/Menu/InventoryPanel.cs +++ b/Assets/Scripts/UI/Menu/InventoryPanel.cs @@ -111,11 +111,11 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler private string _clientStatePath = ""; private CultMeshReactiveDocument _catalog; private CultMeshReactiveDocument _playerSettings; - private AetheriaRuntimeCurrentEntitySession _currentEntity; - private AetheriaRuntimeStationRefitSession _stationRefit; - private AetheriaRuntimeDaemonFrameSession _loadoutFrame; + private CultMeshReactiveDocument _currentEntity; + private CultMeshReactiveDocument _stationRefit; + private CultMeshReactiveDocument _loadoutFrame; private int _inventoryEntityIndex = -1; - private AetheriaRuntimeInventorySession _inventory; + private CultMeshReactiveDocument _inventory; private AetheriaRuntimeStationRefitEntityOption[] _dropdownStationRefitEntities = Array.Empty(); private AetheriaRuntimeStationLoadoutRestoreOption[] _dropdownStationRefitLoadouts = @@ -1506,7 +1506,7 @@ private void Update() _currentEntity = ResolveClient() .State .Current - .ObserveEntity(); + .ReactiveEntity(); } catch (Exception ex) { @@ -1525,7 +1525,7 @@ private void Update() { _stationRefit = ResolveClient() .State - .ObserveStationRefit(); + .ReactiveStationRefit(); } catch (Exception ex) { @@ -1552,7 +1552,7 @@ private void Update() { _loadoutFrame = ResolveClient() .State - .ObserveDaemonFrame(); + .ReactiveDaemonFrame(); } catch (Exception ex) { @@ -1572,7 +1572,7 @@ private void Update() var nextInventory = ResolveClient() .State .Details - .ObserveInventory(entityIndex); + .ReactiveInventory(entityIndex); _inventory?.Dispose(); _inventoryEntityIndex = entityIndex; _inventory = nextInventory;