125
packages/shared/src/contracts/match3dRuntime.ts
Normal file
125
packages/shared/src/contracts/match3dRuntime.ts
Normal file
@@ -0,0 +1,125 @@
|
||||
export type Match3DRunStatus =
|
||||
| 'running'
|
||||
| 'won'
|
||||
| 'failed'
|
||||
| 'stopped'
|
||||
| 'Running'
|
||||
| 'Won'
|
||||
| 'Failed'
|
||||
| 'Stopped'
|
||||
| string;
|
||||
export type Match3DItemState =
|
||||
| 'in_board'
|
||||
| 'in_tray'
|
||||
| 'cleared'
|
||||
| 'InBoard'
|
||||
| 'Flying'
|
||||
| 'InTray'
|
||||
| 'Cleared'
|
||||
| string;
|
||||
export type Match3DFailureReason =
|
||||
| 'time_up'
|
||||
| 'tray_full'
|
||||
| 'TimeUp'
|
||||
| 'TrayFull'
|
||||
| string;
|
||||
export type Match3DClickRejectReason =
|
||||
| 'run_not_active'
|
||||
| 'snapshot_version_mismatch'
|
||||
| 'item_not_found'
|
||||
| 'item_not_in_board'
|
||||
| 'item_not_clickable'
|
||||
| 'tray_full'
|
||||
| string;
|
||||
|
||||
export type Match3DClickConfirmStatus =
|
||||
| 'Accepted'
|
||||
| 'RejectedNotClickable'
|
||||
| 'RejectedAlreadyMoved'
|
||||
| 'RejectedTrayFull'
|
||||
| 'VersionConflict'
|
||||
| 'RunFinished';
|
||||
|
||||
export interface StartMatch3DRunRequest {
|
||||
profileId: string;
|
||||
}
|
||||
|
||||
export interface Match3DClickItemRequest {
|
||||
runId?: string;
|
||||
itemInstanceId: string;
|
||||
clientActionId?: string;
|
||||
snapshotVersion?: number;
|
||||
clientSnapshotVersion: number;
|
||||
clientEventId: string;
|
||||
clickedAtMs: number;
|
||||
}
|
||||
|
||||
export type ClickMatch3DItemRequest = Match3DClickItemRequest;
|
||||
|
||||
export interface StopMatch3DRunRequest {
|
||||
clientActionId: string;
|
||||
}
|
||||
|
||||
export interface Match3DItemSnapshot {
|
||||
itemInstanceId: string;
|
||||
itemTypeId: string;
|
||||
visualKey: string;
|
||||
x: number;
|
||||
y: number;
|
||||
radius: number;
|
||||
layer: number;
|
||||
state: Match3DItemState;
|
||||
clickable: boolean;
|
||||
traySlotIndex?: number | null;
|
||||
}
|
||||
|
||||
export interface Match3DTraySlot {
|
||||
slotIndex: number;
|
||||
itemInstanceId?: string | null;
|
||||
itemTypeId?: string | null;
|
||||
visualKey?: string | null;
|
||||
}
|
||||
|
||||
export interface Match3DRunSnapshot {
|
||||
runId: string;
|
||||
profileId: string;
|
||||
ownerUserId?: string;
|
||||
status: Match3DRunStatus;
|
||||
snapshotVersion: number;
|
||||
startedAtMs: number;
|
||||
durationLimitMs: number;
|
||||
serverNowMs?: number;
|
||||
remainingMs: number;
|
||||
clearCount: number;
|
||||
totalItemCount: number;
|
||||
clearedItemCount: number;
|
||||
boardVersion?: number;
|
||||
items: Match3DItemSnapshot[];
|
||||
traySlots: Match3DTraySlot[];
|
||||
failureReason?: Match3DFailureReason | null;
|
||||
lastConfirmedActionId?: string | null;
|
||||
}
|
||||
|
||||
export interface Match3DClickConfirmation {
|
||||
accepted: boolean;
|
||||
rejectReason?: Match3DClickRejectReason | null;
|
||||
enteredSlotIndex?: number | null;
|
||||
clearedItemInstanceIds: string[];
|
||||
run: Match3DRunSnapshot;
|
||||
}
|
||||
|
||||
export interface Match3DClickItemResult {
|
||||
status: Match3DClickConfirmStatus;
|
||||
run: Match3DRunSnapshot;
|
||||
acceptedItemInstanceId?: string;
|
||||
clearedItemInstanceIds: string[];
|
||||
failureReason?: Match3DFailureReason | null;
|
||||
}
|
||||
|
||||
export interface Match3DRunResponse {
|
||||
run: Match3DRunSnapshot;
|
||||
}
|
||||
|
||||
export interface Match3DClickResponse {
|
||||
confirmation: Match3DClickConfirmation;
|
||||
}
|
||||
Reference in New Issue
Block a user