Use reactive player settings in main menu
This commit is contained in:
parent
1335802aff
commit
55e6dbbfc7
2 changed files with 41 additions and 4 deletions
|
|
@ -7133,6 +7133,31 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
string.Join(", ", missingMapRendererSharedDocumentSymbols));
|
||||
}
|
||||
|
||||
var mainMenu = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"Assets",
|
||||
"Scripts",
|
||||
"UI",
|
||||
"MainMenu.cs"));
|
||||
var requiredMainMenuSharedDocumentSymbols = new[]
|
||||
{
|
||||
"CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings",
|
||||
".Settings",
|
||||
".ReactivePlayer()",
|
||||
"_playerSettings?.Dispose()",
|
||||
"_playerSettings?.Current",
|
||||
"private void OnDestroy()"
|
||||
};
|
||||
var missingMainMenuSharedDocumentSymbols = requiredMainMenuSharedDocumentSymbols
|
||||
.Where(symbol => !mainMenu.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (missingMainMenuSharedDocumentSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"MainMenu should bind player settings through the managed reactive Aetheria settings document: " +
|
||||
string.Join(", ", missingMainMenuSharedDocumentSymbols));
|
||||
}
|
||||
|
||||
var tradeMenu = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"Assets",
|
||||
|
|
@ -14705,7 +14730,7 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
!mainMenu.Contains("LatestSectorMap(AetheriaRuntimeStateBootReport stateBoot)", StringComparison.Ordinal) ||
|
||||
!mainMenu.Contains(".Aetheria()", StringComparison.Ordinal) ||
|
||||
!mainMenu.Contains(".LatestSectorMap()", StringComparison.Ordinal) ||
|
||||
!mainMenu.Contains(".LatestPlayer()", StringComparison.Ordinal))
|
||||
!mainMenu.Contains(".ReactivePlayer()", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"MainMenu no longer routes sector-map lookup through the shared Aetheria client facade.");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using GameCult.Mesh;
|
||||
using GameCult.Aetheria.EveRuntime;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Eve.Surface;
|
||||
|
|
@ -18,6 +19,7 @@ public class MainMenu : MonoBehaviour
|
|||
|
||||
private UIDocument _menuSurfaceDocument;
|
||||
private string _clientStatePath;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings;
|
||||
private Func<bool> _canOpenRuntimeInputScreen;
|
||||
private Action _openRuntimeInputScreen;
|
||||
private readonly AetheriaEveUnitySurfaceChrome _menuSurfaceChrome = new AetheriaEveUnitySurfaceChrome
|
||||
|
|
@ -164,14 +166,15 @@ public class MainMenu : MonoBehaviour
|
|||
|
||||
try
|
||||
{
|
||||
return ResolveClient(stateBoot)
|
||||
_playerSettings ??= ResolveClient(stateBoot)
|
||||
.Aetheria()
|
||||
.Settings
|
||||
.LatestPlayer();
|
||||
.ReactivePlayer();
|
||||
return _playerSettings?.Current;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Failed to read typed Aetheria player settings for the main menu: {ex}");
|
||||
Debug.LogError($"Failed to bind typed Aetheria player settings for the main menu: {ex}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -458,13 +461,22 @@ public class MainMenu : MonoBehaviour
|
|||
if (!string.Equals(_clientStatePath, statePath, StringComparison.Ordinal))
|
||||
{
|
||||
_clientStatePath = statePath;
|
||||
ClearClientCaches();
|
||||
}
|
||||
|
||||
return AetheriaUnityRuntimeClientProvider.ResolveClient(stateBoot, "unity-main-menu");
|
||||
}
|
||||
|
||||
private void ClearClientCaches()
|
||||
{
|
||||
_playerSettings?.Dispose();
|
||||
_playerSettings = null;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ClearClientCaches();
|
||||
|
||||
if (_menuSurfaceDocument != null)
|
||||
{
|
||||
Destroy(_menuSurfaceDocument.gameObject);
|
||||
|
|
|
|||
Loading…
Reference in a new issue