Route inventory menu through managed runtime client
This commit is contained in:
parent
ddef3fde64
commit
de7d576b37
2 changed files with 18 additions and 28 deletions
|
|
@ -12868,6 +12868,10 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
var tradeMenu = File.Exists(tradeMenuPath)
|
||||
? File.ReadAllText(tradeMenuPath)
|
||||
: throw new InvalidOperationException("Cannot verify daemon state acquisition; TradeMenu.cs is missing.");
|
||||
var inventoryMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryMenu.cs");
|
||||
var inventoryMenu = File.Exists(inventoryMenuPath)
|
||||
? File.ReadAllText(inventoryMenuPath)
|
||||
: throw new InvalidOperationException("Cannot verify daemon state acquisition; InventoryMenu.cs is missing.");
|
||||
var gameplayBootShellPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaUnityGameplayBootShell.cs");
|
||||
var gameplayBootShell = File.Exists(gameplayBootShellPath)
|
||||
? File.ReadAllText(gameplayBootShellPath)
|
||||
|
|
@ -12977,7 +12981,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
["Assets/Scripts/UI/Menu/LocalMenu.cs"] = localMenu,
|
||||
["Assets/Scripts/UI/Menu/SectorRenderer.cs"] = sectorRenderer,
|
||||
["Assets/Scripts/UI/HUD/SchematicDisplay.cs"] = schematicDisplay,
|
||||
["Assets/Scripts/UI/Menu/TradeMenu.cs"] = tradeMenu
|
||||
["Assets/Scripts/UI/Menu/TradeMenu.cs"] = tradeMenu,
|
||||
["Assets/Scripts/UI/Menu/InventoryMenu.cs"] = inventoryMenu
|
||||
};
|
||||
var directClientOpenHits = providerOwnedClientAccessSources
|
||||
.Where(pair =>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,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;
|
||||
|
|
@ -31,7 +30,6 @@ public class InventoryMenu : MonoBehaviour
|
|||
private UIDocument _shipSettingsSurfaceDocument;
|
||||
private UIDocument _cargoItemDetailsSurfaceDocument;
|
||||
private UIDocument _equippedItemDetailsSurfaceDocument;
|
||||
private AetheriaClient _client;
|
||||
private string _clientStatePath = "";
|
||||
private AetheriaRuntimeCatalogSnapshot _catalog;
|
||||
private AetheriaRuntimePlayerSettingsDocument _playerSettings;
|
||||
|
|
@ -957,29 +955,18 @@ public class InventoryMenu : 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-inventory-menu",
|
||||
"local",
|
||||
pullOnOpen: true)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
_clientStatePath = stateBoot.StateFilePath;
|
||||
return _client;
|
||||
return AetheriaUnityRuntimeClientProvider.ResolveClient(stateBoot, "unity-inventory-menu");
|
||||
}
|
||||
|
||||
private void DisposeClient()
|
||||
private void ClearClientCaches()
|
||||
{
|
||||
_client?.Dispose();
|
||||
_client = null;
|
||||
_clientStatePath = "";
|
||||
_catalog = null;
|
||||
_playerSettings = null;
|
||||
}
|
||||
|
|
@ -1129,8 +1116,6 @@ public class InventoryMenu : MonoBehaviour
|
|||
|
||||
private void OnDestroy()
|
||||
{
|
||||
DisposeClient();
|
||||
|
||||
if (_shipSettingsSurfaceDocument != null)
|
||||
{
|
||||
AetheriaEveUnitySurfaceHost.DestroyDocument(_shipSettingsSurfaceDocument);
|
||||
|
|
|
|||
Loading…
Reference in a new issue