Use reactive sector map documents

This commit is contained in:
Meta Vens 2026-06-28 09:43:47 +01:00
commit df67219fae
4 changed files with 135 additions and 18 deletions

View file

@ -4508,9 +4508,10 @@ static void RequireSectorMapZoneDetailsUseEveSurface(string root)
"ProjectZoneDetailsSurfaceState(",
"AetheriaUnityRuntimeClientProvider.ResolveClient(",
".Aetheria()",
".LatestSectorMap()",
".ReactiveSectorMap()",
".Details",
".LatestZone(zoneIndex)",
".ReactiveZone(zoneIndex)",
"_zoneDetails?.Current",
".Settings",
".ReactiveCatalog()",
".ReactivePlayer()",
@ -7003,7 +7004,19 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
"public Task<CultMeshReactiveDocument<AetheriaRuntimeStationRefitDocument>> ReactiveStationRefitAsync(",
"public CultMeshReactiveDocument<AetheriaRuntimeStationRefitDocument> ReactiveStationRefit(",
"public Task<CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument>> ReactiveZoneRenderAsync(",
"public CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument> ReactiveZoneRender("
"public CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument> ReactiveZoneRender(",
"public Task<CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument>> ReactiveZoneAsync(",
"public CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument> ReactiveZone(",
"public Task<CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument>> ReactiveEntityAsync(",
"public CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument> ReactiveEntity(",
"public Task<CultMeshReactiveDocument<AetheriaRuntimeCurrentDockingDocument>> ReactiveDockingAsync(",
"public CultMeshReactiveDocument<AetheriaRuntimeCurrentDockingDocument> ReactiveDocking(",
"public Task<CultMeshReactiveDocument<AetheriaRuntimeZoneDetailsDocument>> ReactiveZoneAsync(",
"public CultMeshReactiveDocument<AetheriaRuntimeZoneDetailsDocument> ReactiveZone(",
"public Task<CultMeshReactiveDocument<AetheriaRuntimeSelectedObjectDocument>> ReactiveSelectedObjectAsync(",
"public CultMeshReactiveDocument<AetheriaRuntimeSelectedObjectDocument> ReactiveSelectedObject(",
"public Task<CultMeshReactiveDocument<AetheriaRuntimeInventoryDocument>> ReactiveInventoryAsync(",
"public CultMeshReactiveDocument<AetheriaRuntimeInventoryDocument> ReactiveInventory("
};
var missingClientSymbols = requiredClientSymbols
.Where(symbol => !clientState.Contains(symbol, StringComparison.Ordinal))
@ -12987,15 +13000,16 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
!mapRenderer.Contains(".ReactivePlayer()", StringComparison.Ordinal) ||
!sectorRenderer.Contains("AetheriaUnityRuntimeClientProvider.ResolveClient(", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".Aetheria()", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".LatestSectorMap()", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".ReactiveSectorMap()", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".Details", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".LatestZone(zoneIndex)", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".ReactiveZone(zoneIndex)", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".Current", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".Settings", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".ReactiveCatalog()", StringComparison.Ordinal) ||
!sectorRenderer.Contains(".ReactivePlayer()", StringComparison.Ordinal) ||
!sectorMap.Contains("AetheriaUnityRuntimeClientProvider.ResolveClient(", StringComparison.Ordinal) ||
!sectorMap.Contains(".Aetheria()", StringComparison.Ordinal) ||
!sectorMap.Contains(".LatestSectorMap()", StringComparison.Ordinal) ||
!sectorMap.Contains(".ReactiveSectorMap()", StringComparison.Ordinal) ||
!sectorRenderer.Contains("AetheriaRuntimeZoneDetailsSurfaceBuilder.ProjectDaemonZone(", StringComparison.Ordinal))
{
throw new InvalidOperationException(

View file

@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using GameCult.Mesh;
using GameCult.Aetheria.State.Verse;
using TMPro;
using UniRx;
@ -52,6 +53,7 @@ public class SectorMap : MonoBehaviour
private readonly Queue<IEnumerable<int>> _queuedZoneReveals = new Queue<IEnumerable<int>>();
private readonly Dictionary<int, AetheriaRuntimeSectorMapZone> _zonesByIndex =
new Dictionary<int, AetheriaRuntimeSectorMapZone>();
private CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> _sectorMapDocument;
private AetheriaRuntimeSectorMapDocument _sectorMap;
private bool _sectorMapLoaded;
@ -219,9 +221,10 @@ public class SectorMap : MonoBehaviour
private void EnsureSectorMapLoaded()
{
_sectorMap = ResolveClient()
_sectorMapDocument ??= ResolveClient()
.Aetheria()
.LatestSectorMap();
.ReactiveSectorMap();
_sectorMap = _sectorMapDocument.Current;
if (_sectorMapLoaded)
return;
@ -252,6 +255,8 @@ public class SectorMap : MonoBehaviour
private void OnDestroy()
{
_sectorMapDocument?.Dispose();
_sectorMapDocument = null;
_sectorMapLoaded = false;
}

View file

@ -49,6 +49,10 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
private string _clientStatePath = "";
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,
@ -170,9 +174,10 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
try
{
var sectorMap = ResolveClient()
_sectorMap ??= ResolveClient()
.Aetheria()
.LatestSectorMap();
.ReactiveSectorMap();
var sectorMap = _sectorMap.Current;
return (sectorMap?.Zones ?? Array.Empty<AetheriaRuntimeSectorMapZone>())
.FirstOrDefault(zone => zone.ZoneIndex == zoneIndex);
}
@ -193,18 +198,25 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
if (zoneIndex < 0)
return null;
if (_zoneDetails != null && _zoneDetailsIndex == zoneIndex)
return _zoneDetails.Current;
try
{
return ResolveClient()
var nextZoneDetails = ResolveClient()
.Aetheria()
.Details
.LatestZone(zoneIndex);
.ReactiveZone(zoneIndex);
_zoneDetails?.Dispose();
_zoneDetailsIndex = zoneIndex;
_zoneDetails = nextZoneDetails;
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to read Aetheria sector zone details from local Verse state: {ex.Message}");
return null;
Debug.LogWarning($"Failed to bind Aetheria sector zone details from local Verse state: {ex.Message}");
}
return _zoneDetails?.Current;
}
private string ResolveHullType(string hullItemKey)
@ -281,8 +293,15 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
{
_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()
{
@ -303,16 +322,17 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
{
try
{
return ResolveClient()
_currentZone ??= ResolveClient()
.Aetheria()
.Current
.LatestZone();
.ReactiveZone();
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to read Aetheria sector current zone from local Verse state: {ex.Message}");
return null;
Debug.LogWarning($"Failed to bind Aetheria sector current zone from local Verse state: {ex.Message}");
}
return _currentZone?.Current;
}
private void OnDisable()

View file

@ -558,6 +558,18 @@ namespace GameCult.Aetheria.State.Verse
return LatestZoneAsync().ConfigureAwait(false).GetAwaiter().GetResult();
}
public Task<CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument>> ReactiveZoneAsync(
CultMeshReactiveDocumentOptions? options = null)
{
return Zone.ReactiveAsync(options);
}
public CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument> ReactiveZone(
CultMeshReactiveDocumentOptions? options = null)
{
return Zone.Reactive(options);
}
public Task<AetheriaRuntimeCurrentEntityDocument> LatestEntityAsync()
{
return Entity.LatestAsync();
@ -567,6 +579,30 @@ namespace GameCult.Aetheria.State.Verse
{
return LatestEntityAsync().ConfigureAwait(false).GetAwaiter().GetResult();
}
public Task<CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument>> ReactiveEntityAsync(
CultMeshReactiveDocumentOptions? options = null)
{
return Entity.ReactiveAsync(options);
}
public CultMeshReactiveDocument<AetheriaRuntimeCurrentEntityDocument> ReactiveEntity(
CultMeshReactiveDocumentOptions? options = null)
{
return Entity.Reactive(options);
}
public Task<CultMeshReactiveDocument<AetheriaRuntimeCurrentDockingDocument>> ReactiveDockingAsync(
CultMeshReactiveDocumentOptions? options = null)
{
return Docking.ReactiveAsync(options);
}
public CultMeshReactiveDocument<AetheriaRuntimeCurrentDockingDocument> ReactiveDocking(
CultMeshReactiveDocumentOptions? options = null)
{
return Docking.Reactive(options);
}
}
public sealed class AetheriaClientSettingsState
@ -883,6 +919,20 @@ namespace GameCult.Aetheria.State.Verse
return LatestZoneAsync(zoneIndex).ConfigureAwait(false).GetAwaiter().GetResult();
}
public Task<CultMeshReactiveDocument<AetheriaRuntimeZoneDetailsDocument>> ReactiveZoneAsync(
int zoneIndex,
CultMeshReactiveDocumentOptions? options = null)
{
return Zone(zoneIndex).ReactiveAsync(options);
}
public CultMeshReactiveDocument<AetheriaRuntimeZoneDetailsDocument> ReactiveZone(
int zoneIndex,
CultMeshReactiveDocumentOptions? options = null)
{
return Zone(zoneIndex).Reactive(options);
}
public CultMeshDocumentHandle<AetheriaRuntimeSelectedObjectDocument> SelectedObject(int entityIndex)
{
return _selectedObject(entityIndex);
@ -898,6 +948,20 @@ namespace GameCult.Aetheria.State.Verse
return LatestSelectedObjectAsync(entityIndex).ConfigureAwait(false).GetAwaiter().GetResult();
}
public Task<CultMeshReactiveDocument<AetheriaRuntimeSelectedObjectDocument>> ReactiveSelectedObjectAsync(
int entityIndex,
CultMeshReactiveDocumentOptions? options = null)
{
return SelectedObject(entityIndex).ReactiveAsync(options);
}
public CultMeshReactiveDocument<AetheriaRuntimeSelectedObjectDocument> ReactiveSelectedObject(
int entityIndex,
CultMeshReactiveDocumentOptions? options = null)
{
return SelectedObject(entityIndex).Reactive(options);
}
public CultMeshDocumentHandle<AetheriaRuntimeInventoryDocument> Inventory(int entityIndex)
{
return _inventory(entityIndex);
@ -912,6 +976,20 @@ namespace GameCult.Aetheria.State.Verse
{
return LatestInventoryAsync(entityIndex).ConfigureAwait(false).GetAwaiter().GetResult();
}
public Task<CultMeshReactiveDocument<AetheriaRuntimeInventoryDocument>> ReactiveInventoryAsync(
int entityIndex,
CultMeshReactiveDocumentOptions? options = null)
{
return Inventory(entityIndex).ReactiveAsync(options);
}
public CultMeshReactiveDocument<AetheriaRuntimeInventoryDocument> ReactiveInventory(
int entityIndex,
CultMeshReactiveDocumentOptions? options = null)
{
return Inventory(entityIndex).Reactive(options);
}
}
public sealed class AetheriaClientStarbridgeState