feat: 턴 선택기를 재 작성 (#211)

- select form에서 유사 dialog 버튼 방식으로 변경
  - 카테고리마다 페이지 이동
- 일반 모드 / 고급 모드 분리
- 일반 모드에서는 턴별 즉시 설정
- 고급 모드에서는 드래그를 포함한 각종 기능 제공
  - 최근 실행 턴
  - 잘라내기, 복사하기, 붙여넣기
  - 반복하기
  - 비우기
  - 지우고 당기기, 뒤로 밀기
  - 보관하기, 보관한 턴 사용하기

Co-authored-by: Hide_D <hided62@gmail.com>
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/211
Co-authored-by: hide_d <hided62@gmail.com>
Co-committed-by: hide_d <hided62@gmail.com>
This commit was merged in pull request #211.
This commit is contained in:
2022-03-23 20:13:27 +09:00
parent f6c59ad1f5
commit 75a4377e13
18 changed files with 1979 additions and 586 deletions
+23 -5
View File
@@ -9,11 +9,20 @@ import { type App, createApp } from 'vue';
import { auto500px } from './util/auto500px';
import { isString } from 'lodash';
import { type Args, testSubmitArgs } from './processing/args';
import { SammoAPI, type ValidResponse } from './SammoAPI';
import { SammoAPI } from './SammoAPI';
import { StoredActionsHelper } from './util/StoredActionsHelper';
import type { ReserveCommandResponse } from './defs';
declare const turnList: number[];
declare const staticValues: {
serverNick: string,
turnList: number[],
mapName: string,
unitSet: string,
};
async function submitCommand<T extends ValidResponse>(isChiefTurn: boolean, turnList: number[], action: string, arg: Args): Promise<T> {
const { turnList } = staticValues;
async function submitCommand<T extends ReserveCommandResponse>(isChiefTurn: boolean, turnList: number[], action: string, arg: Args): Promise<T> {
const targetAPI = isChiefTurn ? SammoAPI.NationCommand.ReserveCommand : SammoAPI.Command.ReserveCommand;
try {
@@ -22,19 +31,28 @@ async function submitCommand<T extends ValidResponse>(isChiefTurn: boolean, turn
throw new TypeError(`Invalied Type ${testResult[0]}, ${testResult[2]} should be ${testResult[1]}`);
}
console.log('trySubmit', arg);
const response = await targetAPI({
const responseP = targetAPI<T>({
action,
turnList,
arg,
});
const storedActionsHelper = new StoredActionsHelper(staticValues.serverNick, isChiefTurn?'nation':'general', staticValues.mapName, staticValues.unitSet);
const response = await responseP;
storedActionsHelper.pushRecentActions({
action,
brief: response.brief,
arg: (arg??{}),
})
if (!isChiefTurn) {
window.location.href = './';
} else {
window.location.href = 'v_chiefCenter.php';
}
return response as T;
return response;
}
catch (e) {
console.error(e);