refactor(game): 重构游戏模块并添加WebSocket客户端

- 修改开发环境配置中的代理目标地址
- 移除旧的活动房间状态管理模块
- 移除成都麻将游戏相关的测试用例
- 添加新的游戏动作发送功能
- 实现WebSocket客户端类并支持自动重连
- 添加WebSocket消息处理器注册机制
- 创建游戏相关状态类型定义
- 添加ID生成工具函数
- 移除废弃的游戏相关模块和常量定义
- 添加WebSocket消息结构定义
- 重构游戏状态相关类型定义
This commit is contained in:
2026-03-24 23:42:03 +08:00
parent 7316588d9e
commit 4f6ef1d0ec
48 changed files with 423 additions and 994 deletions

31
src/ws/message.ts Normal file
View File

@@ -0,0 +1,31 @@
// 通用消息结构
/**
* 客户端 → 服务端(请求 / 操作)
*/
export interface ActionMessage<T = any> {
type: string
sender?: string
target?: string
roomId?: string
seq?: number
status?: string
requestId?: string
trace_id?: string
payload?: T
}
/**
* 服务端 → 客户端(事件 / 推送)
*/
export interface ActionEvent<T = any> {
type: string
target?: string
roomId?: string
seq?: number
status?: string
requestId?: string
trace_id?: string
payload?: T
}