From ddef3fde6457373959331bfe2412eea54c47f3b1 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 28 Jun 2026 02:41:48 +0100 Subject: [PATCH] Route trade menu through managed runtime client --- Aetheria.State.Verify/Program.cs | 7 ++++++- Assets/Scripts/UI/Menu/TradeMenu.cs | 31 ++++++++--------------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 86a04f1e8..791257c84 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -12864,6 +12864,10 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) var sectorRenderer = File.Exists(sectorRendererPath) ? File.ReadAllText(sectorRendererPath) : throw new InvalidOperationException("Cannot verify daemon state acquisition; SectorRenderer.cs is missing."); + var tradeMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "TradeMenu.cs"); + var tradeMenu = File.Exists(tradeMenuPath) + ? File.ReadAllText(tradeMenuPath) + : throw new InvalidOperationException("Cannot verify daemon state acquisition; TradeMenu.cs is missing."); var gameplayBootShellPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaUnityGameplayBootShell.cs"); var gameplayBootShell = File.Exists(gameplayBootShellPath) ? File.ReadAllText(gameplayBootShellPath) @@ -12972,7 +12976,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) ["Assets/Scripts/UI/Menu/SectorMap.cs"] = sectorMap, ["Assets/Scripts/UI/Menu/LocalMenu.cs"] = localMenu, ["Assets/Scripts/UI/Menu/SectorRenderer.cs"] = sectorRenderer, - ["Assets/Scripts/UI/HUD/SchematicDisplay.cs"] = schematicDisplay + ["Assets/Scripts/UI/HUD/SchematicDisplay.cs"] = schematicDisplay, + ["Assets/Scripts/UI/Menu/TradeMenu.cs"] = tradeMenu }; var directClientOpenHits = providerOwnedClientAccessSources .Where(pair => diff --git a/Assets/Scripts/UI/Menu/TradeMenu.cs b/Assets/Scripts/UI/Menu/TradeMenu.cs index cdb67a41a..29f5eff6c 100644 --- a/Assets/Scripts/UI/Menu/TradeMenu.cs +++ b/Assets/Scripts/UI/Menu/TradeMenu.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Linq; using GameCult.Aetheria.EveRuntime; using GameCult.Aetheria.State.Verse; @@ -36,7 +35,6 @@ public class TradeMenu : MonoBehaviour private UIDocument _filterSurfaceDocument; private UIDocument _rowActionSurfaceDocument; private UIDocument _tradeItemSurfaceDocument; - private AetheriaClient _client; private string _clientStatePath = ""; private AetheriaRuntimeCatalogSnapshot _catalog; private AetheriaRuntimePlayerSettingsDocument _playerSettings; @@ -611,29 +609,18 @@ public class TradeMenu : MonoBehaviour private AetheriaClient ResolveClient() { - var gameDataDirectory = new DirectoryInfo(Path.Combine(Application.dataPath, "..", "GameData")); - var stateBoot = AetheriaRuntimeStateBoot.Inspect(gameDataDirectory); - if (_client != null && string.Equals(_clientStatePath, stateBoot.StateFilePath, StringComparison.Ordinal)) - return _client; + var stateBoot = AetheriaRuntimeStateBoot.Inspect(AetheriaUnityRuntimePaths.GameDataDirectory); + if (!string.Equals(_clientStatePath, stateBoot.StateFilePath, StringComparison.Ordinal)) + { + _clientStatePath = stateBoot.StateFilePath; + ClearClientCaches(); + } - DisposeClient(); - _client = AetheriaClient - .OpenLocalAsync( - gameDataDirectory, - "unity-trade", - "local", - pullOnOpen: true) - .GetAwaiter() - .GetResult(); - _clientStatePath = stateBoot.StateFilePath; - return _client; + return AetheriaUnityRuntimeClientProvider.ResolveClient(stateBoot, "unity-trade"); } - private void DisposeClient() + private void ClearClientCaches() { - _client?.Dispose(); - _client = null; - _clientStatePath = ""; _catalog = null; _playerSettings = null; _dockingState = null; @@ -1305,8 +1292,6 @@ public class TradeMenu : MonoBehaviour private void OnDestroy() { - DisposeClient(); - if (_cargoSelectorSurfaceDocument != null) { AetheriaEveUnitySurfaceHost.DestroyDocument(_cargoSelectorSurfaceDocument);