Skip to content

Commit 31982a6

Browse files
committed
[refactoring] Put normalStart into nextCommand, use nextCommand for UI
1 parent 3ef9b58 commit 31982a6

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

internal/app/controller/engine.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,15 @@ func (e *Engine) Continue() {
104104
e.SendCommand(CommandHalt, "")
105105
} else if e.State.NextCommand != CommandUnknown {
106106
e.SendCommand(e.State.NextCommand, e.State.NextCommandFor)
107-
} else if e.State.Command == CommandPenalty || e.State.Command == CommandKickoff {
108-
e.SendCommand(CommandNormalStart, "")
109107
}
110108
}
111109

112110
func (e *Engine) updateNextCommand() {
111+
if e.State.Command == CommandPenalty || e.State.Command == CommandKickoff {
112+
e.State.NextCommand = CommandNormalStart
113+
e.State.NextCommandFor = ""
114+
return
115+
}
113116
primaryEvent := e.State.PrimaryGameEvent()
114117
if primaryEvent == nil {
115118
return

src/components/GameState.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<template>
22
<div>
3+
<span v-b-tooltip.hover title="Next command">
4+
<span v-if="state.nextCommand !== ''"
5+
:class="{'team-blue': state.nextCommandFor === 'Blue', 'team-yellow': state.nextCommandFor === 'Yellow'}">
6+
{{state.nextCommand}}
7+
</span>
8+
<span v-if="state.nextCommand === ''">-</span>
9+
</span>
10+
|
311
<span v-b-tooltip.hover title="Last game event">
412
<span v-if="state.gameEvents.length > 0">{{state.gameEvents[0].type}}</span>
513
<span v-if="state.gameEvents.length === 0">-</span>
@@ -8,13 +16,6 @@
816
v-b-tooltip.hover title="Additional game events">
917
(+{{state.gameEvents.length-1}})
1018
</span>
11-
<span v-if="state.nextCommand !== ''"
12-
v-b-tooltip.hover title="Next command">
13-
->
14-
<span :class="{'team-blue': state.nextCommandFor === 'Blue', 'team-yellow': state.nextCommandFor === 'Yellow'}">
15-
{{state.nextCommand}}
16-
</span>
17-
</span>
1819
|
1920
<span v-b-tooltip.hover title="The current stage of the game">
2021
{{state.stage}}

src/components/control/ControlGeneral.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@
135135
stopped() {
136136
return this.state.command === 'stop';
137137
},
138-
ballPlacement() {
139-
return this.state.command === 'ballPlacement';
140-
},
141138
prepareSth() {
142139
return this.state.command === 'kickoff' || this.state.command === 'penalty';
143140
},
@@ -151,14 +148,11 @@
151148
return isNonPausedStage(this.$store.state.refBoxState)
152149
|| isPreStage(this.$store.state.refBoxState);
153150
},
154-
gameEventPresent() {
155-
return this.state.gameEvents.length > 0;
156-
},
157151
autoContinue() {
158152
return this.state.autoContinue;
159153
},
160154
continuePossible() {
161-
return (this.gameEventPresent && (this.stopped || this.ballPlacement)) || this.prepareSth;
155+
return this.state.nextCommand !== '';
162156
}
163157
}
164158
}

0 commit comments

Comments
 (0)