diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-22 12:53:25 -0400 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:27 +0200 |
| commit | ad78bff7dc46892f358fc550cdd3c991b8dd79fe (patch) | |
| tree | fddef409765f9a77b1c8eedc665bd83555b94cc6 | |
| parent | 2b31330cb51e9be8960fa7d7dc1d9c6e3bba79eb (diff) | |
| download | muhqs-game-ad78bff7dc46892f358fc550cdd3c991b8dd79fe.tar.gz muhqs-game-ad78bff7dc46892f358fc550cdd3c991b8dd79fe.zip | |
hide the store after declaring the buy action
| -rw-r--r-- | go/client/game.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/go/client/game.go b/go/client/game.go index 4dc61a1a..4402d1ea 100644 --- a/go/client/game.go +++ b/go/client/game.go @@ -46,6 +46,7 @@ type Game struct { resetButton *ui.SimpleButton discardPileView *ui.PocList discardPileButton *ui.SimpleButton + storeVisible bool storeView *ui.PocList storeButton *ui.SimpleButton stackBuffer *ui.Buffer @@ -181,7 +182,7 @@ func (g *Game) initPlayerUi(player *game.Player) *Game { DEFAULT_BUTTON_HEIGHT, "Store", func(*ui.SimpleButton) { - if idx := g.FindWidget(g.storeView); idx == -1 { + if !g.storeVisible { g.showStore() } else { g.hideStore() @@ -198,11 +199,16 @@ func (g *Game) initPlayerUi(player *game.Player) *Game { } func (g *Game) showStore() { + if g.storeVisible { + return + } + g.storeVisible = true g.storeView.ForceRedraw() g.AddWidget(g.storeView) } func (g *Game) hideStore() { + g.storeVisible = false g.RemoveWidget(g.storeView) } @@ -380,6 +386,9 @@ func (g *Game) clearHighlights() { } func (g *Game) declareAction(a game.Action) { + if _, ok := a.(*game.BuyAction); ok { + g.hideStore() + } g.playerCtrl.SendAction(a) g.clearHighlights() g.hasPriority = false |
