Add named map and zone document access
This commit is contained in:
parent
6f666fd6cf
commit
c2ef01f8b4
11 changed files with 179 additions and 52 deletions
|
|
@ -40,7 +40,7 @@ public sealed class AetheriaUnityGameplayBootShell
|
|||
var runtimeCatalog = runtimeCatalogDocument.Current;
|
||||
if (runtimeCatalog == null)
|
||||
throw new InvalidOperationException("Aetheria typed runtime catalog is required before gameplay boot.");
|
||||
using var sectorMapDocument = runtimeState.Reactive<AetheriaRuntimeSectorMapDocument>();
|
||||
using var sectorMapDocument = runtimeState.ReactiveSectorMap();
|
||||
var sectorMap = sectorMapDocument.Current;
|
||||
if (sectorMap == null)
|
||||
throw new InvalidOperationException("Aetheria typed sector map is required before gameplay boot.");
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public sealed class AetheriaUnityObservedTargetQuery : IDisposable
|
|||
try
|
||||
{
|
||||
_zoneContacts = AetheriaUnityRuntimeClientProvider
|
||||
.Reactive<AetheriaRuntimeZoneContactsDocument>("unity-observed-target-query");
|
||||
.ReactiveZoneContacts("unity-observed-target-query");
|
||||
return _zoneContacts?.Current;
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -215,6 +215,71 @@ public static class AetheriaUnityRuntimeClientProvider
|
|||
return RuntimeState(stateBoot, runtimeId).ReactiveZoneRender();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeLoadoutTemplatesDocument> ReactiveLoadoutTemplates(
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).ReactiveLoadoutTemplates();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeLoadoutTemplatesDocument> ReactiveLoadoutTemplates(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).ReactiveLoadoutTemplates();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> ReactiveSectorMap(
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).ReactiveSectorMap();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> ReactiveSectorMap(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).ReactiveSectorMap();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument> ReactiveCurrentZone(
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).ReactiveCurrentZone();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeCurrentZoneDocument> ReactiveCurrentZone(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).ReactiveCurrentZone();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> ReactiveZoneContacts(
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).ReactiveZoneContacts();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> ReactiveZoneContacts(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).ReactiveZoneContacts();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeVerseHostSettingsDocument> ReactiveVerseHostSettings(
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).ReactiveVerseHostSettings();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeVerseHostSettingsDocument> ReactiveVerseHostSettings(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).ReactiveVerseHostSettings();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<TDocument> Reactive<TDocument>(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ public class DaemonRuntimeDocumentTests
|
|||
var latestFrame = ReadLatest(client.State.DaemonFrameDocument());
|
||||
var catalog = ReadLatest(client.State.Document<AetheriaRuntimeCatalogSnapshot>());
|
||||
var playerSettings = ReadLatest(client.State.Document<AetheriaRuntimePlayerSettingsDocument>());
|
||||
var verseHostSettings = ReadLatest(client.State.Document<AetheriaRuntimeVerseHostSettingsDocument>());
|
||||
var verseHostSettings = ReadLatest(client.State.VerseHostSettingsDocument());
|
||||
var currentEntityByType = client.State
|
||||
.Document<AetheriaRuntimeCurrentEntityDocument>()
|
||||
.LatestAsync()
|
||||
|
|
@ -211,12 +211,12 @@ public class DaemonRuntimeDocumentTests
|
|||
daemonSoaViewReactive,
|
||||
zoneRenderReactive,
|
||||
out var observed));
|
||||
using var loadoutTemplatesReactive = client.State.Reactive<AetheriaRuntimeLoadoutTemplatesDocument>();
|
||||
using var sectorMapReactive = client.State.Reactive<AetheriaRuntimeSectorMapDocument>();
|
||||
using var loadoutTemplatesReactive = client.State.ReactiveLoadoutTemplates();
|
||||
using var sectorMapReactive = client.State.ReactiveSectorMap();
|
||||
using var playerSettingsReactive = client.State.ReactivePlayerSettingsDocument();
|
||||
using var verseHostSettingsReactive = client.State.Reactive<AetheriaRuntimeVerseHostSettingsDocument>();
|
||||
using var zoneContactsReactive = client.State.Reactive<AetheriaRuntimeZoneContactsDocument>();
|
||||
using var currentZoneReactive = client.State.Reactive<AetheriaRuntimeCurrentZoneDocument>();
|
||||
using var verseHostSettingsReactive = client.State.ReactiveVerseHostSettings();
|
||||
using var zoneContactsReactive = client.State.ReactiveZoneContacts();
|
||||
using var currentZoneReactive = client.State.ReactiveCurrentZone();
|
||||
using var currentEntityDocumentReactive = client.State.ReactiveCurrentEntity();
|
||||
using var currentDockingReactive = client.State.ReactiveCurrentDocking();
|
||||
using var stationRefitReactive = client.State.ReactiveStationRefit();
|
||||
|
|
@ -270,9 +270,9 @@ public class DaemonRuntimeDocumentTests
|
|||
Assert.AreEqual(currentDocking.CurrentEntityKey, currentDockingReactive.Current.CurrentEntityKey);
|
||||
Assert.AreEqual(stationRefit.StationEntityKey, stationRefitReactive.Current.StationEntityKey);
|
||||
Assert.AreSame(client.State.PlayerSettings, client.State.Document<AetheriaRuntimePlayerSettingsDocument>());
|
||||
Assert.AreSame(client.State.VerseHostSettings, client.State.Document<AetheriaRuntimeVerseHostSettingsDocument>());
|
||||
Assert.AreSame(client.State.VerseHostSettings, client.State.VerseHostSettingsDocument());
|
||||
Assert.AreSame(client.State.CurrentEntity, client.State.Document<AetheriaRuntimeCurrentEntityDocument>());
|
||||
Assert.AreSame(client.State.ZoneContacts, client.State.Document<AetheriaRuntimeZoneContactsDocument>());
|
||||
Assert.AreSame(client.State.ZoneContacts, client.State.ZoneContactsDocument());
|
||||
Assert.AreEqual(
|
||||
typeof(AetheriaRuntimeCurrentEntityDocument),
|
||||
client.State.Document<AetheriaRuntimeCurrentEntityDocument>().DocumentType);
|
||||
|
|
@ -362,7 +362,7 @@ public class DaemonRuntimeDocumentTests
|
|||
.GetResult();
|
||||
|
||||
var player = ReadLatest(client.State.Document<AetheriaRuntimePlayerSettingsDocument>());
|
||||
var verseHost = ReadLatest(client.State.Document<AetheriaRuntimeVerseHostSettingsDocument>());
|
||||
var verseHost = ReadLatest(client.State.VerseHostSettingsDocument());
|
||||
var catalog = ReadLatest(client.State.Document<AetheriaRuntimeCatalogSnapshot>());
|
||||
|
||||
Assert.AreEqual(AetheriaRuntimeCatalogSnapshot.SchemaId, client.State.Catalog.Sources.Last().SchemaId);
|
||||
|
|
@ -372,7 +372,7 @@ public class DaemonRuntimeDocumentTests
|
|||
Assert.AreEqual("", player.PlayerName);
|
||||
Assert.AreEqual("", verseHost.VerseId);
|
||||
Assert.AreSame(client.State.PlayerSettings, client.State.Document<AetheriaRuntimePlayerSettingsDocument>());
|
||||
Assert.AreSame(client.State.VerseHostSettings, client.State.Document<AetheriaRuntimeVerseHostSettingsDocument>());
|
||||
Assert.AreSame(client.State.VerseHostSettings, client.State.VerseHostSettingsDocument());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public class MainMenu : MonoBehaviour
|
|||
{
|
||||
PrepareDocumentAccess(stateBoot);
|
||||
_sectorMap ??= AetheriaUnityRuntimeClientProvider
|
||||
.Reactive<AetheriaRuntimeSectorMapDocument>(stateBoot, "unity-main-menu");
|
||||
.ReactiveSectorMap(stateBoot, "unity-main-menu");
|
||||
return _sectorMap?.Current;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -189,7 +189,7 @@ public class MainMenu : MonoBehaviour
|
|||
{
|
||||
PrepareDocumentAccess(stateBoot);
|
||||
_verseHostSettings ??= AetheriaUnityRuntimeClientProvider
|
||||
.Reactive<AetheriaRuntimeVerseHostSettingsDocument>(stateBoot, "unity-main-menu");
|
||||
.ReactiveVerseHostSettings(stateBoot, "unity-main-menu");
|
||||
return _verseHostSettings?.Current;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ public class SectorMap : MonoBehaviour
|
|||
private void EnsureSectorMapLoaded()
|
||||
{
|
||||
_sectorMapDocument ??= AetheriaUnityRuntimeClientProvider
|
||||
.Reactive<AetheriaRuntimeSectorMapDocument>("unity-sector-map");
|
||||
.ReactiveSectorMap("unity-sector-map");
|
||||
_sectorMap = _sectorMapDocument?.Current;
|
||||
|
||||
if (_sectorMapLoaded)
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
|
|||
try
|
||||
{
|
||||
_sectorMap ??= AetheriaUnityRuntimeClientProvider
|
||||
.Reactive<AetheriaRuntimeSectorMapDocument>("unity-sector-renderer");
|
||||
.ReactiveSectorMap("unity-sector-renderer");
|
||||
var sectorMap = _sectorMap?.Current;
|
||||
return (sectorMap?.Zones ?? Array.Empty<AetheriaRuntimeSectorMapZone>())
|
||||
.FirstOrDefault(zone => zone.ZoneIndex == zoneIndex);
|
||||
|
|
@ -301,7 +301,7 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
|
|||
try
|
||||
{
|
||||
_currentZone ??= AetheriaUnityRuntimeClientProvider
|
||||
.Reactive<AetheriaRuntimeCurrentZoneDocument>("unity-sector-renderer");
|
||||
.ReactiveCurrentZone("unity-sector-renderer");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1226,7 +1226,7 @@ public class ZoneRenderer : MonoBehaviour
|
|||
try
|
||||
{
|
||||
_zoneContacts = AetheriaUnityRuntimeClientProvider
|
||||
.Reactive<AetheriaRuntimeZoneContactsDocument>("unity-zone-renderer");
|
||||
.ReactiveZoneContacts("unity-zone-renderer");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue