Expose native daemon render document handle
This commit is contained in:
parent
f09c298bcd
commit
09d92e3d90
5 changed files with 115 additions and 52 deletions
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Mesh;
|
||||
|
||||
public sealed class AetheriaUnityDaemonRenderDocuments : IDisposable
|
||||
{
|
||||
private AetheriaUnityDaemonRenderDocuments(AetheriaClientState state)
|
||||
{
|
||||
if (state == null)
|
||||
throw new ArgumentNullException(nameof(state));
|
||||
|
||||
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;
|
||||
|
||||
public static AetheriaUnityDaemonRenderDocuments Open(AetheriaClientState state)
|
||||
{
|
||||
return new AetheriaUnityDaemonRenderDocuments(state);
|
||||
}
|
||||
|
||||
public bool TryRead(out AetheriaRuntimeDaemonRenderView observed)
|
||||
{
|
||||
return AetheriaRuntimeDaemonRenderView.TryCreateCurrent(
|
||||
Frame,
|
||||
SoaView,
|
||||
ZoneRender,
|
||||
out observed);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Frame?.Dispose();
|
||||
SoaView?.Dispose();
|
||||
ZoneRender?.Dispose();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue