Let main menu boot without daemon surfaces
This commit is contained in:
parent
c28cb4beff
commit
534ef56b4d
3 changed files with 91 additions and 24 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
|
|
@ -87,7 +88,7 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
var surface = ReadDaemonSurface(stateBoot);
|
||||
if (surface == null)
|
||||
{
|
||||
root.Add(BuildError($"Eve surface not found: {surfaceId}"));
|
||||
ClearMountedSurface();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -170,10 +171,17 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
private CultMeshReactiveDocument<global::Aetheria.State.Documents.EveSurfaceState>? CreateReactiveDaemonSurfaceState(
|
||||
AetheriaRuntimeStateBootReport stateBoot)
|
||||
{
|
||||
return AetheriaEveRuntimeUnityHooks
|
||||
.RequireRuntimeState(stateBoot, "unity-eve-surface-presenter")
|
||||
.EveSurfaceDocument(surfaceId)
|
||||
?.Reactive();
|
||||
try
|
||||
{
|
||||
return AetheriaEveRuntimeUnityHooks
|
||||
.RequireRuntimeState(stateBoot, "unity-eve-surface-presenter")
|
||||
.EveSurfaceDocument(surfaceId)
|
||||
?.Reactive();
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private UIDocument ResolveDocument()
|
||||
|
|
@ -206,6 +214,16 @@ namespace GameCult.Aetheria.EveRuntime
|
|||
!string.Equals(_mountedSurfaceUpdatedAtUtc, surface.UpdatedAtUtc, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private void ClearMountedSurface()
|
||||
{
|
||||
var document = ResolveDocument();
|
||||
document.rootVisualElement.Clear();
|
||||
_mountedStatePath = "";
|
||||
_mountedSurfaceId = "";
|
||||
_mountedSurfaceVersion = -1;
|
||||
_mountedSurfaceUpdatedAtUtc = "";
|
||||
}
|
||||
|
||||
private void MountSurface(AetheriaRuntimeStateBootReport stateBoot, EveSurfaceDocument surface)
|
||||
{
|
||||
var statePath = stateBoot.StateFilePath;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GameCult.Mesh;
|
||||
using MessagePack;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
@ -279,16 +281,31 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
public CultMeshStateRefResolver CreateEveSurfaceCultMeshStateRefResolver()
|
||||
{
|
||||
_eveStateRefFrame ??= DaemonFrame.Reactive();
|
||||
_eveStateRefHealth ??= Health.Reactive();
|
||||
_eveStateRefCommandBoundary ??= CommandBoundary.Reactive();
|
||||
_eveStateRefCatalog ??= Catalog.Reactive();
|
||||
|
||||
return AetheriaRuntimeStateRefResolver.CreateEveSurfaceCultMeshStateRefResolver(
|
||||
() => _eveStateRefFrame.Current,
|
||||
() => _eveStateRefHealth.Current,
|
||||
() => _eveStateRefCommandBoundary.Current,
|
||||
() => _eveStateRefCatalog.Current);
|
||||
() => ReadOptionalReactive(ref _eveStateRefFrame, DaemonFrame),
|
||||
() => ReadOptionalReactive(ref _eveStateRefHealth, Health),
|
||||
() => ReadOptionalReactive(ref _eveStateRefCommandBoundary, CommandBoundary),
|
||||
() => ReadOptionalReactive(ref _eveStateRefCatalog, Catalog));
|
||||
}
|
||||
|
||||
private static TDocument? ReadOptionalReactive<TDocument>(
|
||||
ref CultMeshReactiveDocument<TDocument>? reactive,
|
||||
CultMeshDocumentHandle<TDocument> handle)
|
||||
where TDocument : class
|
||||
{
|
||||
try
|
||||
{
|
||||
reactive ??= handle.Reactive();
|
||||
return reactive.Current;
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (FormatterNotRegisteredException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -521,16 +521,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
seatId => Document<AetheriaRuntimeStarbridgePlayerSeatDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.StarbridgePlayerSeat(seatId)));
|
||||
|
||||
managedCatalog = state.Catalog.Reactive();
|
||||
managedLoadoutTemplates = state.LoadoutTemplates.Reactive();
|
||||
managedPlayerSettings = state.PlayerSettings.Reactive();
|
||||
managedStarbridgeScenario = state.StarbridgeScenario.Reactive();
|
||||
managedStarbridgeSession = state.StarbridgeSession.Reactive();
|
||||
_managedCatalog = managedCatalog;
|
||||
_managedLoadoutTemplates = managedLoadoutTemplates;
|
||||
_managedPlayerSettings = managedPlayerSettings;
|
||||
_managedStarbridgeScenario = managedStarbridgeScenario;
|
||||
_managedStarbridgeSession = managedStarbridgeSession;
|
||||
return state;
|
||||
|
||||
CultMeshDocumentHandle<TDocument> ManagedFrameDocument<TDocument>(
|
||||
|
|
@ -573,12 +565,16 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
AetheriaRuntimeCatalogSnapshot RequireManagedCatalog()
|
||||
{
|
||||
managedCatalog ??= catalogDocument.Reactive();
|
||||
_managedCatalog = managedCatalog;
|
||||
return managedCatalog?.Current
|
||||
?? throw new InvalidOperationException("Aetheria Verse client has no runtime catalog document yet.");
|
||||
}
|
||||
|
||||
AetheriaRuntimeLoadoutTemplatesDocument RequireManagedLoadoutTemplates()
|
||||
{
|
||||
managedLoadoutTemplates ??= loadoutTemplatesDocument.Reactive();
|
||||
_managedLoadoutTemplates = managedLoadoutTemplates;
|
||||
return managedLoadoutTemplates?.Current
|
||||
?? throw new InvalidOperationException("Aetheria Verse client has no loadout templates document yet.");
|
||||
}
|
||||
|
|
@ -626,11 +622,47 @@ namespace GameCult.Aetheria.State.Verse
|
|||
{
|
||||
return Task.FromResult(AetheriaRuntimeStarbridgeDocuments.SessionSummary(
|
||||
frame,
|
||||
managedStarbridgeScenario?.Current,
|
||||
managedStarbridgeSession?.Current,
|
||||
CurrentStarbridgeScenario(),
|
||||
CurrentStarbridgeSession(),
|
||||
RequireManagedCatalog()));
|
||||
}
|
||||
|
||||
AetheriaRuntimeStarbridgeScenarioDocument? CurrentStarbridgeScenario()
|
||||
{
|
||||
try
|
||||
{
|
||||
managedStarbridgeScenario ??= starbridgeScenarioDocument.Reactive();
|
||||
_managedStarbridgeScenario = managedStarbridgeScenario;
|
||||
return managedStarbridgeScenario.Current;
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (MessagePack.FormatterNotRegisteredException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
AetheriaRuntimeStarbridgeSessionDocument? CurrentStarbridgeSession()
|
||||
{
|
||||
try
|
||||
{
|
||||
managedStarbridgeSession ??= starbridgeSessionDocument.Reactive();
|
||||
_managedStarbridgeSession = managedStarbridgeSession;
|
||||
return managedStarbridgeSession.Current;
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (MessagePack.FormatterNotRegisteredException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Task<AetheriaRuntimeSurfaceDocument> ZoneDetailsSurfaceAsync(
|
||||
AetheriaRuntimeDaemonFrameDocument frame,
|
||||
int zoneIndex)
|
||||
|
|
|
|||
Loading…
Reference in a new issue