diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 7bc891048..01180f88b 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -4893,8 +4893,7 @@ static void RequireRuntimeMenuTabsUseEveSurface(string root) "SetObservedEntityIndex(AetheriaUnityObservedEntityIndex observedEntityIndex)", "dockingIndex.TryResolveCurrentDockingBay(out var dockingBay)", "dockingBay?.Entity is not OrbitalEntity { Story: { } dockedStory }", - "AetheriaRuntimeLocalStorySurfaceBuilder.Build(ProjectStorySurface())", - "AetheriaRuntimeLocalStorySurfaceBuilder.Project(", + "AetheriaRuntimeLocalStorySurfaceBuilder.Build(", "AetheriaRuntimeLocalStorySurfaceCommands.TryRead(request, out var command)", "AetheriaRuntimeLocalStoryCommandKind.Continue", "AetheriaRuntimeLocalStoryCommandKind.Choose", @@ -4920,11 +4919,13 @@ static void RequireRuntimeMenuTabsUseEveSurface(string root) localMenu.Contains("TryGetObservedDockedLocalStory", StringComparison.Ordinal) || actionGameManager.Contains("TryGetObservedDockedLocalStory", StringComparison.Ordinal) || actionGameManager.Contains("IsObservedDocked", StringComparison.Ordinal) || + localMenu.Contains("ProjectStorySurface(", StringComparison.Ordinal) || + localMenu.Contains("AetheriaRuntimeLocalStorySurfaceBuilder.Project(", StringComparison.Ordinal) || localMenu.Contains("Instantiate(ChoicePrefab", StringComparison.Ordinal) || localMenu.Contains("choiceInstance.Button.onClick.AddListener", StringComparison.Ordinal)) { throw new InvalidOperationException( - "Runtime menu/local UI must not inspect DockedEntity or rebuild legacy prefab buttons; use typed docking and the Eve local-story surface."); + "Runtime menu/local UI must not inspect DockedEntity, rebuild legacy prefab buttons, or carry a local story projection helper; use typed docking and build the Eve local-story surface directly."); } var requiredLocalStoryBuilderSymbols = new[] @@ -4933,8 +4934,8 @@ static void RequireRuntimeMenuTabsUseEveSurface(string root) "public const string SurfaceId = \"aetheria.runtime_menu.local_story\"", "public const string Continue = \"aetheria.runtime_menu.local_story.continue\"", "ChoiceCommandFor(int choiceIndex)", - "public static AetheriaRuntimeLocalStorySurfaceState Project(", "public static AetheriaRuntimeSurfaceDocument Build(", + "private static AetheriaRuntimeLocalStorySurfaceState ComposeState(", "public enum AetheriaRuntimeLocalStoryCommandKind", "public readonly struct AetheriaRuntimeLocalStoryCommand", "public static class AetheriaRuntimeLocalStorySurfaceCommands", diff --git a/Assets/Scripts/UI/Menu/LocalMenu.cs b/Assets/Scripts/UI/Menu/LocalMenu.cs index 546c71f13..f19c62a49 100644 --- a/Assets/Scripts/UI/Menu/LocalMenu.cs +++ b/Assets/Scripts/UI/Menu/LocalMenu.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; using System.Linq; using GameCult.Aetheria.EveRuntime; using GameCult.Aetheria.State.Verse; @@ -146,24 +145,19 @@ public class LocalMenu : MonoBehaviour transform, _surfaceDocument, "Aetheria Runtime Local Story Surface", - AetheriaRuntimeLocalStorySurfaceBuilder.Build(ProjectStorySurface()), + AetheriaRuntimeLocalStorySurfaceBuilder.Build( + ResolveLocationLabel(), + _currentPath, + _activeStory?.currentText ?? "", + _activeStory?.canContinue == true, + _activeChoices.Select(choice => new AetheriaRuntimeLocalStoryChoiceState( + choice.Index, + choice.Choice?.text ?? "")), + DateTime.UtcNow.ToString("O")), HandleStorySurfaceCommand, _surfaceChrome); } - private AetheriaRuntimeLocalStorySurfaceState ProjectStorySurface() - { - return AetheriaRuntimeLocalStorySurfaceBuilder.Project( - ResolveLocationLabel(), - _currentPath, - _activeStory?.currentText ?? "", - _activeStory?.canContinue == true, - _activeChoices.Select(choice => new AetheriaRuntimeLocalStoryChoiceState( - choice.Index, - choice.Choice?.text ?? "")), - DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)); - } - private void HandleStorySurfaceCommand(EveSurfaceCommandRequest request) { if (!AetheriaRuntimeLocalStorySurfaceCommands.TryRead(request, out var command)) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeLocalStorySurfaceBuilder.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeLocalStorySurfaceBuilder.cs index 8e96776f6..5b63896b6 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeLocalStorySurfaceBuilder.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeLocalStorySurfaceBuilder.cs @@ -54,7 +54,27 @@ namespace GameCult.Aetheria.State.Verse return $"{ChoicePrefix}{Math.Max(0, choiceIndex)}"; } - public static AetheriaRuntimeLocalStorySurfaceState Project( + public static AetheriaRuntimeSurfaceDocument Build( + string locationLabel, + string currentPath, + string body, + bool canContinue, + IEnumerable choices, + string updatedAtUtc, + long version = 1) + { + return Build( + ComposeState( + locationLabel, + currentPath, + body, + canContinue, + choices, + updatedAtUtc), + version); + } + + private static AetheriaRuntimeLocalStorySurfaceState ComposeState( string locationLabel, string currentPath, string body, @@ -78,7 +98,7 @@ namespace GameCult.Aetheria.State.Verse AetheriaRuntimeLocalStorySurfaceState state, long version = 1) { - state ??= Project("", "", "", false, Array.Empty(), ""); + state ??= ComposeState("", "", "", false, Array.Empty(), ""); var commands = new List(); var controls = new List();