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