From 4bb93813ebe5f7f6c4a6e13bed8a54a147d063ce Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 21 Jun 2026 23:12:59 +0100 Subject: [PATCH] Move input surface candidates into runtime --- Aetheria.State.Verify/Program.cs | 8 +- .../UI/InputScreen/InputDisplayLayout.cs | 46 ---------- ...heriaRuntimeInputSettingsSurfaceBuilder.cs | 90 +++++++++++++++++++ 3 files changed, 95 insertions(+), 49 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index b24dcac70..d881dcd33 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -3584,11 +3584,9 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root) "ActionGameManager.RequestRuntimeActionBarInput", "action.ApplyBindingOverride", "new InputAction(\"Aetheria Input Capture\")", - "AetheriaRuntimeInputSettingsSurfaceBuilder.DefaultActionBarCandidatePaths", "AetheriaRuntimeInputSettingsSurfaceBuilder.IsSupportedCapturePath(", "AetheriaRuntimeInputSettingsSurfaceBuilder.Project(", "new AetheriaRuntimeObservedInputBinding(", - "new AetheriaRuntimeInputPathSurfaceLabel(", "HideLegacyChildren()" }; @@ -3630,7 +3628,9 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root) "new AetheriaRuntimeInputBindingSurfaceState(", "new AetheriaRuntimeActionBarInputSurfaceState(", "AetheriaRuntimeInputSettingsSurfaceBuilder.ProjectActionBarInputs(", - "new SortedDictionary(StringComparer.Ordinal)" + "AetheriaRuntimeInputSettingsSurfaceBuilder.ProjectActionBarCandidates(", + "new SortedDictionary(StringComparer.Ordinal)", + "private IReadOnlyList ProjectActionBarCandidates(" }; var survivingLegacySymbols = forbiddenInputScreenSymbols @@ -3663,9 +3663,11 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root) "public sealed class AetheriaRuntimeInputPathSurfaceLabel", "public sealed class AetheriaRuntimeObservedInputBinding", "public static readonly IReadOnlyList DefaultActionBarCandidatePaths", + "public static readonly IReadOnlyList DefaultActionBarCandidateInputPaths", "public static bool IsSupportedCapturePath(string path)", "public static AetheriaRuntimeInputSettingsSurfaceState Project(", "public static IReadOnlyList ProjectBindingInputs(", + "public static IReadOnlyList ProjectActionBarCandidates(", "public static IReadOnlyList ProjectActionBarInputs(", "new SortedDictionary(StringComparer.Ordinal)", "public enum AetheriaRuntimeInputSettingsCommandKind", diff --git a/Assets/Scripts/UI/InputScreen/InputDisplayLayout.cs b/Assets/Scripts/UI/InputScreen/InputDisplayLayout.cs index 6abb0e800..6fdc009af 100644 --- a/Assets/Scripts/UI/InputScreen/InputDisplayLayout.cs +++ b/Assets/Scripts/UI/InputScreen/InputDisplayLayout.cs @@ -168,7 +168,6 @@ public class InputDisplayLayout : MonoBehaviour return AetheriaRuntimeInputSettingsSurfaceBuilder.Project( ProjectObservedBindings(), runtimeSettings.ActionBarInputs, - ProjectActionBarCandidates(runtimeSettings.ActionBarInputs), capturePending: _captureBindingIndex >= 0 && !string.IsNullOrWhiteSpace(_captureActionName), capturePrompt: BuildCapturePrompt(), updatedAtUtc: DateTime.UtcNow.ToString("O")); @@ -200,51 +199,6 @@ public class InputDisplayLayout : MonoBehaviour .ToArray(); } - private IReadOnlyList ProjectActionBarCandidates( - IEnumerable enabledActionBarInputPaths) - { - var candidates = new List(); - - foreach (var defaultPath in AetheriaRuntimeInputSettingsSurfaceBuilder.DefaultActionBarCandidatePaths) - { - candidates.Add(new AetheriaRuntimeInputPathSurfaceLabel( - defaultPath, - DescribeInputPath(defaultPath))); - } - - foreach (var inputPath in enabledActionBarInputPaths ?? Array.Empty()) - { - if (!string.IsNullOrWhiteSpace(inputPath)) - { - candidates.Add(new AetheriaRuntimeInputPathSurfaceLabel( - inputPath, - DescribeInputPath(inputPath))); - } - } - - if (Input != null) - { - foreach (var action in Input.Where(action => action.actionMap.name != "UI")) - { - foreach (var binding in action.bindings) - { - if (binding.isComposite || - string.IsNullOrWhiteSpace(binding.effectivePath) || - !AetheriaRuntimeInputSettingsSurfaceBuilder.IsSupportedCapturePath(binding.effectivePath)) - { - continue; - } - - candidates.Add(new AetheriaRuntimeInputPathSurfaceLabel( - binding.effectivePath, - DescribeInputPath(binding.effectivePath))); - } - } - } - - return candidates; - } - private static string DescribeBinding(string actionName, InputBinding binding) { if (binding.isPartOfComposite && !string.IsNullOrWhiteSpace(binding.name)) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInputSettingsSurfaceBuilder.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInputSettingsSurfaceBuilder.cs index da3a6c776..051e7ad0f 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInputSettingsSurfaceBuilder.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInputSettingsSurfaceBuilder.cs @@ -128,6 +128,22 @@ namespace GameCult.Aetheria.State.Verse "/leftShift" }; + public static readonly IReadOnlyList DefaultActionBarCandidateInputPaths = + new[] + { + new AetheriaRuntimeInputPathSurfaceLabel("/leftButton", "Left Button"), + new AetheriaRuntimeInputPathSurfaceLabel("/rightButton", "Right Button"), + new AetheriaRuntimeInputPathSurfaceLabel("/middleButton", "Middle Button"), + new AetheriaRuntimeInputPathSurfaceLabel("/forwardButton", "Forward Button"), + new AetheriaRuntimeInputPathSurfaceLabel("/backButton", "Back Button"), + new AetheriaRuntimeInputPathSurfaceLabel("/1", "1"), + new AetheriaRuntimeInputPathSurfaceLabel("/2", "2"), + new AetheriaRuntimeInputPathSurfaceLabel("/3", "3"), + new AetheriaRuntimeInputPathSurfaceLabel("/4", "4"), + new AetheriaRuntimeInputPathSurfaceLabel("/5", "5"), + new AetheriaRuntimeInputPathSurfaceLabel("/leftShift", "Left Shift") + }; + public static bool IsSupportedCapturePath(string path) { return !string.IsNullOrWhiteSpace(path) && @@ -135,6 +151,26 @@ namespace GameCult.Aetheria.State.Verse path.StartsWith("/", StringComparison.Ordinal)); } + public static AetheriaRuntimeInputSettingsSurfaceState Project( + IEnumerable observedBindings, + IEnumerable enabledActionBarInputPaths, + bool capturePending, + string capturePrompt, + string updatedAtUtc) + { + var observed = (observedBindings ?? Array.Empty()) + .Where(binding => binding != null) + .ToArray(); + + return Project( + observed, + enabledActionBarInputPaths, + ProjectActionBarCandidates(observed, enabledActionBarInputPaths), + capturePending, + capturePrompt, + updatedAtUtc); + } + public static AetheriaRuntimeInputSettingsSurfaceState Project( IEnumerable observedBindings, IEnumerable enabledActionBarInputPaths, @@ -170,6 +206,41 @@ namespace GameCult.Aetheria.State.Verse .ToArray(); } + public static IReadOnlyList ProjectActionBarCandidates( + IEnumerable observedBindings, + IEnumerable enabledInputPaths) + { + var candidates = new List(); + candidates.AddRange(DefaultActionBarCandidateInputPaths); + + foreach (var inputPath in enabledInputPaths ?? Array.Empty()) + { + if (!string.IsNullOrWhiteSpace(inputPath)) + { + candidates.Add(new AetheriaRuntimeInputPathSurfaceLabel( + inputPath, + ReadInputLabel(inputPath, observedBindings))); + } + } + + foreach (var binding in observedBindings ?? Array.Empty()) + { + if (binding == null || + !binding.Include || + string.IsNullOrWhiteSpace(binding.InputPath) || + !IsSupportedCapturePath(binding.InputPath)) + { + continue; + } + + candidates.Add(new AetheriaRuntimeInputPathSurfaceLabel( + binding.InputPath, + string.IsNullOrWhiteSpace(binding.InputLabel) ? binding.InputPath : binding.InputLabel)); + } + + return candidates; + } + public static IReadOnlyList ProjectActionBarInputs( IEnumerable enabledInputPaths, IEnumerable candidateInputPaths) @@ -207,6 +278,25 @@ namespace GameCult.Aetheria.State.Verse .ToArray(); } + private static string ReadInputLabel( + string inputPath, + IEnumerable observedBindings) + { + foreach (var binding in observedBindings ?? Array.Empty()) + { + if (binding == null || + !string.Equals(binding.InputPath, inputPath, StringComparison.Ordinal) || + string.IsNullOrWhiteSpace(binding.InputLabel)) + { + continue; + } + + return binding.InputLabel; + } + + return inputPath; + } + public static AetheriaRuntimeSurfaceDocument Build( AetheriaRuntimeInputSettingsSurfaceState settings, long version = 1)