Use reactive shared documents in inventory menu
This commit is contained in:
parent
6e16e2f605
commit
aaada3d382
2 changed files with 21 additions and 32 deletions
|
|
@ -7663,19 +7663,7 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
"UI",
|
||||
"Menu",
|
||||
"InventoryMenu.cs"));
|
||||
var requiredInventoryMenuSharedDocumentSymbols = new[]
|
||||
{
|
||||
"AetheriaRuntimeCatalogSession _catalog",
|
||||
"AetheriaRuntimePlayerSettingsSession _playerSettings",
|
||||
"ResolveClient().State.ObserveCatalog()",
|
||||
".Settings",
|
||||
".ObservePlayer()",
|
||||
"_catalog?.Dispose()",
|
||||
"_playerSettings?.Dispose()",
|
||||
"_catalog?.Current",
|
||||
"_playerSettings?.Current",
|
||||
"private void OnDestroy()"
|
||||
};
|
||||
var requiredInventoryMenuSharedDocumentSymbols = new[] { "private void OnDestroy()" };
|
||||
var missingInventoryMenuSharedDocumentSymbols = requiredInventoryMenuSharedDocumentSymbols
|
||||
.Where(symbol => !inventoryMenu.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
|
|
@ -7686,22 +7674,22 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
string.Join(", ", missingInventoryMenuSharedDocumentSymbols));
|
||||
}
|
||||
|
||||
var forbiddenInventoryMenuSharedDocumentSymbols = new[]
|
||||
{
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings",
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
inventoryMenu,
|
||||
"InventoryMenu",
|
||||
"AetheriaRuntimeCatalogSnapshot",
|
||||
"_catalog",
|
||||
"ResolveClient().State.ReactiveCatalog()",
|
||||
".ReactivePlayer()"
|
||||
};
|
||||
var inventoryMenuRawDocumentHits = forbiddenInventoryMenuSharedDocumentSymbols
|
||||
.Where(symbol => inventoryMenu.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (inventoryMenuRawDocumentHits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"InventoryMenu still owns raw catalog/settings CultMesh documents instead of managed sessions: " +
|
||||
string.Join(", ", inventoryMenuRawDocumentHits));
|
||||
}
|
||||
"AetheriaRuntimeCatalogSession",
|
||||
"ResolveClient().State.ObserveCatalog()");
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
inventoryMenu,
|
||||
"InventoryMenu",
|
||||
"AetheriaRuntimePlayerSettingsDocument",
|
||||
"_playerSettings",
|
||||
".ReactivePlayer()",
|
||||
"AetheriaRuntimePlayerSettingsSession",
|
||||
".ObservePlayer()");
|
||||
|
||||
var inventoryPanel = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using System.Linq;
|
|||
using GameCult.Aetheria.EveRuntime;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
using UnityEngine;
|
||||
using UniRx;
|
||||
using UniRx.Triggers;
|
||||
|
|
@ -31,8 +32,8 @@ public class InventoryMenu : MonoBehaviour
|
|||
private UIDocument _cargoItemDetailsSurfaceDocument;
|
||||
private UIDocument _equippedItemDetailsSurfaceDocument;
|
||||
private string _clientStatePath = "";
|
||||
private AetheriaRuntimeCatalogSession _catalog;
|
||||
private AetheriaRuntimePlayerSettingsSession _playerSettings;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings;
|
||||
private AetheriaRuntimeCurrentEntitySession _currentEntity;
|
||||
private AetheriaRuntimeStationRefitSession _stationRefit;
|
||||
private int _inventoryEntityIndex = -1;
|
||||
|
|
@ -1077,7 +1078,7 @@ public class InventoryMenu : MonoBehaviour
|
|||
|
||||
try
|
||||
{
|
||||
_catalog = ResolveClient().State.ObserveCatalog();
|
||||
_catalog = ResolveClient().State.ReactiveCatalog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -1097,7 +1098,7 @@ public class InventoryMenu : MonoBehaviour
|
|||
_playerSettings = ResolveClient()
|
||||
.State
|
||||
.Settings
|
||||
.ObservePlayer();
|
||||
.ReactivePlayer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue