refactor(hero-ui): 重构英雄信息面板为点击弹窗形式
本次修改完成以下核心调整: 1. 在GameUIConfig中注册HInfo弹窗的UIID与预制体路径 2. 为场上英雄节点添加点击交互,点击时打开对应英雄的信息弹窗 3. 清理MissionCardComp中常驻英雄信息面板的旧逻辑代码 4. 重构HInfoComp适配弹窗模式,支持按实体ID绑定英雄数据并实时刷新显示 5. 调整CardComp中英雄图标缩放,优化界面显示效果
This commit is contained in:
@@ -689,16 +689,16 @@ export class CardComp extends CCComp {
|
||||
});
|
||||
}
|
||||
|
||||
if (this.HF_node) {
|
||||
this.HF_node.active = true;
|
||||
this.HF_node.children.forEach(child => {
|
||||
child.active = (child.name === kindName);
|
||||
});
|
||||
}
|
||||
// if (this.HF_node) {
|
||||
// this.HF_node.active = true;
|
||||
// this.HF_node.children.forEach(child => {
|
||||
// child.active = (child.name === kindName);
|
||||
// });
|
||||
// }
|
||||
|
||||
if (this.NF_node) {
|
||||
this.NF_node.active = false;
|
||||
}
|
||||
// if (this.NF_node) {
|
||||
// this.NF_node.active = false;
|
||||
// }
|
||||
|
||||
const hbNodeUI = this.node.getChildByName("HB");
|
||||
if (hbNodeUI) hbNodeUI.active = false;
|
||||
@@ -753,39 +753,39 @@ export class CardComp extends CCComp {
|
||||
});
|
||||
}
|
||||
|
||||
if (this.HF_node) {
|
||||
const hfTrans = this.HF_node.getComponent(UITransform);
|
||||
if (hfTrans) {
|
||||
hfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = this.HF_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
this.HF_node.children.forEach(child => {
|
||||
const childTrans = child.getComponent(UITransform);
|
||||
if (childTrans) {
|
||||
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = child.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (this.HF_node) {
|
||||
// const hfTrans = this.HF_node.getComponent(UITransform);
|
||||
// if (hfTrans) {
|
||||
// hfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
// const widget = this.HF_node.getComponent(Widget);
|
||||
// if (widget) widget.updateAlignment();
|
||||
// }
|
||||
// this.HF_node.children.forEach(child => {
|
||||
// const childTrans = child.getComponent(UITransform);
|
||||
// if (childTrans) {
|
||||
// childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
// const widget = child.getComponent(Widget);
|
||||
// if (widget) widget.updateAlignment();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
if (this.NF_node) {
|
||||
const nfTrans = this.NF_node.getComponent(UITransform);
|
||||
if (nfTrans) {
|
||||
nfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = this.NF_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
this.NF_node.children.forEach(child => {
|
||||
const childTrans = child.getComponent(UITransform);
|
||||
if (childTrans) {
|
||||
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = child.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (this.NF_node) {
|
||||
// const nfTrans = this.NF_node.getComponent(UITransform);
|
||||
// if (nfTrans) {
|
||||
// nfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
// const widget = this.NF_node.getComponent(Widget);
|
||||
// if (widget) widget.updateAlignment();
|
||||
// }
|
||||
// this.NF_node.children.forEach(child => {
|
||||
// const childTrans = child.getComponent(UITransform);
|
||||
// if (childTrans) {
|
||||
// childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
// const widget = child.getComponent(Widget);
|
||||
// if (widget) widget.updateAlignment();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
const hbNode = this.node.getChildByName("HB");
|
||||
if (hbNode) {
|
||||
@@ -892,10 +892,12 @@ export class CardComp extends CCComp {
|
||||
// ---- 图标 ----
|
||||
const iconNode = this.icon_node as Node;
|
||||
if (this.card_type === CardType.Hero) {
|
||||
iconNode.setScale(new Vec3(-1.5, 1.5, 1));
|
||||
// 英雄卡使用 AnimationClip,加载 idle 动画
|
||||
this.updateHeroAnimation(iconNode, this.card_uuid, this.iconVisualToken);
|
||||
return;
|
||||
}
|
||||
iconNode.setScale(new Vec3(1, 1, 1));
|
||||
// 非英雄卡使用静态图标
|
||||
this.clearIconAnimation(iconNode);
|
||||
const iconId = this.resolveCardIconId(this.card_type, this.card_uuid);
|
||||
@@ -1005,38 +1007,38 @@ export class CardComp extends CCComp {
|
||||
if (childWidget) childWidget.updateAlignment();
|
||||
});
|
||||
}
|
||||
if (this.HF_node) {
|
||||
const hfTrans = this.HF_node.getComponent(UITransform);
|
||||
if (hfTrans) {
|
||||
hfTrans.setContentSize(170, 230);
|
||||
const widget = this.HF_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
this.HF_node.children.forEach(child => {
|
||||
const childTrans = child.getComponent(UITransform);
|
||||
if (childTrans) {
|
||||
childTrans.setContentSize(170, 230);
|
||||
const widget = child.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.NF_node) {
|
||||
const nfTrans = this.NF_node.getComponent(UITransform);
|
||||
if (nfTrans) {
|
||||
nfTrans.setContentSize(170, 230);
|
||||
const widget = this.NF_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
this.NF_node.children.forEach(child => {
|
||||
const childTrans = child.getComponent(UITransform);
|
||||
if (childTrans) {
|
||||
childTrans.setContentSize(170, 230);
|
||||
const widget = child.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (this.HF_node) {
|
||||
// const hfTrans = this.HF_node.getComponent(UITransform);
|
||||
// if (hfTrans) {
|
||||
// hfTrans.setContentSize(170, 230);
|
||||
// const widget = this.HF_node.getComponent(Widget);
|
||||
// if (widget) widget.updateAlignment();
|
||||
// }
|
||||
// this.HF_node.children.forEach(child => {
|
||||
// const childTrans = child.getComponent(UITransform);
|
||||
// if (childTrans) {
|
||||
// childTrans.setContentSize(170, 230);
|
||||
// const widget = child.getComponent(Widget);
|
||||
// if (widget) widget.updateAlignment();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// if (this.NF_node) {
|
||||
// const nfTrans = this.NF_node.getComponent(UITransform);
|
||||
// if (nfTrans) {
|
||||
// nfTrans.setContentSize(170, 230);
|
||||
// const widget = this.NF_node.getComponent(Widget);
|
||||
// if (widget) widget.updateAlignment();
|
||||
// }
|
||||
// this.NF_node.children.forEach(child => {
|
||||
// const childTrans = child.getComponent(UITransform);
|
||||
// if (childTrans) {
|
||||
// childTrans.setContentSize(170, 230);
|
||||
// const widget = child.getComponent(Widget);
|
||||
// if (widget) widget.updateAlignment();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
const hbNode = this.node.getChildByName("HB");
|
||||
if (hbNode) {
|
||||
const hbTrans = hbNode.getComponent(UITransform);
|
||||
@@ -1079,15 +1081,16 @@ export class CardComp extends CCComp {
|
||||
if (this.BG_node) {
|
||||
this.BG_node.children.forEach(child => child.active = false);
|
||||
}
|
||||
if (this.HF_node) {
|
||||
this.HF_node.active = false;
|
||||
this.HF_node.children.forEach(child => child.active = false);
|
||||
}
|
||||
if (this.NF_node) this.NF_node.active = false;
|
||||
if (this.lv_node) {
|
||||
this.lv_node.children.forEach(child => child.active = false);
|
||||
}
|
||||
// if (this.HF_node) {
|
||||
// this.HF_node.active = false;
|
||||
// this.HF_node.children.forEach(child => child.active = false);
|
||||
// }
|
||||
// if (this.NF_node) this.NF_node.active = false;
|
||||
// if (this.lv_node) {
|
||||
// this.lv_node.children.forEach(child => child.active = false);
|
||||
// }
|
||||
if (this.cost_node) this.cost_node.active = false;
|
||||
if (this.icon_node) (this.icon_node as Node).setScale(new Vec3(1, 1, 1));
|
||||
this.clearIconAnimation(this.icon_node as Node);
|
||||
const sprite = this.icon_node?.getComponent(Sprite) || this.icon_node?.getComponentInChildren(Sprite);
|
||||
if (sprite) sprite.spriteFrame = null;
|
||||
|
||||
Reference in New Issue
Block a user