fix(英雄/UI): 修正英雄升级动画与卡牌等级显示的匹配逻辑
- 英雄升级时根据具体等级播放对应的动画(plus2 到 plus5),而非之前所有大于1级都播放"plus" - 卡牌等级显示改为显示小于等于当前等级的所有节点,而非仅精确匹配当前等级
This commit is contained in:
@@ -87,7 +87,11 @@ export class Hero extends ecs.Entity {
|
||||
mLogger.log(this.debugMode,"hero",node.getSiblingIndex());
|
||||
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
if(hero_lv >1){hv.playAllTime("plus")}
|
||||
if(hero_lv == 2){hv.playAllTime("plus")}
|
||||
if(hero_lv == 3){hv.playAllTime("plus2")}
|
||||
if(hero_lv == 4){hv.playAllTime("plus3")}
|
||||
if(hero_lv == 5){hv.playAllTime("plus4")}
|
||||
if(hero_lv == 6){hv.playAllTime("plus5")}
|
||||
|
||||
const model = this.get(HeroAttrsComp);
|
||||
// 从配置中读取英雄静态数据
|
||||
|
||||
@@ -101,9 +101,12 @@ export class HInfoComp extends CCComp {
|
||||
|
||||
// ---- 卡牌等级显示 ----
|
||||
if (this.lv_node) {
|
||||
const cardLvStr = `lv${this.model.pool_lv ?? 1}`;
|
||||
const currentLv = this.model.lv ?? 1;
|
||||
this.lv_node.children.forEach(child => {
|
||||
child.active = (child.name === cardLvStr);
|
||||
if (child.name.startsWith('lv')) {
|
||||
const nodeLv = parseInt(child.name.substring(2));
|
||||
child.active = !isNaN(nodeLv) && nodeLv <= currentLv;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user