fix: 捡黄宝石报错

This commit is contained in:
unanmed 2025-10-11 14:37:41 +08:00
parent 14aa4d6109
commit ef48dc07cd
5 changed files with 110 additions and 1156 deletions

View File

@ -1,22 +1,22 @@
import { gameKey } from '@motajs/system-action'; import { gameKey } from '@motajs/system-action';
import { MAIN_WIDTH, MAIN_HEIGHT, POP_BOX_WIDTH, CENTER_LOC } from './shared'; import { POP_BOX_WIDTH, CENTER_LOC, FULL_LOC } from './shared';
import { import {
saveSave, saveSave,
mainUIController, mainUIController,
saveLoad, saveLoad,
openSettings, openSettings,
ReplaySettingsUI, openViewMap,
openViewMap openReplay
} from './ui'; } from './ui';
import { ElementLocator } from '@motajs/render-core'; import { ElementLocator } from '@motajs/render-core';
export function createAction() { export function createAction() {
gameKey gameKey
.realize('save', () => { .realize('save', () => {
saveSave(mainUIController, [0, 0, MAIN_WIDTH, MAIN_HEIGHT]); saveSave(mainUIController, FULL_LOC);
}) })
.realize('load', () => { .realize('load', () => {
saveLoad(mainUIController, [0, 0, MAIN_WIDTH, MAIN_HEIGHT]); saveLoad(mainUIController, FULL_LOC);
}) })
.realize('menu', () => { .realize('menu', () => {
const loc = CENTER_LOC.slice() as ElementLocator; const loc = CENTER_LOC.slice() as ElementLocator;
@ -24,11 +24,11 @@ export function createAction() {
openSettings(mainUIController, loc); openSettings(mainUIController, loc);
}) })
.realize('replay', () => { .realize('replay', () => {
mainUIController.open(ReplaySettingsUI, { const loc = CENTER_LOC.slice() as ElementLocator;
loc: CENTER_LOC loc[2] = POP_BOX_WIDTH;
}); openReplay(mainUIController, loc);
}) })
.realize('viewMap', () => { .realize('viewMap', () => {
openViewMap(mainUIController, [0, 0, MAIN_WIDTH, MAIN_HEIGHT]); openViewMap(mainUIController, FULL_LOC);
}); });
} }

View File

@ -693,3 +693,14 @@ export function openSettings(
loc loc
}); });
} }
export function openReplay(
controller: IUIMountable,
loc: ElementLocator,
props?: MainSettingsProps
) {
controller.open(ReplaySettingsUI, {
...props,
loc
});
}

View File

@ -23,7 +23,7 @@ import { SetupComponentOptions } from '@motajs/system-ui';
import { saveSave, saveLoad } from './save'; import { saveSave, saveLoad } from './save';
import { mainUIController } from './controller'; import { mainUIController } from './controller';
import { MAIN_HEIGHT, FULL_LOC, POP_BOX_WIDTH, CENTER_LOC } from '../shared'; import { MAIN_HEIGHT, FULL_LOC, POP_BOX_WIDTH, CENTER_LOC } from '../shared';
import { openSettings } from './settings'; import { openReplay, openSettings } from './settings';
import { openViewMap } from './viewmap'; import { openViewMap } from './viewmap';
interface ToolbarProps extends DefaultProps { interface ToolbarProps extends DefaultProps {
@ -112,7 +112,11 @@ export const PlayingToolbar = defineComponent<
const view = () => { const view = () => {
openViewMap(mainUIController, FULL_LOC); openViewMap(mainUIController, FULL_LOC);
}; };
const replay = () => core.ui._drawReplay(); const replay = () => {
const loc = CENTER_LOC.slice() as ElementLocator;
loc[2] = POP_BOX_WIDTH;
openReplay(mainUIController, loc);
};
const settings = () => { const settings = () => {
const loc = CENTER_LOC.slice() as ElementLocator; const loc = CENTER_LOC.slice() as ElementLocator;
loc[2] = POP_BOX_WIDTH; loc[2] = POP_BOX_WIDTH;

File diff suppressed because it is too large Load Diff

View File

@ -2241,15 +2241,19 @@ ui.prototype.drawChoices = async function (content, choices, width) {
core.insertAction(choices[selected].action); core.insertAction(choices[selected].action);
core.doAction(); core.doAction();
} else { } else {
const { routedChoices, mainUIController } = Mota.require( const {
'@user/client-modules' routedChoices,
); mainUIController,
HALF_WIDTH,
HALF_HEIGHT,
POP_BOX_WIDTH
} = Mota.require('@user/client-modules');
const choice = choices.map((v, i) => [i, v.text]); const choice = choices.map((v, i) => [i, v.text]);
const selected = await routedChoices( const selected = await routedChoices(
mainUIController, mainUIController,
choice, choice,
[420, 240, void 0, void 0, 0.5, 0.5], [HALF_WIDTH, HALF_HEIGHT, void 0, void 0, 0.5, 0.5],
width, width ?? POP_BOX_WIDTH,
{ title: content ?? '' } { title: content ?? '' }
); );
core.insertAction(choices[selected].action); core.insertAction(choices[selected].action);
@ -2295,14 +2299,18 @@ ui.prototype.drawConfirmBox = async function (
noCallback?.(); noCallback?.();
} }
} else { } else {
const { routedConfirm, mainUIController } = Mota.require( const {
'@user/client-modules' routedConfirm,
); mainUIController,
HALF_WIDTH,
HALF_HEIGHT,
POP_BOX_WIDTH
} = Mota.require('@user/client-modules');
const confirm = await routedConfirm( const confirm = await routedConfirm(
mainUIController, mainUIController,
text, text,
[420, 240, void 0, void 0, 0.5, 0.5], [HALF_WIDTH, HALF_HEIGHT, void 0, void 0, 0.5, 0.5],
240 POP_BOX_WIDTH
); );
if (confirm) { if (confirm) {
yesCallback?.(); yesCallback?.();