This commit is contained in:
2026-04-24 12:21:33 +08:00
parent 3528980645
commit 70b5a7cf73
515 changed files with 14971 additions and 6831 deletions

View File

@@ -12,6 +12,7 @@ import RpgCreationAssetDebugPanel, {
import RpgCreationResultActionBar from './RpgCreationResultActionBar';
import RpgCreationResultHeader from './RpgCreationResultHeader';
import { useRpgCreationResultActions } from './useRpgCreationResultActions';
import type { EntityGenerationKind } from './useRpgCreationResultActions';
export interface RpgCreationResultViewProps {
profile: CustomWorldProfile;
@@ -25,6 +26,12 @@ export interface RpgCreationResultViewProps {
onRegenerate?: () => void;
onContinueExpand?: () => void;
onEnterWorld?: () => void;
onDeleteEntities?: (kind: 'story' | 'landmark', ids: string[]) => Promise<void> | void;
onGenerateEntity?:
| ((kind: EntityGenerationKind) => Promise<{ profile?: CustomWorldProfile | null } | void> | { profile?: CustomWorldProfile | null } | void)
| undefined;
onGenerateRoleAssets?: (roleId: string) => Promise<void> | void;
onGenerateSceneAssets?: (sceneId: string, sceneKind: 'camp' | 'landmark') => Promise<void> | void;
onProfileChange: (profile: CustomWorldProfile) => void;
readOnly?: boolean;
backLabel?: string;
@@ -56,7 +63,11 @@ export function RpgCreationResultView({
onEditSetting,
onRegenerate: triggerRegenerate,
onContinueExpand,
onDeleteEntities,
onEnterWorld,
onGenerateEntity,
onGenerateRoleAssets,
onGenerateSceneAssets,
onProfileChange,
readOnly = false,
backLabel = '返回',
@@ -68,7 +79,6 @@ export function RpgCreationResultView({
publishReady = true,
publishBlockers = [],
qualityFindings = [],
previewSourceLabel = null,
}: RpgCreationResultViewProps) {
const [activeTab, setActiveTab] = useState<ResultTab>('world');
const assetDebugEnabled = useMemo(
@@ -90,6 +100,11 @@ export function RpgCreationResultView({
setEditorTarget,
} = useRpgCreationResultActions({
activeTab,
agentEntityGenerator: onGenerateEntity
? async (kind) => {
return onGenerateEntity(kind);
}
: undefined,
isGenerating,
onProfileChange,
profile,
@@ -97,8 +112,19 @@ export function RpgCreationResultView({
triggerRegenerate,
});
const deleteStoryNpcs = onDeleteEntities
? (ids: string[]) => {
void onDeleteEntities('story', ids);
}
: handleDeleteStoryNpcs;
const deleteLandmarks = onDeleteEntities
? (ids: string[]) => {
void onDeleteEntities('landmark', ids);
}
: handleDeleteLandmarks;
return (
<div className="flex h-full min-h-0 flex-col">
<div className="platform-remap-surface flex h-full min-h-0 flex-col">
<RpgCreationResultHeader
autoSaveState={autoSaveState}
backLabel={backLabel}
@@ -114,13 +140,17 @@ export function RpgCreationResultView({
onActiveTabChange={setActiveTab}
onEditTarget={setEditorTarget}
onProfileChange={onProfileChange}
onDeleteStoryNpcs={handleDeleteStoryNpcs}
onDeleteLandmarks={handleDeleteLandmarks}
onDeleteStoryNpcs={deleteStoryNpcs}
onDeleteLandmarks={deleteLandmarks}
onGenerateRoleAssets={onGenerateRoleAssets ? (roleId) => { void onGenerateRoleAssets(roleId); } : undefined}
onGenerateSceneAssets={onGenerateSceneAssets ? (sceneId, sceneKind) => { void onGenerateSceneAssets(sceneId, sceneKind); } : undefined}
createActionLabel={
readOnly || compactAgentResultMode ? undefined : createLabel
readOnly || (compactAgentResultMode && !onGenerateEntity)
? undefined
: createLabel
}
onCreateAction={
readOnly || compactAgentResultMode || !createTarget
readOnly || (compactAgentResultMode && !onGenerateEntity) || !createTarget
? undefined
: () => {
if (activeTab === 'playable') {
@@ -171,25 +201,6 @@ export function RpgCreationResultView({
{error}
</div>
) : null}
{!error && compactAgentResultMode && previewSourceLabel ? (
<div className="platform-banner platform-banner--info mt-3 rounded-2xl text-sm leading-6">
{previewSourceLabel}
</div>
) : null}
{!error && compactAgentResultMode && publishBlockers.length > 0 ? (
<div className="platform-banner platform-banner--warning mt-3 rounded-2xl text-sm leading-6">
{publishReady
? '当前世界已满足发布门槛。'
: `当前还有 ${publishBlockers.length} 个发布阻断项,请先补齐后再进入世界。`}
<div className="mt-2 space-y-1">
{publishBlockers.slice(0, 4).map((entry, index) => (
<div key={`publish-blocker-${index}-${entry}`}>
{index + 1}. {entry}
</div>
))}
</div>
</div>
) : null}
{!error &&
compactAgentResultMode &&
publishBlockers.length <= 0 &&
@@ -216,6 +227,7 @@ export function RpgCreationResultView({
profile={profile}
regenerateActionLabel={regenerateActionLabel}
publishReady={publishReady}
publishBlockers={publishBlockers}
/>
<RpgCreationEntityEditorModal