Slice 2: menu class picker (Warrior / Ranger)
MainMenuController gains a 2-class picker that sets WorldLauncher.SelectedClass; WorldLauncher seeds a ClassSelection singleton into the client world at session start, which GoInGameClientSystem carries on the spawn RPC. Default Warrior. Completes the Slice 2 loop: pick a class in the menu -> spawn with its kit. Editor-default boot stays Warrior (the menu path drives the choice). 348/348. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@ namespace ProjectM.Client
|
||||
VisualElement _mainPanel;
|
||||
VisualElement _settingsPanel;
|
||||
TextField _ipField;
|
||||
Label _classLabel;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -53,6 +54,17 @@ namespace ProjectM.Client
|
||||
_mainPanel = MenuUi.FullScreenRoot(true);
|
||||
var card = MenuUi.Card("PROJECT M");
|
||||
card.Add(MenuUi.Caption("Frontier colony — co-op"));
|
||||
// Slice 2: class picker -> sets WorldLauncher.SelectedClass for the next session (Warrior melee / Ranger ranged).
|
||||
_classLabel = new Label(ClassName(WorldLauncher.SelectedClass));
|
||||
_classLabel.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
_classLabel.style.marginTop = 6; _classLabel.style.marginBottom = 2;
|
||||
card.Add(_classLabel);
|
||||
var classRow = new VisualElement();
|
||||
classRow.style.flexDirection = FlexDirection.Row;
|
||||
classRow.style.justifyContent = Justify.Center;
|
||||
classRow.Add(MenuUi.Button("Warrior", () => SelectClass((byte)CharacterId.Warrior)));
|
||||
classRow.Add(MenuUi.Button("Ranger", () => SelectClass((byte)CharacterId.Ranger)));
|
||||
card.Add(classRow);
|
||||
|
||||
card.Add(MenuUi.Button("Single Player", () => Launch(SessionMode.Single, false)));
|
||||
|
||||
@@ -79,6 +91,14 @@ namespace ProjectM.Client
|
||||
WorldLauncher.StartSession(mode, ip, loadSave);
|
||||
}
|
||||
|
||||
void SelectClass(byte classId)
|
||||
{
|
||||
WorldLauncher.SelectedClass = classId;
|
||||
if (_classLabel != null) _classLabel.text = ClassName(classId);
|
||||
}
|
||||
|
||||
static string ClassName(byte classId) => classId == (byte)CharacterId.Ranger ? "CLASS: Ranger (ranged)" : "CLASS: Warrior (melee)";
|
||||
|
||||
void ShowSettings()
|
||||
{
|
||||
_mainPanel.style.display = DisplayStyle.None;
|
||||
|
||||
Reference in New Issue
Block a user