Skip to content

Commit 082e294

Browse files
committed
[feature] Add a button to end the game immediately
1 parent e7dd7fc commit 082e294

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

internal/app/controller/engine.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ func (e *Engine) processStage(s *EventStage) error {
295295
e.updateStage(e.State.Stage.Next())
296296
} else if s.StageOperation == StagePrevious {
297297
e.updateStage(e.State.Stage.Previous())
298+
} else if s.StageOperation == StageEndGame {
299+
e.updateStage(StagePostGame)
298300
} else {
299301
return errors.Errorf("Unknown stage operation: %v", s.StageOperation)
300302
}

internal/app/controller/events.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const (
3535
StageNext StageOperation = "next"
3636
// StagePrevious previous stage
3737
StagePrevious StageOperation = "previous"
38+
// StageEndGame ends the game
39+
StageEndGame StageOperation = "endGame"
3840
)
3941

4042
// TriggerType is something that can be triggered

src/components/control/ControlMatch.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
:disabled="forbidMatchControls || noNextStage">
3030
Next Stage
3131
</b-button>
32+
<b-button v-b-tooltip.hover title="Finish the game"
33+
v-on:click="endGame"
34+
:disabled="forbidMatchControls || noNextStage">
35+
End of Game
36+
</b-button>
3237
</div>
3338
</template>
3439

@@ -66,6 +71,11 @@
6671
'stage': {'stageOperation': 'next'}
6772
})
6873
},
74+
endGame: function () {
75+
this.$socket.sendObj({
76+
'stage': {'stageOperation': 'endGame'}
77+
})
78+
},
6979
},
7080
computed: {
7181
state() {

0 commit comments

Comments
 (0)