diff --git a/apps/ai-game-creator-shell/src/view/home/homeStartMode.ts b/apps/ai-game-creator-shell/src/view/home/homeStartMode.ts new file mode 100644 index 000000000..4724c1066 --- /dev/null +++ b/apps/ai-game-creator-shell/src/view/home/homeStartMode.ts @@ -0,0 +1,12 @@ +import type { ProjectStartMode } from '../../app/types'; +import type { HomeCreationType } from './useHomeDraftStore'; + +export function resolveHomeStartMode( + creationType: HomeCreationType, + planningCompletionEnabled: boolean, +): ProjectStartMode { + return creationType === 'doc' || + (creationType === 'game' && planningCompletionEnabled) + ? 'planning' + : 'direct-build'; +} diff --git a/apps/ai-game-creator-shell/src/view/home/index.tsx b/apps/ai-game-creator-shell/src/view/home/index.tsx index d1470cb25..74f596b64 100644 --- a/apps/ai-game-creator-shell/src/view/home/index.tsx +++ b/apps/ai-game-creator-shell/src/view/home/index.tsx @@ -20,6 +20,7 @@ import { richTextToAttachments, richTextToPrompt, } from './components/RichInputArea/richTextToPrompt'; +import { resolveHomeStartMode } from './homeStartMode'; import InspirationGallery from './InspirationGallery'; import { type HomeCreationType, @@ -145,14 +146,18 @@ export default function HomeView({ (state) => state.setRichText, ); const [homeCreationBusy, setHomeCreationBusy] = useState(false); + const [planningCompletionEnabled, setPlanningCompletionEnabled] = + useState(false); const homeCreationBusyRef = useRef(false); const activeCreationType = HOME_CREATION_TYPE_ITEMS.find( (item) => item.creationType === homeCreationType, ) ?? HOME_CREATION_TYPE_ITEMS[0]!; // 做方案走立项策划链路,做游戏 / 做素材维持既有的直接开建路由。 - const startMode: ProjectStartMode = - homeCreationType === 'doc' ? 'planning' : 'direct-build'; + const startMode = resolveHomeStartMode( + homeCreationType, + planningCompletionEnabled, + ); async function createFromHome() { if (homeCreationBusyRef.current || creationBusy) { @@ -241,7 +246,12 @@ export default function HomeView({ type="button" key={item.creationType} aria-pressed={isActive} - onClick={() => setHomeCreationType(item.creationType)} + onClick={() => { + setHomeCreationType(item.creationType); + if (item.creationType !== 'game') { + setPlanningCompletionEnabled(false); + } + }} > {item.label} @@ -262,8 +272,21 @@ export default function HomeView({ }} >