Sample sector renderer through current typed access

This commit is contained in:
Meta Vens 2026-06-29 10:20:35 +01:00
commit 10186bd078
2 changed files with 83 additions and 164 deletions

View file

@ -4591,9 +4591,12 @@ static void RequireSectorMapZoneDetailsUseEveSurface(string root)
"zoneFacts.Bodies",
"zoneFacts.Entities",
"AetheriaUnityRuntimeClientProvider",
".ReactiveSectorMap(\"unity-sector-renderer\")",
".ReactiveZoneDetails(zoneIndex, \"unity-sector-renderer\")",
"_zoneDetails?.Current",
".RuntimeState(\"unity-sector-renderer\")",
".CurrentSectorMap()",
".CurrentZoneDetails(zoneIndex)",
".CurrentCatalog()",
".CurrentPlayerSettings()",
".CurrentZoneState()",
"AetheriaRuntimeZoneDetailsSurfaceCommands.TryRead(request, out var command)",
"AetheriaRuntimeZoneDetailsCommandKind.Close"
};
@ -4609,46 +4612,34 @@ static void RequireSectorMapZoneDetailsUseEveSurface(string root)
string.Join(", ", missingSymbols));
}
RequireReactiveTypedDocumentAccess(
source,
"SectorRenderer",
"AetheriaRuntimeSectorMapDocument",
"_sectorMap",
var forbiddenAccessSymbols = new[]
{
"CultMeshReactiveDocument<",
".ReactiveSectorMap(\"unity-sector-renderer\")",
"AetheriaRuntimeSectorMapSession",
".ObserveSectorMap()");
RequireReactiveTypedDocumentAccess(
source,
"SectorRenderer",
"AetheriaRuntimeCurrentZoneDocument",
"_currentZone",
".ReactiveCurrentZone(\"unity-sector-renderer\")",
"AetheriaRuntimeCurrentZoneSession",
".ObserveZone()");
RequireReactiveTypedDocumentAccess(
source,
"SectorRenderer",
"AetheriaRuntimeZoneDetailsDocument",
"_zoneDetails",
".ReactiveZoneDetails(zoneIndex, \"unity-sector-renderer\")",
"AetheriaRuntimeZoneDetailsSession",
".ObserveZone(zoneIndex)");
RequireReactiveTypedDocumentAccess(
source,
"SectorRenderer",
"AetheriaRuntimeCatalogSnapshot",
"_catalog",
".ReactiveCatalogSnapshot(\"unity-sector-renderer\")",
"AetheriaRuntimeCatalogSession",
"ResolveClient().State.ObserveCatalog()");
RequireReactiveTypedDocumentAccess(
source,
"SectorRenderer",
"AetheriaRuntimePlayerSettingsDocument",
"_playerSettings",
".ReactivePlayerSettingsDocument(\"unity-sector-renderer\")",
"AetheriaRuntimeSectorMapSession",
"AetheriaRuntimeCurrentZoneSession",
"AetheriaRuntimeZoneDetailsSession",
"AetheriaRuntimeCatalogSession",
"AetheriaRuntimePlayerSettingsSession",
".ObservePlayer()");
".ObserveSectorMap()",
".ObserveZone()",
".ObserveZone(zoneIndex)",
"ResolveClient().State.ObserveCatalog()",
".ObservePlayer()",
"ClearClientCaches()"
}
.Where(symbol => source.Contains(symbol, StringComparison.Ordinal))
.ToArray();
if (forbiddenAccessSymbols.Length > 0)
{
throw new InvalidOperationException(
"SectorRenderer should sample sector UI documents through named current typed state instead of owning reactive/session handles: " +
string.Join(", ", forbiddenAccessSymbols));
}
var forbiddenSymbols = new[]
{
@ -8038,84 +8029,47 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
"UI",
"Menu",
"SectorRenderer.cs"));
var compactSectorRenderer = CompactSource(sectorRenderer);
var requiredSectorRendererSharedDocumentSymbols = new[]
{
"CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> _sectorMap",
"CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument> _currentZone",
"CultMeshReactiveDocument<AetheriaRuntimeZoneDetailsDocument> _zoneDetails",
".Current",
"_sectorMap?.Dispose()",
"_currentZone?.Dispose()",
"_zoneDetails?.Dispose()",
"private void OnDestroy()"
};
var missingSectorRendererSharedDocumentSymbols = requiredSectorRendererSharedDocumentSymbols
.Where(symbol => !sectorRenderer.Contains(symbol, StringComparison.Ordinal))
".RuntimeState(\"unity-sector-renderer\").CurrentSectorMap()",
".RuntimeState(\"unity-sector-renderer\").CurrentZoneState()",
".RuntimeState(\"unity-sector-renderer\").CurrentZoneDetails(zoneIndex)",
".RuntimeState(\"unity-sector-renderer\").CurrentCatalog()",
".RuntimeState(\"unity-sector-renderer\").CurrentPlayerSettings()"
}
.Where(symbol => !compactSectorRenderer.Contains(symbol, StringComparison.Ordinal))
.ToArray();
var compactSectorRenderer = CompactSource(sectorRenderer);
missingSectorRendererSharedDocumentSymbols = missingSectorRendererSharedDocumentSymbols
.Concat(new[]
{
".ReactiveSectorMap(\"unity-sector-renderer\")",
".ReactiveCurrentZone(\"unity-sector-renderer\")",
".ReactiveZoneDetails(zoneIndex,\"unity-sector-renderer\")"
}.Where(symbol => !compactSectorRenderer.Contains(symbol, StringComparison.Ordinal)))
.ToArray();
if (missingSectorRendererSharedDocumentSymbols.Length > 0)
if (requiredSectorRendererSharedDocumentSymbols.Length > 0)
{
throw new InvalidOperationException(
"SectorRenderer should bind shared catalog/settings through managed reactive Aetheria documents with renderer lifetime disposal: " +
string.Join(", ", missingSectorRendererSharedDocumentSymbols));
"SectorRenderer should sample shared sector UI state through named current typed Aetheria documents: " +
string.Join(", ", requiredSectorRendererSharedDocumentSymbols));
}
RequireReactiveTypedDocumentAccess(
sectorRenderer,
"SectorRenderer",
"AetheriaRuntimeSectorMapDocument",
"_sectorMap",
".ReactiveSectorMap(\"unity-sector-renderer\")",
"AetheriaRuntimeSectorMapSession",
".ObserveSectorMap()");
RequireReactiveTypedDocumentAccess(
sectorRenderer,
"SectorRenderer",
"AetheriaRuntimeCurrentZoneDocument",
"_currentZone",
".ReactiveCurrentZone(\"unity-sector-renderer\")",
"AetheriaRuntimeCurrentZoneSession",
".ObserveZone()");
RequireReactiveTypedDocumentAccess(
sectorRenderer,
"SectorRenderer",
"AetheriaRuntimeZoneDetailsDocument",
"_zoneDetails",
".ReactiveZoneDetails(zoneIndex,\"unity-sector-renderer\")",
"AetheriaRuntimeZoneDetailsSession",
".ObserveZone(zoneIndex)");
RequireReactiveTypedDocumentAccess(
sectorRenderer,
"SectorRenderer",
"AetheriaRuntimeCatalogSnapshot",
"_catalog",
".ReactiveCatalogSnapshot(\"unity-sector-renderer\")",
"AetheriaRuntimeCatalogSession",
"ResolveClient().State.ObserveCatalog()");
RequireReactiveTypedDocumentAccess(
sectorRenderer,
"SectorRenderer",
"AetheriaRuntimePlayerSettingsDocument",
"_playerSettings",
".ReactivePlayerSettingsDocument(\"unity-sector-renderer\")",
"AetheriaRuntimePlayerSettingsSession",
".ObservePlayer()");
var forbiddenSectorRendererSharedDocumentSymbols = new[]
{
"CultMeshReactiveDocument<",
".ReactiveSectorMap(\"unity-sector-renderer\")",
".ReactiveCurrentZone(\"unity-sector-renderer\")",
".ReactiveZoneDetails(zoneIndex, \"unity-sector-renderer\")",
".ReactiveCatalogSnapshot(\"unity-sector-renderer\")",
".ReactivePlayerSettingsDocument(\"unity-sector-renderer\")",
"AetheriaRuntimeSectorMapSession _sectorMap",
"AetheriaRuntimeCurrentZoneSession _currentZone",
"AetheriaRuntimeZoneDetailsSession _zoneDetails",
"AetheriaRuntimeCatalogSession _catalog",
"AetheriaRuntimePlayerSettingsSession _playerSettings",
".ObserveSectorMap()",
".ObserveZone(zoneIndex)"
".ObserveZone()",
".ObserveZone(zoneIndex)",
"ResolveClient().State.ObserveCatalog()",
".ObservePlayer()",
"_sectorMap?.Dispose()",
"_currentZone?.Dispose()",
"_zoneDetails?.Dispose()",
"_catalog?.Dispose()",
"_playerSettings?.Dispose()"
};
var sectorRendererRawDocumentHits = forbiddenSectorRendererSharedDocumentSymbols
.Where(symbol => sectorRenderer.Contains(symbol, StringComparison.Ordinal))
@ -8123,7 +8077,7 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
if (sectorRendererRawDocumentHits.Length > 0)
{
throw new InvalidOperationException(
"SectorRenderer still routes map/current-zone/details through session wrappers instead of managed reactive typed documents: " +
"SectorRenderer still routes map/current-zone/details through wrapper/session/reactive handles instead of current typed documents: " +
string.Join(", ", sectorRendererRawDocumentHits));
}
@ -14944,11 +14898,11 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
!compactMapRenderer.Contains(".ReactiveRenderSplatsViewport(viewport,\"unity-map-renderer\")", StringComparison.Ordinal) ||
!compactMapRenderer.Contains(".ReactivePlayerSettingsDocument(\"unity-map-renderer\")", StringComparison.Ordinal) ||
!sectorRenderer.Contains("AetheriaUnityRuntimeClientProvider", StringComparison.Ordinal) ||
!compactSectorRenderer.Contains(".ReactiveSectorMap(\"unity-sector-renderer\")", StringComparison.Ordinal) ||
!compactSectorRenderer.Contains(".ReactiveZoneDetails(zoneIndex,\"unity-sector-renderer\")", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".Current", StringComparison.Ordinal) ||
!compactSectorRenderer.Contains(".ReactiveCatalogSnapshot(\"unity-sector-renderer\")", StringComparison.Ordinal) ||
!compactSectorRenderer.Contains(".ReactivePlayerSettingsDocument(\"unity-sector-renderer\")", StringComparison.Ordinal) ||
!compactSectorRenderer.Contains(".RuntimeState(\"unity-sector-renderer\").CurrentSectorMap()", StringComparison.Ordinal) ||
!compactSectorRenderer.Contains(".RuntimeState(\"unity-sector-renderer\").CurrentZoneDetails(zoneIndex)", StringComparison.Ordinal) ||
!compactSectorRenderer.Contains(".RuntimeState(\"unity-sector-renderer\").CurrentCatalog()", StringComparison.Ordinal) ||
!compactSectorRenderer.Contains(".RuntimeState(\"unity-sector-renderer\").CurrentPlayerSettings()", StringComparison.Ordinal) ||
!compactSectorRenderer.Contains(".RuntimeState(\"unity-sector-renderer\").CurrentZoneState()", StringComparison.Ordinal) ||
!sectorMap.Contains("AetheriaUnityRuntimeClientProvider", StringComparison.Ordinal) ||
!compactSectorMap.Contains(".RuntimeState(\"unity-sector-map\").CurrentSectorMap()", StringComparison.Ordinal) ||
!sectorRenderer.Contains("AetheriaRuntimeZoneDetailsSurfaceBuilder.Facts(", StringComparison.Ordinal))

View file

@ -6,7 +6,6 @@ using System.Linq;
using GameCult.Aetheria.EveRuntime;
using GameCult.Aetheria.State.Verse;
using GameCult.Eve.Surface;
using GameCult.Mesh;
using UniRx;
using UnityEngine;
using UnityEngine.EventSystems;
@ -46,12 +45,6 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
private float _sectorBackgroundDepth;
private float _sectorCameraDepth;
private UIDocument _zoneDetailsSurfaceDocument;
private CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog;
private CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings;
private CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> _sectorMap;
private CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument> _currentZone;
private int _zoneDetailsIndex = -1;
private CultMeshReactiveDocument<AetheriaRuntimeZoneDetailsDocument> _zoneDetails;
private readonly AetheriaEveUnitySurfaceChrome _zoneDetailsSurfaceChrome = new AetheriaEveUnitySurfaceChrome
{
RootAlignItems = Align.FlexEnd,
@ -168,9 +161,9 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
try
{
_sectorMap ??= AetheriaUnityRuntimeClientProvider
.ReactiveSectorMap("unity-sector-renderer");
var sectorMap = _sectorMap?.Current;
var sectorMap = AetheriaUnityRuntimeClientProvider
.RuntimeState("unity-sector-renderer")
.CurrentSectorMap();
return (sectorMap?.Zones ?? Array.Empty<AetheriaRuntimeSectorMapZone>())
.FirstOrDefault(zone => zone.ZoneIndex == zoneIndex);
}
@ -191,23 +184,17 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
if (zoneIndex < 0)
return null;
if (_zoneDetails != null && _zoneDetailsIndex == zoneIndex)
return _zoneDetails.Current;
try
{
var nextZoneDetails = AetheriaUnityRuntimeClientProvider
.ReactiveZoneDetails(zoneIndex, "unity-sector-renderer");
_zoneDetails?.Dispose();
_zoneDetailsIndex = zoneIndex;
_zoneDetails = nextZoneDetails;
return AetheriaUnityRuntimeClientProvider
.RuntimeState("unity-sector-renderer")
.CurrentZoneDetails(zoneIndex);
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to bind Aetheria sector zone details from local Verse state: {ex.Message}");
Debug.LogWarning($"Failed to read Aetheria sector zone details from local Verse state: {ex.Message}");
return null;
}
return _zoneDetails?.Current;
}
private string ResolveHullType(string hullItemKey)
@ -218,38 +205,32 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
private AetheriaRuntimeCatalogSnapshot ResolveCatalog()
{
if (_catalog != null)
return _catalog.Current;
try
{
_catalog = AetheriaUnityRuntimeClientProvider
.ReactiveCatalogSnapshot("unity-sector-renderer");
return AetheriaUnityRuntimeClientProvider
.RuntimeState("unity-sector-renderer")
.CurrentCatalog();
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to bind Aetheria sector catalog from local Verse state: {ex.Message}");
Debug.LogWarning($"Failed to read Aetheria sector catalog from local Verse state: {ex.Message}");
return null;
}
return _catalog?.Current;
}
private AetheriaRuntimePlayerSettingsDocument ResolvePlayerSettings()
{
if (_playerSettings != null)
return _playerSettings.Current;
try
{
_playerSettings = AetheriaUnityRuntimeClientProvider
.ReactivePlayerSettingsDocument("unity-sector-renderer");
return AetheriaUnityRuntimeClientProvider
.RuntimeState("unity-sector-renderer")
.CurrentPlayerSettings();
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to bind Aetheria sector player settings from local Verse state: {ex.Message}");
Debug.LogWarning($"Failed to read Aetheria sector player settings from local Verse state: {ex.Message}");
return null;
}
return _playerSettings?.Current;
}
private string FormatValue(float value)
@ -267,20 +248,6 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
: formatted;
}
private void ClearClientCaches()
{
_catalog?.Dispose();
_playerSettings?.Dispose();
_sectorMap?.Dispose();
_currentZone?.Dispose();
_zoneDetails?.Dispose();
_catalog = null;
_playerSettings = null;
_sectorMap = null;
_currentZone = null;
_zoneDetails = null;
_zoneDetailsIndex = -1;
}
private void OnEnable()
{
_init = true;
@ -300,15 +267,15 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
{
try
{
_currentZone ??= AetheriaUnityRuntimeClientProvider
.ReactiveCurrentZone("unity-sector-renderer");
return AetheriaUnityRuntimeClientProvider
.RuntimeState("unity-sector-renderer")
.CurrentZoneState();
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to bind Aetheria sector current zone from local Verse state: {ex.Message}");
Debug.LogWarning($"Failed to read Aetheria sector current zone from local Verse state: {ex.Message}");
return null;
}
return _currentZone?.Current;
}
private void OnDisable()
@ -324,8 +291,6 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
private void OnDestroy()
{
ClearClientCaches();
if (_zoneDetailsSurfaceDocument != null)
{
AetheriaEveUnitySurfaceHost.DestroyDocument(_zoneDetailsSurfaceDocument);