From 7535996498c6861ec1ba852a2fa15e5756a65131 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 28 Jun 2026 22:14:19 +0100 Subject: [PATCH] Use reactive player settings in input screen --- Aetheria.State.Verify/Program.cs | 57 +++++++++++++++++-- .../UI/InputScreen/InputDisplayLayout.cs | 5 +- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index abe56c3a1..a29a925e9 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -4221,10 +4221,6 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root) "AetheriaUnityRuntimeClientProvider.ResolveClient(", ".State", ".Settings", - ".ObservePlayer()", - "AetheriaRuntimePlayerSettingsSession _playerSettings", - "_playerSettings?.Dispose()", - "_playerSettings?.Current", "action.ApplyBindingOverride", "new InputAction(\"Aetheria Input Capture\")", "AetheriaRuntimeInputSettingsSurfaceBuilder.IsSupportedCapturePath(", @@ -4244,6 +4240,15 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root) string.Join(", ", missingInputScreenSymbols)); } + RequireReactiveTypedDocumentAccess( + inputScreen, + "InputDisplayLayout", + "AetheriaRuntimePlayerSettingsDocument", + "_playerSettings", + ".ReactivePlayer()", + "AetheriaRuntimePlayerSettingsSession", + ".ObservePlayer()"); + var forbiddenInputScreenSymbols = new[] { "OnPointerClickAsObservable", @@ -4253,8 +4258,6 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root) "LayoutRebuilder", "UILineRenderer", "Observable.NextFrame()", - ".ReactivePlayer()", - "CultMeshReactiveDocument _playerSettings", "DisplayLayout(_inputLayout)", "EnsureSurfaceDocument(", "new EveUiToolkitSurfaceLowerer()", @@ -17775,6 +17778,48 @@ static bool ContainsUnitySettingsMember(string source, string memberName) source.Contains($"\nSettings.{memberName}", StringComparison.Ordinal); } +static void RequireReactiveTypedDocumentAccess( + string source, + string ownerName, + string documentType, + string fieldName, + string reactiveAccessor, + string forbiddenSessionType, + string forbiddenObserveAccessor) +{ + var requiredSymbols = new[] + { + $"CultMeshReactiveDocument<{documentType}> {fieldName}", + reactiveAccessor, + $"{fieldName}?.Current", + $"{fieldName}?.Dispose()" + }; + var missingSymbols = requiredSymbols + .Where(symbol => !source.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (missingSymbols.Length > 0) + { + throw new InvalidOperationException( + $"{ownerName} should read {documentType} through a managed reactive typed document: " + + string.Join(", ", missingSymbols)); + } + + var forbiddenSymbols = new[] + { + $"{forbiddenSessionType} {fieldName}", + forbiddenObserveAccessor + }; + var survivingSymbols = forbiddenSymbols + .Where(symbol => source.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (survivingSymbols.Length > 0) + { + throw new InvalidOperationException( + $"{ownerName} still routes {documentType} through a legacy session wrapper instead of the managed reactive typed document: " + + string.Join(", ", survivingSymbols)); + } +} + static string CompactSource(string source) { return string.Concat((source ?? "").Where(character => !char.IsWhiteSpace(character))); diff --git a/Assets/Scripts/UI/InputScreen/InputDisplayLayout.cs b/Assets/Scripts/UI/InputScreen/InputDisplayLayout.cs index 361639633..b014b1cc0 100644 --- a/Assets/Scripts/UI/InputScreen/InputDisplayLayout.cs +++ b/Assets/Scripts/UI/InputScreen/InputDisplayLayout.cs @@ -4,6 +4,7 @@ using System.Linq; using GameCult.Aetheria.EveRuntime; using GameCult.Aetheria.State.Verse; using GameCult.Eve.Surface; +using GameCult.Mesh; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Utilities; @@ -14,7 +15,7 @@ public class InputDisplayLayout : MonoBehaviour private UIDocument _surfaceDocument; private AetheriaInput _ownedInput; private string _clientStatePath = ""; - private AetheriaRuntimePlayerSettingsSession _playerSettings; + private CultMeshReactiveDocument _playerSettings; private InputAction _captureAction; private InputActionAsset _input; private string _captureActionName = ""; @@ -394,7 +395,7 @@ public class InputDisplayLayout : MonoBehaviour _playerSettings = ResolveClient() .State .Settings - .ObservePlayer(); + .ReactivePlayer(); } catch (Exception ex) {