From 778487d25a79721539cea1e47331e3c2f985c8cc Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 6 Aug 2025 18:02:44 +0200 Subject: rework hover detection --- go/client/game.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'go/client') diff --git a/go/client/game.go b/go/client/game.go index d525a49c..f726c95d 100644 --- a/go/client/game.go +++ b/go/client/game.go @@ -122,7 +122,7 @@ func (g *Game) loadMap(mapName string) *Game { } func (g *Game) initMapUi() { - g.mapView = ui.NewMapView(g.gameState) + g.mapView = ui.NewMapView(g.gameState, &g.Collection) g.AddWidget(g.mapView) storeTiles := g.gameState.Map().FilterTiles(func(t *game.Tile) bool { return t.Type == game.TileTypes.Store }) @@ -179,7 +179,7 @@ func (g *Game) initPlayerUi(player *game.Player) *Game { x = g.discardPileButton.X + g.discardPileButton.Width/2 y = g.Height - DEFAULT_BUTTON_HEIGHT - g.discardPileView = ui.NewPocList(x, y, g.activePlayer().DiscardPile) + g.discardPileView = ui.NewPocList(x, y, g.activePlayer().DiscardPile, &g.Collection) if !g.storesOnMap { x = g.stateBar.Width + g.discardPileButton.Width @@ -199,7 +199,7 @@ func (g *Game) initPlayerUi(player *game.Player) *Game { x = g.storeButton.X + g.storeButton.Width/2 y = g.Height - DEFAULT_BUTTON_HEIGHT - g.storeView = ui.NewPocList(x, y, g.activePlayer().Store) + g.storeView = ui.NewPocList(x, y, g.activePlayer().Store, &g.Collection) } return g @@ -461,6 +461,10 @@ func (g *Game) updateButtons() { g.passButton.UpdateLabel(passButtonLabel) } +func (g *Game) ResetHover() { + ui.AppendInput(ui.InputEvent{ui.HoverEnd, -1, -1, nil}) +} + func (g *Game) reset() { g.removeChoice() g.selectedObject = nil @@ -582,7 +586,7 @@ func (g *Game) handleSelection(obj any, x, y int) { g.hideStore() } - g.storeView = ui.NewPocList(x, y, g.gameState.Map().StoreOn(obj.Position)) + g.storeView = ui.NewPocList(x, y, g.gameState.Map().StoreOn(obj.Position), &g.Collection) g.showStore() } -- cgit v1.2.3