feat: 新增技能触发类型标识与列表预制体,优化技能提示UI

1.  新增技能触发类型背景标识,支持追击/反击/复活等状态显示
2.  扩展技能提示接口,新增触发类型参数传递
3.  新增list-me列表预制体及其元数据
4.  调整部分UI精灵帧与布局参数
5.  修复技能名称显示调用参数不匹配问题
This commit is contained in:
panFD
2026-06-19 15:40:28 +08:00
parent 9220254c56
commit 3d7c9bfe54
14 changed files with 5287 additions and 4373 deletions

View File

@@ -164,12 +164,12 @@
"a": 206 "a": 206
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "2423272e-e63b-4736-b15b-30b40cf98a23@b0413", "__uuid__": "2423272e-e63b-4736-b15b-30b40cf98a23@586a7",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 1, "_type": 1,
"_fillType": 1, "_fillType": 1,
"_sizeMode": 1, "_sizeMode": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,

View File

@@ -2191,7 +2191,7 @@
"__id__": 82 "__id__": 82
}, },
"_children": [], "_children": [],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 84 "__id__": 84

View File

@@ -50,19 +50,22 @@
}, },
{ {
"__id__": 295 "__id__": 295
},
{
"__id__": 307
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 307 "__id__": 323
}, },
{ {
"__id__": 309 "__id__": 325
} }
], ],
"_prefab": { "_prefab": {
"__id__": 311 "__id__": 327
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -5667,6 +5670,396 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "call",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 308
},
{
"__id__": 314
}
],
"_active": true,
"_components": [
{
"__id__": 320
}
],
"_prefab": {
"__id__": 322
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -23.213,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "btn_yellow",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 307
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 309
},
{
"__id__": 311
}
],
"_prefab": {
"__id__": 313
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.8,
"y": 0.8,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 308
},
"_enabled": true,
"__prefab": {
"__id__": 310
},
"_contentSize": {
"__type__": "cc.Size",
"width": 185,
"height": 81
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f5+WQKeepDpI7jXqgvmtiO"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 308
},
"_enabled": true,
"__prefab": {
"__id__": 312
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "6165ffc9-a838-4a33-b569-bdbaaab0e6b4@b2501",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "08MkVcRXlJh64uV97FC5zt"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "979t7Rjp5IGpxx6E++HMV4",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 307
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 315
},
{
"__id__": 317
}
],
"_prefab": {
"__id__": 319
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 314
},
"_enabled": true,
"__prefab": {
"__id__": 316
},
"_contentSize": {
"__type__": "cc.Size",
"width": 63.5999755859375,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "feOuVKuYxJK6z+M3tV8Ey3"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 314
},
"_enabled": true,
"__prefab": {
"__id__": 318
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "召唤",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 29.8,
"_fontSize": 29.8,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": true,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_enableOutline": true,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "00BfCWkAJL/p90pcsuwUDH"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "83KbPaQKpJ3p+hfLZ1PBTs",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 307
},
"_enabled": true,
"__prefab": {
"__id__": 321
},
"_contentSize": {
"__type__": "cc.Size",
"width": 148,
"height": 64.8
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "94GKNoSM1MwIqd0zy183DD"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "57KHqoGQRBmIdHCIXwuEoC",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -5677,7 +6070,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 308 "__id__": 324
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -5705,7 +6098,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 310 "__id__": 326
}, },
"Lock": null, "Lock": null,
"unLock": null, "unLock": null,

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "b2a3067a-af88-4ff7-acdd-7474b8a163d8",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "list-me"
}
}

View File

@@ -185,10 +185,10 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@d1468", "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@d5229",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
"_fillCenter": { "_fillCenter": {
@@ -200,7 +200,10 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": "" "_id": ""
}, },
{ {
@@ -279,8 +282,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -297.949, "x": -276.372,
"y": 0, "y": 8.188,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -418,8 +421,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -299.563, "x": -277.986,
"y": 0, "y": 8.188,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -577,8 +580,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -217.727, "x": -214.902,
"y": 0, "y": 8.188,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -590,8 +593,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0.35, "x": 0.3,
"y": 0.35, "y": 0.3,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@@ -713,8 +716,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -139.467, "x": -136.642,
"y": 0, "y": 8.188,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -872,8 +875,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 225.016, "x": 167.228,
"y": 0, "y": 8.1,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -952,8 +955,8 @@
"_string": "999999", "_string": "999999",
"_horizontalAlign": 0, "_horizontalAlign": 0,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 26, "_actualFontSize": 31,
"_fontSize": 25, "_fontSize": 30,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 40, "_lineHeight": 40,
"_overflow": 2, "_overflow": 2,
@@ -1031,8 +1034,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 181.966, "x": 140.032,
"y": 0, "y": 8.1,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -1044,8 +1047,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0.4, "x": 0.3,
"y": 0.4, "y": 0.3,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,

File diff suppressed because it is too large Load Diff

View File

@@ -3292,7 +3292,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 617.5, "y": 657.577,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -3304,8 +3304,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1, "x": 1.5,
"y": 1, "y": 1.5,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@@ -3332,8 +3332,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 740, "width": 540,
"height": 55 "height": 117
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -3369,12 +3369,12 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@98637", "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@4dd1c",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 1,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,
@@ -3384,7 +3384,10 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": "" "_id": ""
}, },
{ {
@@ -3399,15 +3402,15 @@
"node": { "node": {
"__id__": 134 "__id__": 134
}, },
"_enabled": true, "_enabled": false,
"__prefab": { "__prefab": {
"__id__": 140 "__id__": 140
}, },
"_alignFlags": 41, "_alignFlags": 41,
"_target": null, "_target": null,
"_left": -10, "_left": 90,
"_right": -10, "_right": 0,
"_top": -5, "_top": -89.59100000000001,
"_bottom": 0, "_bottom": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
@@ -3629,10 +3632,10 @@
"__id__": 151 "__id__": 151
}, },
"asset": { "asset": {
"__uuid__": "0c80c911-642f-423a-8ebb-98aebbbe2ef0", "__uuid__": "b2a3067a-af88-4ff7-acdd-7474b8a163d8",
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },
"fileId": "70V66T2DlAP7ksTOaOBDja", "fileId": "43WU05gfVAPr5YF69YW+M4",
"instance": { "instance": {
"__id__": 153 "__id__": 153
}, },
@@ -3640,7 +3643,7 @@
}, },
{ {
"__type__": "cc.PrefabInstance", "__type__": "cc.PrefabInstance",
"fileId": "50AgFB9kROhppT8Q5wAY6S", "fileId": "e722VC+kdPfqeaFe1joI7B",
"prefabRootNode": { "prefabRootNode": {
"__id__": 1 "__id__": 1
}, },
@@ -3670,12 +3673,12 @@
"propertyPath": [ "propertyPath": [
"_name" "_name"
], ],
"value": "melist" "value": "list-me"
}, },
{ {
"__type__": "cc.TargetInfo", "__type__": "cc.TargetInfo",
"localID": [ "localID": [
"70V66T2DlAP7ksTOaOBDja" "43WU05gfVAPr5YF69YW+M4"
] ]
}, },
{ {
@@ -4318,7 +4321,7 @@
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },
"melist_prefab": { "melist_prefab": {
"__uuid__": "0c80c911-642f-423a-8ebb-98aebbbe2ef0", "__uuid__": "b2a3067a-af88-4ff7-acdd-7474b8a163d8",
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },
"_id": "" "_id": ""

View File

@@ -11708,10 +11708,10 @@
"height": 98, "height": 98,
"rawWidth": 96, "rawWidth": 96,
"rawHeight": 98, "rawHeight": 98,
"borderTop": 0, "borderTop": 45,
"borderBottom": 0, "borderBottom": 49,
"borderLeft": 0, "borderLeft": 48,
"borderRight": 0, "borderRight": 48,
"packable": true, "packable": true,
"pixelsToUnit": 100, "pixelsToUnit": 100,
"pivotX": 0.5, "pivotX": 0.5,
@@ -11800,8 +11800,8 @@
"height": 237, "height": 237,
"rawWidth": 117, "rawWidth": 117,
"rawHeight": 237, "rawHeight": 237,
"borderTop": 300, "borderTop": 134,
"borderBottom": 23, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
"borderRight": 0, "borderRight": 0,
"packable": true, "packable": true,

View File

@@ -249,7 +249,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
// 触发复活动画 // 触发复活动画
if (targetView && reviveSkillConf) { if (targetView && reviveSkillConf) {
targetView.playReady(reviveSkillConf.readyAnm); targetView.playReady(reviveSkillConf.readyAnm);
targetView.skill_name('', reviveSkillConf.uuid); targetView.skill_name('', reviveSkillConf.uuid, SkillTriggerType.Revive);
// 延迟 0.5 秒后恢复状态,让特效有时间播放,同时也能体现“正在复活”的过程 // 延迟 0.5 秒后恢复状态,让特效有时间播放,同时也能体现“正在复活”的过程
targetView.scheduleOnce(() => { targetView.scheduleOnce(() => {
if (targetView.node && targetView.node.isValid) { if (targetView.node && targetView.node.isValid) {

View File

@@ -321,10 +321,10 @@ export class HeroViewComp extends CCComp {
Tooltip.load(pos, type, value, s_uuid, this.node); Tooltip.load(pos, type, value, s_uuid, this.node);
} }
/** 技能提示 */ /** 技能提示 */
public skill_name(value: string = "", s_uuid: number = 1001, y: number = 50) { public skill_name(value: string = "", s_uuid: number = 1001, triggerType: string = "", y: number = 50) {
let pos = v3(0, 60); let pos = v3(0, 60);
pos.y = pos.y + y; pos.y = pos.y + y;
Tooltip.load(pos, TooltipTypes.skill, value, s_uuid, this.node); Tooltip.load(pos, TooltipTypes.skill, value, s_uuid, this.node, 1, this.model?.fac ?? FacSet.MON, triggerType);
} }
/** 血量提示(伤害数字) */ /** 血量提示(伤害数字) */
private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 0) { private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 0) {

View File

@@ -278,7 +278,7 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
if(castTimes >1){ if(castTimes >1){
val = "*"+castTimes.toString val = "*"+castTimes.toString
} }
heroView.skill_name(val,s_uuid) heroView.skill_name(val,s_uuid,triggerType)
for (let i = 0; i < castTimes; i++) { for (let i = 0; i < castTimes; i++) {
if (!heroView.node || !heroView.node.isValid) return; if (!heroView.node || !heroView.node.isValid) return;
if (isFriendly) { if (isFriendly) {

View File

@@ -60,7 +60,7 @@ export class Tooltip extends ecs.Entity {
this.remove(TooltipCom); this.remove(TooltipCom);
super.destroy(); 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; let node: Node;
if (Tooltip.pool.size() > 0) { if (Tooltip.pool.size() > 0) {
node = Tooltip.pool.get()!; node = Tooltip.pool.get()!;
@@ -75,7 +75,7 @@ export class Tooltip extends ecs.Entity {
node.active = true; node.active = true;
var sv = node.getComponent(TooltipCom)!; var sv = node.getComponent(TooltipCom)!;
sv.init(type, vaule, s_uuid, fac); sv.init(type, vaule, s_uuid, fac, triggerType);
// this.add(sv); // 不要添加到单例实体上,否则会覆盖或导致单例被销毁 // this.add(sv); // 不要添加到单例实体上,否则会覆盖或导致单例被销毁
} }

View File

@@ -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 { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { SkillSet } from "../common/config/SkillSet"; import { SkillSet } from "../common/config/SkillSet";
import { FacSet, TooltipTypes } from "../common/config/GameSet"; import { FacSet, TooltipTypes } from "../common/config/GameSet";
import { SkillTriggerType } from "../common/config/heroSet";
import { Tooltip } from "./Tooltip"; import { Tooltip } from "./Tooltip";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -28,6 +29,8 @@ export class TooltipCom extends CCComp {
value: string = ""; value: string = "";
s_uuid: number = 1001; s_uuid: number = 1001;
fac: number = FacSet.MON; fac: number = FacSet.MON;
/** 当前技能喊话对应的触发类型(空字符串表示普通主动技能) */
triggerType: string = "";
// 动画参数配置 // 动画参数配置
private readonly popDuration = 0.15; 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.stype = type;
this.value = value; this.value = value;
this.s_uuid = uuid; this.s_uuid = uuid;
this.fac = fac; this.fac = fac;
this.triggerType = triggerType;
// 初始化或获取 UIOpacity 组件 // 初始化或获取 UIOpacity 组件
this._uiOpacity = this.node.getComponent(UIOpacity); this._uiOpacity = this.node.getComponent(UIOpacity);
@@ -119,6 +123,8 @@ export class TooltipCom extends CCComp {
this.setupLabel("skill", "name", skillName+this.value); this.setupLabel("skill", "name", skillName+this.value);
// this.node.setPosition(v3(this.node.position.x, currentY)); // this.node.setPosition(v3(this.node.position.x, currentY));
this.node.setSiblingIndex(topSiblingIndex); this.node.setSiblingIndex(topSiblingIndex);
// 根据触发类型激活对应的背景标识(追击/反击/起手/生息/亡语/复活)
this.setupTriggerBg(this.triggerType);
break; break;
case TooltipTypes.uskill: case TooltipTypes.uskill:
this.setupLabel("uskill", "name", this.value); 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) { playAnimation(scaleMax: number, isCrit: boolean, isHeal: boolean, sx: number = 1) {
// 随机 X 轴偏移 (防止重叠) // 随机 X 轴偏移 (防止重叠)
const randomX = (Math.random() - 0.5) * 60; const randomX = (Math.random() - 0.5) * 60;