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

View File

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

View File

@ -70,7 +70,7 @@ main.floors.MT16=
},
{
"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",