feat(game): 添加摸牌和碰杠胡操作功能
- 在游戏状态中添加 needDraw 字段用于标识当前回合是否需要摸牌 - 实现 canDrawTile 计算属性控制摸牌按钮的显示和启用状态 - 添加 claimActionPending 状态防止重复提交操作 - 实现 myClaimState、visibleClaimOptions 和 showClaimActions 计算属性 - 添加 submitClaim 方法处理碰/杠/胡/过操作 - 实现 normalizePendingClaim 函数解析服务端推送的声明状态 - 在底部手牌区域将牌图片改为按钮以便点击弃牌 - 添加摸牌按钮和声明操作栏界面元素 - 更新房间创建表单添加局数选择选项 - 添加 E2E 测试文件验证多人房间流程 - 为登录页面输入框和按钮添加 testid 属性便于测试 - 修复 test-results 文件中的失败测试记录
This commit is contained in:
@@ -16,6 +16,7 @@ export const useGameStore = defineStore('game', {
|
||||
|
||||
dealerIndex: 0,
|
||||
currentTurn: 0,
|
||||
needDraw: false,
|
||||
|
||||
players: {},
|
||||
|
||||
@@ -57,6 +58,7 @@ export const useGameStore = defineStore('game', {
|
||||
|
||||
// 清除操作窗口
|
||||
this.pendingClaim = undefined
|
||||
this.needDraw = false
|
||||
|
||||
// 进入出牌阶段
|
||||
this.phase = GAME_PHASE.PLAYING
|
||||
@@ -87,6 +89,7 @@ export const useGameStore = defineStore('game', {
|
||||
|
||||
// 更新回合
|
||||
this.currentTurn = data.nextSeat
|
||||
this.needDraw = true
|
||||
|
||||
// 等待其他玩家响应
|
||||
this.phase = GAME_PHASE.ACTION
|
||||
@@ -95,6 +98,7 @@ export const useGameStore = defineStore('game', {
|
||||
// 触发操作窗口(碰/杠/胡)
|
||||
onPendingClaim(data: PendingClaimState) {
|
||||
this.pendingClaim = data
|
||||
this.needDraw = false
|
||||
this.phase = GAME_PHASE.ACTION
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user