f5ed13b98d
- DistroDatabase.TryValidate() catches empty slots, blank ids, and duplicate ids at edit time (OnValidate) and runtime, instead of only surfacing as a runtime count check. - StarterSelectionController centralizes the "do we have a usable starter set" check (previously re-derived in five places) and shows a dismissible in-UI error when the database is misconfigured, rather than silently leaving the modal hidden with just a console warning. - Boot-intro's bootIntroPlayed flag now resets via RuntimeInitializeOnLoadMethod so it stays session-scoped even when the Editor's Reload Domain setting is off. - Extracted StarterSelectionController and CollectionScreenController out of MainMenuController (885 -> ~490 lines), following the same plain-class-plus-Bind() pattern already used by FeaturedUnitPanel. Shared DisplayName/FormatLanguages formatting and digit-key mapping moved into DistroPresentation/CommandKeyBindings to remove the duplication that split would otherwise have introduced. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01364Mm9NsPooiSfDHKr4FAx
25 lines
759 B
C#
25 lines
759 B
C#
using UnityEngine;
|
|
|
|
namespace KernelPanic.UI
|
|
{
|
|
/// <summary>
|
|
/// Maps number-row/keypad digits to menu slot indices. Shared by the command menu and the
|
|
/// starter-selection modal so both keep the same 1-5 shortcut behavior.
|
|
/// </summary>
|
|
internal static class CommandKeyBindings
|
|
{
|
|
public static int GetDigitIndex(KeyCode keyCode)
|
|
{
|
|
return keyCode switch
|
|
{
|
|
KeyCode.Alpha1 or KeyCode.Keypad1 => 0,
|
|
KeyCode.Alpha2 or KeyCode.Keypad2 => 1,
|
|
KeyCode.Alpha3 or KeyCode.Keypad3 => 2,
|
|
KeyCode.Alpha4 or KeyCode.Keypad4 => 3,
|
|
KeyCode.Alpha5 or KeyCode.Keypad5 => 4,
|
|
_ => -1
|
|
};
|
|
}
|
|
}
|
|
}
|