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:
panFD
2026-08-15 14:55:51 +08:00
parent e8c6a7ca6a
commit 667ec1abfb
10 changed files with 50 additions and 28 deletions

View File

@@ -20,6 +20,15 @@ const { ccclass, property } = _decorator;
* 数据流HeroViewComp 将 HeroAttrsComp 引用传入,本组件通过 model 读取属性。
* 注意:英雄根节点下的 "shielded" 是护盾特效动画节点,由 HeroViewComp 管理,不在本组件职责内。
*/
/**
* buffId → debuff 图标节点名映射(节点名为 top.prefab / tooltip.prefab debuff 容器下的子节点名,两处同名)。
* 仅伤害类 debuff 需要图标;未映射的 buff 不显示。
* 导出供 HeroTopBarComp头顶 debuff 栏)与 HeroAtkSystemDoT 飘字图标)共用。
*/
export const DEBUFF_ICON_MAP: Record<number, string> = {
7002: "FireDamage", // 灼烧
};
@ccclass('HeroTopBarComp')
@ecs.register('HeroTopBar', false)
export class HeroTopBarComp extends CCComp {
@@ -135,14 +144,6 @@ export class HeroTopBarComp extends CCComp {
this.shieldProgressBar.node.active = shield > 0;
}
/**
* buffId → debuff 图标节点名映射(节点名为 top.prefab debuff 容器下的子节点名)。
* 仅伤害类 debuff 需要图标;未映射的 buff 不显示。
*/
private static readonly DEBUFF_ICON_MAP: Record<number, string> = {
7002: "FireDamage", // 灼烧
};
/**
* 刷新 debuff 图标显隐:按 BuffComp 中当前生效的 debuff 种类点亮对应图标。
* 由 HeroViewComp 在 dirty_buffs 脏标记时调用;与上次状态做 diff避免重复 set active。
@@ -159,7 +160,7 @@ export class HeroTopBarComp extends CCComp {
const cfg = BuffList[buffId];
// 只显示伤害类 debufftick 负值)与控制类 debuff普通 Buff 不占用 debuff 栏
if (!cfg || cfg.category === BuffCategory.Buff) continue;
const nodeName = HeroTopBarComp.DEBUFF_ICON_MAP[buffId];
const nodeName = DEBUFF_ICON_MAP[buffId];
if (nodeName) wantActive.add(nodeName);
}
}