import type { CustomWorldProfile } from '../../types'; import CampSceneEditor from './CustomWorldCampEditorSection'; import WorldCoverEditor from './CustomWorldCoverEditorSection'; import WorldFoundationEditor from './CustomWorldFoundationEditorSection'; import LandmarkEditor from './CustomWorldLandmarkEditorSection'; import PlayableNpcEditor, { StoryNpcEditor, } from './CustomWorldRoleEditorSection'; import WorldEditor from './CustomWorldWorldEditorSection'; import { resolveEditableLandmark, resolveEditablePlayableNpc, resolveEditableStoryNpc, } from './rpgCreationResultFormMapper'; export type RpgCreationEditorTarget = | { kind: 'world' } | { kind: 'foundation' } | { kind: 'cover' } | { kind: 'camp' } | { kind: 'playable'; mode: 'create' } | { kind: 'playable'; mode: 'edit'; id: string } | { kind: 'story'; mode: 'create' } | { kind: 'story'; mode: 'edit'; id: string } | { kind: 'landmark'; mode: 'create' } | { kind: 'landmark'; mode: 'edit'; id: string }; export interface RpgCreationEntityEditorModalProps { profile: CustomWorldProfile; target: RpgCreationEditorTarget | null; onClose: () => void; onProfileChange: (profile: CustomWorldProfile) => void; } /** * 工作包 C 收口后的编辑器主入口只负责目标分发。 * 具体 section 实现已经下沉到 shared/section 文件,后续可以继续物理拆分而不再膨胀主壳层。 */ export function RpgCreationEntityEditorModal({ profile, target, onClose, onProfileChange, }: RpgCreationEntityEditorModalProps) { if (!target) { return null; } if (target.kind === 'world') { return ( ); } if (target.kind === 'foundation') { return ( ); } if (target.kind === 'cover') { return ( ); } if (target.kind === 'camp') { return ( ); } if (target.kind === 'playable') { const npc = resolveEditablePlayableNpc(profile, target); return npc ? ( onProfileChange({ ...profile, playableNpcs: target.mode === 'create' ? [...profile.playableNpcs, nextNpc] : profile.playableNpcs.map((item) => item.id === nextNpc.id ? nextNpc : item, ), }) } onClose={onClose} /> ) : null; } if (target.kind === 'story') { const npc = resolveEditableStoryNpc(profile, target); return npc ? ( onProfileChange({ ...profile, storyNpcs: target.mode === 'create' ? [...profile.storyNpcs, nextNpc] : profile.storyNpcs.map((item) => item.id === nextNpc.id ? nextNpc : item, ), }) } onClose={onClose} /> ) : null; } const landmark = resolveEditableLandmark(profile, target); return landmark ? ( ) : null; } export default RpgCreationEntityEditorModal;