Use reactive shared documents in trade menu
This commit is contained in:
parent
b18dcfb982
commit
6e16e2f605
2 changed files with 21 additions and 32 deletions
|
|
@ -7628,19 +7628,7 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
"UI",
|
||||
"Menu",
|
||||
"TradeMenu.cs"));
|
||||
var requiredTradeMenuSharedDocumentSymbols = new[]
|
||||
{
|
||||
"AetheriaRuntimeCatalogSession _catalog",
|
||||
"AetheriaRuntimePlayerSettingsSession _playerSettings",
|
||||
"ResolveClient().State.ObserveCatalog()",
|
||||
".Settings",
|
||||
".ObservePlayer()",
|
||||
"_catalog?.Dispose()",
|
||||
"_playerSettings?.Dispose()",
|
||||
"_catalog?.Current",
|
||||
"_playerSettings?.Current",
|
||||
"private void OnDestroy()"
|
||||
};
|
||||
var requiredTradeMenuSharedDocumentSymbols = new[] { "private void OnDestroy()" };
|
||||
var missingTradeMenuSharedDocumentSymbols = requiredTradeMenuSharedDocumentSymbols
|
||||
.Where(symbol => !tradeMenu.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
|
|
@ -7651,22 +7639,22 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
string.Join(", ", missingTradeMenuSharedDocumentSymbols));
|
||||
}
|
||||
|
||||
var forbiddenTradeMenuSharedDocumentSymbols = new[]
|
||||
{
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings",
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
tradeMenu,
|
||||
"TradeMenu",
|
||||
"AetheriaRuntimeCatalogSnapshot",
|
||||
"_catalog",
|
||||
"ResolveClient().State.ReactiveCatalog()",
|
||||
".ReactivePlayer()"
|
||||
};
|
||||
var tradeMenuRawDocumentHits = forbiddenTradeMenuSharedDocumentSymbols
|
||||
.Where(symbol => tradeMenu.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (tradeMenuRawDocumentHits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"TradeMenu still owns raw catalog/settings CultMesh documents instead of managed sessions: " +
|
||||
string.Join(", ", tradeMenuRawDocumentHits));
|
||||
}
|
||||
"AetheriaRuntimeCatalogSession",
|
||||
"ResolveClient().State.ObserveCatalog()");
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
tradeMenu,
|
||||
"TradeMenu",
|
||||
"AetheriaRuntimePlayerSettingsDocument",
|
||||
"_playerSettings",
|
||||
".ReactivePlayer()",
|
||||
"AetheriaRuntimePlayerSettingsSession",
|
||||
".ObservePlayer()");
|
||||
|
||||
var inventoryMenu = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
|
|||
using GameCult.Aetheria.EveRuntime;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
|
@ -37,8 +38,8 @@ public class TradeMenu : MonoBehaviour
|
|||
private UIDocument _rowActionSurfaceDocument;
|
||||
private UIDocument _tradeItemSurfaceDocument;
|
||||
private string _clientStatePath = "";
|
||||
private AetheriaRuntimeCatalogSession _catalog;
|
||||
private AetheriaRuntimePlayerSettingsSession _playerSettings;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings;
|
||||
private readonly AetheriaEveUnitySurfaceChrome _cargoSelectorSurfaceChrome = PanelChrome(360f, 420f, Align.FlexEnd);
|
||||
private readonly AetheriaEveUnitySurfaceChrome _filterSurfaceChrome = PanelChrome(420f, 520f, Align.FlexStart);
|
||||
private readonly AetheriaEveUnitySurfaceChrome _rowActionSurfaceChrome = PanelChrome(320f, 360f, Align.FlexStart);
|
||||
|
|
@ -625,7 +626,7 @@ public class TradeMenu : MonoBehaviour
|
|||
|
||||
try
|
||||
{
|
||||
_catalog = ResolveClient().State.ObserveCatalog();
|
||||
_catalog = ResolveClient().State.ReactiveCatalog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -645,7 +646,7 @@ public class TradeMenu : MonoBehaviour
|
|||
_playerSettings = ResolveClient()
|
||||
.State
|
||||
.Settings
|
||||
.ObservePlayer();
|
||||
.ReactivePlayer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue