Build local story surfaces directly

This commit is contained in:
Meta Vens 2026-06-29 05:21:22 +01:00
commit e45c86026b
3 changed files with 36 additions and 21 deletions

View file

@ -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",

View file

@ -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))

View file

@ -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<AetheriaRuntimeLocalStoryChoiceState> 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<AetheriaRuntimeLocalStoryChoiceState>(), "");
state ??= ComposeState("", "", "", false, Array.Empty<AetheriaRuntimeLocalStoryChoiceState>(), "");
var commands = new List<AetheriaRuntimeSurfaceCommandTemplate>();
var controls = new List<AetheriaRuntimeSurfaceComponent>();