refactor(skill&atk): 优化伤害飘字与debuff图标显示逻辑
1. 调整fb-1、fb-3、fb-5、fb-6技能预制体的攻击偏移与跑动类型参数 2. 重构debuff图标映射逻辑,提取公共常量供多模块复用 3. 为DoT伤害飘字添加debuff图标显示功能,统一伤害与debuff展示流程 4. 修复tooltip预制体默认激活状态问题
This commit is contained in:
@@ -29,6 +29,8 @@ export class TooltipCom extends CCComp {
|
||||
fac: number = FacSet.MON;
|
||||
/** 当前技能喊话对应的触发类型(空字符串表示普通主动技能) */
|
||||
triggerType: string = "";
|
||||
/** DoT 飘字需激活的 debuff 图标节点名(loss_life/hp/debuff 下的子节点,如 FireDamage);空串=普通伤害 */
|
||||
debuffIcon: string = "";
|
||||
|
||||
// 动画参数配置
|
||||
private readonly popDuration = 0.15;
|
||||
@@ -43,12 +45,13 @@ export class TooltipCom extends CCComp {
|
||||
}
|
||||
|
||||
/** 初始化并播放动画 */
|
||||
init(type: number, value: string, uuid: number, fac: number = FacSet.MON, triggerType: string = "") {
|
||||
init(type: number, value: string, uuid: number, fac: number = FacSet.MON, triggerType: string = "", debuffIcon: string = "") {
|
||||
this.stype = type;
|
||||
this.value = value;
|
||||
this.s_uuid = uuid;
|
||||
this.fac = fac;
|
||||
this.triggerType = triggerType;
|
||||
this.debuffIcon = debuffIcon;
|
||||
|
||||
// 初始化或获取 UIOpacity 组件
|
||||
this._uiOpacity = this.node.getComponent(UIOpacity);
|
||||
@@ -94,6 +97,7 @@ export class TooltipCom extends CCComp {
|
||||
this.node.setPosition(v3(this.node.position.x + offsetX, currentY));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
this.setupLabel(this.fac === FacSet.HERO ? "hloss" : "loss_life", "hp", this.value);
|
||||
this.setupDebuffIcon(); // DoT 伤害时点亮 loss_life/hp/debuff 下的对应图标
|
||||
scaleMax = 1.5;
|
||||
break;
|
||||
case TooltipTypes.health: // 治疗
|
||||
@@ -164,6 +168,20 @@ export class TooltipCom extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DoT 伤害飘字:激活 loss_life/hp/debuff 下指定的 debuff 图标子节点。
|
||||
* 仅怪物普通伤害(loss_life)路径调用;debuffIcon 为空或未找到节点时静默跳过。
|
||||
*/
|
||||
private setupDebuffIcon() {
|
||||
if (!this.debuffIcon) return;
|
||||
const debuffNode = this.node.getChildByName("loss_life")?.getChildByName("hp")?.getChildByName("debuff");
|
||||
if (!debuffNode) return;
|
||||
// 先全部隐藏(对象池复用防残留),再点亮目标图标
|
||||
for (const child of debuffNode.children) {
|
||||
child.active = child.name === this.debuffIcon;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据技能触发类型激活对应的背景标识节点
|
||||
* 仅 TooltipTypes.skill 走此分支,其他飘字类型不受影响
|
||||
|
||||
Reference in New Issue
Block a user