Runtime UI under Scripts/UI: a UIStateController owning menu/dialogue state, a PlayerControlLock so opening a panel suppresses world input, panel visibility helpers, and the menu input binding. Views: the dialogue stream presenter and its options presenter and message row, the portrait HUD, and the player menu with character, journal, and tab-bar views. Skills gains SkillsPanelView and SkillRowView, which is why the Skills asmdef now references UnityEngine.UI. Prefabs/UI holds the authored canvases (dialogue stream, HUD, player menu) and their rows. UILayerBootstrap remains a hand-added runtime fallback for scenes where those prefabs are not instantiated; it deliberately does not auto-spawn. Editor/UILayerSetup.cs is the one-shot menu that builds and wires those prefabs into a scene, with UILayerSetupAutoRun reminding after a script reload. Art/UI/Placeholder carries the placeholder portrait the HUD falls back to. Co-Authored-By: Claude Opus 5 <[email protected]>
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// Reminds the user to run the one-shot prefab/scene wiring menu after scripts
|
|
/// compile. Runtime play works without it via UILayerBootstrap.
|
|
/// </summary>
|
|
[InitializeOnLoad]
|
|
static class UILayerSetupAutoRun
|
|
{
|
|
const string PrefKey = "NightclubArcadia.UILayerSetup.Reminded";
|
|
const string MarkerPrefab = "Assets/Prefabs/UI/PlayerMenuCanvas.prefab";
|
|
|
|
static UILayerSetupAutoRun()
|
|
{
|
|
EditorApplication.delayCall += RemindIfNeeded;
|
|
}
|
|
|
|
static void RemindIfNeeded()
|
|
{
|
|
if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (AssetDatabase.LoadAssetAtPath<GameObject>(MarkerPrefab) != null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (EditorPrefs.GetBool(PrefKey, false))
|
|
{
|
|
return;
|
|
}
|
|
|
|
EditorPrefs.SetBool(PrefKey, true);
|
|
Debug.Log(
|
|
"[UILayer] Prefabs not built yet. Play Mode works via UILayerBootstrap. " +
|
|
"To author prefabs into the scene, run Tools → Nightclub Arcadia → Set Up UI Layer.");
|
|
}
|
|
|
|
[MenuItem("Tools/Nightclub Arcadia/Reset UI Layer Auto-Setup Flag")]
|
|
static void ResetFlag()
|
|
{
|
|
EditorPrefs.DeleteKey(PrefKey);
|
|
Debug.Log("[UILayer] Reminder flag cleared.");
|
|
}
|
|
}
|