This commit is contained in:
2026-05-08 11:44:42 +08:00
parent b08127031c
commit abf1f1ebea
249 changed files with 39411 additions and 887 deletions

View File

@@ -2,6 +2,7 @@ import type { BigFishWorkSummary } from '../../../packages/shared/src/contracts/
import type { Match3DWorkSummary } from '../../../packages/shared/src/contracts/match3dWorks';
import type { PuzzleDraftLevel } from '../../../packages/shared/src/contracts/puzzleAgentDraft';
import type { PuzzleWorkSummary } from '../../../packages/shared/src/contracts/puzzleWorkSummary';
import type { VisualNovelWorkSummary } from '../../../packages/shared/src/contracts/visualNovel';
import type {
CustomWorldGalleryCard,
CustomWorldLibraryEntry,
@@ -18,6 +19,7 @@ import {
buildMatch3DPublicWorkCode,
buildPuzzlePublicWorkCode,
buildSquareHolePublicWorkCode,
buildVisualNovelPublicWorkCode,
} from '../../services/publicWorkCode';
import type { CustomWorldProfile } from '../../types';
@@ -30,7 +32,8 @@ export type PlatformWorldCardLike =
| PlatformBigFishGalleryCard
| PlatformMatch3DGalleryCard
| PlatformSquareHoleGalleryCard
| PlatformPuzzleGalleryCard;
| PlatformPuzzleGalleryCard
| PlatformVisualNovelGalleryCard;
export type PlatformPuzzleGalleryCard = {
sourceType: 'puzzle';
@@ -132,12 +135,35 @@ export type PlatformSquareHoleGalleryCard = {
updatedAt: string;
};
export type PlatformVisualNovelGalleryCard = {
sourceType: 'visual-novel';
workId: string;
profileId: string;
sourceSessionId?: string | null;
publicWorkCode: string;
ownerUserId: string;
authorDisplayName: string;
worldName: string;
subtitle: string;
summaryText: string;
coverImageSrc: string | null;
themeTags: string[];
playCount?: number;
remixCount?: number;
likeCount?: number;
recentPlayCount7d?: number;
visibility: 'published';
publishedAt: string | null;
updatedAt: string;
};
export type PlatformPublicGalleryCard =
| CustomWorldGalleryCard
| PlatformBigFishGalleryCard
| PlatformMatch3DGalleryCard
| PlatformSquareHoleGalleryCard
| PlatformPuzzleGalleryCard;
| PlatformPuzzleGalleryCard
| PlatformVisualNovelGalleryCard;
export function isLibraryWorldEntry(
entry: PlatformWorldCardLike,
@@ -169,6 +195,12 @@ export function isSquareHoleGalleryEntry(
return 'sourceType' in entry && entry.sourceType === 'square-hole';
}
export function isVisualNovelGalleryEntry(
entry: PlatformWorldCardLike,
): entry is PlatformVisualNovelGalleryCard {
return 'sourceType' in entry && entry.sourceType === 'visual-novel';
}
export function mapPuzzleWorkToPlatformGalleryCard(
work: PuzzleWorkSummary,
): PlatformPuzzleGalleryCard {
@@ -280,6 +312,32 @@ export function mapBigFishWorkToPlatformGalleryCard(
};
}
export function mapVisualNovelWorkToPlatformGalleryCard(
work: VisualNovelWorkSummary,
): PlatformVisualNovelGalleryCard {
return {
sourceType: 'visual-novel',
workId: work.profileId,
profileId: work.profileId,
sourceSessionId: null,
publicWorkCode: buildVisualNovelPublicWorkCode(work.profileId),
ownerUserId: work.ownerUserId,
authorDisplayName: '玩家',
worldName: work.title,
subtitle: '视觉小说模板',
summaryText: work.description,
coverImageSrc: work.coverImageSrc,
themeTags: work.tags.length > 0 ? work.tags : ['视觉小说'],
playCount: work.playCount ?? 0,
remixCount: 0,
likeCount: 0,
recentPlayCount7d: 0,
visibility: 'published',
publishedAt: work.publishedAt,
updatedAt: work.updatedAt,
};
}
export function resolvePlatformWorldStats(entry: PlatformWorldCardLike) {
return {
playCount: 'playCount' in entry ? (entry.playCount ?? 0) : 0,
@@ -452,6 +510,12 @@ export function buildPlatformWorldTags(entry: PlatformWorldCardLike) {
: ['方洞'];
}
if (isVisualNovelGalleryEntry(entry)) {
return entry.themeTags.length > 0
? entry.themeTags.slice(0, 3)
: ['视觉小说'];
}
if (!isLibraryWorldEntry(entry)) {
return [
describePlatformThemeLabel(entry.themeMode),
@@ -534,6 +598,10 @@ export function resolvePlatformPublicWorkCode(
return entry.publicWorkCode;
}
if (isVisualNovelGalleryEntry(entry)) {
return entry.publicWorkCode;
}
return entry.publicWorkCode;
}