feat(config,skill): 新增通用文字飘字提示功能

1. 新增TooltipTypes.tip枚举类型,支持调用方自定义文字和颜色
2. 扩展Tooltip.load和hp_tip方法,增加tipColor参数传递自定义颜色
3. 新增setupTipLabel工具方法,处理通用文字飘字的UI设置
4. 优化现有tip类型的注释和默认颜色逻辑,修复对象池复用颜色残留问题
5. 修复heroSet.ts导入多余空格问题
This commit is contained in:
panFD
2026-09-07 21:08:26 +08:00
parent 95a8c0e1d6
commit d559fdbaa4
6 changed files with 401 additions and 956 deletions

View File

@@ -1,4 +1,4 @@
import { Vec3, _decorator, v3, Collider2D, Contact2DType, Node, Prefab, instantiate, tween, Tween, BoxCollider2D, UITransform } from "cc";
import { Vec3, _decorator, v3, Collider2D, Contact2DType, Node, Prefab, instantiate, tween, Tween, BoxCollider2D, UITransform, Color } 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";
@@ -222,7 +222,7 @@ export class HeroViewComp extends CCComp {
Tooltip.load(pos, TooltipTypes.skill, value, s_uuid, this.node, 1, this.model?.fac ?? FacSet.MON);
}
/** 血量提示(伤害数字) */
private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 0, debuffIcon: string = "") {
private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 0, debuffIcon: string = "", tipColor: Color | null = null) {
let x = this.node.position.x;
// 获取怪物高度的一半,定位到中心点
let halfHeight = 0;
@@ -234,15 +234,15 @@ export class HeroViewComp extends CCComp {
// 起点设为怪物中心偏下位置,使其在血条下方
let ny = this.node.position.y + halfHeight - 15;
let pos = v3(x, ny, 0);
Tooltip.load(pos, type, value, s_uuid, this.node.parent, 1, this.model?.fac ?? FacSet.MON, debuffIcon);
Tooltip.load(pos, type, value, s_uuid, this.node.parent, 1, this.model?.fac ?? FacSet.MON, debuffIcon, tipColor);
}
/** 护盾减免提示 */
/** 护盾吸收提示:蓝色 "吸收 N" */
shield_tip(absorbed: number) {
this.hp_tip(TooltipTypes.shield, NumberFormatter.formatNumber(Math.max(0, Math.floor(absorbed))));
}
/** 闪避提示 */
/** 闪避提示:白色 "闪避" */
showMiss() {
this.hp_tip(TooltipTypes.miss, "闪避");
}