Expose Aetheria world surface to EveUnity host
This commit is contained in:
parent
8804ba6655
commit
9a22fcb4db
7 changed files with 1079 additions and 4 deletions
|
|
@ -16,6 +16,7 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
IEveUnitySceneProviderSurfaceDocumentSource,
|
||||
IEveUnityPlayableWorldAssetManifestDocumentSource,
|
||||
IEveUnitySceneCommandSink,
|
||||
IEveUnityProviderRefreshSource,
|
||||
IDisposable
|
||||
{
|
||||
private readonly string _stateFilePathOverride;
|
||||
|
|
@ -46,6 +47,8 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
|
||||
public string SinkKind => "aetheria-daemon-command-boundary";
|
||||
|
||||
public string ManifestRef => CurrentDocumentManifest.ManifestRef;
|
||||
|
||||
public EveUnitySceneProviderSurfaceDocument CurrentDocument { get; private set; }
|
||||
|
||||
EveUnityPlayableWorldAssetManifestDocument IEveUnityPlayableWorldAssetManifestDocumentSource.CurrentDocument =>
|
||||
|
|
@ -110,14 +113,16 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
|
||||
private AetheriaRuntimeStateBootReport ResolveStateBoot()
|
||||
{
|
||||
_stateBoot = AetheriaEveRuntimeUnityHooks.RequireStateBoot(_stateFilePathOverride);
|
||||
return _stateBoot;
|
||||
var stateBoot = AetheriaEveRuntimeUnityHooks.RequireStateBoot(_stateFilePathOverride);
|
||||
_stateBoot = stateBoot;
|
||||
return stateBoot;
|
||||
}
|
||||
|
||||
private AetheriaClientState ResolveRuntimeState(AetheriaRuntimeStateBootReport stateBoot)
|
||||
{
|
||||
_runtimeState = AetheriaEveRuntimeUnityHooks.RequireRuntimeState(stateBoot, _runtimeId);
|
||||
return _runtimeState;
|
||||
var runtimeState = AetheriaEveRuntimeUnityHooks.RequireRuntimeState(stateBoot, _runtimeId);
|
||||
_runtimeState = runtimeState;
|
||||
return runtimeState;
|
||||
}
|
||||
|
||||
private EveSurfaceDocument? ReadSurface(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3e2e1c6c7bb24b44b89529166d1676a2
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Eve.UnityScene;
|
||||
using UnityEngine;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace GameCult.Aetheria.EveRuntime
|
||||
{
|
||||
public sealed class AetheriaEveUnitySceneProviderComponent :
|
||||
MonoBehaviour,
|
||||
IEveUnitySceneProviderSurfaceDocumentSource,
|
||||
IEveUnityPlayableWorldAssetManifestDocumentSource,
|
||||
IEveUnitySceneCommandSink,
|
||||
IEveUnityProviderRefreshSource,
|
||||
IDisposable
|
||||
{
|
||||
[SerializeField] private string stateFilePathOverride = "";
|
||||
[SerializeField] private string surfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId;
|
||||
[SerializeField] private string runtimeId = "unity-scene";
|
||||
[SerializeField] private bool refreshOnEnable = true;
|
||||
|
||||
private AetheriaEveUnitySceneProviderBridge? _bridge;
|
||||
|
||||
public string SinkKind => Bridge.SinkKind;
|
||||
|
||||
public string ManifestRef => ((IEveUnityPlayableWorldAssetManifestDocumentSource)Bridge).ManifestRef;
|
||||
|
||||
public EveUnitySceneProviderSurfaceDocument CurrentDocument => Bridge.CurrentDocument;
|
||||
|
||||
EveUnityPlayableWorldAssetManifestDocument IEveUnityPlayableWorldAssetManifestDocumentSource.CurrentDocument =>
|
||||
((IEveUnityPlayableWorldAssetManifestDocumentSource)Bridge).CurrentDocument;
|
||||
|
||||
public event Action<EveUnitySceneProviderSurfaceDocument>? DocumentAvailable
|
||||
{
|
||||
add => Bridge.DocumentAvailable += value;
|
||||
remove => Bridge.DocumentAvailable -= value;
|
||||
}
|
||||
|
||||
event Action<EveUnityPlayableWorldAssetManifestDocument> IEveUnityPlayableWorldAssetManifestDocumentSource.DocumentAvailable
|
||||
{
|
||||
add => ((IEveUnityPlayableWorldAssetManifestDocumentSource)Bridge).DocumentAvailable += value;
|
||||
remove => ((IEveUnityPlayableWorldAssetManifestDocumentSource)Bridge).DocumentAvailable -= value;
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
Bridge.Refresh();
|
||||
}
|
||||
|
||||
public void Submit(EveSurfaceCommandRequest request)
|
||||
{
|
||||
Bridge.Submit(request);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_bridge?.Dispose();
|
||||
_bridge = null;
|
||||
}
|
||||
|
||||
private AetheriaEveUnitySceneProviderBridge Bridge
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_bridge == null)
|
||||
{
|
||||
_bridge = new AetheriaEveUnitySceneProviderBridge(
|
||||
stateFilePathOverride,
|
||||
surfaceId,
|
||||
runtimeId);
|
||||
}
|
||||
|
||||
return _bridge;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (refreshOnEnable)
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 456b6126c7330234799fc1609e117b9a
|
||||
|
|
@ -297,6 +297,7 @@
|
|||
"source": "embedded",
|
||||
"dependencies": {
|
||||
"org.gamecult.aetheria.state": "0.1.0",
|
||||
"org.gamecult.eve.unity-scene": "0.1.0",
|
||||
"org.gamecult.eve.unity-uitoolkit": "0.1.0"
|
||||
}
|
||||
},
|
||||
|
|
@ -321,6 +322,14 @@
|
|||
"source": "local",
|
||||
"dependencies": {}
|
||||
},
|
||||
"org.gamecult.eve.unity-scene": {
|
||||
"version": "file:../../Eve/runtimes/incubating/eve-unity-scene",
|
||||
"depth": 0,
|
||||
"source": "local",
|
||||
"dependencies": {
|
||||
"org.gamecult.eve.surface": "0.1.0"
|
||||
}
|
||||
},
|
||||
"org.gamecult.eve.unity-uitoolkit": {
|
||||
"version": "file:../../Eve/packages/org.gamecult.eve.unity-uitoolkit",
|
||||
"depth": 0,
|
||||
|
|
|
|||
Loading…
Reference in a new issue