Skip to content

Commit 59f5c43

Browse files
committed
Highlight robot substitution
1 parent 73e4a70 commit 59f5c43

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

src/components/MatchStatus.vue

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="match-status">
33
<div>
4-
<div :class="{'highlight-command': true, 'stop-command': isStop, 'halt-command': isHalt}">
4+
<div :class="{'highlight-command': true, 'stop-command': isStop, 'halt-command': isHalt, 'robot-substitution': isRobotSubstitution}">
55
<div class="stage">{{stage}}</div>
66

77
<span class="score">
@@ -32,7 +32,7 @@
3232
</template>
3333

3434
<script>
35-
import {Referee} from "@/sslProto"
35+
import {Referee, GameEvent} from "@/sslProto"
3636
import {mapStageToText, mapCommandToText} from "@/texts";
3737
import PowerPlay from "./PowerPlay";
3838
@@ -44,15 +44,29 @@
4444
return this.$store.state.refereeMsg;
4545
},
4646
isHalt() {
47-
return this.refereeMessage.command === Referee.Command.HALT;
47+
return !this.isRobotSubstitution && this.refereeMessage.command === Referee.Command.HALT;
4848
},
4949
isStop() {
50-
return this.refereeMessage.command === Referee.Command.STOP;
50+
return !this.isRobotSubstitution && this.refereeMessage.command === Referee.Command.STOP;
51+
},
52+
isRobotSubstitution() {
53+
if (this.refereeMessage.command !== Referee.Command.HALT) {
54+
return false;
55+
}
56+
for(const gameEvent of this.refereeMessage.gameEvents) {
57+
if (gameEvent.type === GameEvent.Type.BOT_SUBSTITUTION) {
58+
return true;
59+
}
60+
}
61+
return false;
5162
},
5263
stage() {
5364
return mapStageToText(this.refereeMessage.stage);
5465
},
5566
gameState() {
67+
if (this.isRobotSubstitution) {
68+
return "Robot Substitution"
69+
}
5670
return mapCommandToText(this.refereeMessage.command);
5771
},
5872
isBallPlacement() {
@@ -165,4 +179,8 @@
165179
background-color: #EE0022;
166180
}
167181
182+
.highlight-command.robot-substitution {
183+
background-color: #0053ee;
184+
}
185+
168186
</style>

0 commit comments

Comments
 (0)