Files
Genarrative/packages/shared/src/contracts/jumpHop.ts
2026-05-24 19:00:21 +08:00

268 lines
6.1 KiB
TypeScript

export type JumpHopDifficulty = 'easy' | 'standard' | 'advanced' | 'challenge';
export type JumpHopStylePreset =
| 'minimal-blocks'
| 'paper-toy'
| 'neon-glass'
| 'forest-stone'
| 'future-metal'
| 'custom';
export type JumpHopGenerationStatus =
| 'draft'
| 'generating'
| 'ready'
| 'failed';
export type JumpHopTileType =
| 'start'
| 'normal'
| 'target'
| 'finish'
| 'bonus'
| 'accent';
export type JumpHopActionType =
| 'compile-draft'
| 'regenerate-character'
| 'regenerate-tiles'
| 'update-work-meta'
| 'update-difficulty';
export type JumpHopRunStatus = 'playing' | 'failed' | 'cleared';
export type JumpHopJumpResult = 'miss' | 'hit' | 'perfect' | 'finish';
export interface JumpHopWorkspaceCreateRequest {
templateId: string;
workTitle: string;
workDescription: string;
themeTags: string[];
difficulty: JumpHopDifficulty;
stylePreset: JumpHopStylePreset;
characterPrompt: string;
tilePrompt: string;
endMoodPrompt?: string | null;
}
export interface JumpHopActionRequest {
actionType: JumpHopActionType;
profileId?: string | null;
workTitle?: string | null;
workDescription?: string | null;
themeTags?: string[] | null;
difficulty?: JumpHopDifficulty | null;
stylePreset?: JumpHopStylePreset | null;
characterPrompt?: string | null;
tilePrompt?: string | null;
endMoodPrompt?: string | null;
characterAsset?: JumpHopCharacterAsset | null;
tileAtlasAsset?: JumpHopCharacterAsset | null;
tileAssets?: JumpHopTileAsset[] | null;
coverComposite?: string | null;
}
export interface JumpHopCharacterAsset {
assetId: string;
imageSrc: string;
imageObjectKey: string;
assetObjectId: string;
generationProvider: string;
prompt: string;
width: number;
height: number;
}
export interface JumpHopTileAsset {
tileType: JumpHopTileType;
imageSrc: string;
imageObjectKey: string;
assetObjectId: string;
sourceAtlasCell: string;
visualWidth: number;
visualHeight: number;
topSurfaceRadius: number;
landingRadius: number;
}
export interface JumpHopScoring {
chargeToDistanceRatio: number;
maxChargeMs: number;
hitBonus: number;
perfectBonus: number;
}
export interface JumpHopPlatform {
platformId: string;
tileType: JumpHopTileType;
x: number;
y: number;
width: number;
height: number;
landingRadius: number;
perfectRadius: number;
scoreValue: number;
}
export interface JumpHopPath {
seed: string;
difficulty: JumpHopDifficulty;
platforms: JumpHopPlatform[];
finishIndex: number;
cameraPreset: string;
scoring: JumpHopScoring;
}
export interface JumpHopLastJump {
chargeMs: number;
jumpDistance: number;
targetPlatformIndex: number;
landedX: number;
landedY: number;
result: JumpHopJumpResult;
}
export interface JumpHopDraftResponse {
templateId: string;
templateName: string;
profileId: string | null;
workTitle: string;
workDescription: string;
themeTags: string[];
difficulty: JumpHopDifficulty;
stylePreset: JumpHopStylePreset;
characterPrompt: string;
tilePrompt: string;
endMoodPrompt: string | null;
characterAsset: JumpHopCharacterAsset | null;
tileAtlasAsset: JumpHopCharacterAsset | null;
tileAssets: JumpHopTileAsset[];
path: JumpHopPath | null;
coverComposite: string | null;
generationStatus: JumpHopGenerationStatus;
}
export interface JumpHopSessionSnapshotResponse {
sessionId: string;
ownerUserId: string;
status: JumpHopGenerationStatus;
draft: JumpHopDraftResponse | null;
createdAt: string;
updatedAt: string;
}
export interface JumpHopSessionResponse {
session: JumpHopSessionSnapshotResponse;
}
export interface JumpHopActionResponse {
actionType: JumpHopActionType;
session: JumpHopSessionSnapshotResponse;
work: JumpHopWorkProfileResponse | null;
}
export interface JumpHopWorkSummaryResponse {
runtimeKind: 'jump-hop';
workId: string;
profileId: string;
ownerUserId: string;
sourceSessionId: string | null;
workTitle: string;
workDescription: string;
themeTags: string[];
difficulty: JumpHopDifficulty;
stylePreset: JumpHopStylePreset;
coverImageSrc: string | null;
publicationStatus: string;
playCount: number;
updatedAt: string;
publishedAt: string | null;
publishReady: boolean;
generationStatus: JumpHopGenerationStatus;
}
export interface JumpHopWorkProfileResponse {
summary: JumpHopWorkSummaryResponse;
draft: JumpHopDraftResponse;
path: JumpHopPath;
characterAsset: JumpHopCharacterAsset;
tileAtlasAsset: JumpHopCharacterAsset;
tileAssets: JumpHopTileAsset[];
}
export interface JumpHopWorksResponse {
items: JumpHopWorkSummaryResponse[];
}
export interface JumpHopWorkDetailResponse {
item: JumpHopWorkProfileResponse;
}
export interface JumpHopWorkMutationResponse {
item: JumpHopWorkProfileResponse;
}
export interface JumpHopGalleryCardResponse {
publicWorkCode: string;
workId: string;
profileId: string;
ownerUserId: string;
authorDisplayName: string;
workTitle: string;
workDescription: string;
coverImageSrc: string | null;
themeTags: string[];
difficulty: JumpHopDifficulty;
stylePreset: JumpHopStylePreset;
publicationStatus: string;
playCount: number;
updatedAt: string;
publishedAt: string | null;
generationStatus: JumpHopGenerationStatus;
}
export interface JumpHopGalleryResponse {
items: JumpHopGalleryCardResponse[];
hasMore: boolean;
nextCursor: string | null;
}
export interface JumpHopGalleryDetailResponse {
item: JumpHopWorkProfileResponse;
}
export interface JumpHopRuntimeRunSnapshotResponse {
runId: string;
profileId: string;
ownerUserId: string;
status: JumpHopRunStatus;
currentPlatformIndex: number;
score: number;
combo: number;
path: JumpHopPath;
lastJump: JumpHopLastJump | null;
startedAtMs: number;
finishedAtMs: number | null;
}
export interface JumpHopRunResponse {
run: JumpHopRuntimeRunSnapshotResponse;
}
export interface JumpHopStartRunRequest {
profileId: string;
}
export interface JumpHopJumpRequest {
chargeMs: number;
clientEventId: string;
}
export interface JumpHopRestartRunRequest {
clientActionId: string;
}
export interface JumpHopJumpResponse {
run: JumpHopRuntimeRunSnapshotResponse;
}