Route Aetheria Unity scene through Eve live transport
This commit is contained in:
parent
e6b75942e1
commit
aad0710444
3 changed files with 100 additions and 7 deletions
|
|
@ -2832,7 +2832,7 @@ public class DaemonRuntimeDocumentTests
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void GenericEveUnityRuntimePresentsAetheriaDaemonPlayableWorldThroughProviderBridge()
|
||||
public void GenericEveUnityRuntimePresentsAetheriaDaemonPlayableWorldThroughLiveProviderTransport()
|
||||
{
|
||||
var statePath = Path.Combine(
|
||||
Path.GetTempPath(),
|
||||
|
|
@ -2884,19 +2884,22 @@ public class DaemonRuntimeDocumentTests
|
|||
AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId,
|
||||
"unity-scene-playable-test");
|
||||
bridge.Refresh();
|
||||
using var liveBridge = new EveUnitySceneLiveProviderBridge(bridge);
|
||||
|
||||
var sceneSink = new RecordingPlayableWorldSceneSink();
|
||||
using var runtime = new EveUnityPlayableWorldRuntime(
|
||||
bridge,
|
||||
bridge,
|
||||
liveBridge,
|
||||
liveBridge,
|
||||
sceneSink,
|
||||
bridge,
|
||||
bridge);
|
||||
liveBridge,
|
||||
liveBridge);
|
||||
EveUnitySceneCommandReceipt observedReceipt = null;
|
||||
runtime.ReceiptAvailable += receipt => observedReceipt = receipt;
|
||||
|
||||
var presentation = runtime.Connect();
|
||||
|
||||
Assert.AreEqual("aetheria-cultmesh-cultcache-transport", liveBridge.TransportKind);
|
||||
Assert.AreEqual(AetheriaRuntimeVerseRecordKeys.DaemonAssetManifest.ToString(), liveBridge.AssetManifestPointer);
|
||||
Assert.AreEqual(1, presentation.ActiveEntities);
|
||||
Assert.AreEqual(1, sceneSink.Upserts.Count);
|
||||
Assert.IsNotNull(runtime.ActiveWorld);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using EveSurfaceDocument = GameCult.Eve.Surface.EveSurfaceDocument;
|
|||
namespace GameCult.Aetheria.EveRuntime
|
||||
{
|
||||
public sealed class AetheriaEveUnitySceneProviderBridge :
|
||||
IEveUnitySceneLiveProviderTransport,
|
||||
IEveUnitySceneProviderSurfaceDocumentSource,
|
||||
IEveUnityPlayableWorldAssetManifestDocumentSource,
|
||||
IEveUnitySceneCommandSink,
|
||||
|
|
@ -44,27 +45,66 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
"aetheria.daemon");
|
||||
}
|
||||
|
||||
public string TransportKind => "aetheria-cultmesh-cultcache-transport";
|
||||
|
||||
public string SurfacePointer => CurrentDocument.SourcePointer;
|
||||
|
||||
public string AssetManifestPointer => CurrentDocumentManifest.ManifestRef;
|
||||
|
||||
public string SinkKind => "aetheria-daemon-command-boundary";
|
||||
|
||||
public string ManifestRef => CurrentDocumentManifest.ManifestRef;
|
||||
|
||||
public EveUnitySceneProviderSurfaceDocument CurrentDocument { get; private set; }
|
||||
|
||||
EveUnitySceneProviderSurfaceDocument IEveUnitySceneLiveProviderTransport.CurrentSurfaceDocument =>
|
||||
CurrentDocument;
|
||||
|
||||
EveUnityPlayableWorldAssetManifestDocument IEveUnityPlayableWorldAssetManifestDocumentSource.CurrentDocument =>
|
||||
CurrentDocumentManifest;
|
||||
|
||||
EveUnityPlayableWorldAssetManifestDocument IEveUnitySceneLiveProviderTransport.CurrentAssetManifestDocument =>
|
||||
CurrentDocumentManifest;
|
||||
|
||||
public EveUnityPlayableWorldAssetManifestDocument CurrentDocumentManifest { get; private set; }
|
||||
|
||||
public event Action<EveUnitySceneProviderSurfaceDocument>? DocumentAvailable;
|
||||
|
||||
public event Action<EveUnitySceneCommandReceipt>? ReceiptAvailable;
|
||||
|
||||
event Action<EveUnitySceneProviderSurfaceDocument> IEveUnitySceneLiveProviderTransport.SurfaceDocumentAvailable
|
||||
{
|
||||
add => DocumentAvailable += value;
|
||||
remove => DocumentAvailable -= value;
|
||||
}
|
||||
|
||||
event Action<EveUnityPlayableWorldAssetManifestDocument> IEveUnityPlayableWorldAssetManifestDocumentSource.DocumentAvailable
|
||||
{
|
||||
add => AssetManifestDocumentAvailable += value;
|
||||
remove => AssetManifestDocumentAvailable -= value;
|
||||
}
|
||||
|
||||
event Action<EveUnityPlayableWorldAssetManifestDocument> IEveUnitySceneLiveProviderTransport.AssetManifestDocumentAvailable
|
||||
{
|
||||
add => AssetManifestDocumentAvailable += value;
|
||||
remove => AssetManifestDocumentAvailable -= value;
|
||||
}
|
||||
|
||||
event Action<EveUnitySceneCommandReceipt> IEveUnitySceneLiveProviderTransport.CommandReceiptAvailable
|
||||
{
|
||||
add => ReceiptAvailable += value;
|
||||
remove => ReceiptAvailable -= value;
|
||||
}
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
var stateBoot = ResolveStateBoot();
|
||||
|
|
@ -106,6 +146,11 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
ReceiptAvailable?.Invoke(ToReceipt(request, envelope));
|
||||
}
|
||||
|
||||
public void SubmitCommand(EveSurfaceCommandRequest request)
|
||||
{
|
||||
Submit(request);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using UnityEngine;
|
|||
namespace GameCult.Aetheria.EveRuntime
|
||||
{
|
||||
public sealed class AetheriaEveUnitySceneProviderComponent :
|
||||
MonoBehaviour,
|
||||
EveUnitySceneLiveProviderTransportBehaviour,
|
||||
IEveUnitySceneProviderSurfaceDocumentSource,
|
||||
IEveUnityPlayableWorldAssetManifestDocumentSource,
|
||||
IEveUnitySceneCommandSink,
|
||||
|
|
@ -24,6 +24,18 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
|
||||
private AetheriaEveUnitySceneProviderBridge? _bridge;
|
||||
|
||||
public override string TransportKind => Bridge.TransportKind;
|
||||
|
||||
public override string SurfacePointer => Bridge.SurfacePointer;
|
||||
|
||||
public override string AssetManifestPointer => Bridge.AssetManifestPointer;
|
||||
|
||||
public override EveUnitySceneProviderSurfaceDocument CurrentSurfaceDocument =>
|
||||
((IEveUnitySceneLiveProviderTransport)Bridge).CurrentSurfaceDocument;
|
||||
|
||||
public override EveUnityPlayableWorldAssetManifestDocument CurrentAssetManifestDocument =>
|
||||
((IEveUnitySceneLiveProviderTransport)Bridge).CurrentAssetManifestDocument;
|
||||
|
||||
public string SinkKind => Bridge.SinkKind;
|
||||
|
||||
public string ManifestRef => ((IEveUnityPlayableWorldAssetManifestDocumentSource)Bridge).ManifestRef;
|
||||
|
|
@ -39,19 +51,47 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
remove => Bridge.DocumentAvailable -= value;
|
||||
}
|
||||
|
||||
public override event Action<EveUnitySceneProviderSurfaceDocument> SurfaceDocumentAvailable
|
||||
{
|
||||
add => ((IEveUnitySceneLiveProviderTransport)Bridge).SurfaceDocumentAvailable += value;
|
||||
remove => ((IEveUnitySceneLiveProviderTransport)Bridge).SurfaceDocumentAvailable -= value;
|
||||
}
|
||||
|
||||
public event Action<EveUnitySceneCommandReceipt>? ReceiptAvailable
|
||||
{
|
||||
add => Bridge.ReceiptAvailable += value;
|
||||
remove => Bridge.ReceiptAvailable -= value;
|
||||
}
|
||||
|
||||
public override event Action<EveUnitySceneCommandReceipt> CommandReceiptAvailable
|
||||
{
|
||||
add => ((IEveUnitySceneLiveProviderTransport)Bridge).CommandReceiptAvailable += value;
|
||||
remove => ((IEveUnitySceneLiveProviderTransport)Bridge).CommandReceiptAvailable -= value;
|
||||
}
|
||||
|
||||
event Action<EveUnityPlayableWorldAssetManifestDocument> IEveUnityPlayableWorldAssetManifestDocumentSource.DocumentAvailable
|
||||
{
|
||||
add => ((IEveUnityPlayableWorldAssetManifestDocumentSource)Bridge).DocumentAvailable += value;
|
||||
remove => ((IEveUnityPlayableWorldAssetManifestDocumentSource)Bridge).DocumentAvailable -= value;
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
public override event Action<EveUnityPlayableWorldAssetManifestDocument> AssetManifestDocumentAvailable
|
||||
{
|
||||
add => ((IEveUnitySceneLiveProviderTransport)Bridge).AssetManifestDocumentAvailable += value;
|
||||
remove => ((IEveUnitySceneLiveProviderTransport)Bridge).AssetManifestDocumentAvailable -= value;
|
||||
}
|
||||
|
||||
public override void Connect()
|
||||
{
|
||||
Bridge.Connect();
|
||||
}
|
||||
|
||||
public override void Disconnect()
|
||||
{
|
||||
Bridge.Disconnect();
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
Bridge.Refresh();
|
||||
}
|
||||
|
|
@ -61,6 +101,11 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
Bridge.Submit(request);
|
||||
}
|
||||
|
||||
public override void SubmitCommand(EveSurfaceCommandRequest request)
|
||||
{
|
||||
Bridge.SubmitCommand(request);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_bridge?.Dispose();
|
||||
|
|
|
|||
Loading…
Reference in a new issue