Centralize inventory state sessions

This commit is contained in:
Meta Vens 2026-06-28 14:25:08 +01:00
commit d6bee723ec
6 changed files with 195 additions and 47 deletions

View file

@ -7,7 +7,6 @@ using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using GameCult.Mesh;
using GameCult.Aetheria.EveRuntime;
using GameCult.Aetheria.State.Verse;
using GameCult.Eve.Surface;
@ -103,13 +102,13 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
private InventoryCell _clickCell;
private float _clickTime;
private string _clientStatePath = "";
private CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog;
private CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings;
private CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument> _currentEntity;
private CultMeshReactiveDocument<AetheriaRuntimeStationRefitDocument> _stationRefit;
private CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> _loadoutFrame;
private AetheriaRuntimeCatalogSession _catalog;
private AetheriaRuntimePlayerSettingsSession _playerSettings;
private AetheriaRuntimeCurrentEntitySession _currentEntity;
private AetheriaRuntimeStationRefitSession _stationRefit;
private AetheriaRuntimeDaemonFrameSession _loadoutFrame;
private int _inventoryEntityIndex = -1;
private CultMeshReactiveDocument<AetheriaRuntimeInventoryDocument> _inventory;
private AetheriaRuntimeInventorySession _inventory;
private AetheriaRuntimeStationRefitEntityOption[] _dropdownStationRefitEntities =
Array.Empty<AetheriaRuntimeStationRefitEntityOption>();
private AetheriaRuntimeStationLoadoutRestoreOption[] _dropdownStationRefitLoadouts =
@ -1243,7 +1242,7 @@ private void Update()
return true;
}
var refit = ResolveReactiveStationRefit();
var refit = ResolveStationRefitDocument();
var entityIndex = -1;
if (refit != null)
{
@ -1498,7 +1497,7 @@ private void Update()
_currentEntity = ResolveClient()
.State
.Current
.ReactiveEntity();
.ObserveEntity();
}
catch (Exception ex)
{
@ -1508,7 +1507,7 @@ private void Update()
return _currentEntity?.Current;
}
private AetheriaRuntimeStationRefitDocument ResolveReactiveStationRefit()
private AetheriaRuntimeStationRefitDocument ResolveStationRefitDocument()
{
if (_stationRefit != null)
return _stationRefit.Current;
@ -1517,7 +1516,7 @@ private void Update()
{
_stationRefit = ResolveClient()
.State
.ReactiveStationRefit();
.ObserveStationRefit();
}
catch (Exception ex)
{
@ -1544,7 +1543,7 @@ private void Update()
{
_loadoutFrame = ResolveClient()
.State
.ReactiveDaemonFrame();
.ObserveDaemonFrame();
}
catch (Exception ex)
{
@ -1564,7 +1563,7 @@ private void Update()
var nextInventory = ResolveClient()
.State
.Details
.ReactiveInventory(entityIndex);
.ObserveInventory(entityIndex);
_inventory?.Dispose();
_inventoryEntityIndex = entityIndex;
_inventory = nextInventory;
@ -1584,7 +1583,7 @@ private void Update()
try
{
_catalog = ResolveClient().State.ReactiveCatalog();
_catalog = ResolveClient().State.ObserveCatalog();
}
catch (Exception ex)
{
@ -1604,7 +1603,7 @@ private void Update()
_playerSettings = ResolveClient()
.State
.Settings
.ReactivePlayer();
.ObservePlayer();
}
catch (Exception ex)
{