mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-07-19 03:41:47 +08:00
Compare commits
7 Commits
2d301cf0d0
...
e3edac3d55
Author | SHA1 | Date | |
---|---|---|---|
e3edac3d55 | |||
a165e97027 | |||
a2848679c8 | |||
a2e0d818ea | |||
dfd44e2083 | |||
c2cbc107a5 | |||
5adeff1a11 |
@ -435,11 +435,6 @@ gameKey
|
|||||||
})
|
})
|
||||||
// #region 存档界面
|
// #region 存档界面
|
||||||
.group('@ui_save', 'save')
|
.group('@ui_save', 'save')
|
||||||
.register({
|
|
||||||
id: '@save_exit',
|
|
||||||
name: '退出存档界面',
|
|
||||||
defaults: KeyCode.KeyS
|
|
||||||
})
|
|
||||||
.register({
|
.register({
|
||||||
id: '@save_pageUp',
|
id: '@save_pageUp',
|
||||||
name: '存档向后翻页',
|
name: '存档向后翻页',
|
||||||
@ -485,9 +480,6 @@ gameKey
|
|||||||
.realize('book', () => {
|
.realize('book', () => {
|
||||||
core.openBook(true);
|
core.openBook(true);
|
||||||
})
|
})
|
||||||
.realize('load', () => {
|
|
||||||
core.load(true);
|
|
||||||
})
|
|
||||||
.realize('toolbox', () => {
|
.realize('toolbox', () => {
|
||||||
core.openToolbox(true);
|
core.openToolbox(true);
|
||||||
})
|
})
|
||||||
@ -497,9 +489,6 @@ gameKey
|
|||||||
.realize('fly', () => {
|
.realize('fly', () => {
|
||||||
core.useFly(true);
|
core.useFly(true);
|
||||||
})
|
})
|
||||||
.realize('menu', () => {
|
|
||||||
core.openSettings(true);
|
|
||||||
})
|
|
||||||
.realize('replay', () => {
|
.realize('replay', () => {
|
||||||
core.ui._drawReplay();
|
core.ui._drawReplay();
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
import { gameKey } from '@motajs/system-action';
|
import { gameKey } from '@motajs/system-action';
|
||||||
import { MAIN_WIDTH, MAIN_HEIGHT } from './shared';
|
import { MAIN_WIDTH, MAIN_HEIGHT } from './shared';
|
||||||
import { saveSave, mainUIController, openStatistics } from './ui';
|
import {
|
||||||
|
saveSave,
|
||||||
|
mainUIController,
|
||||||
|
openStatistics,
|
||||||
|
saveLoad,
|
||||||
|
openSettings
|
||||||
|
} from './ui';
|
||||||
|
|
||||||
export function createAction() {
|
export function createAction() {
|
||||||
gameKey
|
gameKey
|
||||||
@ -9,5 +15,11 @@ export function createAction() {
|
|||||||
})
|
})
|
||||||
.realize('statistics', () => {
|
.realize('statistics', () => {
|
||||||
openStatistics(mainUIController);
|
openStatistics(mainUIController);
|
||||||
|
})
|
||||||
|
.realize('load', () => {
|
||||||
|
saveLoad(mainUIController, [0, 0, MAIN_WIDTH, MAIN_HEIGHT]);
|
||||||
|
})
|
||||||
|
.realize('menu', () => {
|
||||||
|
openSettings(mainUIController, [420, 240, 240, 400, 0.5, 0.5]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ export const ConfirmBox = defineComponent<
|
|||||||
<Background
|
<Background
|
||||||
loc={[0, 0, props.width, height.value]}
|
loc={[0, 0, props.width, height.value]}
|
||||||
winskin={props.winskin}
|
winskin={props.winskin}
|
||||||
color={props.color}
|
color={props.color ?? '#333'}
|
||||||
border={props.border}
|
border={props.border}
|
||||||
zIndex={0}
|
zIndex={0}
|
||||||
/>
|
/>
|
||||||
@ -444,11 +444,13 @@ export const Choices = defineComponent<
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
key.realize('moveDown', () => {
|
key.realize('moveDown', () => {
|
||||||
|
const page = pageCom.value?.now() ?? 0;
|
||||||
if (selected.value === choiceCountPerPage.value - 1) {
|
if (selected.value === choiceCountPerPage.value - 1) {
|
||||||
pageCom.value?.movePage(1);
|
if (page < pages.value - 1) {
|
||||||
selected.value = 0;
|
pageCom.value?.movePage(1);
|
||||||
|
selected.value = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const page = pageCom.value?.now() ?? 1;
|
|
||||||
const index = page * choiceCountPerPage.value + selected.value;
|
const index = page * choiceCountPerPage.value + selected.value;
|
||||||
if (index < props.choices.length - 1) {
|
if (index < props.choices.length - 1) {
|
||||||
selected.value++;
|
selected.value++;
|
||||||
@ -458,7 +460,7 @@ export const Choices = defineComponent<
|
|||||||
key.realize('moveLeft', () => pageCom.value?.movePage(-1));
|
key.realize('moveLeft', () => pageCom.value?.movePage(-1));
|
||||||
key.realize('moveRight', () => pageCom.value?.movePage(1));
|
key.realize('moveRight', () => pageCom.value?.movePage(1));
|
||||||
key.realize('confirm', () => {
|
key.realize('confirm', () => {
|
||||||
const page = pageCom.value?.now() ?? 1;
|
const page = pageCom.value?.now() ?? 0;
|
||||||
const index = page * choiceCountPerPage.value + selected.value;
|
const index = page * choiceCountPerPage.value + selected.value;
|
||||||
emit('choose', props.choices[index][0]);
|
emit('choose', props.choices[index][0]);
|
||||||
});
|
});
|
||||||
|
@ -309,8 +309,8 @@ export const Selection = defineComponent<SelectionProps>(props => {
|
|||||||
isWinskin.value ? core.material.images.images[props.winskin!] : null
|
isWinskin.value ? core.material.images.images[props.winskin!] : null
|
||||||
);
|
);
|
||||||
const fixedLoc = computed<ElementLocator>(() => {
|
const fixedLoc = computed<ElementLocator>(() => {
|
||||||
const [x = 0, y = 0, width = 200, height = 200] = props.loc;
|
const [x = 0, y = 0, width = 200, height = 200, ax, ay] = props.loc;
|
||||||
return [x + 1, y + 1, width - 2, height - 2];
|
return [x + 1, y + 1, width - 2, height - 2, ax, ay];
|
||||||
});
|
});
|
||||||
|
|
||||||
const renderWinskin = (canvas: MotaOffscreenCanvas2D) => {
|
const renderWinskin = (canvas: MotaOffscreenCanvas2D) => {
|
||||||
|
@ -135,13 +135,11 @@ export const TextContent = defineComponent<
|
|||||||
}
|
}
|
||||||
renderable = [];
|
renderable = [];
|
||||||
|
|
||||||
spriteElement.value?.requestBeforeFrame(() => {
|
typer.setConfig(props);
|
||||||
typer.setConfig(props);
|
typer.setText(props.text ?? '');
|
||||||
typer.setText(props.text ?? '');
|
typer.type();
|
||||||
typer.type();
|
needUpdate = false;
|
||||||
needUpdate = false;
|
updateLoc();
|
||||||
updateLoc();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showAll = () => {
|
const showAll = () => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { createApp } from '@motajs/render';
|
import { createApp, Font } from '@motajs/render';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { MAIN_HEIGHT, MAIN_WIDTH } from './shared';
|
import { MAIN_HEIGHT, MAIN_WIDTH } from './shared';
|
||||||
import { loading } from '@user/data-base';
|
import { loading } from '@user/data-base';
|
||||||
@ -37,6 +37,8 @@ export function createRender() {
|
|||||||
sceneController.open(GameTitleUI, {});
|
sceneController.open(GameTitleUI, {});
|
||||||
mainRenderer.show();
|
mainRenderer.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Font.setDefaults(new Font('normal', 18));
|
||||||
}
|
}
|
||||||
|
|
||||||
export * from './components';
|
export * from './components';
|
||||||
|
@ -14,15 +14,22 @@ import {
|
|||||||
onMounted,
|
onMounted,
|
||||||
shallowReactive
|
shallowReactive
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import { Page, PageExpose } from '../components';
|
import { getConfirm, Page, PageExpose } from '../components';
|
||||||
import { useKey } from '../use';
|
import { useKey } from '../use';
|
||||||
import { MAP_WIDTH } from '../shared';
|
import { MAP_WIDTH } from '../shared';
|
||||||
import { getSave, SaveData } from '../utils';
|
import { getSave, SaveData } from '../utils';
|
||||||
import { Thumbnail } from '../components/thumbnail';
|
import { Thumbnail } from '../components/thumbnail';
|
||||||
import { adjustGrid, IGridLayoutData } from '../utils/layout';
|
import { adjustGrid, IGridLayoutData } from '../utils/layout';
|
||||||
|
|
||||||
|
export const enum SaveMode {
|
||||||
|
Save,
|
||||||
|
Load,
|
||||||
|
Other
|
||||||
|
}
|
||||||
|
|
||||||
export interface SaveProps extends UIComponentProps, DefaultProps {
|
export interface SaveProps extends UIComponentProps, DefaultProps {
|
||||||
loc: ElementLocator;
|
loc: ElementLocator;
|
||||||
|
mode: SaveMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SaveItemProps extends DefaultProps {
|
export interface SaveItemProps extends DefaultProps {
|
||||||
@ -43,7 +50,7 @@ export type SaveEmits = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const saveProps = {
|
const saveProps = {
|
||||||
props: ['loc', 'controller', 'instance'],
|
props: ['loc', 'controller', 'instance', 'mode'],
|
||||||
emits: ['delete', 'emit', 'exit']
|
emits: ['delete', 'emit', 'exit']
|
||||||
} satisfies SetupComponentOptions<SaveProps, SaveEmits, keyof SaveEmits>;
|
} satisfies SetupComponentOptions<SaveProps, SaveEmits, keyof SaveEmits>;
|
||||||
|
|
||||||
@ -63,7 +70,7 @@ export const SaveItem = defineComponent<SaveItemProps>(props => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const name = computed(() => {
|
const name = computed(() => {
|
||||||
return props.index === -1 ? '自动存档' : `存档${props.index}`;
|
return props.index === 0 ? '自动存档' : `存档${props.index}`;
|
||||||
});
|
});
|
||||||
const statusText = computed(() => {
|
const statusText = computed(() => {
|
||||||
if (!props.data) return '';
|
if (!props.data) return '';
|
||||||
@ -181,23 +188,25 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
|
|||||||
*/
|
*/
|
||||||
const getPosIndex = (index: number) => {
|
const getPosIndex = (index: number) => {
|
||||||
if (index === -1) return 0;
|
if (index === -1) return 0;
|
||||||
return index % (grid.value.count - 1);
|
return (index % (grid.value.count - 1)) + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取存档的总序号,从 0 开始,用于数据交互。
|
* 获取存档的总序号,从 0 开始,用于数据交互。
|
||||||
*/
|
*/
|
||||||
const getIndex = (posIndex: number, page: number) => {
|
const getIndex = (posIndex: number, page: number) => {
|
||||||
return page * grid.value.count + posIndex - 1;
|
return page * (grid.value.count - 1) + posIndex - 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateDataList = async (page: number) => {
|
const updateDataList = async (page: number) => {
|
||||||
const promises: Promise<SaveData | null>[] = [];
|
const promises: Promise<SaveData | null>[] = [getSave(0)];
|
||||||
for (let i = 0; i < grid.value.count; i++) {
|
for (let i = 1; i < grid.value.count; i++) {
|
||||||
const index = getIndex(i, page);
|
const index = getIndex(i, page);
|
||||||
promises.push(getSave(index));
|
promises.push(getSave(index + 1));
|
||||||
}
|
}
|
||||||
|
const before = now.value;
|
||||||
const data = await Promise.all(promises);
|
const data = await Promise.all(promises);
|
||||||
|
if (before !== now.value) return;
|
||||||
|
|
||||||
data.forEach((v, i) => {
|
data.forEach((v, i) => {
|
||||||
if (v) {
|
if (v) {
|
||||||
@ -217,14 +226,28 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
const startIndex = getPosIndex(core.saves.saveIndex);
|
||||||
|
selected.value = startIndex;
|
||||||
|
pageRef.value?.changePage(
|
||||||
|
Math.floor(core.saves.saveIndex / (grid.value.count - 1))
|
||||||
|
);
|
||||||
updateDataList(now.value);
|
updateDataList(now.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
const emitSave = (index: number) => {
|
const emitSave = async (index: number) => {
|
||||||
const posIndex = getPosIndex(index);
|
const posIndex = getPosIndex(index);
|
||||||
if (inDelete.value) {
|
if (inDelete.value) {
|
||||||
emit('delete', index, exist(posIndex));
|
const confirm = await getConfirm(
|
||||||
deleteData(posIndex);
|
props.controller,
|
||||||
|
`确认要删除存档 ${index + 1}?`,
|
||||||
|
[420, 240, void 0, void 0, 0.5, 0.5],
|
||||||
|
240,
|
||||||
|
{ winskin: 'winskin2.png' }
|
||||||
|
);
|
||||||
|
if (confirm) {
|
||||||
|
emit('delete', index, exist(posIndex));
|
||||||
|
deleteData(posIndex);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
emit('emit', index, exist(posIndex));
|
emit('emit', index, exist(posIndex));
|
||||||
}
|
}
|
||||||
@ -260,11 +283,18 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
|
|||||||
if (selected.value === 0) {
|
if (selected.value === 0) {
|
||||||
emitSave(-1);
|
emitSave(-1);
|
||||||
} else {
|
} else {
|
||||||
emitSave((grid.value.count - 1) * now.value + selected.value);
|
emitSave(
|
||||||
|
(grid.value.count - 1) * now.value + selected.value - 1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.realize('exit', exit)
|
.realize('exit', exit)
|
||||||
.realize('@save_exit', exit)
|
.realize('save', () => {
|
||||||
|
if (props.mode === SaveMode.Save) exit();
|
||||||
|
})
|
||||||
|
.realize('load', () => {
|
||||||
|
if (props.mode === SaveMode.Load) exit();
|
||||||
|
})
|
||||||
.realize(
|
.realize(
|
||||||
'@save_pageUp',
|
'@save_pageUp',
|
||||||
() => {
|
() => {
|
||||||
@ -345,7 +375,7 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<container loc={props.loc} zIndex={10}>
|
<container loc={props.loc}>
|
||||||
<Page
|
<Page
|
||||||
ref={pageRef}
|
ref={pageRef}
|
||||||
loc={[0, 0, width.value, height.value - 10]}
|
loc={[0, 0, width.value, height.value - 10]}
|
||||||
@ -360,7 +390,7 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
|
|||||||
{grid.value.locs.map((v, i) => {
|
{grid.value.locs.map((v, i) => {
|
||||||
const count = grid.value.count;
|
const count = grid.value.count;
|
||||||
const rawIndex = (count - 1) * page + i;
|
const rawIndex = (count - 1) * page + i;
|
||||||
const index = i === 0 ? -1 : rawIndex;
|
const index = i === 0 ? 0 : rawIndex;
|
||||||
return (
|
return (
|
||||||
<SaveItem
|
<SaveItem
|
||||||
loc={v}
|
loc={v}
|
||||||
@ -368,7 +398,7 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
|
|||||||
selected={selected.value === i}
|
selected={selected.value === i}
|
||||||
inDelete={inDelete.value}
|
inDelete={inDelete.value}
|
||||||
data={saveData[i]}
|
data={saveData[i]}
|
||||||
onClick={() => emitSave(index)}
|
onClick={() => emitSave(index - 1)}
|
||||||
onEnter={() => (selected.value = i)}
|
onEnter={() => (selected.value = i)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -434,6 +464,7 @@ export type SaveValidationFunction = (
|
|||||||
export function selectSave(
|
export function selectSave(
|
||||||
controller: IUIMountable,
|
controller: IUIMountable,
|
||||||
loc: ElementLocator,
|
loc: ElementLocator,
|
||||||
|
mode: SaveMode,
|
||||||
validate?: SaveValidationFunction,
|
validate?: SaveValidationFunction,
|
||||||
props?: SaveProps
|
props?: SaveProps
|
||||||
) {
|
) {
|
||||||
@ -449,6 +480,7 @@ export function selectSave(
|
|||||||
const instance = controller.open(SaveUI, {
|
const instance = controller.open(SaveUI, {
|
||||||
loc,
|
loc,
|
||||||
...props,
|
...props,
|
||||||
|
mode,
|
||||||
onEmit: (index: number, exist: boolean) => {
|
onEmit: (index: number, exist: boolean) => {
|
||||||
if (!validate) {
|
if (!validate) {
|
||||||
controller.close(instance);
|
controller.close(instance);
|
||||||
@ -491,8 +523,15 @@ export async function saveSave(
|
|||||||
return { message: '', valid: true };
|
return { message: '', valid: true };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const index = await selectSave(controller, loc, validate, props);
|
const index = await selectSave(
|
||||||
|
controller,
|
||||||
|
loc,
|
||||||
|
SaveMode.Save,
|
||||||
|
validate,
|
||||||
|
props
|
||||||
|
);
|
||||||
if (index === -2) return false;
|
if (index === -2) return false;
|
||||||
|
core.saves.saveIndex = index;
|
||||||
core.doSL(index + 1, 'save');
|
core.doSL(index + 1, 'save');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -505,10 +544,16 @@ export async function saveLoad(
|
|||||||
const validate = (_: number, exist: boolean): SaveValidation => {
|
const validate = (_: number, exist: boolean): SaveValidation => {
|
||||||
return { message: '无效的存档!', valid: exist };
|
return { message: '无效的存档!', valid: exist };
|
||||||
};
|
};
|
||||||
const index = await selectSave(controller, loc, validate, props);
|
const index = await selectSave(
|
||||||
|
controller,
|
||||||
|
loc,
|
||||||
|
SaveMode.Load,
|
||||||
|
validate,
|
||||||
|
props
|
||||||
|
);
|
||||||
if (index === -2) return false;
|
if (index === -2) return false;
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
core.doSL('autosave', 'load');
|
core.doSL('autoSave', 'load');
|
||||||
} else {
|
} else {
|
||||||
core.doSL(index + 1, 'load');
|
core.doSL(index + 1, 'load');
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { ElementLocator } from '@motajs/render';
|
import { ElementLocator } from '@motajs/render';
|
||||||
import {
|
import {
|
||||||
GameUI,
|
GameUI,
|
||||||
|
IUIMountable,
|
||||||
SetupComponentOptions,
|
SetupComponentOptions,
|
||||||
UIComponentProps
|
UIComponentProps
|
||||||
} from '@motajs/system-ui';
|
} from '@motajs/system-ui';
|
||||||
@ -21,13 +22,15 @@ import { getAllSavesData, getSaveData, syncFromServer } from '../utils';
|
|||||||
import { getInput } from '../components/input';
|
import { getInput } from '../components/input';
|
||||||
import { openStatistics } from './statistics';
|
import { openStatistics } from './statistics';
|
||||||
|
|
||||||
export interface SettingsProps extends Partial<ChoicesProps>, UIComponentProps {
|
export interface MainSettingsProps
|
||||||
|
extends Partial<ChoicesProps>,
|
||||||
|
UIComponentProps {
|
||||||
loc: ElementLocator;
|
loc: ElementLocator;
|
||||||
}
|
}
|
||||||
|
|
||||||
const settingsProps = {
|
const mainSettingsProps = {
|
||||||
props: ['loc', 'controller', 'instance']
|
props: ['loc', 'controller', 'instance']
|
||||||
} satisfies SetupComponentOptions<SettingsProps>;
|
} satisfies SetupComponentOptions<MainSettingsProps>;
|
||||||
|
|
||||||
const enum MainChoice {
|
const enum MainChoice {
|
||||||
SystemSetting,
|
SystemSetting,
|
||||||
@ -43,7 +46,7 @@ const enum MainChoice {
|
|||||||
Back
|
Back
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MainSettings = defineComponent<SettingsProps>(props => {
|
export const MainSettings = defineComponent<MainSettingsProps>(props => {
|
||||||
const choices: ChoiceItem[] = [
|
const choices: ChoiceItem[] = [
|
||||||
[MainChoice.SystemSetting, '系统设置'],
|
[MainChoice.SystemSetting, '系统设置'],
|
||||||
[MainChoice.VirtualKey, '虚拟键盘'],
|
[MainChoice.VirtualKey, '虚拟键盘'],
|
||||||
@ -106,9 +109,11 @@ export const MainSettings = defineComponent<SettingsProps>(props => {
|
|||||||
choices={choices}
|
choices={choices}
|
||||||
width={240}
|
width={240}
|
||||||
onChoose={choose}
|
onChoose={choose}
|
||||||
|
maxHeight={400}
|
||||||
|
interval={8}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}, settingsProps);
|
}, mainSettingsProps);
|
||||||
|
|
||||||
const enum ReplayChoice {
|
const enum ReplayChoice {
|
||||||
Start,
|
Start,
|
||||||
@ -120,7 +125,7 @@ const enum ReplayChoice {
|
|||||||
Back
|
Back
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ReplaySettings = defineComponent<SettingsProps>(props => {
|
export const ReplaySettings = defineComponent<MainSettingsProps>(props => {
|
||||||
const choice: ChoiceItem[] = [
|
const choice: ChoiceItem[] = [
|
||||||
[ReplayChoice.Start, '从头回放录像'],
|
[ReplayChoice.Start, '从头回放录像'],
|
||||||
[ReplayChoice.StartFromSave, '从存档开始回放'],
|
[ReplayChoice.StartFromSave, '从存档开始回放'],
|
||||||
@ -186,9 +191,10 @@ export const ReplaySettings = defineComponent<SettingsProps>(props => {
|
|||||||
choices={choice}
|
choices={choice}
|
||||||
width={240}
|
width={240}
|
||||||
onChoose={choose}
|
onChoose={choose}
|
||||||
|
interval={8}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}, settingsProps);
|
}, mainSettingsProps);
|
||||||
|
|
||||||
const enum GameInfoChoice {
|
const enum GameInfoChoice {
|
||||||
Statistics,
|
Statistics,
|
||||||
@ -199,7 +205,7 @@ const enum GameInfoChoice {
|
|||||||
Back
|
Back
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GameInfo = defineComponent<SettingsProps>(props => {
|
export const GameInfo = defineComponent<MainSettingsProps>(props => {
|
||||||
const choices: ChoiceItem[] = [
|
const choices: ChoiceItem[] = [
|
||||||
[GameInfoChoice.Statistics, '数据统计'],
|
[GameInfoChoice.Statistics, '数据统计'],
|
||||||
[GameInfoChoice.Project, '查看工程'],
|
[GameInfoChoice.Project, '查看工程'],
|
||||||
@ -272,9 +278,10 @@ export const GameInfo = defineComponent<SettingsProps>(props => {
|
|||||||
choices={choices}
|
choices={choices}
|
||||||
width={240}
|
width={240}
|
||||||
onChoose={choose}
|
onChoose={choose}
|
||||||
|
interval={8}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}, mainSettingsProps);
|
||||||
|
|
||||||
const enum SyncSaveChoice {
|
const enum SyncSaveChoice {
|
||||||
// ----- 主菜单
|
// ----- 主菜单
|
||||||
@ -289,7 +296,7 @@ const enum SyncSaveChoice {
|
|||||||
NowSave
|
NowSave
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SyncSave = defineComponent<SettingsProps>(props => {
|
export const SyncSave = defineComponent<MainSettingsProps>(props => {
|
||||||
const choices: ChoiceItem[] = [
|
const choices: ChoiceItem[] = [
|
||||||
[SyncSaveChoice.ToServer, '同步存档至服务器'],
|
[SyncSaveChoice.ToServer, '同步存档至服务器'],
|
||||||
[SyncSaveChoice.FromServer, '从服务器加载存档'],
|
[SyncSaveChoice.FromServer, '从服务器加载存档'],
|
||||||
@ -340,11 +347,12 @@ export const SyncSave = defineComponent<SettingsProps>(props => {
|
|||||||
width={240}
|
width={240}
|
||||||
choices={choices}
|
choices={choices}
|
||||||
onChoose={choose}
|
onChoose={choose}
|
||||||
|
interval={8}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}, mainSettingsProps);
|
||||||
|
|
||||||
export const SyncSaveSelect = defineComponent<SettingsProps>(props => {
|
export const SyncSaveSelect = defineComponent<MainSettingsProps>(props => {
|
||||||
const choices: ChoiceItem[] = [
|
const choices: ChoiceItem[] = [
|
||||||
[SyncSaveChoice.AllSaves, '同步全部存档'],
|
[SyncSaveChoice.AllSaves, '同步全部存档'],
|
||||||
[SyncSaveChoice.NowSave, '同步当前存档'],
|
[SyncSaveChoice.NowSave, '同步当前存档'],
|
||||||
@ -392,11 +400,12 @@ export const SyncSaveSelect = defineComponent<SettingsProps>(props => {
|
|||||||
width={240}
|
width={240}
|
||||||
choices={choices}
|
choices={choices}
|
||||||
onChoose={choose}
|
onChoose={choose}
|
||||||
|
interval={8}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}, mainSettingsProps);
|
||||||
|
|
||||||
export const DownloadSaveSelect = defineComponent<SettingsProps>(props => {
|
export const DownloadSaveSelect = defineComponent<MainSettingsProps>(props => {
|
||||||
const choices: ChoiceItem[] = [
|
const choices: ChoiceItem[] = [
|
||||||
[SyncSaveChoice.AllSaves, '下载全部存档'],
|
[SyncSaveChoice.AllSaves, '下载全部存档'],
|
||||||
[SyncSaveChoice.NowSave, '下载当前存档'],
|
[SyncSaveChoice.NowSave, '下载当前存档'],
|
||||||
@ -460,11 +469,12 @@ export const DownloadSaveSelect = defineComponent<SettingsProps>(props => {
|
|||||||
width={240}
|
width={240}
|
||||||
choices={choices}
|
choices={choices}
|
||||||
onChoose={choose}
|
onChoose={choose}
|
||||||
|
interval={8}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}, mainSettingsProps);
|
||||||
|
|
||||||
export const ClearSaveSelect = defineComponent<SettingsProps>(props => {
|
export const ClearSaveSelect = defineComponent<MainSettingsProps>(props => {
|
||||||
const choices: ChoiceItem[] = [
|
const choices: ChoiceItem[] = [
|
||||||
[SyncSaveChoice.AllSaves, '清空全部塔存档'],
|
[SyncSaveChoice.AllSaves, '清空全部塔存档'],
|
||||||
[SyncSaveChoice.NowSave, '清空当前塔存档'],
|
[SyncSaveChoice.NowSave, '清空当前塔存档'],
|
||||||
@ -568,9 +578,10 @@ export const ClearSaveSelect = defineComponent<SettingsProps>(props => {
|
|||||||
width={240}
|
width={240}
|
||||||
choices={choices}
|
choices={choices}
|
||||||
onChoose={choose}
|
onChoose={choose}
|
||||||
|
interval={8}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}, mainSettingsProps);
|
||||||
|
|
||||||
/** @see {@link MainSettings} */
|
/** @see {@link MainSettings} */
|
||||||
export const MainSettingsUI = new GameUI('main-settings', MainSettings);
|
export const MainSettingsUI = new GameUI('main-settings', MainSettings);
|
||||||
@ -592,3 +603,14 @@ export const ClearSaveSelectUI = new GameUI(
|
|||||||
'clear-save-select',
|
'clear-save-select',
|
||||||
ClearSaveSelect
|
ClearSaveSelect
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export function openSettings(
|
||||||
|
controller: IUIMountable,
|
||||||
|
loc: ElementLocator,
|
||||||
|
props?: MainSettingsProps
|
||||||
|
) {
|
||||||
|
controller.open(MainSettingsUI, {
|
||||||
|
...props,
|
||||||
|
loc
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -25,7 +25,7 @@ export function getSave(index: number) {
|
|||||||
const content = {
|
const content = {
|
||||||
name: core.firstData.name,
|
name: core.firstData.name,
|
||||||
version: core.firstData.version,
|
version: core.firstData.version,
|
||||||
data: data instanceof Array ? data[0] : data
|
data: data instanceof Array ? data.at(-1)! : data
|
||||||
};
|
};
|
||||||
res(content);
|
res(content);
|
||||||
});
|
});
|
||||||
|
@ -24,17 +24,19 @@ export const UIContainer = defineComponent<UIContainerProps>(props => {
|
|||||||
instance={b}
|
instance={b}
|
||||||
key={b.key}
|
key={b.key}
|
||||||
hidden={b.hidden && !b.alwaysShow}
|
hidden={b.hidden && !b.alwaysShow}
|
||||||
|
zIndex={0}
|
||||||
></b.ui.component>
|
></b.ui.component>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return elements.concat(
|
return elements.concat(
|
||||||
data.stack.map(v => (
|
data.stack.map((v, i) => (
|
||||||
<v.ui.component
|
<v.ui.component
|
||||||
{...v.vBind}
|
{...v.vBind}
|
||||||
key={v.key}
|
key={v.key}
|
||||||
controller={data}
|
controller={data}
|
||||||
instance={v}
|
instance={v}
|
||||||
hidden={v.hidden && !v.alwaysShow}
|
hidden={v.hidden && !v.alwaysShow}
|
||||||
|
zIndex={i * 5}
|
||||||
></v.ui.component>
|
></v.ui.component>
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
2
src/types/declaration/control.d.ts
vendored
2
src/types/declaration/control.d.ts
vendored
@ -636,7 +636,7 @@ interface Control {
|
|||||||
/**
|
/**
|
||||||
* 获得某个存档内容
|
* 获得某个存档内容
|
||||||
*/
|
*/
|
||||||
getSave(index: number, callback?: (data?: Save) => void): void;
|
getSave(index: number, callback?: (data?: Save | Save[]) => void): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得某些存档内容
|
* 获得某些存档内容
|
||||||
|
Loading…
Reference in New Issue
Block a user