From 28defc1cad1a96a2954780efa01396db8bb2fe31 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 17 Feb 2023 00:29:26 +0100 Subject: implement unit and artifact switch action Simplify the Choice Widget and make it a TextBox variant. Drive-by fixes: * ui.Collection: prioritize newer widgets during active widget selection * game.FullAction: fix incorrect cost function. Full actions cost all available actions. Also fix the cost check --- go/client/game.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'go/client') diff --git a/go/client/game.go b/go/client/game.go index 8447e452..32fb5f2f 100644 --- a/go/client/game.go +++ b/go/client/game.go @@ -409,18 +409,12 @@ func (g *Game) highlightTargets() { func (g *Game) Update() error { g.handlePlayerNotifications() - - if err := g.Collection.Update(); err != nil { - return nil - } - - x, y := ebiten.CursorPosition() - - obj := g.findObjectAt(x, y) - g.highlightTargets() if inpututil.IsMouseButtonJustPressed(ebiten.MouseButtonLeft) { + x, y := ebiten.CursorPosition() + obj := g.findObjectAt(x, y) + if g.prompt != nil { if err := g.prompt.Add(obj); err == nil { g.AddHighlight(obj) @@ -445,7 +439,8 @@ func (g *Game) Update() error { g.prompt.ClearSelections() } } - return nil + + return g.Collection.Update() } func (g *Game) Draw(screen *ebiten.Image) { -- cgit v1.2.3