From a304e66e75d2df088b94325f4cc1ab1e4051b8c6 Mon Sep 17 00:00:00 2001 From: tsui110 Date: Sat, 3 Jan 2026 16:51:45 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages-game/game/minesweeper/play.vue | 63 +++++++++++++++++++--------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/pages-game/game/minesweeper/play.vue b/pages-game/game/minesweeper/play.vue index 7d8327b..28c3966 100644 --- a/pages-game/game/minesweeper/play.vue +++ b/pages-game/game/minesweeper/play.vue @@ -232,24 +232,15 @@ -<<<<<<< HEAD - {{ gameState.winnerId === myUserId ? '🏆' : '💀' }} - {{ gameState.winnerId === myUserId ? '胜利!' : '很遗憾失败了' }} + {{ getGameResultEmoji() }} + {{ getGameResultTitle() }} {{ getResultMessage() }} - - {{ gameState.winnerId === 'draw' ? '🤝' : (gameState.winnerId === myUserId ? '🏆' : '💀') }} - {{ gameState.winnerId === 'draw' ? '平局' : (gameState.winnerId === myUserId ? '胜利!' : '很遗憾失败了') }} - >>>>>> c028a29943b7b201a73114cb14a1109deb3af339 :class="{ disabled: isRefreshing }" @tap="refreshAndPlayAgain" > @@ -662,21 +653,25 @@ export default { console.log('[游戏结束] gameStarted:', this.gameState.gameStarted); console.log('[游戏结束] 是否显示弹窗:', !this.gameState.gameStarted && !!this.gameState.winnerId); - this.addLog('system', `战局结束:${this.gameState.winnerId === this.myUserId ? '🎉 您获得了胜利!' : '💀 很遗憾失败了'}`); + // 根据结果显示不同的日志消息 + let endMsg = ''; + if (this.gameState.winnerId === 'draw') { + endMsg = '平局:无人幸存'; + } else if (this.gameState.winnerId === this.myUserId) { + endMsg = '🎉 您获得了胜利!'; + } else { + endMsg = '💀 很遗憾失败了'; + } + this.addLog('system', `战局结束:${endMsg}`); // 添加震动反馈 if (this.gameState.winnerId === this.myUserId) { uni.vibrateShort({ type: 'success' }); + } else if (this.gameState.winnerId === 'draw') { + uni.vibrateShort({ type: 'warning' }); } else { uni.vibrateShort({ type: 'fail' }); } -<<<<<<< HEAD -======= - let endMsg = ''; - if (data.winnerId === 'draw') endMsg = '平局:无人幸存'; - else endMsg = `战局结束:${data.winnerId === this.myUserId ? '您获得了胜利!' : '很遗憾失败了'}`; - this.addLog('system', endMsg); ->>>>>>> c028a29943b7b201a73114cb14a1109deb3af339 } }, handleEvent(event) { @@ -812,6 +807,12 @@ export default { if (!this.gameState || !this.gameState.players) return ''; const winnerId = this.gameState.winnerId; + + // 平局情况 + if (winnerId === 'draw') { + return '所有玩家都倒下了,本局为平局!'; + } + const winner = this.gameState.players[winnerId]; const winnerName = winner ? (winner.username || '对手') : '未知'; @@ -820,6 +821,30 @@ export default { } else { return `${winnerName.substring(0, 10)} 获得了胜利,下次好运!`; } + }, + // 获取游戏结果表情 + getGameResultEmoji() { + if (!this.gameState || !this.gameState.winnerId) return '💀'; + + if (this.gameState.winnerId === 'draw') { + return '🤝'; + } else if (this.gameState.winnerId === this.myUserId) { + return '🏆'; + } else { + return '💀'; + } + }, + // 获取游戏结果标题 + getGameResultTitle() { + if (!this.gameState || !this.gameState.winnerId) return '很遗憾失败了'; + + if (this.gameState.winnerId === 'draw') { + return '平局'; + } else if (this.gameState.winnerId === this.myUserId) { + return '胜利!'; + } else { + return '很遗憾失败了'; + } } } }