feat: 턴 선택기에서 '턴' 부분 선택 시 커맨드로 선택

This commit is contained in:
2021-12-26 23:57:20 +09:00
parent c3f1457fce
commit 8ccedb598b
2 changed files with 24 additions and 0 deletions
+12
View File
@@ -143,6 +143,7 @@
)" )"
:key="turnIdx" :key="turnIdx"
class="turn_pad center" class="turn_pad center"
@click="chooseCommand(turnObj.action)"
> >
<span <span
class="turn_text" class="turn_text"
@@ -547,6 +548,9 @@ export default defineComponent({
this.searchModeOn = searchModeOn; this.searchModeOn = searchModeOn;
localStorage.setItem(searchModeKey, searchModeOn ? "1" : "0"); localStorage.setItem(searchModeKey, searchModeOn ? "1" : "0");
}, },
chooseCommand(val: string){
this.selectedCommand = this.invCommandMap[val];
}
}, },
data() { data() {
const serverNowObj = parseTime(serverNow); const serverNowObj = parseTime(serverNow);
@@ -613,12 +617,20 @@ export default defineComponent({
const isDragSingle = ref(false); const isDragSingle = ref(false);
const isDragToggle = ref(false); const isDragToggle = ref(false);
const invCommandMap: Record<string, commandItem> = {};
for(const category of commandList){
for(const command of category.values){
invCommandMap[command.value] = command;
}
}
return { return {
isDragSingle, isDragSingle,
isDragToggle, isDragToggle,
flippedMaxTurn, flippedMaxTurn,
viewMaxTurn, viewMaxTurn,
rowGridStyle, rowGridStyle,
invCommandMap,
}; };
}, },
mounted() { mounted() {
@@ -63,6 +63,7 @@
v-for="(turnObj, turnIdx) in reservedCommandList" v-for="(turnObj, turnIdx) in reservedCommandList"
:key="turnIdx" :key="turnIdx"
class="turn_pad center" class="turn_pad center"
@click="chooseCommand(turnObj.action)"
> >
<span <span
class="turn_text" class="turn_text"
@@ -398,6 +399,9 @@ export default defineComponent({
this.searchModeOn = searchModeOn; this.searchModeOn = searchModeOn;
localStorage.setItem(searchModeKey, searchModeOn ? "1" : "0"); localStorage.setItem(searchModeKey, searchModeOn ? "1" : "0");
}, },
chooseCommand(val: string){
this.selectedCommand = this.invCommandMap[val];
},
}, },
data() { data() {
const serverNowObj = parseTime(this.date); const serverNowObj = parseTime(this.date);
@@ -427,6 +431,13 @@ export default defineComponent({
} }
} }
const invCommandMap: Record<string, commandItem> = {};
for(const category of this.commandList){
for(const command of category.values){
invCommandMap[command.value] = command;
}
}
const searchModeOn = (localStorage.getItem(searchModeKey) ?? "0") != "0"; const searchModeOn = (localStorage.getItem(searchModeKey) ?? "0") != "0";
const emptyTurn: TurnObjWithTime[] = Array.from<TurnObjWithTime>({ const emptyTurn: TurnObjWithTime[] = Array.from<TurnObjWithTime>({
@@ -461,6 +472,7 @@ export default defineComponent({
rowGridStyle, rowGridStyle,
isDragSingle: false, isDragSingle: false,
isDragToggle: false, isDragToggle: false,
invCommandMap,
}; };
}, },
mounted() { mounted() {