Centralize main menu state sessions
This commit is contained in:
parent
7521f59a23
commit
1a535c416d
5 changed files with 93 additions and 20 deletions
|
|
@ -7415,13 +7415,13 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
"MainMenu.cs"));
|
||||
var requiredMainMenuSharedDocumentSymbols = new[]
|
||||
{
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> _sectorMap",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeVerseHostSettingsDocument> _verseHostSettings",
|
||||
".ReactiveSectorMap()",
|
||||
"AetheriaRuntimeSectorMapSession _sectorMap",
|
||||
"AetheriaRuntimePlayerSettingsSession _playerSettings",
|
||||
"AetheriaRuntimeVerseHostSettingsSession _verseHostSettings",
|
||||
".ObserveSectorMap()",
|
||||
".Settings",
|
||||
".ReactivePlayer()",
|
||||
".ReactiveVerseHost()",
|
||||
".ObservePlayer()",
|
||||
".ObserveVerseHost()",
|
||||
"_sectorMap?.Dispose()",
|
||||
"_playerSettings?.Dispose()",
|
||||
"_verseHostSettings?.Dispose()",
|
||||
|
|
@ -7440,6 +7440,25 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
string.Join(", ", missingMainMenuSharedDocumentSymbols));
|
||||
}
|
||||
|
||||
var forbiddenMainMenuSharedDocumentSymbols = new[]
|
||||
{
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> _sectorMap",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeVerseHostSettingsDocument> _verseHostSettings",
|
||||
".ReactiveSectorMap()",
|
||||
".ReactivePlayer()",
|
||||
".ReactiveVerseHost()"
|
||||
};
|
||||
var mainMenuRawDocumentHits = forbiddenMainMenuSharedDocumentSymbols
|
||||
.Where(symbol => mainMenu.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (mainMenuRawDocumentHits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"MainMenu still owns raw sector/settings CultMesh documents instead of managed sessions: " +
|
||||
string.Join(", ", mainMenuRawDocumentHits));
|
||||
}
|
||||
|
||||
var tradeMenu = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"Assets",
|
||||
|
|
@ -7803,6 +7822,7 @@ static void RequireAetheriaManagedStateAccessorsCoverDomainDocuments(string root
|
|||
"public AetheriaRuntimeObservedDaemonState? LatestObservedDaemon()",
|
||||
"public AetheriaRuntimeObservedDockingState? CurrentDocking(",
|
||||
"public AetheriaRuntimeCatalogSession ObserveCatalog(",
|
||||
"public AetheriaRuntimeSectorMapSession ObserveSectorMap(",
|
||||
"public AetheriaRuntimeZoneContactsSession ObserveZoneContacts(",
|
||||
"public AetheriaRuntimePlayerHudSession ObservePlayerHud(",
|
||||
"public AetheriaRuntimeLoadoutTemplatesDocument LatestLoadoutTemplates()",
|
||||
|
|
@ -8540,7 +8560,7 @@ static void RequireClientTargetBootAuthority(string root)
|
|||
"ResolveSectorMap(AetheriaRuntimeStateBootReport stateBoot)",
|
||||
"AetheriaClient",
|
||||
".State",
|
||||
".ReactiveSectorMap()",
|
||||
".ObserveSectorMap()",
|
||||
"ResolveVerseHostSettings(AetheriaRuntimeStateBootReport stateBoot)",
|
||||
"AetheriaState.At(AetheriaUnityRuntimePaths.GameDataDirectory)",
|
||||
".ClientTarget",
|
||||
|
|
@ -11921,7 +11941,7 @@ static void RequireMainMenuVerseHostProjection(string root)
|
|||
{
|
||||
"ResolveVerseHostSettings(AetheriaRuntimeStateBootReport stateBoot)",
|
||||
".Settings",
|
||||
".ReactiveVerseHost()",
|
||||
".ObserveVerseHost()",
|
||||
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectRoot(",
|
||||
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildRoot("
|
||||
};
|
||||
|
|
@ -12054,7 +12074,7 @@ static void RequireMainMenuContinueRunState(string root)
|
|||
"ResolveSectorMap",
|
||||
"AetheriaClient",
|
||||
".State",
|
||||
".ReactiveSectorMap()",
|
||||
".ObserveSectorMap()",
|
||||
"ContinueGame()",
|
||||
"SceneManager.LoadScene(\"ARPG\")"
|
||||
};
|
||||
|
|
@ -14189,7 +14209,7 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
|
|||
"TryStartDaemonObservedGame",
|
||||
"ResolveSectorMap(stateBoot)",
|
||||
".State",
|
||||
".ReactiveSectorMap()",
|
||||
".ObserveSectorMap()",
|
||||
"sectorMap.FrameId",
|
||||
"SceneManager.LoadScene(\"ARPG\")"
|
||||
};
|
||||
|
|
@ -15263,7 +15283,9 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
"public AetheriaRuntimeObservedDaemonSession ObserveDaemon(",
|
||||
"public AetheriaRuntimeCatalogSession ObserveCatalog(",
|
||||
"public AetheriaRuntimeZoneContactsSession ObserveZoneContacts(",
|
||||
"public AetheriaRuntimePlayerSettingsSession ObservePlayer("
|
||||
"public AetheriaRuntimePlayerSettingsSession ObservePlayer(",
|
||||
"public AetheriaRuntimeVerseHostSettingsSession ObserveVerseHost(",
|
||||
"public AetheriaRuntimeSectorMapSession ObserveSectorMap("
|
||||
};
|
||||
var missingManagedStateAccessSymbols = requiredManagedStateAccessSymbols
|
||||
.Where(symbol => !aetheriaClientState.Contains(symbol, StringComparison.Ordinal))
|
||||
|
|
@ -15492,8 +15514,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
if (!mainMenu.Contains("AetheriaClient", StringComparison.Ordinal) ||
|
||||
!mainMenu.Contains("ResolveSectorMap(AetheriaRuntimeStateBootReport stateBoot)", StringComparison.Ordinal) ||
|
||||
!mainMenu.Contains(".State", StringComparison.Ordinal) ||
|
||||
!mainMenu.Contains(".ReactiveSectorMap()", StringComparison.Ordinal) ||
|
||||
!mainMenu.Contains(".ReactivePlayer()", StringComparison.Ordinal))
|
||||
!mainMenu.Contains(".ObserveSectorMap()", StringComparison.Ordinal) ||
|
||||
!mainMenu.Contains(".ObservePlayer()", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"MainMenu no longer routes sector-map lookup through the shared Aetheria client facade.");
|
||||
|
|
|
|||
|
|
@ -206,7 +206,9 @@ public class DaemonRuntimeDocumentTests
|
|||
var observed = client.State.LatestObservedDaemon();
|
||||
var observedAuthoritativeFrame = client.State.LatestDaemonFrame();
|
||||
using var catalogSession = client.State.ObserveCatalog();
|
||||
using var sectorMapSession = client.State.ObserveSectorMap();
|
||||
using var playerSettingsSession = client.State.Settings.ObservePlayer();
|
||||
using var verseHostSettingsSession = client.State.Settings.ObserveVerseHost();
|
||||
using var zoneContactsSession = client.State.ObserveZoneContacts();
|
||||
using var playerHud = client.State.ObservePlayerHud();
|
||||
var gameSurface = client.State.LatestGameSurface();
|
||||
|
|
@ -284,8 +286,10 @@ public class DaemonRuntimeDocumentTests
|
|||
Assert.GreaterOrEqual(catalog.Items.Count, 0);
|
||||
Assert.AreEqual(AetheriaRuntimePlayerSettingsDocument.SchemaId, playerSettings.Schema);
|
||||
Assert.AreSame(catalog, catalogSession.Current);
|
||||
Assert.AreEqual(AetheriaRuntimeDaemonSchemas.SectorMap, sectorMapSession.Current.Schema);
|
||||
Assert.AreEqual(AetheriaRuntimePlayerSettingsDocument.SchemaId, playerSettingsSession.Current.Schema);
|
||||
Assert.AreEqual(AetheriaRuntimeVerseHostSettingsDocument.SchemaId, verseHostSettings.Schema);
|
||||
Assert.AreEqual(AetheriaRuntimeVerseHostSettingsDocument.SchemaId, verseHostSettingsSession.Current.Schema);
|
||||
Assert.AreEqual(AetheriaRuntimeDaemonSchemas.ObjectsViewport, objectsViewport.Schema);
|
||||
Assert.AreEqual(AetheriaRuntimeDaemonSchemas.ZoneContacts, zoneContactsSession.Current.Schema);
|
||||
Assert.AreEqual("Player", objectsViewport.Objects.FirstOrDefault()?.DisplayName);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using GameCult.Mesh;
|
||||
using GameCult.Aetheria.EveRuntime;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Eve.Surface;
|
||||
|
|
@ -19,9 +18,9 @@ public class MainMenu : MonoBehaviour
|
|||
|
||||
private UIDocument _menuSurfaceDocument;
|
||||
private string _clientStatePath;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> _sectorMap;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeVerseHostSettingsDocument> _verseHostSettings;
|
||||
private AetheriaRuntimeSectorMapSession _sectorMap;
|
||||
private AetheriaRuntimePlayerSettingsSession _playerSettings;
|
||||
private AetheriaRuntimeVerseHostSettingsSession _verseHostSettings;
|
||||
private Func<bool> _canOpenRuntimeInputScreen;
|
||||
private Action _openRuntimeInputScreen;
|
||||
private readonly AetheriaEveUnitySurfaceChrome _menuSurfaceChrome = new AetheriaEveUnitySurfaceChrome
|
||||
|
|
@ -152,7 +151,7 @@ public class MainMenu : MonoBehaviour
|
|||
{
|
||||
_sectorMap ??= ResolveClient(stateBoot)
|
||||
.State
|
||||
.ReactiveSectorMap();
|
||||
.ObserveSectorMap();
|
||||
return _sectorMap?.Current;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -172,7 +171,7 @@ public class MainMenu : MonoBehaviour
|
|||
_playerSettings ??= ResolveClient(stateBoot)
|
||||
.State
|
||||
.Settings
|
||||
.ReactivePlayer();
|
||||
.ObservePlayer();
|
||||
return _playerSettings?.Current;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -192,7 +191,7 @@ public class MainMenu : MonoBehaviour
|
|||
_verseHostSettings ??= ResolveClient(stateBoot)
|
||||
.State
|
||||
.Settings
|
||||
.ReactiveVerseHost();
|
||||
.ObserveVerseHost();
|
||||
return _verseHostSettings?.Current;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
|
|
@ -526,6 +526,12 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return SectorMap.Reactive(options);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeSectorMapSession ObserveSectorMap(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return new AetheriaRuntimeSectorMapSession(ReactiveSectorMap(options));
|
||||
}
|
||||
|
||||
public Task<AetheriaRuntimeZoneContactsDocument> LatestZoneContactsAsync()
|
||||
{
|
||||
return ZoneContacts.LatestAsync();
|
||||
|
|
@ -984,6 +990,12 @@ namespace GameCult.Aetheria.State.Verse
|
|||
{
|
||||
return VerseHost.Reactive(options);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeVerseHostSettingsSession ObserveVerseHost(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
return new AetheriaRuntimeVerseHostSettingsSession(ReactiveVerseHost(options));
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class AetheriaClientViewportState
|
||||
|
|
|
|||
|
|
@ -41,6 +41,42 @@ namespace GameCult.Aetheria.State.Verse
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeVerseHostSettingsSession : IDisposable
|
||||
{
|
||||
private readonly CultMeshReactiveDocument<AetheriaRuntimeVerseHostSettingsDocument> _verseHostSettings;
|
||||
|
||||
public AetheriaRuntimeVerseHostSettingsSession(
|
||||
CultMeshReactiveDocument<AetheriaRuntimeVerseHostSettingsDocument> verseHostSettings)
|
||||
{
|
||||
_verseHostSettings = verseHostSettings ?? throw new ArgumentNullException(nameof(verseHostSettings));
|
||||
}
|
||||
|
||||
public AetheriaRuntimeVerseHostSettingsDocument? Current => _verseHostSettings.Current;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_verseHostSettings.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeSectorMapSession : IDisposable
|
||||
{
|
||||
private readonly CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> _sectorMap;
|
||||
|
||||
public AetheriaRuntimeSectorMapSession(
|
||||
CultMeshReactiveDocument<AetheriaRuntimeSectorMapDocument> sectorMap)
|
||||
{
|
||||
_sectorMap = sectorMap ?? throw new ArgumentNullException(nameof(sectorMap));
|
||||
}
|
||||
|
||||
public AetheriaRuntimeSectorMapDocument? Current => _sectorMap.Current;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_sectorMap.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeZoneContactsSession : IDisposable
|
||||
{
|
||||
private readonly CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> _zoneContacts;
|
||||
|
|
|
|||
Loading…
Reference in a new issue