aboutsummaryrefslogtreecommitdiff
path: root/go/client
diff options
context:
space:
mode:
Diffstat (limited to 'go/client')
-rw-r--r--go/client/game.go32
-rw-r--r--go/client/keybindings.go4
2 files changed, 26 insertions, 10 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)
diff --git a/go/client/keybindings.go b/go/client/keybindings.go
index 2bfc52c7..ebc66c22 100644
--- a/go/client/keybindings.go
+++ b/go/client/keybindings.go
@@ -67,7 +67,9 @@ func selection(g *Game, x, y int) bool {
if g.prompt != nil {
if err := g.prompt.Add(obj); err != nil {
log.Println("Not added", obj, "to active prompt:", err)
- g.handleSelection(obj, x, y)
+ if g.prompt.Cancelable() {
+ g.handleSelection(obj, x, y)
+ }
} else {
g.updateHighlight()
}