Validate DistroDatabase and split MainMenuController's starter/collection logic out
- 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
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user