diff --git a/assets/resources/gui/element/hnode.prefab b/assets/resources/gui/element/hnode.prefab index 6786f84d..b1b0aed2 100644 --- a/assets/resources/gui/element/hnode.prefab +++ b/assets/resources/gui/element/hnode.prefab @@ -10421,6 +10421,9 @@ "sell_node": { "__id__": 330 }, + "BG_node": { + "__id__": 32 + }, "close_node": { "__id__": 346 }, diff --git a/assets/script/game/map/HInfoComp.ts b/assets/script/game/map/HInfoComp.ts index b8871c3c..6e019f0e 100644 --- a/assets/script/game/map/HInfoComp.ts +++ b/assets/script/game/map/HInfoComp.ts @@ -36,6 +36,7 @@ import { mLogger } from "../common/Logger"; import { MissionHeroComp } from "./MissionHeroComp"; import { MoveComp } from "../hero/MoveComp"; import { FacSet, getLvColor } from "../common/config/GameSet"; +import { CKind } from "../common/config/CardSet"; import { MissionEconomy } from "./MissionEconomy"; const {property, ccclass } = _decorator; @@ -56,6 +57,10 @@ export class HInfoComp extends CCComp { @property(Node) sell_node=null! + /** 卡牌背景底框节点(按卡池等级切换子节点显示) */ + @property(Node) + BG_node=null! + /** 关闭窗口按钮节点 */ @property(Node) close_node=null! @@ -162,6 +167,25 @@ export class HInfoComp extends CCComp { }); } + const poolColorNames = ["green", "blue", "purple", "yellow", "red"]; + const poolColorIdx = Math.min(this.previewPoolLv, 5) - 1; + const activeColor = poolColorNames[poolColorIdx]; + const kindName = CKind[CKind.Hero]; + if (this.BG_node) { + this.BG_node.children.forEach(child => { + child.active = (child.name === kindName); + if (child.active) { + child.children.forEach(colorChild => { + colorChild.active = (colorChild.name === activeColor); + }); + } else { + child.children.forEach(colorChild => { + colorChild.active = false; + }); + } + }); + } + if (heroUuid !== this.iconHeroUuid) { this.iconHeroUuid = heroUuid; this.iconVisualToken += 1; @@ -264,16 +288,30 @@ export class HInfoComp extends CCComp { } // ---- 卡池等级标识 ---- + const poolLv = this.model.pool_lv ?? 1; if (this.pool_lvnode) { - const poolLvStr = `lv${this.model.pool_lv ?? 1}`; + const poolLvStr = `lv${poolLv}`; this.pool_lvnode.children.forEach(child => { - // if (child.name === "light") { - // child.active = false; - // } else if (child.name === "bg") { - // child.active = true; - // } else { - child.active = (child.name === poolLvStr); - // } + child.active = (child.name === poolLvStr); + }); + } + + const poolColorNames = ["green", "blue", "purple", "yellow", "red"]; + const poolColorIdx = Math.min(poolLv, 5) - 1; + const activeColor = poolColorNames[poolColorIdx]; + const kindName = CKind[CKind.Hero]; + if (this.BG_node) { + this.BG_node.children.forEach(child => { + child.active = (child.name === kindName); + if (child.active) { + child.children.forEach(colorChild => { + colorChild.active = (colorChild.name === activeColor); + }); + } else { + child.children.forEach(colorChild => { + colorChild.active = false; + }); + } }); }