|
3 | 3 | <span v-b-tooltip.hover
|
4 | 4 | :title="'Prepare for a kickoff (' + Object.keys(keymapKickoff)[0] + ')'">
|
5 | 5 | <b-button v-hotkey="keymapKickoff"
|
6 |
| - v-on:click="send('kickoff')" |
| 6 | + ref="btnKickoff" |
| 7 | + v-on:click="sendKickoff" |
7 | 8 | v-bind:disabled="halted || running || preparing">
|
8 | 9 | Kickoff
|
9 | 10 | </b-button>
|
10 | 11 | </span>
|
11 | 12 | <span v-b-tooltip.hover
|
12 | 13 | :title="'Perform direct kick (corner and goal kicks) (' + Object.keys(keymapDirect)[0] + ')'">
|
13 | 14 | <b-button v-hotkey="keymapDirect"
|
14 |
| - v-on:click="send('direct')" |
| 15 | + ref="btnDirect" |
| 16 | + v-on:click="sendDirect" |
15 | 17 | v-bind:disabled="halted || running || preparing || !nonPausedStage">
|
16 | 18 | Direct
|
17 | 19 | </b-button>
|
18 | 20 | </span>
|
19 | 21 | <span v-b-tooltip.hover
|
20 | 22 | :title="'Perform indirect kick (throw-in) (' + Object.keys(keymapIndirect)[0] + ')'">
|
21 | 23 | <b-button v-hotkey="keymapIndirect"
|
22 |
| - v-on:click="send('indirect')" |
| 24 | + ref="btnIndirect" |
| 25 | + v-on:click="sendIndirect" |
23 | 26 | v-bind:disabled="halted || running || preparing || !nonPausedStage">
|
24 | 27 | Indirect
|
25 | 28 | </b-button>
|
26 | 29 | </span>
|
27 | 30 | <span v-b-tooltip.hover
|
28 | 31 | title="Prepare for a penalty kick">
|
29 |
| - <b-button v-on:click="send('penalty')" |
| 32 | + <b-button v-on:click="sendPenalty" |
30 | 33 | v-bind:disabled="halted || running || preparing || !nonPausedStage">
|
31 | 34 | Penalty
|
32 | 35 | </b-button>
|
|
38 | 41 | <b-button v-on:click="addGoal">
|
39 | 42 | Goal
|
40 | 43 | </b-button>
|
41 |
| - <b-button v-on:click="addYellowCard" |
42 |
| - v-hotkey="keymapYellowCard"> |
| 44 | + <b-button v-on:click="addYellowCard"> |
43 | 45 | Yellow Card
|
44 | 46 | </b-button>
|
45 | 47 |
|
|
77 | 79 | addGoal: function () {
|
78 | 80 | this.$socket.sendObj({'modify': {'forTeam': this.teamColor, 'goals': this.teamState.goals + 1}})
|
79 | 81 | },
|
| 82 | + sendKickoff() { |
| 83 | + if (!this.$refs.btnKickoff.disabled) { |
| 84 | + this.send('kickoff') |
| 85 | + } |
| 86 | + }, |
| 87 | + sendDirect() { |
| 88 | + if (!this.$refs.btnDirect.disabled) { |
| 89 | + this.send('direct') |
| 90 | + } |
| 91 | + }, |
| 92 | + sendIndirect() { |
| 93 | + if (!this.$refs.btnIndirect.disabled) { |
| 94 | + this.send('indirect') |
| 95 | + } |
| 96 | + }, |
| 97 | + sendPenalty() { |
| 98 | + this.send('penalty') |
| 99 | + }, |
80 | 100 | },
|
81 | 101 | computed: {
|
82 | 102 | teamState: function () {
|
83 | 103 | return this.$store.state.refBoxState.teamState[this.teamColor]
|
84 | 104 | },
|
85 | 105 | keymapKickoff() {
|
86 | 106 | if (this.teamColor === 'Yellow') {
|
87 |
| - return {'numpad 1': () => this.send('kickoff')}; |
| 107 | + return {'numpad 1': this.sendKickoff}; |
88 | 108 | } else if (this.teamColor === 'Blue') {
|
89 |
| - return {'numpad 3': () => this.send('kickoff')}; |
| 109 | + return {'numpad 3': this.sendKickoff}; |
90 | 110 | }
|
91 | 111 | },
|
92 | 112 | keymapDirect() {
|
93 | 113 | if (this.teamColor === 'Yellow') {
|
94 |
| - return {'numpad 7': () => this.send('direct')}; |
| 114 | + return {'numpad 7': this.sendDirect}; |
95 | 115 | } else if (this.teamColor === 'Blue') {
|
96 |
| - return {'numpad 9': () => this.send('direct')}; |
| 116 | + return {'numpad 9': this.sendDirect}; |
97 | 117 | }
|
98 | 118 | },
|
99 | 119 | keymapIndirect() {
|
100 | 120 | if (this.teamColor === 'Yellow') {
|
101 |
| - return {'numpad 4': () => this.send('indirect')}; |
| 121 | + return {'numpad 4': this.sendIndirect}; |
102 | 122 | } else if (this.teamColor === 'Blue') {
|
103 |
| - return {'numpad 6': () => this.send('indirect')}; |
104 |
| - } |
105 |
| - }, |
106 |
| - keymapYellowCard() { |
107 |
| - switch (this.teamColor) { |
108 |
| - case 'Yellow': |
109 |
| - return {'numpad 4': this.addYellowCard}; |
110 |
| - case 'Blue': |
111 |
| - return {'numpad 6': this.addYellowCard}; |
| 123 | + return {'numpad 6': this.sendIndirect}; |
112 | 124 | }
|
113 | 125 | },
|
114 | 126 | state() {
|
|
0 commit comments