diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-08 17:50:10 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-02-08 17:50:10 +0100 |
| commit | 23ecef83b28e9b51187fe34032e9558cf0eb5e05 (patch) | |
| tree | c55d54dd209509e376a4965782b9161243c1fd7d /go/client | |
| parent | bd558df11dbe60c0bd310b95b26bf17ba06cab35 (diff) | |
| download | muhqs-game-rework-targets.tar.gz muhqs-game-rework-targets.zip | |
intermediate commitrework-targets
Diffstat (limited to 'go/client')
| -rw-r--r-- | go/client/game.go | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/go/client/game.go b/go/client/game.go index 91e7e365..f2a035d3 100644 --- a/go/client/game.go +++ b/go/client/game.go @@ -153,7 +153,7 @@ func (g *Game) getPlayer(name string) *game.Player { func (g *Game) initPlayerUi(player *game.Player) *Game { g.activePlayer = player - g.playerCtrl = game.NewChanPlayerControl() + g.playerCtrl = game.NewChanPlayerControl(player) player.Ctrl = g.playerCtrl var x, y int @@ -338,6 +338,7 @@ func (g *Game) passPriority() { func (g *Game) handlePlayerNotifications() { n := g.playerCtrl.RecvNotification() for n != nil { + log.Println("Received notification", n) switch n.Notification { case game.PriorityNotification: g.showPassButton() @@ -355,16 +356,15 @@ func (g *Game) handlePlayerNotifications() { g.stackBuffer.RemoveLast() g.mapView.ForceRedraw() - case game.BuyPrompt: - if !g.storesOnMap { - g.showStore() + case game.TargetSelectionPrompt: + ctx := n.Context.(game.TargetSelectionCtx) + if _, ok := ctx.Action.(*game.BuyAction); ok { + if !g.storesOnMap { + g.showStore() + } } - case game.HandCardSelectionPrompt: - ctx := n.Context.([]int) - min, max := ctx[0], ctx[1] - promptTxt := fmt.Sprintf("Select between %d and %d hand cards", min, max) - g.prompt = ui.NewHandCardPrompt(g.height/2, g.width, promptTxt) + g.prompt = ui.NewPrompt(g.height/2, g.width, ctx.Action, ctx.Prompt) g.addWidget(g.prompt) g.showPassButton() } @@ -426,12 +426,6 @@ func (g *Game) handleSelection(obj interface{}, x, y int) { g.selectedObject = game.NewPlayAction(g.activePlayer, obj.C) g.handLayer.HighlightCard(obj.C) - case *game.Card: - if g.gameState.IsActivePlayer(g.activePlayer) && - g.gameState.ActivePhase == game.Phases.BuyPhase { - g.declareAction(game.NewBuyAction(g.activePlayer, obj)) - } - default: log.Fatalf("Object of type %T not handled", obj) } |
