fix:修复合并错误
This commit is contained in:
parent
9309277047
commit
a304e66e75
@ -232,24 +232,15 @@
|
||||
</view>
|
||||
|
||||
<!-- 结算弹窗 -->
|
||||
<<<<<<< HEAD
|
||||
<view v-if="shouldShowResultModal" class="modal-overlay">
|
||||
<view class="modal-content glass-card">
|
||||
<text class="modal-emoji">{{ gameState.winnerId === myUserId ? '🏆' : '💀' }}</text>
|
||||
<text class="modal-title">{{ gameState.winnerId === myUserId ? '胜利!' : '很遗憾失败了' }}</text>
|
||||
<text class="modal-emoji">{{ getGameResultEmoji() }}</text>
|
||||
<text class="modal-title">{{ getGameResultTitle() }}</text>
|
||||
<view class="result-details" v-if="gameState.players">
|
||||
<text class="detail-text">{{ getResultMessage() }}</text>
|
||||
</view>
|
||||
<view
|
||||
class="btn-primary"
|
||||
=======
|
||||
<view v-if="gameState && !gameState.gameStarted && gameState.winnerId" class="modal-overlay">
|
||||
<view class="modal-content glass-card">
|
||||
<text class="modal-emoji">{{ gameState.winnerId === 'draw' ? '🤝' : (gameState.winnerId === myUserId ? '🏆' : '💀') }}</text>
|
||||
<text class="modal-title">{{ gameState.winnerId === 'draw' ? '平局' : (gameState.winnerId === myUserId ? '胜利!' : '很遗憾失败了') }}</text>
|
||||
<view
|
||||
class="btn-primary"
|
||||
>>>>>>> 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 '很遗憾失败了';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user