diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-22 12:53:25 -0400 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-07-24 12:22:09 -0400 |
| commit | 6bfb6e5dfc3c944fe8b9b5b86cccd8a51084f402 (patch) | |
| tree | 1f34a54d622fb90e09c1f341329c1f9db5f6f69c /go/client | |
| parent | 68741debf9078982941ce071b5e0cd8b8f2f0d96 (diff) | |
| download | muhqs-game-6bfb6e5dfc3c944fe8b9b5b86cccd8a51084f402.tar.gz muhqs-game-6bfb6e5dfc3c944fe8b9b5b86cccd8a51084f402.zip | |
hide the store after declaring the buy action
Diffstat (limited to 'go/client')
| -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 |
