Fix stuff
This commit is contained in:
parent
fc270d437f
commit
32696ad33d
13 changed files with 2194 additions and 110 deletions
29
types.ts
29
types.ts
|
|
@ -8,7 +8,10 @@ export type GameState =
|
|||
| 'QUESTION'
|
||||
| 'REVEAL'
|
||||
| 'SCOREBOARD'
|
||||
| 'PODIUM';
|
||||
| 'PODIUM'
|
||||
| 'DISCONNECTED'
|
||||
| 'WAITING_TO_REJOIN'
|
||||
| 'HOST_RECONNECTED';
|
||||
|
||||
export type GameRole = 'HOST' | 'CLIENT';
|
||||
|
||||
|
|
@ -112,6 +115,7 @@ export interface Player {
|
|||
previousScore: number;
|
||||
streak: number;
|
||||
lastAnswerCorrect: boolean | null;
|
||||
selectedShape: 'triangle' | 'diamond' | 'circle' | 'square' | null;
|
||||
pointsBreakdown: PointsBreakdown | null;
|
||||
isBot: boolean;
|
||||
avatarSeed: number;
|
||||
|
|
@ -120,8 +124,25 @@ export interface Player {
|
|||
|
||||
// Network Types
|
||||
export type NetworkMessage =
|
||||
| { type: 'JOIN'; payload: { name: string } }
|
||||
| { type: 'WELCOME'; payload: { playerId: string; quizTitle: string; players: Player[] } }
|
||||
| { type: 'JOIN'; payload: { name: string; reconnect?: boolean; previousId?: string } }
|
||||
| { type: 'WELCOME'; payload: {
|
||||
playerId: string;
|
||||
quizTitle: string;
|
||||
players: Player[];
|
||||
gameState?: GameState;
|
||||
score?: number;
|
||||
streak?: number;
|
||||
hasAnswered?: boolean;
|
||||
lastAnswerCorrect?: boolean | null;
|
||||
lastPointsEarned?: number;
|
||||
selectedShape?: 'triangle' | 'diamond' | 'circle' | 'square' | null;
|
||||
currentQuestionIndex?: number;
|
||||
totalQuestions?: number;
|
||||
questionText?: string;
|
||||
options?: AnswerOption[];
|
||||
correctShape?: string;
|
||||
timeLeft?: number;
|
||||
} }
|
||||
| { type: 'PLAYER_JOINED'; payload: { player: Player } }
|
||||
| { type: 'GAME_START'; payload: {} }
|
||||
| { type: 'START_COUNTDOWN'; payload: { duration: number } }
|
||||
|
|
@ -136,7 +157,7 @@ export type NetworkMessage =
|
|||
options: AnswerOption[];
|
||||
}
|
||||
}
|
||||
| { type: 'ANSWER'; payload: { playerId: string; isCorrect: boolean } }
|
||||
| { type: 'ANSWER'; payload: { playerId: string; isCorrect: boolean; selectedShape: 'triangle' | 'diamond' | 'circle' | 'square' } }
|
||||
| { type: 'RESULT'; payload: { isCorrect: boolean; scoreAdded: number; newScore: number; breakdown: PointsBreakdown } }
|
||||
| { type: 'TIME_SYNC'; payload: { timeLeft: number } }
|
||||
| { type: 'TIME_UP'; payload: {} }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue