diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-24 12:17:26 -0400 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:30 +0200 |
| commit | 1db9bf77e011afba4f4ca6d0b98e766eb9701375 (patch) | |
| tree | 6ec38d9e6df4d060519fb1db4ab0f590969a8dec /go/client/startMenu.go | |
| parent | 18fbd176c73e7102528d6ddce8353476d000d386 (diff) | |
| download | muhqs-game-1db9bf77e011afba4f4ca6d0b98e766eb9701375.tar.gz muhqs-game-1db9bf77e011afba4f4ca6d0b98e766eb9701375.zip | |
add random challange aupport to the client
Diffstat (limited to 'go/client/startMenu.go')
| -rw-r--r-- | go/client/startMenu.go | 22 |
1 files changed, 22 insertions, 0 deletions
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()) +} |
