diff --git a/hwe/ts/ReservedCommand.vue b/hwe/ts/ReservedCommand.vue index c0f2a5a7..00dcabcb 100644 --- a/hwe/ts/ReservedCommand.vue +++ b/hwe/ts/ReservedCommand.vue @@ -58,15 +58,15 @@ :key="turnIdx" height="28" :id="`command_${turnIdx}`" - :class="pressed[turnIdx] ? 'pressed' : ''" + :class="turnList.has(turnIdx) ? 'pressed' : ''" >
this.maxTurn) { - this.pressed.fill(false); + if (this.turnList.size * 3 > this.maxTurn) { + this.turnList.clear(); } else { - this.pressed.fill(true); + for (let i = 0; i < this.maxTurn; i++) { + this.turnList.add(i); + } } }, selectStep(begin: number, step: number) { + this.turnList.clear(); for (const idx of range(0, maxTurn)) { if ((idx - begin) % step == 0) { - this.pressed[idx] = true; - } else { - this.pressed[idx] = false; + this.turnList.add(idx); } } }, @@ -439,12 +437,11 @@ export default defineComponent({ this.timeDiff = timeDiff; }, async reserveCommand() { - const turnList: number[] = []; - for (const [turnIdx, pressed] of this.pressed.entries()) { - if (!pressed) { - continue; - } - turnList.push(turnIdx); + let turnList: number[]; + if (this.turnList.size == 0) { + turnList = Array.from(this.prevTurnList.values()); + } else { + turnList = Array.from(this.turnList.values()); } if (turnList.length == 0) { @@ -469,7 +466,14 @@ export default defineComponent({ turnList, action: commandName, }); - this.pressed.fill(false); + + if (this.turnList.size > 0) { + this.prevTurnList.clear(); + for (const v of this.turnList) { + this.prevTurnList.add(v); + } + this.turnList.clear(); + } } catch (e) { console.error(e); alert(`실패했습니다: ${e}`); @@ -492,9 +496,6 @@ export default defineComponent({ this.updateNow(); }, 1000 - serverNowObj.getMilliseconds()); - const pressed = Array.from({ length: maxTurn }).fill(false); - //pressed[0] = true; - const selectedCommand = commandList[0].values[0]; for (const subCategory of commandList) { for (const command of subCategory.values) { @@ -521,6 +522,9 @@ export default defineComponent({ time: "", }); + const prevTurnList = new Set([0]); + const turnList = new Set(); + return { maxTurn, flippedMaxTurn: 16, @@ -529,7 +533,8 @@ export default defineComponent({ commandList, serverNow: formatTime(serverNowObj, "HH:mm:ss"), timeDiff, - pressed, + prevTurnList, + turnList, selectedCommand, reservedCommandList: emptyTurn, autorun_limit: null as null | number,