Files
Project-M/Assets/_Project/Scripts/Client/Building/BuildPaletteState.cs
T
kronic a4edf7a03b UITK HUD rework + build palette (click-to-place ghost)
Rebuild the in-game HUD on UI Toolkit (HudUi/HudSystem, Aether palette) consistent with the menu; build-palette bar (BuildPaletteState) drives cursor->cell ground-ghost preview (green/red via BuildPreviewMath), left-click place / right-click cancel / rotate; fire suppressed in build mode; combat juice restyle. +4 BuildPreviewMath EditMode tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 15:05:49 -07:00

30 lines
1.4 KiB
C#

namespace ProjectM.Client
{
/// <summary>
/// Client-local build-mode state shared between the HUD build palette (sets the selected buildable), the
/// build placement input (ground ghost preview + click-to-place + conveyor rotation), and the input gather
/// (suppresses Fire while a build is selected, so a left-click places instead of firing). Pure UI state —
/// never replicated, never touches the sim. Reset on play-enter (statics survive fast-enter domain reloads).
/// </summary>
public static class BuildPaletteState
{
/// <summary>Selected structure type (StructureType.*); 0 = none / build mode off.</summary>
public static byte Selected;
/// <summary>Pending conveyor facing (0=+X,1=-X,2=+Z,3=-Z); rotated by [ / ] or R.</summary>
public static byte Direction;
/// <summary>True while a buildable is selected (build mode active).</summary>
public static bool Active => Selected != 0;
/// <summary>Select a type (or 0 to leave build mode), resetting the pending conveyor facing.</summary>
public static void Select(byte type) { Selected = type; Direction = 0; }
/// <summary>Leave build mode.</summary>
public static void Clear() { Selected = 0; Direction = 0; }
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
static void ResetStatics() { Selected = 0; Direction = 0; }
}
}