Frontend menu + settings + saves foundation
Netcode frontend pattern: UITK main menu / pause / settings (MenuUi + controllers), on-demand world lifecycle (WorldLauncher/SessionRunner), GameBootstrap menu branch; Graphics/Audio settings (SettingsService/GameVolume); single-slot save foundation (SaveData/SaveService, born-correct load at director spawn, autosave on Siege->Calm + quit); RuntimePanelSettings + theme; BuildTool menu; 10 EditMode tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build.Reporting;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ProjectM.EditorTools
|
||||
{
|
||||
/// <summary>
|
||||
/// One-click Windows player build + the "Boot Into Menu (Editor)" toggle that flips GameBootstrap into the
|
||||
/// frontend path for in-editor menu testing (shared EditorPrefs key "ProjectM.BootIntoMenu"). Lives in the
|
||||
/// special Editor folder (compiles into Assembly-CSharp-Editor) so it needs no ProjectM asmdef references.
|
||||
/// </summary>
|
||||
public static class BuildTool
|
||||
{
|
||||
const string BootPrefKey = "ProjectM.BootIntoMenu";
|
||||
const string BootMenuItem = "ProjectM/Boot Into Menu (Editor)";
|
||||
|
||||
[MenuItem("ProjectM/Build/Windows Player")]
|
||||
public static void BuildWindows()
|
||||
{
|
||||
string[] scenes =
|
||||
{
|
||||
"Assets/Scenes/MainMenu.unity",
|
||||
"Assets/Scenes/Game.unity",
|
||||
};
|
||||
const string dir = "Builds/Windows";
|
||||
System.IO.Directory.CreateDirectory(dir);
|
||||
|
||||
var options = new BuildPlayerOptions
|
||||
{
|
||||
scenes = scenes,
|
||||
locationPathName = System.IO.Path.Combine(dir, "ProjectM.exe"),
|
||||
target = BuildTarget.StandaloneWindows64,
|
||||
options = BuildOptions.None,
|
||||
};
|
||||
|
||||
BuildReport report = BuildPipeline.BuildPlayer(options);
|
||||
BuildSummary s = report.summary;
|
||||
if (s.result == BuildResult.Succeeded)
|
||||
Debug.Log($"[BuildTool] Build succeeded: ~{s.totalSize / (1024 * 1024)} MB -> {options.locationPathName}");
|
||||
else
|
||||
Debug.LogError($"[BuildTool] Build {s.result}: {s.totalErrors} error(s).");
|
||||
}
|
||||
|
||||
[MenuItem(BootMenuItem)]
|
||||
public static void ToggleBootMenu()
|
||||
{
|
||||
bool v = !EditorPrefs.GetBool(BootPrefKey, false);
|
||||
EditorPrefs.SetBool(BootPrefKey, v);
|
||||
Debug.Log($"[BuildTool] Boot Into Menu (Editor) = {v}. " +
|
||||
(v ? "Open MainMenu.unity and Play to test the menu."
|
||||
: "Normal instant-play / MPPM loop restored."));
|
||||
}
|
||||
|
||||
[MenuItem(BootMenuItem, true)]
|
||||
public static bool ToggleBootMenuValidate()
|
||||
{
|
||||
Menu.SetChecked(BootMenuItem, EditorPrefs.GetBool(BootPrefKey, false));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c4747ef10cbb424bbfa8ebd4f807fb7
|
||||
Reference in New Issue
Block a user