Use reactive typed docs in schematic HUD
This commit is contained in:
parent
d54af47ff5
commit
9e4a17bb22
2 changed files with 71 additions and 30 deletions
|
|
@ -2556,13 +2556,17 @@ static void RequireDaemonRenderQueryAuthority(string root)
|
|||
|
||||
var requiredSchematicHudSymbols = new[]
|
||||
{
|
||||
"private AetheriaRuntimePlayerHudSession _playerHud;",
|
||||
"ResolvePlayerHud()",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument> _currentEntity",
|
||||
"ResolveCatalog()",
|
||||
"ResolveCurrentEntityHudStatus()",
|
||||
"AetheriaUnityRuntimeClientProvider.ResolveClient(",
|
||||
"ResolveClient().State.ObservePlayerHud()",
|
||||
"return ResolvePlayerHud()?.Hud ?? new AetheriaRuntimeCurrentEntityHudStatus();",
|
||||
"_playerHud?.Dispose()",
|
||||
"ResolveClient().State.ReactiveCatalog()",
|
||||
"ResolveClient().State.Settings.ReactivePlayer()",
|
||||
"ResolveClient().State.Current.ReactiveEntity()",
|
||||
"return _currentEntity?.Current?.Hud ?? new AetheriaRuntimeCurrentEntityHudStatus();",
|
||||
"_currentEntity?.Dispose()",
|
||||
"hud.OverrideShutdown",
|
||||
"hud.HeatsinksEnabled",
|
||||
"hud.Heatstroke",
|
||||
|
|
@ -7361,11 +7365,17 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
"AetheriaRuntimePlayerHudState.cs"));
|
||||
var requiredSchematicDisplaySymbols = new[]
|
||||
{
|
||||
"AetheriaRuntimePlayerHudSession _playerHud",
|
||||
"ResolveClient().State.ObservePlayerHud()",
|
||||
"_playerHud?.Dispose()",
|
||||
"ResolvePlayerHud()?.Catalog?.FindItem(item, x => x.ItemKey)",
|
||||
"ResolvePlayerHud()?.PlayerSettings",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument> _currentEntity",
|
||||
"ResolveClient().State.ReactiveCatalog()",
|
||||
"ResolveClient().State.Settings.ReactivePlayer()",
|
||||
"ResolveClient().State.Current.ReactiveEntity()",
|
||||
"_catalog?.Dispose()",
|
||||
"_playerSettings?.Dispose()",
|
||||
"_currentEntity?.Dispose()",
|
||||
"ResolveCatalog()?.Current?.FindItem(item, x => x.ItemKey)",
|
||||
"return _playerSettings?.Current;",
|
||||
"private void OnDestroy()"
|
||||
};
|
||||
var missingSchematicDisplaySymbols = requiredSchematicDisplaySymbols
|
||||
|
|
@ -7374,18 +7384,18 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
if (missingSchematicDisplaySymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"SchematicDisplay should bind shared catalog/settings/current-entity HUD through one managed Aetheria player HUD session: " +
|
||||
"SchematicDisplay should bind shared catalog/settings/current-entity HUD through managed reactive typed documents: " +
|
||||
string.Join(", ", missingSchematicDisplaySymbols));
|
||||
}
|
||||
|
||||
var forbiddenSchematicDisplaySymbols = new[]
|
||||
{
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument> _currentEntity",
|
||||
".State.ReactiveCatalog()",
|
||||
".ReactivePlayer()",
|
||||
".ReactiveEntity()"
|
||||
"AetheriaRuntimePlayerHudSession _playerHud",
|
||||
"ResolvePlayerHud()",
|
||||
"ResolveClient().State.ObservePlayerHud()",
|
||||
"ResolvePlayerHud()?.Catalog",
|
||||
"ResolvePlayerHud()?.PlayerSettings",
|
||||
"ResolvePlayerHud()?.Hud"
|
||||
};
|
||||
var schematicDisplayHits = forbiddenSchematicDisplaySymbols
|
||||
.Where(symbol => schematicDisplay.Contains(symbol, StringComparison.Ordinal))
|
||||
|
|
@ -7393,7 +7403,7 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
if (schematicDisplayHits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"SchematicDisplay still owns raw player HUD CultMesh documents instead of AetheriaRuntimePlayerHudSession: " +
|
||||
"SchematicDisplay still routes through AetheriaRuntimePlayerHudSession instead of direct managed reactive typed documents: " +
|
||||
string.Join(", ", schematicDisplayHits));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Mesh;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
|
@ -69,7 +70,9 @@ public class SchematicDisplay : MonoBehaviour
|
|||
private SchematicDisplayItem[] _schematicItems;
|
||||
private AetherDrive _aetherDrive;
|
||||
private string _clientStatePath = "";
|
||||
private AetheriaRuntimePlayerHudSession _playerHud;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument> _currentEntity;
|
||||
private AetheriaRuntimeDaemonRenderSettings? _renderSettings;
|
||||
|
||||
private bool _enemy;
|
||||
|
|
@ -313,34 +316,58 @@ public class SchematicDisplay : MonoBehaviour
|
|||
|
||||
private AetheriaRuntimeCatalogItem FindTypedItem(ItemInstance item)
|
||||
{
|
||||
return ResolvePlayerHud()?.Catalog?.FindItem(item, x => x.ItemKey);
|
||||
return ResolveCatalog()?.Current?.FindItem(item, x => x.ItemKey);
|
||||
}
|
||||
|
||||
private AetheriaRuntimePlayerHudSession ResolvePlayerHud()
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> ResolveCatalog()
|
||||
{
|
||||
if (_playerHud != null)
|
||||
return _playerHud;
|
||||
if (_catalog != null)
|
||||
return _catalog;
|
||||
|
||||
try
|
||||
{
|
||||
_playerHud = ResolveClient().State.ObservePlayerHud();
|
||||
_catalog = ResolveClient().State.ReactiveCatalog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria player HUD state for schematic display: {ex.Message}");
|
||||
Debug.LogWarning($"Failed to bind Aetheria runtime catalog for schematic display: {ex.Message}");
|
||||
}
|
||||
|
||||
return _playerHud;
|
||||
return _catalog;
|
||||
}
|
||||
|
||||
private AetheriaRuntimePlayerSettingsDocument ResolvePlayerSettings()
|
||||
{
|
||||
return ResolvePlayerHud()?.PlayerSettings;
|
||||
if (_playerSettings == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_playerSettings = ResolveClient().State.Settings.ReactivePlayer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria player settings for schematic display: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
return _playerSettings?.Current;
|
||||
}
|
||||
|
||||
private AetheriaRuntimeCurrentEntityHudStatus ResolveCurrentEntityHudStatus()
|
||||
{
|
||||
return ResolvePlayerHud()?.Hud ?? new AetheriaRuntimeCurrentEntityHudStatus();
|
||||
if (_currentEntity == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentEntity = ResolveClient().State.Current.ReactiveEntity();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria current entity for schematic display: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
return _currentEntity?.Current?.Hud ?? new AetheriaRuntimeCurrentEntityHudStatus();
|
||||
}
|
||||
|
||||
private AetheriaClient ResolveClient()
|
||||
|
|
@ -385,8 +412,12 @@ public class SchematicDisplay : MonoBehaviour
|
|||
|
||||
private void ClearClientCaches()
|
||||
{
|
||||
_playerHud?.Dispose();
|
||||
_playerHud = null;
|
||||
_catalog?.Dispose();
|
||||
_catalog = null;
|
||||
_playerSettings?.Dispose();
|
||||
_playerSettings = null;
|
||||
_currentEntity?.Dispose();
|
||||
_currentEntity = null;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
|
|
|||
Loading…
Reference in a new issue