Centralize sector map state sessions

This commit is contained in:
Meta Vens 2026-06-28 14:14:50 +01:00
commit 90630cbc31
6 changed files with 122 additions and 29 deletions

View file

@ -892,6 +892,12 @@ namespace GameCult.Aetheria.State.Verse
return Zone.Reactive(options);
}
public AetheriaRuntimeCurrentZoneSession ObserveZone(
CultMeshReactiveDocumentOptions? options = null)
{
return new AetheriaRuntimeCurrentZoneSession(ReactiveZone(options));
}
public Task<AetheriaRuntimeCurrentEntityDocument> LatestEntityAsync()
{
return Entity.LatestAsync();
@ -1193,6 +1199,13 @@ namespace GameCult.Aetheria.State.Verse
return Zone(zoneIndex).Reactive(options);
}
public AetheriaRuntimeZoneDetailsSession ObserveZone(
int zoneIndex,
CultMeshReactiveDocumentOptions? options = null)
{
return new AetheriaRuntimeZoneDetailsSession(ReactiveZone(zoneIndex, options));
}
public CultMeshDocumentHandle<AetheriaRuntimeSelectedObjectDocument> SelectedObject(int entityIndex)
{
return _selectedObject(entityIndex);

View file

@ -95,6 +95,42 @@ namespace GameCult.Aetheria.State.Verse
}
}
public sealed class AetheriaRuntimeCurrentZoneSession : IDisposable
{
private readonly CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument> _currentZone;
public AetheriaRuntimeCurrentZoneSession(
CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument> currentZone)
{
_currentZone = currentZone ?? throw new ArgumentNullException(nameof(currentZone));
}
public AetheriaRuntimeCurrentZoneDocument? Current => _currentZone.Current;
public void Dispose()
{
_currentZone.Dispose();
}
}
public sealed class AetheriaRuntimeZoneDetailsSession : IDisposable
{
private readonly CultMeshReactiveDocument<AetheriaRuntimeZoneDetailsDocument> _zoneDetails;
public AetheriaRuntimeZoneDetailsSession(
CultMeshReactiveDocument<AetheriaRuntimeZoneDetailsDocument> zoneDetails)
{
_zoneDetails = zoneDetails ?? throw new ArgumentNullException(nameof(zoneDetails));
}
public AetheriaRuntimeZoneDetailsDocument? Current => _zoneDetails.Current;
public void Dispose()
{
_zoneDetails.Dispose();
}
}
public sealed class AetheriaRuntimeObjectsViewportSession : IDisposable
{
private readonly CultMeshReactiveDocument<AetheriaRuntimeObjectsViewportDocument> _objectsViewport;