refactor(hero-ui): 重构英雄信息面板为点击弹窗形式
本次修改完成以下核心调整: 1. 在GameUIConfig中注册HInfo弹窗的UIID与预制体路径 2. 为场上英雄节点添加点击交互,点击时打开对应英雄的信息弹窗 3. 清理MissionCardComp中常驻英雄信息面板的旧逻辑代码 4. 重构HInfoComp适配弹窗模式,支持按实体ID绑定英雄数据并实时刷新显示 5. 调整CardComp中英雄图标缩放,优化界面显示效果
This commit is contained in:
@@ -137,7 +137,7 @@ export class Hero extends ecs.Entity {
|
||||
model.critical = HeroAttrsComp.getTalentValue(TalentType.Critical); // 暴击强化
|
||||
model.wfuny = HeroAttrsComp.getTalentValue(TalentType.WindFury); // 风怒强化
|
||||
model.freeze_chance = HeroAttrsComp.getTalentValue(TalentType.Freeze); // 冰冻强化
|
||||
model.puncture = HeroAttrsComp.getTalentValue(TalentType.Puncture); // 穿刺强化
|
||||
model.puncture_chance = HeroAttrsComp.getTalentValue(TalentType.Puncture); // 穿刺强化
|
||||
// 护盾强化 和 亡语强化 在对应逻辑中应用
|
||||
} else {
|
||||
model.ap = base_ap;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween, Tween, Color, BoxCollider2D, UITransform, UIOpacity} from "cc";
|
||||
import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween, Tween, Color, BoxCollider2D, UITransform, UIOpacity, NodeEventType} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
@@ -8,6 +8,7 @@ import { smc } from "../common/SingletonModuleComp";
|
||||
import { SkillSet,} from "../common/config/SkillSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { Tooltip } from "../skill/Tooltip";
|
||||
import { timedCom } from "../skill/timedCom";
|
||||
@@ -80,7 +81,22 @@ export class HeroViewComp extends CCComp {
|
||||
},0.1)
|
||||
// let anm = this.node.getChildByName("anm")
|
||||
// anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
|
||||
|
||||
// 绑定点击事件,点击打开英雄信息面板弹窗
|
||||
this.node.on(NodeEventType.TOUCH_END, this.onHeroClicked, this);
|
||||
}
|
||||
|
||||
private onHeroClicked() {
|
||||
if (!this.model) return;
|
||||
if (this.model.fac !== FacSet.HERO) return;
|
||||
|
||||
const eid = this.ent?.eid;
|
||||
if (!eid) return;
|
||||
|
||||
oops.gui.remove(UIID.HInfo);
|
||||
oops.gui.open(UIID.HInfo, { eid: eid });
|
||||
}
|
||||
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start () {
|
||||
this.init();
|
||||
@@ -621,6 +637,9 @@ export class HeroViewComp extends CCComp {
|
||||
this.damageQueue.length = 0;
|
||||
this.isProcessingDamage = false;
|
||||
|
||||
// 解绑点击事件
|
||||
this.node.off(NodeEventType.TOUCH_END, this.onHeroClicked, this);
|
||||
|
||||
// 节点生命周期由 Monster 对象池管理,此处不再销毁
|
||||
// if (this.node && this.node.isValid) {
|
||||
// this.node.destroy();
|
||||
|
||||
Reference in New Issue
Block a user