Route inventory panel through managed runtime client
This commit is contained in:
parent
de7d576b37
commit
ae08f4ddcf
2 changed files with 15 additions and 26 deletions
|
|
@ -12872,6 +12872,10 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
var inventoryMenu = File.Exists(inventoryMenuPath)
|
||||
? File.ReadAllText(inventoryMenuPath)
|
||||
: throw new InvalidOperationException("Cannot verify daemon state acquisition; InventoryMenu.cs is missing.");
|
||||
var inventoryPanelPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryPanel.cs");
|
||||
var inventoryPanel = File.Exists(inventoryPanelPath)
|
||||
? File.ReadAllText(inventoryPanelPath)
|
||||
: throw new InvalidOperationException("Cannot verify daemon state acquisition; InventoryPanel.cs is missing.");
|
||||
var gameplayBootShellPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaUnityGameplayBootShell.cs");
|
||||
var gameplayBootShell = File.Exists(gameplayBootShellPath)
|
||||
? File.ReadAllText(gameplayBootShellPath)
|
||||
|
|
@ -12982,7 +12986,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
["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/InventoryMenu.cs"] = inventoryMenu
|
||||
["Assets/Scripts/UI/Menu/InventoryMenu.cs"] = inventoryMenu,
|
||||
["Assets/Scripts/UI/Menu/InventoryPanel.cs"] = inventoryPanel
|
||||
};
|
||||
var directClientOpenHits = providerOwnedClientAccessSources
|
||||
.Where(pair =>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using GameCult.Aetheria.EveRuntime;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
|
|
@ -101,7 +100,6 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
|||
private int _clickCount;
|
||||
private InventoryCell _clickCell;
|
||||
private float _clickTime;
|
||||
private AetheriaClient _client;
|
||||
private string _clientStatePath = "";
|
||||
private AetheriaRuntimeCatalogSnapshot _catalog;
|
||||
private AetheriaRuntimePlayerSettingsDocument _playerSettings;
|
||||
|
|
@ -1492,30 +1490,18 @@ private void Update()
|
|||
|
||||
private AetheriaClient ResolveClient()
|
||||
{
|
||||
var gameDataDirectory = new DirectoryInfo(Path.Combine(Application.dataPath, "..", "GameData"));
|
||||
var stateBoot = AetheriaRuntimeStateBoot.Inspect(gameDataDirectory);
|
||||
var stateBoot = AetheriaRuntimeStateBoot.Inspect(AetheriaUnityRuntimePaths.GameDataDirectory);
|
||||
if (!string.Equals(_clientStatePath, stateBoot.StateFilePath, StringComparison.Ordinal))
|
||||
{
|
||||
_clientStatePath = stateBoot.StateFilePath;
|
||||
ClearClientCaches();
|
||||
}
|
||||
|
||||
if (_client != null && string.Equals(_clientStatePath, stateBoot.StateFilePath, StringComparison.Ordinal))
|
||||
return _client;
|
||||
|
||||
DisposeClient();
|
||||
_client = AetheriaClient
|
||||
.OpenLocalAsync(
|
||||
gameDataDirectory,
|
||||
"unity-inventory",
|
||||
"local",
|
||||
pullOnOpen: true)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
_clientStatePath = stateBoot.StateFilePath;
|
||||
return _client;
|
||||
return AetheriaUnityRuntimeClientProvider.ResolveClient(stateBoot, "unity-inventory");
|
||||
}
|
||||
|
||||
private void DisposeClient()
|
||||
private void ClearClientCaches()
|
||||
{
|
||||
_client?.Dispose();
|
||||
_client = null;
|
||||
_clientStatePath = "";
|
||||
_catalog = null;
|
||||
_playerSettings = null;
|
||||
}
|
||||
|
|
@ -1631,8 +1617,6 @@ private void Update()
|
|||
|
||||
private void OnDestroy()
|
||||
{
|
||||
DisposeClient();
|
||||
|
||||
if (_dropdownSurfaceDocument != null)
|
||||
{
|
||||
AetheriaEveUnitySurfaceHost.DestroyDocument(_dropdownSurfaceDocument);
|
||||
|
|
|
|||
Loading…
Reference in a new issue