From 83377543f806a6d1a100213bfdf663dc3c329e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=96=B9=E6=88=90?= Date: Sat, 3 Jan 2026 19:16:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E6=97=A5=E5=BF=97=E6=98=BE=E7=A4=BA=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E4=BC=98=E5=85=88=E4=BD=BF=E7=94=A8=20event.?= =?UTF-8?q?message=20=E5=B9=B6=E5=AE=8C=E5=96=84=20isMe=20=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages-game/game/minesweeper/play.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pages-game/game/minesweeper/play.vue b/pages-game/game/minesweeper/play.vue index 9a7dcb1..e4ddd9f 100644 --- a/pages-game/game/minesweeper/play.vue +++ b/pages-game/game/minesweeper/play.vue @@ -718,23 +718,26 @@ export default { }, handleEvent(event) { if (event.type === 'damage' || event.type === 'heal' || event.type === 'item' || event.type === 'ability') { - const isMe = event.targetUserId === this.myUserId; - const iAmTarget = isMe; - const attackerName = event.playerName || '对手'; + const isMe = event.playerID === this.myUserId || event.targetUserId === this.myUserId; + const iAmTarget = event.targetUserId === this.myUserId; + const attackerName = event.playerName || '系统'; const itemDisplayName = this.guideItems.find(i => i.i === event.itemId)?.n || event.itemId; - let msg = ''; - if (event.type === 'item') msg = `发现了 ${itemDisplayName}`; - else if (event.type === 'damage') msg = `受到了 ${event.value} 点伤害`; - else if (event.type === 'heal') msg = `回复了 ${event.value} 点生命`; + // 优先使用服务端传来的 message 字段 + let msg = event.message; + if (!msg) { + if (event.type === 'item') msg = `发现了 ${itemDisplayName}`; + else if (event.type === 'damage') msg = `受到了 ${event.value} 点伤害`; + else if (event.type === 'heal') msg = `回复了 ${event.value} 点生命制`; + } - if (isMe) this.addLog('effect', `指令提示: ${msg}`); + if (isMe) this.addLog('effect', msg); else this.addLog('effect', `${attackerName.substring(0,8)}: ${msg}`); if (event.type === 'damage' || event.type === 'item') { if (iAmTarget && event.value) this.spawnLabel(0, 0, `-${event.value}`, 'damage', undefined, this.myUserId); } - // 对于 opCode 5 的 damage 事件,也触发特效(通常 opCode 2 会覆盖,但多触发一次无妨,作为保险) + // 对于 opCode 5 的 damage 事件,也触发特效 if (event.type === 'damage' && iAmTarget) this.triggerDamageEffect(this.myUserId, event.value); } },