diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-25 23:08:47 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:52 +0100 |
| commit | db469da2704f703d15e81f5e44ba157c10a21e77 (patch) | |
| tree | 2f5b21600ed07b900b141aa910a9b2d6a1dfd4a3 /go/client/game.go | |
| parent | 7f271376d192b95e072750411970768782e75a63 (diff) | |
| download | muhqs-game-db469da2704f703d15e81f5e44ba157c10a21e77.tar.gz muhqs-game-db469da2704f703d15e81f5e44ba157c10a21e77.zip | |
intermediate commit
* Implement move artifact action
* Fix widget update memory leak
* update the highlights not during on each frame
* do not update the unchanged label of a button
* Allow to exit the game by pressing 'q'
* Implement some cards from the magic set
* Improve permanent formatting
* Some tweaks to UnitAI code
Diffstat (limited to 'go/client/game.go')
| -rw-r--r-- | go/client/game.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/go/client/game.go b/go/client/game.go index 8dc69b25..bbfb6643 100644 --- a/go/client/game.go +++ b/go/client/game.go @@ -32,6 +32,8 @@ const ( ) type Game struct { + app *app + selectedObject interface{} handLayer *ui.HandView @@ -58,6 +60,7 @@ type Game struct { func newGame(app *app) *Game { g := &Game{ + app: app, Collection: ui.Collection{ Width: app.windowWidth, Height: app.windowHeight, @@ -110,6 +113,7 @@ func (g *Game) addActivePlayer(name string, deckList string) *Game { func (g *Game) addPrompt(action game.Action, prompt string) { g.prompt = ui.NewPrompt(g.Height/2, g.Width, action, prompt) g.AddWidget(g.prompt) + g.updateHighlight() } func (g *Game) getPlayer(name string) *game.Player { @@ -289,6 +293,7 @@ func (g *Game) progressPrompt() { targets := a.Targets() if targets.RequireSelection() { targets.Next() + g.updateHighlight() } else { g.declareAction(a) g.removePrompt() @@ -515,12 +520,16 @@ func (g *Game) Update() error { if err := g.prompt.Add(obj); err != nil { log.Println("Not added", obj, "to active prompt:", err) g.handleSelection(obj, x, y) + } else { + g.updateHighlight() } } else { g.handleSelection(obj, x, y) } } else if inpututil.IsKeyJustPressed(ebiten.KeySpace) { g.passButton.Click(0, 0) + } else if inpututil.IsKeyJustPressed(ebiten.KeyQ) { + return fmt.Errorf("Exit") } else if inpututil.IsKeyJustPressed(ebiten.KeyEscape) { g.removeChoice() g.selectedObject = nil @@ -541,7 +550,6 @@ func (g *Game) Update() error { return err } - g.updateHighlight() g.updatePassButton() return nil } |
