feat(WIP): 턴 조작기 고급 기능

- 잘라내기, 복사하기, 붙여넣기
- 반복하기
- 비우기
- 지우고 당기기, 뒤로 밀기
This commit is contained in:
2022-03-23 20:12:59 +09:00
parent bcf52e0460
commit 39ac64b837
3 changed files with 252 additions and 37 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ import { ref } from 'vue';
export class StoredActionsHelper {
public readonly recentActions = ref<TurnObj[]>([]);
public readonly storedActions = ref(new Map<string, Record<number, TurnObj>>());
public readonly storedActions = ref(new Map<string, [number[], TurnObj][]>());
public readonly recentActionsKey: string;
public readonly storedActionsKey: string;
@@ -32,11 +32,11 @@ export class StoredActionsHelper {
}
loadStoredActions() {
const rawValue: [string, Record<number, TurnObj>][] = JSON.parse(localStorage.getItem(this.storedActionsKey) ?? '[]');
const rawValue: [string, [number[], TurnObj][]][] = JSON.parse(localStorage.getItem(this.storedActionsKey) ?? '[]');
this.storedActions.value = new Map(rawValue);
}
setStoredActions(actionKey: string, actions: Record<number, TurnObj>) {
setStoredActions(actionKey: string, actions: [number[], TurnObj][]) {
this.storedActions.value.set(actionKey, actions);
this.saveStoredActions();
}