From 6281c0f1b2478b5bedb82b6646c4b1ddd2757275 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sun, 26 Apr 2026 09:05:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=BB=93=E7=AE=97):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9C=80=E9=AB=98=E5=88=86=E8=AE=B0=E5=BD=95=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=E4=B8=8EUI=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在胜利结算时,增加最高分记录判定逻辑。当当前局分数超过历史最高分时,更新存储并标记为新记录。同时,在总分UI旁显示"new"标识以提示玩家打破了记录。 --- assets/script/game/map/VictoryComp.ts | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/assets/script/game/map/VictoryComp.ts b/assets/script/game/map/VictoryComp.ts index d0afd4cc..1a03e07d 100644 --- a/assets/script/game/map/VictoryComp.ts +++ b/assets/script/game/map/VictoryComp.ts @@ -442,8 +442,23 @@ export class VictoryComp extends CCComp { highlightBonus += item.config.scoreBonus; } - // 取整并存储 + // 取整并存储当前局分数 s.score = Math.floor(s.score_combat + s.score_output + s.score_defense + s.score_build + s.score_efficiency + highlightBonus); + + // 判定是否打破历史最高分记录 + let isNewRecord = false; + if (s.score > smc.data.score) { + smc.data.score = s.score; + isNewRecord = true; + // 更新云端/本地存储,保存新记录 + if (typeof smc.updateCloudData === "function") { + smc.updateCloudData(); + } + } + + // 借用 scores 对象传递新记录标记,供 UI 渲染使用 + (s as any).isNewRecord = isNewRecord; + mLogger.log(this.debugMode, 'VictoryComp', `[VictoryComp] 结算总分: ${s.score}`, { combat: s.score_combat, output: s.score_output, @@ -451,7 +466,8 @@ export class VictoryComp extends CCComp { build: s.score_build, efficiency: s.score_efficiency, highlightBonus: highlightBonus, - achievedHighlights: achieved + achievedHighlights: achieved, + isNewRecord: isNewRecord }); } @@ -465,6 +481,13 @@ export class VictoryComp extends CCComp { // 渲染总分 if (this.total_score_label) { this.total_score_label.string = `${s.score}`; + + // 判定是否是新记录,如果是则激活 new 节点 + const isNewRecord = (s as any).isNewRecord === true; + const newNode = this.total_score_label.node.getChildByName("new"); + if (newNode) { + newNode.active = isNewRecord; + } } // 通用渲染单个维度的函数