From 749dc58ced17662d9f6dd40bb44d315d12d3d48b Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 24 Jul 2025 12:17:26 -0400 Subject: add random challange aupport to the client --- go/client/startMenu.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'go/client/startMenu.go') diff --git a/go/client/startMenu.go b/go/client/startMenu.go index a9ee5c48..2c3225b9 100644 --- a/go/client/startMenu.go +++ b/go/client/startMenu.go @@ -132,6 +132,17 @@ func (m *startMenu) build() { m.startDeck = deckInput.Text() m.startGame() })) + m.AddWidget(ui.NewSimpleButton( + (m.Width-START_BUTTON_WIDTH)/2, + deckInput.Y+deckInput.Height+4*START_BUTTON_HEIGHT, + START_BUTTON_WIDTH, + START_BUTTON_HEIGHT, + "Challenge", + func(*ui.SimpleButton) { + m.playerName = playerInput.Text() + s := game.NewRandomChallenge(m.playerName) + m.startChallenge(s) + })) } func (m *startMenu) Update() error { @@ -178,3 +189,14 @@ func (m *startMenu) startGame() { activities.PushActivity(g.Start()) } + +func (m *startMenu) startChallenge(state game.State) { + g := newGame(m.app, state) + + g.initMapUi() + p := state.PlayerByName(m.playerName) + g.activePlayerId = p.Id + g.initPlayerUi(p) + + activities.PushActivity(g.Start()) +} -- cgit v1.2.3