Files
mahjong-web/src/store/state.ts
wsy182 921f47d916 feat(game): 添加房间管理和游戏启动功能
- 添加 setActiveRoom 导入和房间状态管理功能
- 实现房间所有者判断逻辑和玩家准备状态检查
- 添加游戏启动按钮和相关权限控制
- 实现房间信息请求和响应处理机制
- 添加 WebSocket 消息规范化处理函数
- 集成 tile 数据标准化和验证逻辑
- 更新 CSS 样式以支持新的界面元素
- 修复 Vite 配置以支持外部访问
- 优化 UI 组件布局和交互反馈机制
2026-03-26 23:37:00 +08:00

52 lines
1.1 KiB
TypeScript

// 房间玩家状态
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[]
myHand?: string[]
game?: ActiveRoomState['game']
}