feat(game): 实现游戏房间状态管理和WebSocket连接功能
- 添加路由参数解析和房间状态初始化逻辑 - 实现房间玩家座位视图计算和状态映射 - 集成WebSocket客户端连接管理和重连机制 - 添加房间数据持久化存储功能 - 实现游戏界面状态显示和用户交互控制 - 更新WS代理目标地址配置 - 重构房间状态管理模块分离到独立store
This commit is contained in:
49
src/store/state.ts
Normal file
49
src/store/state.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
// 房间玩家状态
|
||||
export interface RoomPlayerState {
|
||||
index: number
|
||||
playerId: string
|
||||
displayName?: string
|
||||
missingSuit?: string | null
|
||||
ready: boolean
|
||||
hand: string[]
|
||||
melds: string[]
|
||||
outTiles: string[]
|
||||
hasHu: boolean
|
||||
}
|
||||
|
||||
// 房间整体状态
|
||||
export interface ActiveRoomState {
|
||||
roomId: string
|
||||
roomName: string
|
||||
gameType: string
|
||||
ownerId: string
|
||||
maxPlayers: number
|
||||
playerCount: number
|
||||
status: string
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
players: RoomPlayerState[]
|
||||
myHand: string[]
|
||||
game?: {
|
||||
state?: {
|
||||
wall?: string[]
|
||||
scores?: Record<string, number>
|
||||
dealerIndex?: number
|
||||
currentTurn?: number
|
||||
phase?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface ActiveRoomSelectionInput {
|
||||
roomId: string
|
||||
roomName?: string
|
||||
gameType?: string
|
||||
ownerId?: string
|
||||
maxPlayers?: number
|
||||
playerCount?: number
|
||||
status?: string
|
||||
createdAt?: string
|
||||
updatedAt?: string
|
||||
players?: RoomPlayerState[]
|
||||
}
|
||||
Reference in New Issue
Block a user