mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-07-18 11:01:48 +08:00
fix: 回到标题界面
This commit is contained in:
parent
ef0c6a1647
commit
783b7beacd
@ -1,7 +1,7 @@
|
||||
import { createApp, Font } from '@motajs/render';
|
||||
import { defineComponent } from 'vue';
|
||||
import { MAIN_HEIGHT, MAIN_WIDTH } from './shared';
|
||||
import { loading } from '@user/data-base';
|
||||
import { hook, loading } from '@user/data-base';
|
||||
import { createLoopMap } from './loopMap';
|
||||
import { createElements } from './elements';
|
||||
import { mainRenderer } from './renderer';
|
||||
@ -38,6 +38,11 @@ export function createRender() {
|
||||
mainRenderer.show();
|
||||
});
|
||||
|
||||
hook.on('restart', () => {
|
||||
sceneController.closeAll();
|
||||
sceneController.open(GameTitleUI, {});
|
||||
});
|
||||
|
||||
Font.setDefaults(new Font('normal', 18));
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ export const MainSettings = defineComponent<MainSettingsProps>(props => {
|
||||
[MainChoice.Back, '返回游戏']
|
||||
];
|
||||
|
||||
const choose = (key: ChoiceKey) => {
|
||||
const choose = async (key: ChoiceKey) => {
|
||||
switch (key) {
|
||||
case MainChoice.SystemSetting: {
|
||||
mainUi.open('settings');
|
||||
@ -92,8 +92,16 @@ export const MainSettings = defineComponent<MainSettingsProps>(props => {
|
||||
break;
|
||||
}
|
||||
case MainChoice.Restart: {
|
||||
props.controller.closeAll();
|
||||
core.restart();
|
||||
const confirm = await getConfirm(
|
||||
props.controller,
|
||||
'确认要返回标题吗?',
|
||||
[420, 240, void 0, void 0, 0.5, 0.5],
|
||||
240
|
||||
);
|
||||
if (confirm) {
|
||||
props.controller.closeAll();
|
||||
core.restart();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MainChoice.Back: {
|
||||
|
@ -237,7 +237,8 @@ export class UIController
|
||||
|
||||
closeAll(ui?: IGameUI): void {
|
||||
if (!ui) {
|
||||
this.stack.splice(0);
|
||||
const list = this.stack.slice();
|
||||
list.forEach(v => this.close(v));
|
||||
} else {
|
||||
const list = this.stack.filter(v => v.ui === ui);
|
||||
list.forEach(v => this.close(v));
|
||||
|
Loading…
Reference in New Issue
Block a user