diff options
Diffstat (limited to 'go/client/game.go')
| -rw-r--r-- | go/client/game.go | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/go/client/game.go b/go/client/game.go index 62e1d79c..0870450e 100644 --- a/go/client/game.go +++ b/go/client/game.go @@ -93,13 +93,13 @@ func newGame(app *app, gameState game.State) *Game { } }) - g.resetButton = ui.NewSimpleButton(g.Width-PASS_BUTTON_WIDTH, - g.Height-DEFAULT_BUTTON_HEIGHT, - PASS_BUTTON_WIDTH, + g.resetButton = ui.NewRoundSimpleButton( + 10, + g.Height/2+DEFAULT_BUTTON_HEIGHT/2, DEFAULT_BUTTON_HEIGHT, - "cancel", + "X", func(*ui.SimpleButton) { - reset(g) + g.reset() }) g.stackBuffer = ui.NewBuffer(g.Width-STACK_BUFFER_WIDTH, g.passButton.Y-400, @@ -236,7 +236,7 @@ func (g *Game) addPermActionChoice(perm game.Permanent, x, y int) { func (g *Game) declareOrPromptTargets(a game.Action) { if a.Targets() != nil && a.Targets().RequireSelection() { - g.addPrompt(a, fmt.Sprintf("Select targets for %v", a)) + g.addCancelablePrompt(a, fmt.Sprintf("Select targets for %v", a)) } else { g.declareAction(a) } @@ -299,13 +299,27 @@ func (g *Game) removeChoice() { g.choice = nil } +func (g *Game) addCancelablePrompt(action game.Action, prompt string) { + g._addPrompt(action, prompt, true) +} + func (g *Game) addPrompt(action game.Action, prompt string) { + g._addPrompt(action, prompt, false) +} + +func (g *Game) _addPrompt(action game.Action, prompt string, cancelable bool) { if g.prompt != nil { g.removePrompt() } - g.prompt = ui.NewPrompt(g.Height/2, g.Width, action, prompt) + if cancelable { + g.prompt = ui.NewCancelablePrompt(g.Height/2, g.Width, action, prompt) + } else { + g.prompt = ui.NewPrompt(g.Height/2, g.Width, action, prompt) + } g.AddWidget(g.prompt) - g.AddWidget(g.resetButton) + if cancelable { + g.show(g.resetButton) + } g.updateHighlight() } @@ -486,7 +500,7 @@ func (g *Game) findObjectAt(x, y int) interface{} { func (g *Game) progressPlayAction(a *game.PlayAction) { targets := a.Targets() if targets != nil && targets.AllowSelection() { - g.addPrompt(a, fmt.Sprintf("Select targets to play %v", a.Card.Name)) + g.addCancelablePrompt(a, fmt.Sprintf("Select targets to play %v", a.Card.Name)) g.handLayer.HighlightCard(a.Card, ui.HighlightSelectionColor) } else { g.declareAction(a) |
