This commit is contained in:
79
packages/shared/src/contracts/puzzleRuntimeSession.ts
Normal file
79
packages/shared/src/contracts/puzzleRuntimeSession.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
export type PuzzleGridSize = 3 | 4;
|
||||
|
||||
export interface PuzzleCellPosition {
|
||||
row: number;
|
||||
col: number;
|
||||
}
|
||||
|
||||
export interface PuzzlePieceState {
|
||||
pieceId: string;
|
||||
correctRow: number;
|
||||
correctCol: number;
|
||||
currentRow: number;
|
||||
currentCol: number;
|
||||
mergedGroupId: string | null;
|
||||
}
|
||||
|
||||
export interface PuzzleMergedGroupState {
|
||||
groupId: string;
|
||||
pieceIds: string[];
|
||||
occupiedCells: PuzzleCellPosition[];
|
||||
}
|
||||
|
||||
export interface PuzzleBoardSnapshot {
|
||||
rows: number;
|
||||
cols: number;
|
||||
pieces: PuzzlePieceState[];
|
||||
mergedGroups: PuzzleMergedGroupState[];
|
||||
selectedPieceId: string | null;
|
||||
allTilesResolved: boolean;
|
||||
}
|
||||
|
||||
export interface PuzzleRuntimeLevelSnapshot {
|
||||
runId: string;
|
||||
levelIndex: number;
|
||||
gridSize: PuzzleGridSize;
|
||||
profileId: string;
|
||||
levelName: string;
|
||||
authorDisplayName: string;
|
||||
themeTags: string[];
|
||||
coverImageSrc: string | null;
|
||||
board: PuzzleBoardSnapshot;
|
||||
status: 'playing' | 'cleared';
|
||||
}
|
||||
|
||||
export interface PuzzleRunSnapshot {
|
||||
runId: string;
|
||||
entryProfileId: string;
|
||||
clearedLevelCount: number;
|
||||
currentLevelIndex: number;
|
||||
currentGridSize: PuzzleGridSize;
|
||||
playedProfileIds: string[];
|
||||
previousLevelTags: string[];
|
||||
currentLevel: PuzzleRuntimeLevelSnapshot | null;
|
||||
recommendedNextProfileId: string | null;
|
||||
}
|
||||
|
||||
export interface StartPuzzleRunRequest {
|
||||
profileId: string;
|
||||
}
|
||||
|
||||
export interface AdvanceLocalPuzzleNextLevelRequest {
|
||||
run: PuzzleRunSnapshot;
|
||||
sourceSessionId?: string | null;
|
||||
}
|
||||
|
||||
export interface PuzzleRunResponse {
|
||||
run: PuzzleRunSnapshot;
|
||||
}
|
||||
|
||||
export interface SwapPuzzlePiecesRequest {
|
||||
firstPieceId: string;
|
||||
secondPieceId: string;
|
||||
}
|
||||
|
||||
export interface DragPuzzlePieceRequest {
|
||||
pieceId: string;
|
||||
targetRow: number;
|
||||
targetCol: number;
|
||||
}
|
||||
Reference in New Issue
Block a user