From 99ee713a1fab683430284c419d094411552f79ca Mon Sep 17 00:00:00 2001 From: walkpan Date: Sat, 28 Mar 2026 18:39:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(mission):=20=E5=A4=84=E7=90=86=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E5=85=A8=E7=81=AD=E6=97=B6=E8=87=AA=E5=8A=A8=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E6=88=98=E6=96=97=E5=B9=B6=E4=BC=98=E5=8C=96UI?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 MissionComp 中新增 handleHeroWipe 方法,当英雄数量为0且处于战斗状态时自动结束战斗 - 修复 MissionCardComp 中卡池等级UI显示逻辑,简化激活条件判断 - 调整 role_controller.prefab 中多个UI元素的布局参数,优化界面显示效果 --- assets/resources/gui/role_controller.prefab | 30 +++++++--- assets/script/game/map/MissionCardComp.ts | 61 ++++++++++----------- assets/script/game/map/MissionComp.ts | 21 ++++++- 3 files changed, 68 insertions(+), 44 deletions(-) diff --git a/assets/resources/gui/role_controller.prefab b/assets/resources/gui/role_controller.prefab index cb362c97..7947d877 100644 --- a/assets/resources/gui/role_controller.prefab +++ b/assets/resources/gui/role_controller.prefab @@ -2962,7 +2962,7 @@ "__prefab": { "__id__": 125 }, - "_resizeMode": 1, + "_resizeMode": 0, "_layoutType": 1, "_cellSize": { "__type__": "cc.Size", @@ -2997,6 +2997,8 @@ "__id__": 0 }, "fileId": "33rSVysAVB1LO2v7wC2zZ1", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -3924,7 +3926,7 @@ "__prefab": { "__id__": 167 }, - "_resizeMode": 1, + "_resizeMode": 0, "_layoutType": 1, "_cellSize": { "__type__": "cc.Size", @@ -3943,7 +3945,7 @@ "_constraint": 0, "_constraintNum": 2, "_affectedByScale": false, - "_isAlign": false, + "_isAlign": true, "_id": "" }, { @@ -3959,6 +3961,8 @@ "__id__": 0 }, "fileId": "50nlTzRABGJ4vZYBkdXijK", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -4156,6 +4160,8 @@ "__id__": 0 }, "fileId": "ebDo8RYmhKJoLQcsDOvm6d", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -4191,7 +4197,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -44.229, + "x": -70, "y": 0, "z": 0 }, @@ -4741,7 +4747,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 10, + "x": -47.013, "y": 0, "z": 0 }, @@ -4787,7 +4793,7 @@ }, "_anchorPoint": { "__type__": "cc.Vec2", - "x": 0.5, + "x": 0, "y": 0.5 }, "_id": "" @@ -4819,7 +4825,7 @@ "a": 255 }, "_string": "{{0}}/{{1}}", - "_horizontalAlign": 1, + "_horizontalAlign": 0, "_verticalAlign": 1, "_actualFontSize": 25, "_fontSize": 25, @@ -5180,6 +5186,8 @@ "__id__": 0 }, "fileId": "35dr0lJV9CO5Ld8TLk7eCZ", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -5205,7 +5213,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -71.736, + "x": -70.3, "y": 0, "z": 0 }, @@ -5317,6 +5325,8 @@ "__id__": 0 }, "fileId": "e7dPNasr5IyqES0tbwxJX3", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -5345,7 +5355,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -49.32, + "x": -47.013, "y": 0, "z": 0 }, @@ -5501,6 +5511,8 @@ "__id__": 0 }, "fileId": "65zRY1wpZPNLTXws9hsdcE", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index db4e0595..a6d371ba 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -428,43 +428,38 @@ export class MissionCardComp extends CCComp { } /** 更新升级按钮上的等级文案,反馈当前卡池层级 */ private updatePoolLvUI() { - if (!this.cards_up) return; - const nobg = this.cards_up.getChildByName("nobg"); - if (nobg) { - nobg.active = !this.canUpPool(); - } - const coinNode = this.cards_up.getChildByName("coin"); - const label = coinNode?.getChildByName("num")?.getComponent(Label); - if (this.poolLv >= CARD_POOL_MAX_LEVEL) { - if (label) { - label.string = `0`; + if (this.cards_up) { + const nobg = this.cards_up.getChildByName("nobg"); + if (nobg) { + nobg.active = !this.canUpPool(); } - } else { - if (label) { - label.string = `${this.getUpgradeCost(this.poolLv)}`; + const coinNode = this.cards_up.getChildByName("coin"); + const label = coinNode?.getChildByName("num")?.getComponent(Label); + if (this.poolLv >= CARD_POOL_MAX_LEVEL) { + if (label) { + label.string = `0`; + } + } else { + if (label) { + label.string = `${this.getUpgradeCost(this.poolLv)}`; + } } } if (this.pool_lv_node) { - let hasMatchedNode = false; - const children = this.pool_lv_node.children; - for (let i = 0; i < children.length; i++) { - const node = children[i]; - const lvText = node.name.match(/\d+/)?.[0]; - const lv = lvText ? Number(lvText) : (i + 1); - const active = lv === this.poolLv; - node.active = active; - if (active) { - hasMatchedNode = true; - } - } - if (!hasMatchedNode) { - for (let i = 1; i <= CARD_POOL_MAX_LEVEL; i++) { - const n = this.pool_lv_node.getChildByName(`lv${i}`); - if (n) { - n.active = i === this.poolLv; - } - } - } + this.pool_lv_node.active = true; + const lv = Math.max(CARD_POOL_INIT_LEVEL, Math.min(CARD_POOL_MAX_LEVEL, Math.floor(this.poolLv))); + const lv1 = this.pool_lv_node.getChildByName("lv1"); + const lv2 = this.pool_lv_node.getChildByName("lv2"); + const lv3 = this.pool_lv_node.getChildByName("lv3"); + const lv4 = this.pool_lv_node.getChildByName("lv4"); + const lv5 = this.pool_lv_node.getChildByName("lv5"); + const lv6 = this.pool_lv_node.getChildByName("lv6"); + if (lv1) lv1.active = lv >= 1; + if (lv2) lv2.active = lv >= 2; + if (lv3) lv3.active = lv >= 3; + if (lv4) lv4.active = lv >= 4; + if (lv5) lv5.active = lv >= 5; + if (lv6) lv6.active = lv >= 6; } mLogger.log(this.debugMode, "MissionCardComp", "pool lv ui update", { poolLv: this.poolLv, diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index e1ec906b..1587bee4 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -290,11 +290,19 @@ export class MissionComp extends CCComp { if (dt > 0 && this.monsterCountSyncTimer < 0.2) return; this.monsterCountSyncTimer = 0; let monsterCount = 0; + let heroCount = 0; ecs.query(this.heroAttrsMatcher).forEach(entity => { const attrs = entity.get(HeroAttrsComp); - if (!attrs || attrs.fac !== FacSet.MON || attrs.is_dead) return; - monsterCount += 1; + if (!attrs || attrs.is_dead) return; + if (attrs.fac === FacSet.MON) { + monsterCount += 1; + return; + } + if (attrs.fac === FacSet.HERO) { + heroCount += 1; + } }); + this.handleHeroWipe(heroCount); smc.vmdata.mission_data.mon_num = monsterCount; const { max, resume } = this.getMonsterThresholds(); smc.vmdata.mission_data.mon_max = max; @@ -306,6 +314,15 @@ export class MissionComp extends CCComp { if (monsterCount >= max) smc.mission.stop_spawn_mon = true; } + private handleHeroWipe(heroCount: number) { + if (heroCount > 0) return; + if (!smc.mission.play || smc.mission.pause) return; + if (!smc.mission.in_fight) return; + smc.mission.in_fight = false; + smc.vmdata.mission_data.in_fight = false; + this.open_Victory(null, true); + } + private cleanComponents() { const heroEntities: ecs.Entity[] = []; ecs.query(this.heroViewMatcher).forEach(entity => {