diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-08-19 15:32:17 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:40 +0200 |
| commit | edf89db6fc28931ca59f6c9acfd0a561d68145c7 (patch) | |
| tree | fe2961223279d16f5d9952f2e9d4aa6d1a5fcf66 /go/client | |
| parent | 97a80cc2cf2a5b5a8334fc42f65863651516d4cf (diff) | |
| download | muhqs-game-edf89db6fc28931ca59f6c9acfd0a561d68145c7.tar.gz muhqs-game-edf89db6fc28931ca59f6c9acfd0a561d68145c7.zip | |
add discard2 icon and button to trigger the free action
Diffstat (limited to 'go/client')
| -rw-r--r-- | go/client/game.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/go/client/game.go b/go/client/game.go index d726e760..caf73933 100644 --- a/go/client/game.go +++ b/go/client/game.go @@ -45,6 +45,7 @@ type Game struct { selectedObject any handLayer *ui.HandView + discardBtn *ui.ImageButton stateBar *ui.StateBar mapView *ui.MapView choice ui.Widget @@ -170,6 +171,17 @@ func (g *Game) initPlayerUi(player *game.Player) *Game { true) g.AddWidget(g.handLayer) + discardImg := ebiten.NewImageFromImage(assets.GetIcon("discard2.png")) + g.discardBtn = ui.NewImageButton( + g.handLayer.X+2, + g.handLayer.Y+g.handLayer.Height-discardImg.Bounds().Dy()-2, + discardImg, + func(*ui.ImageButton) { + g.addCancelablePrompt(game.NewFreeDiscardAction(player), "select two hand cards") + }, + ) + g.AddWidget(g.discardBtn) + g.stateBar = ui.NewStateBar(0, g.Height-DEFAULT_BUTTON_HEIGHT, STATE_BAR_WIDTH, @@ -471,6 +483,12 @@ func (g *Game) updateButtons() { g.hide(g.passButton) } + if g.activePlayer().Hand.Size() < 2 { + g.hide(g.discardBtn) + } else { + g.show(g.discardBtn) + } + passButtonLabel := "pass" if g.prompt != nil { targets := g.prompt.Action().Targets() |
