fix: 确认框的默认选项

This commit is contained in:
unanmed 2025-09-13 18:19:09 +08:00
parent b50c868b6d
commit 8db7411def
3 changed files with 17 additions and 27 deletions

View File

@ -638,10 +638,10 @@ export function getChoice<T extends ChoiceKey = ChoiceKey>(
}); });
} }
function getChoiceRoute() { function getChoiceRoute(defaults: number) {
const route = core.status.replay.toReplay[0]; const route = core.status.replay.toReplay[0];
if (!route.startsWith('choices:')) { if (!route.startsWith('choices:')) {
return 0; return defaults;
} else { } else {
return Number(route.slice(8)); return Number(route.slice(8));
} }
@ -680,9 +680,9 @@ export async function routedConfirm(
props?: Partial<ConfirmBoxProps> props?: Partial<ConfirmBoxProps>
) { ) {
if (core.isReplaying()) { if (core.isReplaying()) {
const confirm = getChoiceRoute() === 1; const confirm = getChoiceRoute(1) === 0;
const timeout = core.control.__replay_getTimeout(); const timeout = core.control.__replay_getTimeout();
core.status.route.push(`choices:${confirm ? 1 : 0}`); core.status.route.push(`choices:${confirm ? 0 : 1}`);
if (timeout === 0) return confirm; if (timeout === 0) return confirm;
const instance = controller.open(ConfirmBoxUI, { const instance = controller.open(ConfirmBoxUI, {
...(props ?? {}), ...(props ?? {}),
@ -696,7 +696,7 @@ export async function routedConfirm(
return confirm; return confirm;
} else { } else {
const confirm = await getConfirm(controller, text, loc, width, props); const confirm = await getConfirm(controller, text, loc, width, props);
core.status.route.push(`choices:${confirm ? 1 : 0}`); core.status.route.push(`choices:${confirm ? 0 : 1}`);
return confirm; return confirm;
} }
} }
@ -734,7 +734,7 @@ export async function routedChoices<T extends ChoiceKey>(
props?: Partial<ChoicesProps> props?: Partial<ChoicesProps>
): Promise<T> { ): Promise<T> {
if (core.isReplaying()) { if (core.isReplaying()) {
const selected = getChoiceRoute(); const selected = getChoiceRoute(0);
const timeout = core.control.__replay_getTimeout(); const timeout = core.control.__replay_getTimeout();
core.status.route.push(`choices:${selected}`); core.status.route.push(`choices:${selected}`);
if (timeout === 0) return choices[selected][0]; if (timeout === 0) return choices[selected][0];

View File

@ -23,7 +23,6 @@ import {
LeftStatusBar, LeftStatusBar,
RightStatusBar RightStatusBar
} from './statusBar'; } from './statusBar';
import { onLoaded } from '../use';
import { ReplayingStatus } from './toolbar'; import { ReplayingStatus } from './toolbar';
import { getHeroStatusOn, HeroSkill, NightSpecial } from '@user/data-state'; import { getHeroStatusOn, HeroSkill, NightSpecial } from '@user/data-state';
import { jumpIgnoreFloor } from '@user/legacy-plugin-data'; import { jumpIgnoreFloor } from '@user/legacy-plugin-data';
@ -82,11 +81,6 @@ const MainScene = defineComponent(() => {
const locked = ref(false); const locked = ref(false);
const weather = new WeatherController('main'); const weather = new WeatherController('main');
const loaded = ref(true);
onLoaded(() => {
loaded.value = true;
});
onMounted(() => { onMounted(() => {
weather.bind(map.value); weather.bind(map.value);
}); });
@ -260,13 +254,11 @@ const MainScene = defineComponent(() => {
return () => ( return () => (
<container id="main-scene" width={MAIN_WIDTH} height={MAIN_HEIGHT}> <container id="main-scene" width={MAIN_WIDTH} height={MAIN_HEIGHT}>
{loaded.value && ( <LeftStatusBar
<LeftStatusBar loc={[0, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]}
loc={[0, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]} status={leftStatus}
status={leftStatus} hidden={hideStatus.value}
hidden={hideStatus.value} ></LeftStatusBar>
></LeftStatusBar>
)}
<g-line line={[180, 0, 180, 480]} lineWidth={1} /> <g-line line={[180, 0, 180, 480]} lineWidth={1} />
<container <container
id="map-draw" id="map-draw"
@ -302,13 +294,11 @@ const MainScene = defineComponent(() => {
/> />
</container> </container>
<g-line line={[180 + 480, 0, 180 + 480, 480]} lineWidth={1} /> <g-line line={[180 + 480, 0, 180 + 480, 480]} lineWidth={1} />
{loaded.value && ( <RightStatusBar
<RightStatusBar loc={[480 + 180, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]}
loc={[480 + 180, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]} status={rightStatus}
status={rightStatus} hidden={hideStatus.value}
hidden={hideStatus.value} ></RightStatusBar>
></RightStatusBar>
)}
<container <container
loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]} loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]}
hidden={!mainUIController.active.value} hidden={!mainUIController.active.value}

View File

@ -70,7 +70,7 @@ main.floors.MT16=
}, },
{ {
"type": "function", "type": "function",
"function": "function(){\ncore.status.maps.MT14.canFlyFrom = false;\nMota.require('chase_g').chaseInit1();\n}" "function": "function(){\ncore.status.maps.MT14.canFlyFrom = false;\nMota.require('@user/legacy-plugin-data').chaseInit1();\n}"
}, },
{ {
"type": "show", "type": "show",