feat: 新增技能触发类型标识与列表预制体,优化技能提示UI
1. 新增技能触发类型背景标识,支持追击/反击/复活等状态显示 2. 扩展技能提示接口,新增触发类型参数传递 3. 新增list-me列表预制体及其元数据 4. 调整部分UI精灵帧与布局参数 5. 修复技能名称显示调用参数不匹配问题
This commit is contained in:
@@ -60,7 +60,7 @@ export class Tooltip extends ecs.Entity {
|
||||
this.remove(TooltipCom);
|
||||
super.destroy();
|
||||
}
|
||||
static load(pos: Vec3 = Vec3.ZERO,type:number=1,vaule:string="",s_uuid:number=1001,parent:any=null,cd:number=1,fac:number=FacSet.MON) {
|
||||
static load(pos: Vec3 = Vec3.ZERO,type:number=1,vaule:string="",s_uuid:number=1001,parent:any=null,cd:number=1,fac:number=FacSet.MON,triggerType:string="") {
|
||||
let node: Node;
|
||||
if (Tooltip.pool.size() > 0) {
|
||||
node = Tooltip.pool.get()!;
|
||||
@@ -75,7 +75,7 @@ export class Tooltip extends ecs.Entity {
|
||||
node.active = true;
|
||||
|
||||
var sv = node.getComponent(TooltipCom)!;
|
||||
sv.init(type, vaule, s_uuid, fac);
|
||||
sv.init(type, vaule, s_uuid, fac, triggerType);
|
||||
|
||||
// this.add(sv); // 不要添加到单例实体上,否则会覆盖或导致单例被销毁
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -28,6 +29,8 @@ export class TooltipCom extends CCComp {
|
||||
value: string = "";
|
||||
s_uuid: number = 1001;
|
||||
fac: number = FacSet.MON;
|
||||
/** 当前技能喊话对应的触发类型(空字符串表示普通主动技能) */
|
||||
triggerType: string = "";
|
||||
|
||||
// 动画参数配置
|
||||
private readonly popDuration = 0.15;
|
||||
@@ -42,11 +45,12 @@ export class TooltipCom extends CCComp {
|
||||
}
|
||||
|
||||
/** 初始化并播放动画 */
|
||||
init(type: number, value: string, uuid: number, fac: number = FacSet.MON) {
|
||||
init(type: number, value: string, uuid: number, fac: number = FacSet.MON, triggerType: string = "") {
|
||||
this.stype = type;
|
||||
this.value = value;
|
||||
this.s_uuid = uuid;
|
||||
this.fac = fac;
|
||||
this.triggerType = triggerType;
|
||||
|
||||
// 初始化或获取 UIOpacity 组件
|
||||
this._uiOpacity = this.node.getComponent(UIOpacity);
|
||||
@@ -119,6 +123,8 @@ export class TooltipCom extends CCComp {
|
||||
this.setupLabel("skill", "name", skillName+this.value);
|
||||
// this.node.setPosition(v3(this.node.position.x, currentY));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
// 根据触发类型激活对应的背景标识(追击/反击/起手/生息/亡语/复活)
|
||||
this.setupTriggerBg(this.triggerType);
|
||||
break;
|
||||
case TooltipTypes.uskill:
|
||||
this.setupLabel("uskill", "name", this.value);
|
||||
@@ -159,6 +165,34 @@ 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.fend_bg && (this.fend_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.FEnd]: this.fend_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