feat: 为扫雷游戏添加平局状态的 UI 显示和系统日志处理,并优化 gameState 访问检查
This commit is contained in:
parent
3a1d4857dd
commit
c028a29943
@ -232,10 +232,10 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 结算弹窗 -->
|
<!-- 结算弹窗 -->
|
||||||
<view v-if="!gameState?.gameStarted && gameState?.winnerId" class="modal-overlay">
|
<view v-if="gameState && !gameState.gameStarted && gameState.winnerId" class="modal-overlay">
|
||||||
<view class="modal-content glass-card">
|
<view class="modal-content glass-card">
|
||||||
<text class="modal-emoji">{{ gameState.winnerId === myUserId ? '🏆' : '💀' }}</text>
|
<text class="modal-emoji">{{ gameState.winnerId === 'draw' ? '🤝' : (gameState.winnerId === myUserId ? '🏆' : '💀') }}</text>
|
||||||
<text class="modal-title">{{ gameState.winnerId === myUserId ? '胜利!' : '很遗憾失败了' }}</text>
|
<text class="modal-title">{{ gameState.winnerId === 'draw' ? '平局' : (gameState.winnerId === myUserId ? '胜利!' : '很遗憾失败了') }}</text>
|
||||||
<view
|
<view
|
||||||
class="btn-primary"
|
class="btn-primary"
|
||||||
:class="{ disabled: isRefreshing }"
|
:class="{ disabled: isRefreshing }"
|
||||||
@ -607,7 +607,10 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.gameState = data;
|
this.gameState = data;
|
||||||
}
|
}
|
||||||
this.addLog('system', `战局结束:${data.winnerId === this.myUserId ? '您获得了胜利!' : '很遗憾失败了'}`);
|
let endMsg = '';
|
||||||
|
if (data.winnerId === 'draw') endMsg = '平局:无人幸存';
|
||||||
|
else endMsg = `战局结束:${data.winnerId === this.myUserId ? '您获得了胜利!' : '很遗憾失败了'}`;
|
||||||
|
this.addLog('system', endMsg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleEvent(event) {
|
handleEvent(event) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user