Merge branch 'codex/feature-1'

# Conflicts:
#	docs/【玩法创作】平台入口与玩法链路-2026-05-15.md
#	src/components/platform-entry/PlatformEntryFlowShellImpl.tsx
#	src/components/rpg-entry/RpgEntryFlowShell.agent.interaction.test.tsx
#	src/services/miniGameDraftGenerationProgress.ts
This commit is contained in:
2026-06-03 03:56:25 +08:00
51 changed files with 3075 additions and 482 deletions

View File

@@ -1,5 +1,6 @@
import { requestJson } from './apiClient';
/** 后端下发的单个创作类型入口配置,前端只据此展示和分流。 */
export type CreationEntryTypeConfig = {
id: string;
title: string;
@@ -16,6 +17,7 @@ export type CreationEntryTypeConfig = {
unifiedCreationSpec?: UnifiedCreationSpec | null;
};
/** 统一创作工作台字段契约,用于表单型玩法的最小输入描述。 */
export type UnifiedCreationField = {
id: string;
kind: 'text' | 'select' | 'image' | 'audio';
@@ -23,6 +25,7 @@ export type UnifiedCreationField = {
required: boolean;
};
/** 统一创作工作台契约,把入口类型映射到工作台、生成页和结果页阶段。 */
export type UnifiedCreationSpec = {
playId: 'puzzle' | 'match3d' | 'jump-hop' | 'wooden-fish';
title: string;
@@ -44,6 +47,19 @@ export type UnifiedCreationSpec = {
fields: UnifiedCreationField[];
};
/** 创作入口公告位配置HTML 模式仅用于沙箱预览,结构化字段保留旧数据兼容。 */
export type CreationEntryEventBannerConfig = {
title: string;
description: string;
coverImageSrc: string;
prizePoolMudPoints: number;
startsAtText: string;
endsAtText: string;
renderMode?: 'structured' | 'html';
htmlCode?: string | null;
};
/** 创作入口页完整配置;前端只展示后端事实源,不内置入口默认值。 */
export type CreationEntryConfig = {
startCard: {
title: string;
@@ -55,17 +71,14 @@ export type CreationEntryConfig = {
title: string;
description: string;
};
eventBanner: {
title: string;
description: string;
coverImageSrc: string;
prizePoolMudPoints: number;
startsAtText: string;
endsAtText: string;
};
/** 旧单条公告位兼容字段,新代码优先读取 eventBanners。 */
eventBanner: CreationEntryEventBannerConfig;
/** 底部加号创作入口页的多公告轮播配置。 */
eventBanners?: CreationEntryEventBannerConfig[];
creationTypes: CreationEntryTypeConfig[];
};
/** 拉取底部加号创作入口配置;所有入口和公告都以后端事实源为准。 */
export async function fetchCreationEntryConfig(): Promise<CreationEntryConfig> {
return requestJson<CreationEntryConfig>(
'/api/creation-entry/config',

View File

@@ -809,7 +809,54 @@ function resolveElapsedActiveStepProgressRatio(
? WOODEN_FISH_ESTIMATED_WAIT_MS
: 1;
return Math.max(0, Math.min(0.98, elapsedMs / Math.max(1, estimatedWaitMs)));
return Math.max(
0,
Math.min(0.98, elapsedMs / Math.max(1, estimatedWaitMs)),
);
}
/** 计算拼图生成总进度,后端里程碑决定跨步骤,当前步骤内使用平滑假进度。 */
function resolvePuzzleOverallProgress(
state: MiniGameDraftGenerationState,
activeStepProgressRatio: number,
) {
const backendProgressPercent = resolvePuzzleBackendProgressPercent(state);
// 中文注释88 以下的后端进度只保留为会话事实,不参与首帧总进度抬升。
// 生成页恢复时必须先从 0% 起步,再由当前步骤内的假进度平滑推进。
const backendProgressFloor =
backendProgressPercent != null &&
backendProgressPercent >= PUZZLE_COMPILE_MILESTONE_PROGRESS
? backendProgressPercent
: 0;
const range =
state.phase === 'puzzle-select-image'
? {
start: PUZZLE_UI_MILESTONE_PROGRESS,
end: PUZZLE_NON_READY_MAX_PROGRESS,
}
: state.phase === 'puzzle-ui-assets'
? {
start: PUZZLE_IMAGE_MILESTONE_PROGRESS,
end: PUZZLE_UI_MILESTONE_PROGRESS,
}
: state.phase === 'puzzle-cover-image' ||
state.phase === 'puzzle-level-scene'
? {
start: PUZZLE_COMPILE_MILESTONE_PROGRESS,
end: PUZZLE_IMAGE_MILESTONE_PROGRESS,
}
: {
start: 0,
end: PUZZLE_COMPILE_MILESTONE_PROGRESS,
};
const fakeProgress =
range.start + (range.end - range.start) * activeStepProgressRatio;
const nextProgress = Math.min(
PUZZLE_NON_READY_MAX_PROGRESS,
Math.max(range.start, backendProgressFloor, fakeProgress),
);
return nextProgress;
}
export function buildMiniGameDraftGenerationProgress(