Integrate CultMesh UI and URP cleanup
This commit is contained in:
parent
932cc9f906
commit
4d7bb65868
131 changed files with 7209 additions and 5084 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Mesh;
|
||||
using TMPro;
|
||||
using UniRx.Triggers;
|
||||
using UnityEngine;
|
||||
|
|
@ -52,6 +53,7 @@ public class ActionBarSlot : MonoBehaviour
|
|||
|
||||
public abstract class ActionBarBinding
|
||||
{
|
||||
private static AetheriaClientState s_runtimeState;
|
||||
public Entity Entity { get; }
|
||||
private readonly Func<AetheriaControl> _resolveControl;
|
||||
protected ActionBarSlot Slot { get; }
|
||||
|
|
@ -97,9 +99,8 @@ public abstract class ActionBarBinding
|
|||
{
|
||||
try
|
||||
{
|
||||
return AetheriaUnityRuntimeClientProvider
|
||||
.CurrentCatalog()
|
||||
.FindItem(item, x => x.ItemKey);
|
||||
s_runtimeState ??= AetheriaUnityRuntimeClientProvider.RuntimeState("unity-action-bar");
|
||||
return s_runtimeState.Catalog.Latest()?.FindItem(item, x => x.ItemKey);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@
|
|||
using System;
|
||||
using Cinemachine;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Mesh;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using float2 = Unity.Mathematics.float2;
|
||||
|
|
@ -29,13 +30,17 @@ public class ActionGameManager : MonoBehaviour
|
|||
private AetheriaUnityGameplayLoopShell _gameplayLoopShell;
|
||||
private AetheriaUnityGameplayBootShell _gameplayBootShell;
|
||||
private AetheriaUnityGameplaySceneWiring _sceneWiring;
|
||||
private AetheriaClientState _gameplayState;
|
||||
private AetheriaClientState GameplayState =>
|
||||
_gameplayState ??= AetheriaUnityRuntimeClientProvider.RuntimeState("unity-action-game-manager");
|
||||
|
||||
private AetheriaUnityPilotCommandSender PilotCommands =>
|
||||
_pilotCommands ??= new AetheriaUnityPilotCommandSender(
|
||||
() => AetheriaUnityRuntimeClientProvider.Control("unity-pilot-commands"),
|
||||
() => Time.unscaledTime);
|
||||
private AetheriaUnityObservedEntityRestorer ObservedEntityRestorer =>
|
||||
_observedEntityRestorer ??= new AetheriaUnityObservedEntityRestorer(
|
||||
_observedEntityIndex,
|
||||
_presentationEntityIndex,
|
||||
ItemManager,
|
||||
EntityBlueprintMaterializer.MaterializeObservedEntity,
|
||||
_loadoutItemFactory.CreateLoadoutItem,
|
||||
|
|
@ -81,16 +86,16 @@ public class ActionGameManager : MonoBehaviour
|
|||
private AetheriaUnityPilotOperationController PilotOperationController =>
|
||||
_pilotOperationController ??= new AetheriaUnityPilotOperationController(
|
||||
() => PilotCommands,
|
||||
_observedEntityIndex,
|
||||
_presentationEntityIndex,
|
||||
() => _viewDirection,
|
||||
() => CurrentEntity);
|
||||
private AetheriaUnityObservedFrameApplier ObservedFrameApplier =>
|
||||
_observedFrameApplier ??= new AetheriaUnityObservedFrameApplier(
|
||||
ResolveDaemonObserver,
|
||||
ResolveObservedGalaxyZone,
|
||||
ObservedZoneContextFactory.ResolveGalaxyZone,
|
||||
() => Zone,
|
||||
zone => Zone = zone,
|
||||
_observedEntityIndex,
|
||||
_presentationEntityIndex,
|
||||
ObservedEntityRestorer,
|
||||
ObservedZoneContextFactory,
|
||||
() => ZoneRenderer,
|
||||
|
|
@ -200,7 +205,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
TargetShieldsFill = TargetShieldsFill,
|
||||
MainMenu = MainMenu
|
||||
};
|
||||
private readonly AetheriaUnityObservedEntityIndex _observedEntityIndex = new AetheriaUnityObservedEntityIndex();
|
||||
private readonly AetheriaUnityPresentationEntityIndex _presentationEntityIndex = new AetheriaUnityPresentationEntityIndex();
|
||||
private static RuntimePlayerSettings RuntimePlayerSettings
|
||||
=> AetheriaUnityRuntimeClientProvider.PlayerSettings;
|
||||
|
||||
|
|
@ -211,9 +216,9 @@ public class ActionGameManager : MonoBehaviour
|
|||
public float TargetSpottedBlinkOffset = -.25f;
|
||||
|
||||
[Header("Postprocessing")]
|
||||
public PostProcessVolume DeathPost;
|
||||
public PostProcessVolume HeatstrokePost;
|
||||
public PostProcessVolume SevereHeatstrokePost;
|
||||
public Volume DeathPost;
|
||||
public Volume HeatstrokePost;
|
||||
public Volume SevereHeatstrokePost;
|
||||
|
||||
[Header("Scene Links")]
|
||||
public GameObject UiRoot;
|
||||
|
|
@ -303,7 +308,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
SceneWiring.ConfigureTargetPresentation(
|
||||
_targetPresentation,
|
||||
boot.RuntimeCatalog,
|
||||
_observedEntityIndex);
|
||||
_presentationEntityIndex);
|
||||
SceneWiring.ConfigureInventoryDragSession(_dragSession);
|
||||
SceneWiring.ConfigureActionBarPresentation(
|
||||
_actionBarPresentation,
|
||||
|
|
@ -313,7 +318,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
() => CurrentEntity,
|
||||
() => AetheriaUnityRuntimeClientProvider.Control("unity-action-bar"));
|
||||
SceneWiring.ConfigureRuntimeInputScreenShell(MenuShell);
|
||||
SceneWiring.ConfigureObservedEntityIndex(_observedEntityIndex);
|
||||
SceneWiring.ConfigurePresentationEntityIndex(_presentationEntityIndex);
|
||||
|
||||
// TODO: Process Stories
|
||||
|
||||
|
|
@ -347,7 +352,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
return false;
|
||||
}
|
||||
|
||||
if (_observedEntityIndex.TryResolveEntityRecordKey(CurrentEntity, out var currentEntityKey) &&
|
||||
if (_presentationEntityIndex.TryGetRecordKeyForPresentationEntity(CurrentEntity, out var currentEntityKey) &&
|
||||
!string.IsNullOrWhiteSpace(docking.CurrentEntityKey) &&
|
||||
!string.Equals(docking.CurrentEntityKey, currentEntityKey, StringComparison.Ordinal))
|
||||
{
|
||||
|
|
@ -369,23 +374,23 @@ public class ActionGameManager : MonoBehaviour
|
|||
return null;
|
||||
}
|
||||
|
||||
if (_observedEntityIndex.TryResolveEntityRecordKey(currentEntity, out var currentEntityKey) &&
|
||||
if (_presentationEntityIndex.TryGetRecordKeyForPresentationEntity(currentEntity, out var currentEntityKey) &&
|
||||
!string.IsNullOrWhiteSpace(docking.CurrentEntityKey) &&
|
||||
!string.Equals(docking.CurrentEntityKey, currentEntityKey, StringComparison.Ordinal))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _observedEntityIndex.TryResolveEntityByRecordKey(docking.DockParentEntityKey, out var dockParent)
|
||||
return _presentationEntityIndex.TryGetPresentationEntityByRecordKey(docking.DockParentEntityKey, out var dockParent)
|
||||
? dockParent
|
||||
: null;
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeCurrentDockingDocument CurrentDockingSnapshot()
|
||||
private AetheriaRuntimeCurrentDockingDocument CurrentDockingSnapshot()
|
||||
{
|
||||
try
|
||||
{
|
||||
return AetheriaUnityRuntimeClientProvider.CurrentDockingState("unity-action-game-manager");
|
||||
return GameplayState.CurrentDocking.Latest();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -394,20 +399,6 @@ public class ActionGameManager : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private GalaxyZone ResolveObservedGalaxyZone(int daemonZoneIndex)
|
||||
{
|
||||
if (daemonZoneIndex < 0 || ObservedGalaxy?.Zones == null)
|
||||
return null;
|
||||
|
||||
foreach (var zone in ObservedGalaxy.Zones)
|
||||
{
|
||||
if (zone != null && zone.ZoneIndex == daemonZoneIndex)
|
||||
return zone;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// public void ToggleEditMode()
|
||||
// {
|
||||
// _editMode = !_editMode;
|
||||
|
|
|
|||
271
Assets/Scripts/Gameplay/AetheriaSceneRenderSplatSource.cs
Normal file
271
Assets/Scripts/Gameplay/AetheriaSceneRenderSplatSource.cs
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using UnityEngine;
|
||||
|
||||
public sealed class AetheriaSceneRenderSplatSource : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private string documentName = "Scene Mock";
|
||||
|
||||
[SerializeField]
|
||||
private AetheriaSceneRenderSplat[] splats =
|
||||
{
|
||||
AetheriaSceneRenderSplat.Animated(
|
||||
AetheriaRuntimeRenderSplatLayerKeys.FogSurfaceHeight,
|
||||
"scene.fog_surface",
|
||||
Vector2.zero,
|
||||
new Vector2(512, 512),
|
||||
Color.white,
|
||||
4,
|
||||
4,
|
||||
0.015f),
|
||||
AetheriaSceneRenderSplat.Animated(
|
||||
AetheriaRuntimeRenderSplatLayerKeys.FogPatchHeight,
|
||||
"scene.fog_patch_height",
|
||||
Vector2.zero,
|
||||
new Vector2(512, 512),
|
||||
Color.white,
|
||||
9,
|
||||
9,
|
||||
0.02f),
|
||||
AetheriaSceneRenderSplat.Animated(
|
||||
AetheriaRuntimeRenderSplatLayerKeys.FogPatch,
|
||||
"scene.fog_patch",
|
||||
Vector2.zero,
|
||||
new Vector2(512, 512),
|
||||
Color.white,
|
||||
6,
|
||||
6,
|
||||
0.01f)
|
||||
};
|
||||
|
||||
[SerializeField]
|
||||
private AetheriaSceneRenderSplatFixture[] fixtures = Array.Empty<AetheriaSceneRenderSplatFixture>();
|
||||
|
||||
public AetheriaRuntimeRenderSplatsViewportDocument BuildDocument(AetheriaRuntimeRtsViewportBounds viewport)
|
||||
{
|
||||
viewport ??= new AetheriaRuntimeRtsViewportBounds();
|
||||
var normalizedViewport = Normalize(viewport);
|
||||
var layers = BuildLayers();
|
||||
var layerIndices = new Dictionary<string, int>(StringComparer.Ordinal);
|
||||
for (var index = 0; index < layers.Length; index++)
|
||||
layerIndices[layers[index].LayerKey] = index;
|
||||
|
||||
var builder = new Builder();
|
||||
foreach (var splat in splats ?? Array.Empty<AetheriaSceneRenderSplat>())
|
||||
splat.AddTo(builder, layerIndices);
|
||||
foreach (var fixture in fixtures ?? Array.Empty<AetheriaSceneRenderSplatFixture>())
|
||||
fixture.AddTo(builder, layerIndices);
|
||||
|
||||
return new AetheriaRuntimeRenderSplatsViewportDocument
|
||||
{
|
||||
PublishedAtUtc = DateTimeOffset.UtcNow.ToString("O"),
|
||||
SimulationTimeSeconds = Application.isPlaying ? Time.timeAsDouble : 0,
|
||||
RunId = "scene",
|
||||
ZoneName = string.IsNullOrWhiteSpace(documentName) ? gameObject.scene.name : documentName,
|
||||
Viewport = normalizedViewport,
|
||||
Layers = layers,
|
||||
Splats = builder.Build()
|
||||
};
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeRtsViewportBounds Normalize(AetheriaRuntimeRtsViewportBounds viewport)
|
||||
{
|
||||
return new AetheriaRuntimeRtsViewportBounds
|
||||
{
|
||||
MinX = Math.Min(viewport.MinX, viewport.MaxX),
|
||||
MinY = Math.Min(viewport.MinY, viewport.MaxY),
|
||||
MaxX = Math.Max(viewport.MinX, viewport.MaxX),
|
||||
MaxY = Math.Max(viewport.MinY, viewport.MaxY)
|
||||
};
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeRenderSplatLayerDefinition[] BuildLayers()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
Layer(AetheriaRuntimeRenderSplatLayerKeys.GravityHeight, "Gravity Height", AetheriaRuntimeRenderSplatChannels.Gravity),
|
||||
Layer(AetheriaRuntimeRenderSplatLayerKeys.GravityWave, "Gravity Wave", AetheriaRuntimeRenderSplatChannels.GravityWave),
|
||||
Layer(AetheriaRuntimeRenderSplatLayerKeys.Visibility, "Visibility Mask", AetheriaRuntimeRenderSplatChannels.Visibility, AetheriaRuntimeRenderSplatBlendModes.Max),
|
||||
Layer(AetheriaRuntimeRenderSplatLayerKeys.FogSurfaceHeight, "Fog Surface Height", AetheriaRuntimeRenderSplatChannels.Tint),
|
||||
Layer(AetheriaRuntimeRenderSplatLayerKeys.FogPatchHeight, "Fog Patch Height", AetheriaRuntimeRenderSplatChannels.Tint),
|
||||
Layer(AetheriaRuntimeRenderSplatLayerKeys.FogPatch, "Fog Patch", AetheriaRuntimeRenderSplatChannels.Tint, AetheriaRuntimeRenderSplatBlendModes.Max),
|
||||
Layer(AetheriaRuntimeRenderSplatLayerKeys.FogTint, "Fog Tint", AetheriaRuntimeRenderSplatChannels.Tint, graphicsFormat: "B10G11R11_UFloatPack32"),
|
||||
Layer(AetheriaRuntimeRenderSplatLayerKeys.Influence, "Influence", AetheriaRuntimeRenderSplatChannels.Influence)
|
||||
};
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeRenderSplatLayerDefinition Layer(
|
||||
string key,
|
||||
string displayName,
|
||||
int channel,
|
||||
string blendMode = AetheriaRuntimeRenderSplatBlendModes.Add,
|
||||
string graphicsFormat = "R16_SFloat")
|
||||
{
|
||||
return new AetheriaRuntimeRenderSplatLayerDefinition
|
||||
{
|
||||
LayerKey = key,
|
||||
DisplayName = displayName,
|
||||
Channel = channel,
|
||||
BlendMode = blendMode,
|
||||
GraphicsFormat = graphicsFormat
|
||||
};
|
||||
}
|
||||
|
||||
public sealed class Builder
|
||||
{
|
||||
private readonly List<double> _centerX = new List<double>();
|
||||
private readonly List<double> _centerY = new List<double>();
|
||||
private readonly List<double> _halfExtentX = new List<double>();
|
||||
private readonly List<double> _halfExtentY = new List<double>();
|
||||
private readonly List<double> _rotationCos = new List<double>();
|
||||
private readonly List<double> _rotationSin = new List<double>();
|
||||
private readonly List<int> _channel = new List<int>();
|
||||
private readonly List<int> _falloff = new List<int>();
|
||||
private readonly List<double> _valueR = new List<double>();
|
||||
private readonly List<double> _valueG = new List<double>();
|
||||
private readonly List<double> _valueB = new List<double>();
|
||||
private readonly List<double> _valueA = new List<double>();
|
||||
private readonly List<string> _sourceKey = new List<string>();
|
||||
private readonly List<int> _layerIndex = new List<int>();
|
||||
private readonly List<int> _sourceKind = new List<int>();
|
||||
private readonly List<double> _frequencyX = new List<double>();
|
||||
private readonly List<double> _frequencyY = new List<double>();
|
||||
private readonly List<double> _phaseX = new List<double>();
|
||||
private readonly List<double> _phaseY = new List<double>();
|
||||
private readonly List<double> _animationSpeed = new List<double>();
|
||||
private readonly List<double> _sourceFlags = new List<double>();
|
||||
|
||||
public void Add(AetheriaSceneRenderSplat splat, int layerIndex)
|
||||
{
|
||||
var rotationRadians = splat.RotationDegrees * Mathf.Deg2Rad;
|
||||
_layerIndex.Add(layerIndex);
|
||||
_centerX.Add(splat.Center.x);
|
||||
_centerY.Add(splat.Center.y);
|
||||
_halfExtentX.Add(Math.Max(0, splat.HalfExtent.x));
|
||||
_halfExtentY.Add(Math.Max(0, splat.HalfExtent.y));
|
||||
_rotationCos.Add(Math.Cos(rotationRadians));
|
||||
_rotationSin.Add(Math.Sin(rotationRadians));
|
||||
_channel.Add(splat.Channel);
|
||||
_falloff.Add(splat.Falloff);
|
||||
_valueR.Add(splat.Value.r);
|
||||
_valueG.Add(splat.Value.g);
|
||||
_valueB.Add(splat.Value.b);
|
||||
_valueA.Add(splat.Value.a);
|
||||
_sourceKey.Add(splat.SourceKey ?? "");
|
||||
_sourceKind.Add(splat.SourceKind);
|
||||
_frequencyX.Add(splat.Frequency.x);
|
||||
_frequencyY.Add(splat.Frequency.y);
|
||||
_phaseX.Add(splat.Phase.x);
|
||||
_phaseY.Add(splat.Phase.y);
|
||||
_animationSpeed.Add(splat.AnimationSpeed);
|
||||
_sourceFlags.Add(splat.SourceFlags);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeRenderSplatSoa Build()
|
||||
{
|
||||
return new AetheriaRuntimeRenderSplatSoa
|
||||
{
|
||||
Count = _centerX.Count,
|
||||
CenterX = _centerX.ToArray(),
|
||||
CenterY = _centerY.ToArray(),
|
||||
HalfExtentX = _halfExtentX.ToArray(),
|
||||
HalfExtentY = _halfExtentY.ToArray(),
|
||||
RotationCos = _rotationCos.ToArray(),
|
||||
RotationSin = _rotationSin.ToArray(),
|
||||
Channel = _channel.ToArray(),
|
||||
Falloff = _falloff.ToArray(),
|
||||
ValueR = _valueR.ToArray(),
|
||||
ValueG = _valueG.ToArray(),
|
||||
ValueB = _valueB.ToArray(),
|
||||
ValueA = _valueA.ToArray(),
|
||||
SourceKey = _sourceKey.ToArray(),
|
||||
LayerIndex = _layerIndex.ToArray(),
|
||||
SourceKind = _sourceKind.ToArray(),
|
||||
FrequencyX = _frequencyX.ToArray(),
|
||||
FrequencyY = _frequencyY.ToArray(),
|
||||
PhaseX = _phaseX.ToArray(),
|
||||
PhaseY = _phaseY.ToArray(),
|
||||
AnimationSpeed = _animationSpeed.ToArray(),
|
||||
SourceFlags = _sourceFlags.ToArray()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class AetheriaSceneRenderSplat
|
||||
{
|
||||
public string LayerKey = AetheriaRuntimeRenderSplatLayerKeys.FogTint;
|
||||
public string SourceKey = "";
|
||||
public Vector2 Center;
|
||||
public Vector2 HalfExtent = Vector2.one * 32;
|
||||
public float RotationDegrees;
|
||||
public int Channel = AetheriaRuntimeRenderSplatChannels.Tint;
|
||||
public int Falloff = AetheriaRuntimeRenderSplatFalloffs.Smooth;
|
||||
public Color Value = Color.white;
|
||||
public int SourceKind = AetheriaRuntimeRenderSplatSourceKinds.Constant;
|
||||
public Vector2 Frequency = Vector2.one;
|
||||
public Vector2 Phase;
|
||||
public float AnimationSpeed;
|
||||
public float SourceFlags;
|
||||
|
||||
public static AetheriaSceneRenderSplat Animated(
|
||||
string layerKey,
|
||||
string sourceKey,
|
||||
Vector2 center,
|
||||
Vector2 halfExtent,
|
||||
Color value,
|
||||
float frequencyX,
|
||||
float frequencyY,
|
||||
float animationSpeed)
|
||||
{
|
||||
return new AetheriaSceneRenderSplat
|
||||
{
|
||||
LayerKey = layerKey,
|
||||
SourceKey = sourceKey,
|
||||
Center = center,
|
||||
HalfExtent = halfExtent,
|
||||
Channel = AetheriaRuntimeRenderSplatChannels.Tint,
|
||||
Falloff = AetheriaRuntimeRenderSplatFalloffs.Solid,
|
||||
Value = value,
|
||||
SourceKind = AetheriaRuntimeRenderSplatSourceKinds.AnimatedSimplexNoise,
|
||||
Frequency = new Vector2(frequencyX, frequencyY),
|
||||
AnimationSpeed = animationSpeed,
|
||||
SourceFlags = 1
|
||||
};
|
||||
}
|
||||
|
||||
public void AddTo(AetheriaSceneRenderSplatSource.Builder builder, IReadOnlyDictionary<string, int> layerIndices)
|
||||
{
|
||||
if (builder == null || !layerIndices.TryGetValue(LayerKey ?? "", out var layerIndex))
|
||||
return;
|
||||
|
||||
builder.Add(this, layerIndex);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class AetheriaSceneRenderSplatFixture
|
||||
{
|
||||
public Transform Transform;
|
||||
public AetheriaSceneRenderSplat Splat = new AetheriaSceneRenderSplat();
|
||||
|
||||
public void AddTo(AetheriaSceneRenderSplatSource.Builder builder, IReadOnlyDictionary<string, int> layerIndices)
|
||||
{
|
||||
if (Transform == null || Splat == null)
|
||||
return;
|
||||
|
||||
var previousCenter = Splat.Center;
|
||||
Splat.Center = new Vector2(Transform.position.x, Transform.position.z);
|
||||
try
|
||||
{
|
||||
Splat.AddTo(builder, layerIndices);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Splat.Center = previousCenter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6c9073f8e2eb4b52b9a11ec60dcfc451
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -7,13 +7,13 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
using UnityEngine.Rendering;
|
||||
using float3 = Unity.Mathematics.float3;
|
||||
|
||||
public sealed class AetheriaUnityCurrentEntityBinder
|
||||
{
|
||||
public ZoneRenderer ZoneRenderer { get; set; }
|
||||
public PostProcessVolume DeathPost { get; set; }
|
||||
public Volume DeathPost { get; set; }
|
||||
public CanvasGroup GameplayUI { get; set; }
|
||||
public AetheriaUnityCurrentEntityPresentation CurrentEntityPresentation { get; set; }
|
||||
public AetheriaUnityTargetPresentation TargetPresentation { get; set; }
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ public sealed class AetheriaUnityDaemonRenderDocuments : IDisposable
|
|||
if (state == null)
|
||||
throw new ArgumentNullException(nameof(state));
|
||||
|
||||
_frame = state.ReactiveDaemonFrame();
|
||||
_soaView = state.ReactiveDaemonSoaView();
|
||||
_zoneRender = state.ReactiveZoneRender();
|
||||
_frame = state.DaemonFrame.Reactive();
|
||||
_soaView = state.DaemonSoaView.Reactive();
|
||||
_zoneRender = state.ZoneRender.Reactive();
|
||||
}
|
||||
|
||||
public AetheriaRuntimeDaemonRenderView Current =>
|
||||
|
|
|
|||
23
Assets/Scripts/Gameplay/AetheriaUnityEveRuntimeHooks.cs
Normal file
23
Assets/Scripts/Gameplay/AetheriaUnityEveRuntimeHooks.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using GameCult.Aetheria.EveRuntime;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using UnityEngine;
|
||||
|
||||
public static class AetheriaUnityEveRuntimeHooks
|
||||
{
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
private static void Install()
|
||||
{
|
||||
AetheriaEveRuntimeUnityHooks.ResolveStateBoot =
|
||||
overridePath => AetheriaRuntimeStateBoot.Inspect(
|
||||
AetheriaUnityRuntimePaths.GameDataDirectory,
|
||||
overridePath ?? "");
|
||||
AetheriaEveRuntimeUnityHooks.RuntimeState =
|
||||
(stateBoot, runtimeId) => AetheriaUnityRuntimeClientProvider.RuntimeState(stateBoot, runtimeId);
|
||||
AetheriaEveRuntimeUnityHooks.Control =
|
||||
(stateBoot, runtimeId) => AetheriaUnityRuntimeClientProvider.Control(stateBoot, runtimeId);
|
||||
AetheriaEveRuntimeUnityHooks.Ui =
|
||||
(stateBoot, runtimeId) => AetheriaUnityRuntimeClientProvider.Ui(stateBoot, runtimeId);
|
||||
AetheriaEveRuntimeUnityHooks.StateRefResolver =
|
||||
(stateBoot, runtimeId) => AetheriaUnityRuntimeClientProvider.EveSurfaceStateRefResolver(stateBoot, runtimeId);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Gameplay/AetheriaUnityEveRuntimeHooks.cs.meta
Normal file
11
Assets/Scripts/Gameplay/AetheriaUnityEveRuntimeHooks.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 72069f7b0885490fb690dc771e422aac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
using System;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Mesh;
|
||||
|
||||
public sealed class AetheriaUnityGameplayBootShell
|
||||
{
|
||||
|
|
@ -34,10 +35,11 @@ public sealed class AetheriaUnityGameplayBootShell
|
|||
$"Aetheria runtime state file is missing at {stateBoot.StateFilePath}; gameplay requires an authoritative daemon mirror.");
|
||||
}
|
||||
|
||||
var runtimeCatalog = AetheriaUnityRuntimeClientProvider.CurrentCatalog(stateBoot, stateBoot.RuntimeId);
|
||||
var runtimeState = AetheriaUnityRuntimeClientProvider.RuntimeState(stateBoot, stateBoot.RuntimeId);
|
||||
var runtimeCatalog = runtimeState.Catalog.Latest();
|
||||
if (runtimeCatalog == null)
|
||||
throw new InvalidOperationException("Aetheria typed runtime catalog is required before gameplay boot.");
|
||||
var sectorMap = AetheriaUnityRuntimeClientProvider.CurrentSectorMap(stateBoot, stateBoot.RuntimeId);
|
||||
var sectorMap = runtimeState.SectorMap.Latest();
|
||||
if (sectorMap == null)
|
||||
throw new InvalidOperationException("Aetheria typed sector map is required before gameplay boot.");
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
using System;
|
||||
using Cinemachine;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Mesh;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public sealed class AetheriaUnityGameplaySceneWiring
|
||||
|
|
@ -34,6 +34,17 @@ public sealed class AetheriaUnityGameplaySceneWiring
|
|||
public Sprite NoShieldIcon { get; set; }
|
||||
public Prototype HostileTargetIndicator { get; set; }
|
||||
public Prototype FriendlyTargetIndicator { get; set; }
|
||||
|
||||
private AetheriaClientState _targetPresentationState;
|
||||
|
||||
private AetheriaClientState TargetPresentationState
|
||||
{
|
||||
get
|
||||
{
|
||||
_targetPresentationState ??= AetheriaUnityRuntimeClientProvider.RuntimeState("unity-target-presentation");
|
||||
return _targetPresentationState;
|
||||
}
|
||||
}
|
||||
public PlaceUIElementWorldspace ViewDot { get; set; }
|
||||
public PlaceUIElementWorldspace TargetIndicator { get; set; }
|
||||
public Image TargetHitpointsFill { get; set; }
|
||||
|
|
@ -78,7 +89,7 @@ public sealed class AetheriaUnityGameplaySceneWiring
|
|||
public void ConfigureTargetPresentation(
|
||||
AetheriaUnityTargetPresentation presentation,
|
||||
AetheriaRuntimeCatalogSnapshot runtimeCatalog,
|
||||
AetheriaUnityObservedEntityIndex observedEntityIndex)
|
||||
AetheriaUnityPresentationEntityIndex presentationEntityIndex)
|
||||
{
|
||||
if (presentation == null)
|
||||
return;
|
||||
|
|
@ -94,18 +105,18 @@ public sealed class AetheriaUnityGameplaySceneWiring
|
|||
presentation.VisibilityToTargetFill = VisibilityToTargetFill;
|
||||
presentation.TargetShieldsFill = TargetShieldsFill;
|
||||
presentation.ResolveEntity = daemonEntityIndex =>
|
||||
observedEntityIndex != null &&
|
||||
observedEntityIndex.TryResolveEntityByDaemonIndex(daemonEntityIndex, out var entity)
|
||||
presentationEntityIndex != null &&
|
||||
presentationEntityIndex.TryGetPresentationEntityByDaemonIndex(daemonEntityIndex, out var entity)
|
||||
? entity
|
||||
: null;
|
||||
presentation.ResolveZoneContacts = ReadZoneContacts;
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeZoneContactsDocument ReadZoneContacts()
|
||||
private AetheriaRuntimeZoneContactsDocument ReadZoneContacts()
|
||||
{
|
||||
try
|
||||
{
|
||||
return AetheriaUnityRuntimeClientProvider.CurrentZoneContacts("unity-target-presentation");
|
||||
return TargetPresentationState.ZoneContacts.Latest();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -143,12 +154,12 @@ public sealed class AetheriaUnityGameplaySceneWiring
|
|||
MainMenu?.SetRuntimeInputScreenShell(menuShell.CanOpenRuntimeInputScreen, menuShell.ShowRuntimeInputScreen);
|
||||
}
|
||||
|
||||
public void ConfigureObservedEntityIndex(AetheriaUnityObservedEntityIndex observedEntityIndex)
|
||||
public void ConfigurePresentationEntityIndex(AetheriaUnityPresentationEntityIndex presentationEntityIndex)
|
||||
{
|
||||
Inventory?.SetObservedEntityIndex(observedEntityIndex);
|
||||
ShipPanel?.SetObservedEntityIndex(observedEntityIndex);
|
||||
TargetShipPanel?.SetObservedEntityIndex(observedEntityIndex);
|
||||
Inventory?.SetPresentationEntityIndex(presentationEntityIndex);
|
||||
ShipPanel?.SetPresentationEntityIndex(presentationEntityIndex);
|
||||
TargetShipPanel?.SetPresentationEntityIndex(presentationEntityIndex);
|
||||
foreach (var localMenu in UnityEngine.Object.FindObjectsByType<LocalMenu>(FindObjectsSortMode.None))
|
||||
localMenu.SetObservedEntityIndex(observedEntityIndex);
|
||||
localMenu.SetPresentationEntityIndex(presentationEntityIndex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1561fad48f5f1aa43a9070d788f6eaa7
|
||||
|
|
@ -8,14 +8,14 @@ using GameCult.Aetheria.State.Verse;
|
|||
|
||||
public sealed class AetheriaUnityObservedEntityRestorer
|
||||
{
|
||||
private readonly AetheriaUnityObservedEntityIndex _entityIndex;
|
||||
private readonly AetheriaUnityPresentationEntityIndex _entityIndex;
|
||||
private readonly ItemManager _itemManager;
|
||||
private readonly Func<AetheriaRuntimeEntitySnapshot, bool, EntityConstructionBlueprint> _createBlueprint;
|
||||
private readonly Func<AetheriaRuntimeLoadoutItemSnapshot, ItemInstance> _createLoadoutItem;
|
||||
private readonly Action<string> _logWarning;
|
||||
|
||||
public AetheriaUnityObservedEntityRestorer(
|
||||
AetheriaUnityObservedEntityIndex entityIndex,
|
||||
AetheriaUnityPresentationEntityIndex entityIndex,
|
||||
ItemManager itemManager,
|
||||
Func<AetheriaRuntimeEntitySnapshot, bool, EntityConstructionBlueprint> createBlueprint,
|
||||
Func<AetheriaRuntimeLoadoutItemSnapshot, ItemInstance> createLoadoutItem,
|
||||
|
|
@ -53,7 +53,7 @@ public sealed class AetheriaUnityObservedEntityRestorer
|
|||
}
|
||||
|
||||
ApplyInPlace(entitySnapshots);
|
||||
if (_entityIndex.TryResolveEntityByRecordKey(currentEntityKey, out var resolvedCurrentEntity) &&
|
||||
if (_entityIndex.TryGetPresentationEntityByRecordKey(currentEntityKey, out var resolvedCurrentEntity) &&
|
||||
currentEntity != resolvedCurrentEntity)
|
||||
{
|
||||
reboundCurrentEntity = resolvedCurrentEntity;
|
||||
|
|
@ -107,7 +107,7 @@ public sealed class AetheriaUnityObservedEntityRestorer
|
|||
{
|
||||
foreach (var entitySnapshot in entitySnapshots)
|
||||
{
|
||||
if (!_entityIndex.TryResolveEntityByRecordKey(entitySnapshot.RecordKey, out var entity))
|
||||
if (!_entityIndex.TryGetPresentationEntityByRecordKey(entitySnapshot.RecordKey, out var entity))
|
||||
continue;
|
||||
|
||||
ApplyPoseAndSimpleRuntimeState(entity, entitySnapshot);
|
||||
|
|
@ -115,7 +115,7 @@ public sealed class AetheriaUnityObservedEntityRestorer
|
|||
if (entity.Settings != null)
|
||||
entity.Settings.ShutdownPerformance = (float)entitySnapshot.ShutdownPerformance;
|
||||
entity.RestoreThermalExposure((float)entitySnapshot.Heatstroke, (float)entitySnapshot.Hypothermia);
|
||||
RestoreRuntimeBehaviorState(entity, entitySnapshot, _entityIndex.EntitiesByRecordKey);
|
||||
RestoreRuntimeBehaviorState(entity, entitySnapshot, _entityIndex.PresentationEntitiesByRecordKey);
|
||||
}
|
||||
|
||||
_entityIndex.RefreshDaemonIndex();
|
||||
|
|
@ -123,6 +123,7 @@ public sealed class AetheriaUnityObservedEntityRestorer
|
|||
|
||||
private static void ApplyPoseAndSimpleRuntimeState(Entity entity, AetheriaRuntimeEntitySnapshot entitySnapshot)
|
||||
{
|
||||
entity.DaemonRecordKey = entitySnapshot.RecordKey ?? "";
|
||||
entity.DaemonEntityIndex = entitySnapshot.EntityIndex;
|
||||
entity.Name = entitySnapshot.Name ?? "";
|
||||
entity.CultPosition = new CultMath.float3((float)entitySnapshot.PositionX, (float)entitySnapshot.PositionY, (float)entitySnapshot.PositionZ);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public sealed class AetheriaUnityObservedFrameApplier
|
|||
private readonly Func<int, GalaxyZone> _resolveObservedZone;
|
||||
private readonly Func<Zone> _getZone;
|
||||
private readonly Action<Zone> _setZone;
|
||||
private readonly AetheriaUnityObservedEntityIndex _entityIndex;
|
||||
private readonly AetheriaUnityPresentationEntityIndex _entityIndex;
|
||||
private readonly AetheriaUnityObservedEntityRestorer _entityRestorer;
|
||||
private readonly AetheriaUnityObservedZoneContextFactory _zoneContextFactory;
|
||||
private readonly Func<ZoneRenderer> _resolveZoneRenderer;
|
||||
|
|
@ -31,7 +31,7 @@ public sealed class AetheriaUnityObservedFrameApplier
|
|||
Func<int, GalaxyZone> resolveObservedZone,
|
||||
Func<Zone> getZone,
|
||||
Action<Zone> setZone,
|
||||
AetheriaUnityObservedEntityIndex entityIndex,
|
||||
AetheriaUnityPresentationEntityIndex entityIndex,
|
||||
AetheriaUnityObservedEntityRestorer entityRestorer,
|
||||
AetheriaUnityObservedZoneContextFactory zoneContextFactory,
|
||||
Func<ZoneRenderer> resolveZoneRenderer,
|
||||
|
|
@ -146,8 +146,8 @@ public sealed class AetheriaUnityObservedFrameApplier
|
|||
}
|
||||
|
||||
_entityRestorer.Replace(entitySnapshots, currentEntityKey, _getZone());
|
||||
zoneRenderer?.LoadDaemonZoneView(_entityIndex.EntitiesByDaemonIndex, render);
|
||||
if (_entityIndex.TryResolveEntityByRecordKey(currentEntityKey, out var currentEntity))
|
||||
zoneRenderer?.LoadDaemonZoneView(_entityIndex.PresentationEntitiesByDaemonIndex, render);
|
||||
if (_entityIndex.TryGetPresentationEntityByRecordKey(currentEntityKey, out var currentEntity))
|
||||
_restoreCurrentEntityBinding(currentEntity);
|
||||
zoneRenderer?.RestoreDroppedPickupsFromZoneRender(render);
|
||||
_lastAppliedZoneRenderFrameId = render.FrameId;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,15 @@ public sealed class AetheriaUnityObservedZoneContextFactory
|
|||
return observedZoneContext;
|
||||
}
|
||||
|
||||
public GalaxyZone ResolveGalaxyZone(int daemonZoneIndex)
|
||||
{
|
||||
if (daemonZoneIndex < 0)
|
||||
return null;
|
||||
|
||||
_observedGalaxy ??= _resolveObservedGalaxy();
|
||||
return _observedGalaxy?.Zones?.FirstOrDefault(zone => zone != null && zone.ZoneIndex == daemonZoneIndex);
|
||||
}
|
||||
|
||||
private static ZoneConstructionBlueprint CreateZoneConstructionBlueprint(AetheriaRuntimeZoneRenderDocument render)
|
||||
{
|
||||
var blueprint = new ZoneConstructionBlueprint
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System;
|
|||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
using UnityEngine.Rendering;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
public sealed class AetheriaUnityPilotFrameController
|
||||
|
|
@ -23,8 +23,8 @@ public sealed class AetheriaUnityPilotFrameController
|
|||
public AetheriaInput Input { get; set; }
|
||||
public AetheriaUnityTargetPresentation TargetPresentation { get; set; }
|
||||
public AetheriaUnityPilotCommandSender PilotCommands { get; set; }
|
||||
public PostProcessVolume HeatstrokePost { get; set; }
|
||||
public PostProcessVolume SevereHeatstrokePost { get; set; }
|
||||
public Volume HeatstrokePost { get; set; }
|
||||
public Volume SevereHeatstrokePost { get; set; }
|
||||
public float2 Sensitivity { get; set; }
|
||||
|
||||
public void Tick(Entity currentEntity, float deltaTime, float timeSeconds)
|
||||
|
|
|
|||
|
|
@ -9,18 +9,18 @@ using Unity.Mathematics;
|
|||
public sealed class AetheriaUnityPilotOperationController
|
||||
{
|
||||
private readonly Func<AetheriaUnityPilotCommandSender> _resolvePilotCommands;
|
||||
private readonly AetheriaUnityObservedEntityIndex _observedEntityIndex;
|
||||
private readonly AetheriaUnityPresentationEntityIndex _presentationEntityIndex;
|
||||
private readonly Func<float3> _resolveViewDirection;
|
||||
private readonly Func<Entity> _resolveCurrentEntity;
|
||||
|
||||
public AetheriaUnityPilotOperationController(
|
||||
Func<AetheriaUnityPilotCommandSender> resolvePilotCommands,
|
||||
AetheriaUnityObservedEntityIndex observedEntityIndex,
|
||||
AetheriaUnityPresentationEntityIndex presentationEntityIndex,
|
||||
Func<float3> resolveViewDirection,
|
||||
Func<Entity> resolveCurrentEntity)
|
||||
{
|
||||
_resolvePilotCommands = resolvePilotCommands ?? throw new ArgumentNullException(nameof(resolvePilotCommands));
|
||||
_observedEntityIndex = observedEntityIndex ?? throw new ArgumentNullException(nameof(observedEntityIndex));
|
||||
_presentationEntityIndex = presentationEntityIndex ?? throw new ArgumentNullException(nameof(presentationEntityIndex));
|
||||
_resolveViewDirection = resolveViewDirection ?? (() => default);
|
||||
_resolveCurrentEntity = resolveCurrentEntity ?? (() => null);
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ public sealed class AetheriaUnityPilotOperationController
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_observedEntityIndex.TryResolveEntityRecordKey(target, out var targetEntityKey) ||
|
||||
if (!_presentationEntityIndex.TryGetRecordKeyForPresentationEntity(target, out var targetEntityKey) ||
|
||||
string.IsNullOrWhiteSpace(targetEntityKey))
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public sealed class AetheriaUnityObservedEntityIndex
|
||||
public sealed class AetheriaUnityPresentationEntityIndex
|
||||
{
|
||||
private readonly Dictionary<string, Entity> _entitiesByRecordKey = new Dictionary<string, Entity>(StringComparer.Ordinal);
|
||||
private readonly Dictionary<int, Entity> _entitiesByDaemonIndex = new Dictionary<int, Entity>();
|
||||
|
||||
public IReadOnlyDictionary<string, Entity> EntitiesByRecordKey => _entitiesByRecordKey;
|
||||
public IReadOnlyDictionary<string, Entity> PresentationEntitiesByRecordKey => _entitiesByRecordKey;
|
||||
|
||||
public IReadOnlyDictionary<int, Entity> EntitiesByDaemonIndex => _entitiesByDaemonIndex;
|
||||
public IReadOnlyDictionary<int, Entity> PresentationEntitiesByDaemonIndex => _entitiesByDaemonIndex;
|
||||
|
||||
public int Count => _entitiesByRecordKey.Count;
|
||||
|
||||
|
|
@ -26,7 +26,10 @@ public sealed class AetheriaUnityObservedEntityIndex
|
|||
foreach (var pair in entitiesByRecordKey)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(pair.Key) && pair.Value != null)
|
||||
{
|
||||
pair.Value.DaemonRecordKey = pair.Key;
|
||||
_entitiesByRecordKey[pair.Key] = pair.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,12 +41,20 @@ public sealed class AetheriaUnityObservedEntityIndex
|
|||
RebuildDaemonIndex();
|
||||
}
|
||||
|
||||
public bool TryResolveEntityRecordKey(Entity entity, out string recordKey)
|
||||
public bool TryGetRecordKeyForPresentationEntity(Entity entity, out string recordKey)
|
||||
{
|
||||
recordKey = "";
|
||||
if (entity == null)
|
||||
return false;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(entity.DaemonRecordKey) &&
|
||||
_entitiesByRecordKey.TryGetValue(entity.DaemonRecordKey, out var indexedEntity) &&
|
||||
ReferenceEquals(indexedEntity, entity))
|
||||
{
|
||||
recordKey = entity.DaemonRecordKey;
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var pair in _entitiesByRecordKey)
|
||||
{
|
||||
if (ReferenceEquals(pair.Value, entity))
|
||||
|
|
@ -56,26 +67,26 @@ public sealed class AetheriaUnityObservedEntityIndex
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool TryResolveEntityByRecordKey(string recordKey, out Entity entity)
|
||||
public bool TryGetPresentationEntityByRecordKey(string recordKey, out Entity entity)
|
||||
{
|
||||
entity = null;
|
||||
return !string.IsNullOrWhiteSpace(recordKey) &&
|
||||
_entitiesByRecordKey.TryGetValue(recordKey, out entity);
|
||||
}
|
||||
|
||||
public bool TryResolveEntityByDaemonIndex(int daemonEntityIndex, out Entity entity)
|
||||
public bool TryGetPresentationEntityByDaemonIndex(int daemonEntityIndex, out Entity entity)
|
||||
{
|
||||
return _entitiesByDaemonIndex.TryGetValue(daemonEntityIndex, out entity);
|
||||
}
|
||||
|
||||
public bool TryResolveDockingBayByRecordKey(
|
||||
public bool TryGetPresentationDockingBayByRecordKey(
|
||||
string parentRecordKey,
|
||||
int dockingBayIndex,
|
||||
out EquippedDockingBay dockingBay)
|
||||
{
|
||||
dockingBay = null;
|
||||
if (dockingBayIndex < 0 ||
|
||||
!TryResolveEntityByRecordKey(parentRecordKey, out var parent) ||
|
||||
!TryGetPresentationEntityByRecordKey(parentRecordKey, out var parent) ||
|
||||
parent?.DockingBays == null ||
|
||||
dockingBayIndex >= parent.DockingBays.Count)
|
||||
{
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1561fad48f5f1aa43a9070d788f6eaa7
|
||||
|
|
@ -27,6 +27,8 @@ public sealed class AetheriaUnityRenderSplatViewportSource : MonoBehaviour
|
|||
|
||||
private float _nextRefreshTime;
|
||||
private AetheriaUnityRtsViewportDocuments _viewportDocuments;
|
||||
private AetheriaRuntimeRenderSplatsViewportDocument _fallbackRenderSplatsViewport;
|
||||
private string _lastWarningMessage = "";
|
||||
|
||||
public RenderTexture TargetTexture
|
||||
{
|
||||
|
|
@ -39,6 +41,15 @@ public sealed class AetheriaUnityRenderSplatViewportSource : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
public AetheriaRuntimeRenderSplatsViewportDocument CurrentDocument =>
|
||||
_viewportDocuments?.CurrentRenderSplatsViewport ?? _fallbackRenderSplatsViewport;
|
||||
|
||||
public bool RenderInLateUpdate
|
||||
{
|
||||
get => renderInLateUpdate;
|
||||
set => renderInLateUpdate = value;
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
rasterizer = GetComponent<AetheriaRenderSplatRasterizer>();
|
||||
|
|
@ -63,7 +74,7 @@ public sealed class AetheriaUnityRenderSplatViewportSource : MonoBehaviour
|
|||
return false;
|
||||
|
||||
RefreshDocument(false);
|
||||
var document = _viewportDocuments?.CurrentRenderSplatsViewport;
|
||||
var document = _viewportDocuments?.CurrentRenderSplatsViewport ?? _fallbackRenderSplatsViewport;
|
||||
if (document == null)
|
||||
return false;
|
||||
|
||||
|
|
@ -118,13 +129,36 @@ public sealed class AetheriaUnityRenderSplatViewportSource : MonoBehaviour
|
|||
.RenderSplatViewportDocuments(viewport, "unity-render-splat-viewport");
|
||||
ClearViewportDocument();
|
||||
_viewportDocuments = nextDocuments;
|
||||
_fallbackRenderSplatsViewport = null;
|
||||
_lastWarningMessage = "";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to read Aetheria render splats from local Verse state: {ex.Message}");
|
||||
ClearViewportDocument();
|
||||
_fallbackRenderSplatsViewport = EmptyRenderSplatsViewport(viewport);
|
||||
WarnOnce($"Failed to read Aetheria render splats from local Verse state: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void WarnOnce(string message)
|
||||
{
|
||||
if (string.Equals(_lastWarningMessage, message, StringComparison.Ordinal))
|
||||
return;
|
||||
|
||||
_lastWarningMessage = message;
|
||||
Debug.LogWarning(message);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeRenderSplatsViewportDocument EmptyRenderSplatsViewport(
|
||||
AetheriaRuntimeRtsViewportBounds viewport)
|
||||
{
|
||||
return new AetheriaRuntimeRenderSplatsViewportDocument
|
||||
{
|
||||
PublishedAtUtc = DateTimeOffset.UtcNow.ToString("O"),
|
||||
Viewport = viewport ?? new AetheriaRuntimeRtsViewportBounds()
|
||||
};
|
||||
}
|
||||
|
||||
private AetheriaRuntimeRtsViewportBounds ResolveViewportBounds()
|
||||
{
|
||||
var halfSize = size * 0.5f;
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ 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.ZoneContacts.Reactive() : null;
|
||||
_objectsViewport = bindObjects ? state.ObjectsViewport(viewport).Reactive() : null;
|
||||
_renderSplatsViewport = bindRenderSplats ? state.RenderSplatsViewport(viewport).Reactive() : null;
|
||||
}
|
||||
|
||||
public AetheriaRuntimeRtsViewportBounds Viewport { get; }
|
||||
|
|
|
|||
|
|
@ -77,104 +77,6 @@ public static class AetheriaUnityRuntimeClientProvider
|
|||
return RuntimeClient(stateBoot, runtimeId).State;
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeCurrentDockingDocument CurrentDockingState(string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentDockingState();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeCurrentDockingDocument CurrentDockingState(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).CurrentDockingState();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeCatalogSnapshot CurrentCatalog(string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentCatalog();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeCatalogSnapshot CurrentCatalog(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).CurrentCatalog();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimePlayerSettingsDocument CurrentPlayerSettings(string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentPlayerSettings();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimePlayerSettingsDocument CurrentPlayerSettings(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).CurrentPlayerSettings();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeCurrentEntityDocument CurrentEntityState(string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentEntityState();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeCurrentZoneDocument CurrentZoneState(string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentZoneState();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeZoneContactsDocument CurrentZoneContacts(string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentZoneContacts();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> ReactiveZoneContacts(
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).ReactiveZoneContacts();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeStationRefitDocument CurrentStationRefit(string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentStationRefit();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeSectorMapDocument CurrentSectorMap(string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentSectorMap();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeSectorMapDocument CurrentSectorMap(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).CurrentSectorMap();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeZoneDetailsDocument CurrentZoneDetails(int zoneIndex, string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentZoneDetails(zoneIndex);
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeInventoryDocument CurrentInventory(int entityIndex, string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentInventory(entityIndex);
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeObjectsViewportDocument> ReactiveObjectsViewport(
|
||||
AetheriaRuntimeRtsViewportBounds viewport,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).ReactiveObjectsViewport(viewport);
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<AetheriaRuntimeRenderSplatsViewportDocument> ReactiveRenderSplatsViewport(
|
||||
AetheriaRuntimeRtsViewportBounds viewport,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).ReactiveRenderSplatsViewport(viewport);
|
||||
}
|
||||
|
||||
public static AetheriaUnityRtsViewportDocuments MapViewportDocuments(
|
||||
AetheriaRuntimeRtsViewportBounds viewport,
|
||||
string runtimeId = "")
|
||||
|
|
@ -196,18 +98,6 @@ public static class AetheriaUnityRuntimeClientProvider
|
|||
return AetheriaUnityRtsViewportDocuments.OpenRenderSplats(RuntimeState(runtimeId), viewport);
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeDaemonFrameDocument CurrentDaemonFrame(string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(runtimeId).CurrentDaemonFrame();
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeDaemonFrameDocument CurrentDaemonFrame(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).CurrentDaemonFrame();
|
||||
}
|
||||
|
||||
public static AetheriaUnityDaemonRenderDocuments DaemonRenderDocuments(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
|
|
@ -215,13 +105,6 @@ public static class AetheriaUnityRuntimeClientProvider
|
|||
return AetheriaUnityDaemonRenderDocuments.Open(RuntimeState(stateBoot, runtimeId));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeVerseHostSettingsDocument CurrentVerseHostSettings(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).CurrentVerseHostSettings();
|
||||
}
|
||||
|
||||
public static AetheriaControl Control(string runtimeId = "")
|
||||
{
|
||||
return RuntimeClient(runtimeId).Control;
|
||||
|
|
@ -277,7 +160,7 @@ public static class AetheriaUnityRuntimeClientProvider
|
|||
{
|
||||
try
|
||||
{
|
||||
var stored = CurrentPlayerSettings();
|
||||
var stored = RuntimeState().PlayerSettings.Latest();
|
||||
if (stored == null)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue