feat(game): 添加游戏状态管理store并统一就绪状态字段

- 在actions.ts中添加is_ready字段支持多种就绪状态标识
- 在ChengduGamePage.vue中更新就绪状态判断逻辑,优先使用is_ready字段
- 修改WebSocket消息类型从SET_READY到PLAYER_READY以保持一致性
- 更新就绪载荷中的用户ID字段从user_id到player_id
- 创建新的gameStore.ts文件实现完整的麻将游戏状态管理
- 添加房间玩家更新、托管设置、玩家回合等核心游戏逻辑处理
- 实现摸牌、出牌、操作窗口等游戏状态变更功能
- 统一处理多种数据格式的兼容性问题
This commit is contained in:
2026-04-03 15:24:46 +08:00
parent 6c3fca3530
commit e6cba75f9b
3 changed files with 14 additions and 9 deletions

View File

@@ -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