feat(HInfoComp): 新增卡牌背景节点适配卡池等级和类型
1. 在hnode.prefab中新增BG_node节点引用 2. 实现根据英雄类型和卡池等级切换背景节点显示逻辑 3. 优化卡池等级标识的显示代码结构
This commit is contained in:
@@ -10421,6 +10421,9 @@
|
||||
"sell_node": {
|
||||
"__id__": 330
|
||||
},
|
||||
"BG_node": {
|
||||
"__id__": 32
|
||||
},
|
||||
"close_node": {
|
||||
"__id__": 346
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user