diff --git a/src/game/actions.ts b/src/game/actions.ts index 39b7f46..df17dca 100644 --- a/src/game/actions.ts +++ b/src/game/actions.ts @@ -17,6 +17,7 @@ export interface RoomPlayerUpdatePayload { avatar_url?: string Ready?: boolean ready?: boolean + is_ready?: boolean MissingSuit?: string | null missing_suit?: string | null }> diff --git a/src/store/gameStore.ts b/src/store/gameStore.ts index 2a81a90..5c4c483 100644 --- a/src/store/gameStore.ts +++ b/src/store/gameStore.ts @@ -172,7 +172,7 @@ export const useGameStore = defineStore('game', { const seatRaw = raw.Index ?? raw.index ?? index const seatIndex = typeof seatRaw === 'number' && Number.isFinite(seatRaw) ? seatRaw : index - const readyRaw = raw.Ready ?? raw.ready + const readyRaw = raw.Ready ?? raw.ready ?? raw.is_ready const ready = parseBooleanish(readyRaw) const displayNameRaw = raw.PlayerName ?? raw.player_name const avatarUrlRaw = raw.AvatarUrl ?? raw.avatar_url diff --git a/src/views/ChengduGamePage.vue b/src/views/ChengduGamePage.vue index f20eb19..bc3ed63 100644 --- a/src/views/ChengduGamePage.vue +++ b/src/views/ChengduGamePage.vue @@ -667,7 +667,9 @@ function syncReadyStatesFromRoomUpdate(payload: RoomPlayerUpdatePayload): void { ? item.Ready : typeof item.ready === 'boolean' ? item.ready - : undefined + : typeof item.is_ready === 'boolean' + ? item.is_ready + : undefined if (!playerId || typeof ready !== 'boolean') { continue @@ -2177,7 +2179,7 @@ function handleReadyStateResponse(message: unknown): void { } const type = normalizeWsType(source.type) - if (type !== 'SET_READY') { + if (type !== 'PLAYER_READY') { return } @@ -2194,12 +2196,14 @@ function handleReadyStateResponse(message: unknown): void { ? source.roomId : '' const userId = - typeof readyPayload.user_id === 'string' - ? readyPayload.user_id - : typeof source.target === 'string' - ? source.target - : '' - const ready = readBoolean(readyPayload, 'ready', 'Ready') + typeof readyPayload.player_id === 'string' + ? readyPayload.player_id + : typeof readyPayload.user_id === 'string' + ? readyPayload.user_id + : typeof source.target === 'string' + ? source.target + : '' + const ready = readBoolean(readyPayload, 'is_ready', 'ready', 'Ready') if (roomId && roomId !== gameStore.roomId) { return