Hide raw reactive docs behind Unity handles

This commit is contained in:
Meta Vens 2026-06-29 13:12:23 +01:00
commit 932cc9f906
3 changed files with 43 additions and 31 deletions

View file

@ -4,20 +4,20 @@ using GameCult.Mesh;
public sealed class AetheriaUnityDaemonRenderDocuments : IDisposable
{
private readonly CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> _frame;
private readonly CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument> _soaView;
private readonly CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument> _zoneRender;
private AetheriaUnityDaemonRenderDocuments(AetheriaClientState state)
{
if (state == null)
throw new ArgumentNullException(nameof(state));
Frame = state.ReactiveDaemonFrame();
SoaView = state.ReactiveDaemonSoaView();
ZoneRender = state.ReactiveZoneRender();
_frame = state.ReactiveDaemonFrame();
_soaView = state.ReactiveDaemonSoaView();
_zoneRender = state.ReactiveZoneRender();
}
public CultMeshReactiveDocument<AetheriaRuntimeDaemonFrameDocument> Frame { get; }
public CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument> SoaView { get; }
public CultMeshReactiveDocument<AetheriaRuntimeZoneRenderDocument> ZoneRender { get; }
public AetheriaRuntimeDaemonRenderView Current =>
TryRead(out var observed) ? observed : null;
@ -29,16 +29,16 @@ public sealed class AetheriaUnityDaemonRenderDocuments : IDisposable
public bool TryRead(out AetheriaRuntimeDaemonRenderView observed)
{
return AetheriaRuntimeDaemonRenderView.TryCreateCurrent(
Frame,
SoaView,
ZoneRender,
_frame,
_soaView,
_zoneRender,
out observed);
}
public void Dispose()
{
Frame?.Dispose();
SoaView?.Dispose();
ZoneRender?.Dispose();
_frame?.Dispose();
_soaView?.Dispose();
_zoneRender?.Dispose();
}
}

View file

@ -4,6 +4,10 @@ using GameCult.Mesh;
public sealed class AetheriaUnityRtsViewportDocuments : IDisposable
{
private readonly CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> _contacts;
private readonly CultMeshReactiveDocument<AetheriaRuntimeObjectsViewportDocument> _objectsViewport;
private readonly CultMeshReactiveDocument<AetheriaRuntimeRenderSplatsViewportDocument> _renderSplatsViewport;
private AetheriaUnityRtsViewportDocuments(
AetheriaClientState state,
AetheriaRuntimeRtsViewportBounds viewport,
@ -17,19 +21,16 @@ public sealed class AetheriaUnityRtsViewportDocuments : IDisposable
throw new ArgumentNullException(nameof(viewport));
Viewport = viewport;
Contacts = bindContacts ? state.ReactiveZoneContacts() : null;
ObjectsViewport = bindObjects ? state.ReactiveObjectsViewport(viewport) : null;
RenderSplatsViewport = bindRenderSplats ? state.ReactiveRenderSplatsViewport(viewport) : null;
_contacts = bindContacts ? state.ReactiveZoneContacts() : null;
_objectsViewport = bindObjects ? state.ReactiveObjectsViewport(viewport) : null;
_renderSplatsViewport = bindRenderSplats ? state.ReactiveRenderSplatsViewport(viewport) : null;
}
public AetheriaRuntimeRtsViewportBounds Viewport { get; }
public CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> Contacts { get; }
public CultMeshReactiveDocument<AetheriaRuntimeObjectsViewportDocument> ObjectsViewport { get; }
public CultMeshReactiveDocument<AetheriaRuntimeRenderSplatsViewportDocument> RenderSplatsViewport { get; }
public AetheriaRuntimeZoneContactsDocument CurrentContacts => Contacts?.Current;
public AetheriaRuntimeObjectsViewportDocument CurrentObjectsViewport => ObjectsViewport?.Current;
public AetheriaRuntimeRenderSplatsViewportDocument CurrentRenderSplatsViewport => RenderSplatsViewport?.Current;
public AetheriaRuntimeZoneContactsDocument CurrentContacts => _contacts?.Current;
public AetheriaRuntimeObjectsViewportDocument CurrentObjectsViewport => _objectsViewport?.Current;
public AetheriaRuntimeRenderSplatsViewportDocument CurrentRenderSplatsViewport => _renderSplatsViewport?.Current;
public static AetheriaUnityRtsViewportDocuments OpenMap(
AetheriaClientState state,
@ -74,9 +75,9 @@ public sealed class AetheriaUnityRtsViewportDocuments : IDisposable
public void Dispose()
{
Contacts?.Dispose();
ObjectsViewport?.Dispose();
RenderSplatsViewport?.Dispose();
_contacts?.Dispose();
_objectsViewport?.Dispose();
_renderSplatsViewport?.Dispose();
}
public static bool SameViewport(