fix: stabilize match3d demo discovery

This commit is contained in:
2026-05-26 00:13:08 +08:00
parent 5d3e2ac111
commit f79a6ea81e
123 changed files with 1778 additions and 233 deletions

View File

@@ -0,0 +1,141 @@
import type {
Match3DGeneratedBackgroundAsset,
Match3DGeneratedItemAsset,
Match3DWorkProfile,
} from '../../packages/shared/src/contracts/match3dWorks';
import { buildMatch3DPublicWorkCode } from '../services/publicWorkCode';
import type { PlatformMatch3DGalleryCard } from '../components/rpg-entry/rpgEntryWorldPresentation';
export const MATCH3D_DEMO_PROFILE_ID = 'match3d-demo-20260525';
export const MATCH3D_DEMO_WORK_ID = 'match3d-demo-undersea-candy-market';
export const MATCH3D_DEMO_PUBLIC_WORK_CODE =
buildMatch3DPublicWorkCode(MATCH3D_DEMO_PROFILE_ID);
const MATCH3D_DEMO_ASSET_BASE = '/match3d-demo/undersea-candy-market';
const MATCH3D_DEMO_PUBLISHED_AT = '2026-05-25T12:04:17.000+08:00';
const MATCH3D_DEMO_ITEM_NAMES = [
'海星糖',
'贝壳糖',
'珊瑚软糖',
'珍珠泡泡糖',
'海马棒棒糖',
'鱼尾果冻',
'水母棉花糖',
'螺旋饼干',
'海螺巧克力',
'贝珠马卡龙',
'珊瑚杯糕',
'星砂软糖',
'小鱼糖块',
'海草曲奇',
'泡泡杯',
'蓝莓珊瑚糖',
'迷你糖罐',
'珍珠饼',
'海浪甜甜圈',
'贝壳蛋糕',
] as const;
export const MATCH3D_DEMO_BACKGROUND_ASSET: Match3DGeneratedBackgroundAsset = {
prompt: '海底糖果集市抓大鹅关卡背景',
levelScenePrompt: '海底糖果集市完整关卡画面',
levelSceneImageSrc: `${MATCH3D_DEMO_ASSET_BASE}/level-scene.png`,
imageSrc: `${MATCH3D_DEMO_ASSET_BASE}/background.png`,
uiSpritesheetPrompt: '海底糖果集市 UI 透明 spritesheet',
uiSpritesheetImageSrc: `${MATCH3D_DEMO_ASSET_BASE}/ui-spritesheet.png`,
itemSpritesheetPrompt: '海底糖果集市物品 10x10 透明 spritesheet',
itemSpritesheetImageSrc: `${MATCH3D_DEMO_ASSET_BASE}/item-spritesheet.png`,
containerImageSrc: null,
status: 'image_ready',
};
export function buildMatch3DDemoGeneratedItemAssets() {
return MATCH3D_DEMO_ITEM_NAMES.map<Match3DGeneratedItemAsset>(
(itemName, itemIndex) => {
const itemNumber = itemIndex + 1;
const paddedItemNumber = String(itemNumber).padStart(2, '0');
return {
itemId: `match3d-item-${itemNumber}`,
itemName,
itemSize:
itemIndex < 4 ? '大' : itemIndex < 14 ? '中' : '小',
imageViews: Array.from({ length: 5 }, (_, viewIndex) => {
const viewNumber = viewIndex + 1;
return {
viewId: `view-${String(viewNumber).padStart(2, '0')}`,
viewIndex: viewNumber,
imageSrc: `${MATCH3D_DEMO_ASSET_BASE}/item-slices/item-${paddedItemNumber}/view-${String(viewNumber).padStart(2, '0')}.png`,
};
}),
backgroundAsset:
itemIndex === 0 ? MATCH3D_DEMO_BACKGROUND_ASSET : null,
status: 'image_ready',
};
},
);
}
export function buildMatch3DDemoWorkProfile(): Match3DWorkProfile {
return {
workId: MATCH3D_DEMO_WORK_ID,
profileId: MATCH3D_DEMO_PROFILE_ID,
ownerUserId: 'official-match3d-demo',
sourceSessionId: 'match3d-demo-session-20260525',
gameName: '海底糖果集市',
themeText: '海底糖果集市',
summary: '在海底糖果集市里把同款甜点抓成三消。',
tags: ['抓大鹅', '海底糖果', '官方示例'],
coverImageSrc: `${MATCH3D_DEMO_ASSET_BASE}/level-scene.png`,
referenceImageSrc: null,
clearCount: 21,
difficulty: 8,
publicationStatus: 'published',
playCount: 0,
updatedAt: MATCH3D_DEMO_PUBLISHED_AT,
publishedAt: MATCH3D_DEMO_PUBLISHED_AT,
publishReady: true,
generationStatus: 'ready',
backgroundPrompt: MATCH3D_DEMO_BACKGROUND_ASSET.prompt,
backgroundImageSrc: MATCH3D_DEMO_BACKGROUND_ASSET.imageSrc,
backgroundImageObjectKey: null,
generatedBackgroundAsset: MATCH3D_DEMO_BACKGROUND_ASSET,
generatedItemAssets: buildMatch3DDemoGeneratedItemAssets(),
};
}
export function buildMatch3DDemoGalleryCard(): PlatformMatch3DGalleryCard {
const profile = buildMatch3DDemoWorkProfile();
return {
sourceType: 'match3d',
workId: profile.workId,
profileId: profile.profileId,
sourceSessionId: profile.sourceSessionId,
publicWorkCode: MATCH3D_DEMO_PUBLIC_WORK_CODE,
ownerUserId: profile.ownerUserId,
authorDisplayName: '官方示例',
worldName: profile.gameName,
subtitle: '抓大鹅 · 资源管线示例',
summaryText: profile.summary,
coverImageSrc: profile.coverImageSrc ?? null,
themeTags: profile.tags,
playCount: profile.playCount,
remixCount: 0,
likeCount: 0,
recentPlayCount7d: 0,
visibility: 'published',
publishedAt: profile.publishedAt ?? null,
updatedAt: profile.updatedAt,
backgroundPrompt: profile.backgroundPrompt ?? null,
backgroundImageSrc: profile.backgroundImageSrc ?? null,
backgroundImageObjectKey: profile.backgroundImageObjectKey ?? null,
generatedBackgroundAsset: profile.generatedBackgroundAsset ?? null,
generatedItemAssets: profile.generatedItemAssets ?? [],
};
}
export const MATCH3D_DEMO_WORK_PROFILE = buildMatch3DDemoWorkProfile();
export const MATCH3D_DEMO_GALLERY_CARD = buildMatch3DDemoGalleryCard();
export function isMatch3DDemoProfileId(profileId: string | null | undefined) {
return profileId?.trim() === MATCH3D_DEMO_PROFILE_ID;
}