refactor(skill tooltip): 移除技能提示的触发类型相关参数
1. 移除TooltipCom中triggerType相关属性和setupTriggerBg方法 2. 简化各层调用时的triggerType参数传递 3. 删除未使用的SkillTriggerType导入
This commit is contained in:
@@ -3,7 +3,6 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { FacSet, TooltipTypes } from "../common/config/GameSet";
|
||||
import { SkillTriggerType } from "../common/config/heroSet";
|
||||
import { Tooltip } from "./Tooltip";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -12,23 +11,10 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('TooltipCom')
|
||||
@ecs.register('TooltipView', false)
|
||||
export class TooltipCom extends CCComp {
|
||||
@property(Node)
|
||||
atking_bg: Node = null;
|
||||
@property(Node)
|
||||
atked_bg: Node = null;
|
||||
@property(Node)
|
||||
fstart_bg: Node = null;
|
||||
@property(Node)
|
||||
dead_bg: Node = null;
|
||||
@property(Node)
|
||||
revive_bg: Node = null;
|
||||
|
||||
stype: number = 1; // 1:减少生命值,2:增加生命值,3:技能图标
|
||||
value: string = "";
|
||||
s_uuid: number = 1001;
|
||||
fac: number = FacSet.MON;
|
||||
/** 当前技能喊话对应的触发类型(空字符串表示普通主动技能) */
|
||||
triggerType: string = "";
|
||||
/** DoT 飘字需激活的 debuff 图标节点名(loss_life/hp/debuff 下的子节点,如 FireDamage);空串=普通伤害 */
|
||||
debuffIcon: string = "";
|
||||
|
||||
@@ -45,12 +31,11 @@ export class TooltipCom extends CCComp {
|
||||
}
|
||||
|
||||
/** 初始化并播放动画 */
|
||||
init(type: number, value: string, uuid: number, fac: number = FacSet.MON, triggerType: string = "", debuffIcon: string = "") {
|
||||
init(type: number, value: string, uuid: number, fac: number = FacSet.MON, debuffIcon: string = "") {
|
||||
this.stype = type;
|
||||
this.value = value;
|
||||
this.s_uuid = uuid;
|
||||
this.fac = fac;
|
||||
this.triggerType = triggerType;
|
||||
this.debuffIcon = debuffIcon;
|
||||
|
||||
// 初始化或获取 UIOpacity 组件
|
||||
@@ -126,8 +111,6 @@ export class TooltipCom extends CCComp {
|
||||
// 技能喊话基于 load 传入位置再抬高 50,避免遮挡角色
|
||||
this.node.setPosition(v3(this.node.position.x, this.node.position.y + 50));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
// 根据触发类型激活对应的背景标识(追击/反击/起手/生息/亡语/复活)
|
||||
this.setupTriggerBg(this.triggerType);
|
||||
break;
|
||||
case TooltipTypes.uskill:
|
||||
this.setupLabel("uskill", "name", this.value);
|
||||
@@ -189,32 +172,6 @@ export class TooltipCom extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据技能触发类型激活对应的背景标识节点
|
||||
* 仅 TooltipTypes.skill 走此分支,其他飘字类型不受影响
|
||||
* 对象池复用场景下先统一关闭所有 _bg,避免上一次的状态残留
|
||||
*/
|
||||
private setupTriggerBg(triggerType: string) {
|
||||
// 先关闭所有触发类型背景,防止节点池复用时残留
|
||||
this.atking_bg && (this.atking_bg.active = false);
|
||||
this.atked_bg && (this.atked_bg.active = false);
|
||||
this.fstart_bg && (this.fstart_bg.active = false);
|
||||
this.dead_bg && (this.dead_bg.active = false);
|
||||
this.revive_bg && (this.revive_bg.active = false);
|
||||
|
||||
if (!triggerType) return;
|
||||
|
||||
const bgMap: Record<string, Node | null> = {
|
||||
[SkillTriggerType.Atking]: this.atking_bg,
|
||||
[SkillTriggerType.Atked]: this.atked_bg,
|
||||
[SkillTriggerType.FStart]: this.fstart_bg,
|
||||
[SkillTriggerType.Dead]: this.dead_bg,
|
||||
[SkillTriggerType.Revive]: this.revive_bg,
|
||||
};
|
||||
const bg = bgMap[triggerType];
|
||||
if (bg) bg.active = true;
|
||||
}
|
||||
|
||||
playAnimation(scaleMax: number, isCrit: boolean, isHeal: boolean, sx: number = 1) {
|
||||
// 随机 X 轴偏移 (防止重叠)
|
||||
const randomX = (Math.random() - 0.5) * 60;
|
||||
|
||||
Reference in New Issue
Block a user