This commit is contained in:
2026-04-27 22:50:18 +08:00
parent ded6f6ee2a
commit b6c6640548
77 changed files with 5240 additions and 833 deletions

View File

@@ -2,7 +2,10 @@ import { lazy, Suspense, useCallback, useEffect, useRef, useState } from 'react'
import { useAuthUi } from './components/auth/AuthUiContext';
import { PlatformEntryFlowShell } from './components/platform-entry/PlatformEntryFlowShell';
import type { SelectionStage } from './components/platform-entry/platformEntryTypes';
import type {
CustomWorldRuntimeLaunchOptions,
SelectionStage,
} from './components/platform-entry/platformEntryTypes';
import type { HydratedSavedGameSnapshot } from './persistence/runtimeSnapshotTypes';
import {
APP_RUNTIME_ROUTES,
@@ -40,6 +43,8 @@ export default function App() {
const [selectionStage, setRawSelectionStage] = useState<SelectionStage>(() =>
resolveSelectionStageFromPath(window.location.pathname),
);
const [runtimeReturnStage, setRuntimeReturnStage] =
useState<SelectionStage>('platform');
const setSelectionStage = useCallback((stage: SelectionStage) => {
setRawSelectionStage(stage);
@@ -86,10 +91,17 @@ export default function App() {
);
const handleCustomWorldSelect = useCallback(
(customWorldProfile: CustomWorldProfile) => {
(
customWorldProfile: CustomWorldProfile,
options?: CustomWorldRuntimeLaunchOptions,
) => {
// 中文注释:作品测试需要在结束测试后精确返回启动它的结果页;
// 正式进入世界仍保持既有平台首页返回语义。
setRuntimeReturnStage(options?.returnStage ?? 'platform');
createRuntimeIntent({
kind: 'custom-world',
profile: customWorldProfile,
mode: options?.mode ?? 'play',
});
},
[createRuntimeIntent],
@@ -102,7 +114,13 @@ export default function App() {
if (isRuntimeActive) {
return (
<Suspense fallback={null}>
<RpgRuntimeApp initialIntent={runtimeIntent} />
<RpgRuntimeApp
initialIntent={runtimeIntent}
onExitRuntime={() => {
setIsRuntimeActive(false);
setSelectionStage(runtimeReturnStage);
}}
/>
</Suspense>
);
}