From 6bfb6e5dfc3c944fe8b9b5b86cccd8a51084f402 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 22 Jul 2025 12:53:25 -0400 Subject: hide the store after declaring the buy action --- go/client/game.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3