First-run onboarding: contextual coach-marks + How-to-Play card + dev replay toggle
Teaches the deep, interlocking loop — especially the inverted win condition (you win by CLEARING EXPEDITIONS, not by surviving base sieges; DR-042/DR-043). - OnboardingSystem: client-only observe-only PresentationSystemGroup overlay (own UIDocument @ sortingOrder 60), soft-gated 10-beat coach-mark sequence with a world-space ▶ pointer; never mutates sim / never destroys a ghost. - OnboardingStepMath: pure, unit-tested step machine (snapshot + IsSatisfied + scheme-aware prompts + pointer kinds + persisted-mask helpers). - HowToPlayPanel: tabbed reference card (Controls / The Loop / Build / Threats / Win-Lose), reachable from the main menu and the pause overlay. - Per-client client-local state in GameSettings (TutorialHints + OnboardingMask bitmask, additive) — a Join client keeps its own; a host save-wipe never re-teaches. Settings toggle + menu "Replay Tutorial". - Dev "Force Each Launch" toggle (GameSettings.ForceOnboardingEachLaunch): SettingsService.Boot wipes the mask + forces hints on in-memory every launch so the tutorial always replays fresh. - HudSystem suppresses its own location hint while onboarding is active (single prompt voice), via OnboardingState + [UpdateAfter(OnboardingSystem)]. Validated green: 20/20 EditMode; Play smoke confirmed overlay render, clean U+25B6 pointer glyph, no system sort-cycle, and the force-wipe end-to-end. Docs: DR-043 + session log; reusable lesson archived in the build-gotchas note. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ namespace ProjectM.Client
|
||||
UIDocument _doc;
|
||||
VisualElement _mainPanel;
|
||||
VisualElement _settingsPanel;
|
||||
VisualElement _howToPanel;
|
||||
TextField _ipField;
|
||||
Label _classLabel;
|
||||
|
||||
@@ -79,6 +80,21 @@ namespace ProjectM.Client
|
||||
card.Add(MenuUi.Button("Join", () => Launch(SessionMode.Join, false)));
|
||||
|
||||
card.Add(MenuUi.Button("Settings", ShowSettings));
|
||||
card.Add(MenuUi.Button("How to Play", ShowHowToPlay));
|
||||
|
||||
// Re-arm the first-run coach-marks (clears the client-local completed-step mask). The next session
|
||||
// replays them; the How-to-Play card stays available regardless.
|
||||
Button replayBtn = null;
|
||||
replayBtn = MenuUi.Button("Replay Tutorial", () =>
|
||||
{
|
||||
var s = SettingsService.Current;
|
||||
s.OnboardingMask = 0;
|
||||
s.TutorialHints = 1;
|
||||
SettingsService.Save(s);
|
||||
if (replayBtn != null) replayBtn.text = "Tutorial armed ✓";
|
||||
});
|
||||
card.Add(replayBtn);
|
||||
|
||||
card.Add(MenuUi.Button("Quit", Quit));
|
||||
|
||||
_mainPanel.Add(card);
|
||||
@@ -112,6 +128,19 @@ namespace ProjectM.Client
|
||||
_mainPanel.style.display = DisplayStyle.Flex;
|
||||
}
|
||||
|
||||
void ShowHowToPlay()
|
||||
{
|
||||
_mainPanel.style.display = DisplayStyle.None;
|
||||
_howToPanel = HowToPlayPanel.Build(HideHowToPlay);
|
||||
_doc.rootVisualElement.Add(_howToPanel);
|
||||
}
|
||||
|
||||
void HideHowToPlay()
|
||||
{
|
||||
if (_howToPanel != null) { _howToPanel.RemoveFromHierarchy(); _howToPanel = null; }
|
||||
_mainPanel.style.display = DisplayStyle.Flex;
|
||||
}
|
||||
|
||||
static void Quit()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
|
||||
Reference in New Issue
Block a user