Sample docking state through current typed access
This commit is contained in:
parent
ac82c7f88e
commit
ade95ae5b6
8 changed files with 27 additions and 63 deletions
|
|
@ -297,7 +297,6 @@ public class ActionGameManager : MonoBehaviour
|
|||
{
|
||||
_gameplayInputShell?.Dispose();
|
||||
_observedTargetQuery?.Dispose();
|
||||
_observedDocking?.Dispose();
|
||||
_observedTargetQuery = null;
|
||||
_observedDocking = null;
|
||||
AetheriaUnityRuntimeClientProvider.Dispose();
|
||||
|
|
|
|||
|
|
@ -5,14 +5,10 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Mesh;
|
||||
|
||||
public sealed class AetheriaUnityObservedDockingIndex : IDisposable
|
||||
public sealed class AetheriaUnityObservedDockingIndex
|
||||
{
|
||||
private readonly AetheriaUnityObservedEntityIndex _observedEntityIndex;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument> _currentEntity;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCurrentDockingDocument> _currentDocking;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeStationRefitDocument> _stationRefit;
|
||||
|
||||
public AetheriaUnityObservedDockingIndex(AetheriaUnityObservedEntityIndex observedEntityIndex)
|
||||
{
|
||||
|
|
@ -175,13 +171,13 @@ public sealed class AetheriaUnityObservedDockingIndex : IDisposable
|
|||
refit = null;
|
||||
try
|
||||
{
|
||||
EnsureDockingDocuments();
|
||||
docking = _currentDocking?.Current;
|
||||
refit = _stationRefit?.Current;
|
||||
var state = AetheriaUnityRuntimeClientProvider.RuntimeState();
|
||||
docking = state.CurrentDockingState();
|
||||
refit = state.CurrentStationRefit();
|
||||
if (docking == null || refit == null)
|
||||
return false;
|
||||
|
||||
entity = _currentEntity?.Current;
|
||||
entity = state.CurrentEntityState();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
|
|
@ -198,27 +194,4 @@ public sealed class AetheriaUnityObservedDockingIndex : IDisposable
|
|||
? entity.EntityKey
|
||||
: docking?.CurrentEntityKey ?? "";
|
||||
}
|
||||
|
||||
private void EnsureDockingDocuments()
|
||||
{
|
||||
if (_currentEntity != null && _currentDocking != null && _stationRefit != null)
|
||||
return;
|
||||
|
||||
_currentEntity ??= AetheriaUnityRuntimeClientProvider
|
||||
.ReactiveCurrentEntity("unity-observed-docking");
|
||||
_currentDocking ??= AetheriaUnityRuntimeClientProvider
|
||||
.ReactiveCurrentDocking("unity-observed-docking");
|
||||
_stationRefit ??= AetheriaUnityRuntimeClientProvider
|
||||
.ReactiveStationRefit("unity-observed-docking");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_currentEntity?.Dispose();
|
||||
_currentEntity = null;
|
||||
_currentDocking?.Dispose();
|
||||
_currentDocking = null;
|
||||
_stationRefit?.Dispose();
|
||||
_stationRefit = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ public class InventoryMenu : MonoBehaviour
|
|||
{
|
||||
if (!ReferenceEquals(_observedEntityIndex, observedEntityIndex))
|
||||
{
|
||||
_observedDockingIndex?.Dispose();
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
|
|
@ -908,7 +907,6 @@ public class InventoryMenu : MonoBehaviour
|
|||
_playerSettings?.Dispose();
|
||||
_currentEntity?.Dispose();
|
||||
_stationRefit?.Dispose();
|
||||
_observedDockingIndex?.Dispose();
|
||||
_inventory?.Dispose();
|
||||
_catalog = null;
|
||||
_playerSettings = null;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
|||
{
|
||||
if (!ReferenceEquals(_observedEntityIndex, observedEntityIndex))
|
||||
{
|
||||
_observedDockingIndex?.Dispose();
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
|
|
@ -1466,7 +1465,6 @@ private void Update()
|
|||
_currentEntity?.Dispose();
|
||||
_stationRefit?.Dispose();
|
||||
_loadoutFrame?.Dispose();
|
||||
_observedDockingIndex?.Dispose();
|
||||
_inventory?.Dispose();
|
||||
_catalog = null;
|
||||
_playerSettings = null;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ public class LocalMenu : MonoBehaviour
|
|||
{
|
||||
if (!ReferenceEquals(_observedEntityIndex, observedEntityIndex))
|
||||
{
|
||||
_observedDockingIndex?.Dispose();
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
|
|
@ -247,7 +246,6 @@ public class LocalMenu : MonoBehaviour
|
|||
AetheriaEveUnitySurfaceHost.DestroyDocument(_surfaceDocument);
|
||||
_surfaceDocument = null;
|
||||
}
|
||||
_observedDockingIndex?.Dispose();
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ public class MenuPanel : MonoBehaviour
|
|||
{
|
||||
if (!ReferenceEquals(_observedEntityIndex, observedEntityIndex))
|
||||
{
|
||||
_observedDockingIndex?.Dispose();
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +106,6 @@ public class MenuPanel : MonoBehaviour
|
|||
_tabSurfaceDocument = null;
|
||||
}
|
||||
|
||||
_observedDockingIndex?.Dispose();
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ public class TradeMenu : MonoBehaviour
|
|||
{
|
||||
if (!ReferenceEquals(_observedEntityIndex, observedEntityIndex))
|
||||
{
|
||||
_observedDockingIndex?.Dispose();
|
||||
_observedDockingIndex = null;
|
||||
}
|
||||
|
||||
|
|
@ -589,7 +588,6 @@ public class TradeMenu : MonoBehaviour
|
|||
{
|
||||
_catalog?.Dispose();
|
||||
_playerSettings?.Dispose();
|
||||
_observedDockingIndex?.Dispose();
|
||||
_catalog = null;
|
||||
_playerSettings = null;
|
||||
_observedDockingIndex = null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue