feat(card): 实现英雄卡升级标识与交互优化

1. 新增升级专用动画资源与up_icon_node节点
2. 重构等级显示逻辑,升级卡显示前后等级
3. 调整召唤按钮文案为"升级"或"招募"适配场景
4. 移除无用的getLvColor导入与旧的层级控制逻辑
This commit is contained in:
pan
2026-07-21 11:02:27 +08:00
parent 9a0dbaf41d
commit c1d461516b
4 changed files with 748 additions and 26 deletions

View File

@@ -0,0 +1,287 @@
[
{
"__type__": "cc.AnimationClip",
"_name": "card_lv_up",
"_objFlags": 0,
"__editorExtras__": {
"embeddedPlayerGroups": []
},
"_native": "",
"sample": 15,
"speed": 1,
"wrapMode": 2,
"enableTrsBlending": false,
"_duration": 0.4,
"_hash": 500763545,
"_tracks": [
{
"__id__": 1
},
{
"__id__": 12
}
],
"_exoticAnimation": null,
"_events": [],
"_embeddedPlayers": [],
"_additiveSettings": {
"__id__": 18
},
"_auxiliaryCurveEntries": []
},
{
"__type__": "cc.animation.VectorTrack",
"_binding": {
"__type__": "cc.animation.TrackBinding",
"path": {
"__id__": 2
},
"proxy": null
},
"_channels": [
{
"__id__": 4
},
{
"__id__": 6
},
{
"__id__": 8
},
{
"__id__": 10
}
],
"_nComponents": 3
},
{
"__type__": "cc.animation.TrackPath",
"_paths": [
{
"__id__": 3
},
"position"
]
},
{
"__type__": "cc.animation.HierarchyPath",
"path": "arrow3"
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 5
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.3333333432674408
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 7
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.3333333432674408
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 20,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 9
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.3333333432674408
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 11
}
},
{
"__type__": "cc.RealCurve",
"_times": [],
"_values": [],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.ObjectTrack",
"_binding": {
"__type__": "cc.animation.TrackBinding",
"path": {
"__id__": 13
},
"proxy": null
},
"_channel": {
"__id__": 16
}
},
{
"__type__": "cc.animation.TrackPath",
"_paths": [
{
"__id__": 14
},
{
"__id__": 15
},
"spriteFrame"
]
},
{
"__type__": "cc.animation.HierarchyPath",
"path": "Effect_UpArrow-0"
},
{
"__type__": "cc.animation.ComponentPath",
"component": "cc.Sprite"
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 17
}
},
{
"__type__": "cc.ObjectCurve",
"_times": [
0,
0.06666666666666667,
0.13333333333333333,
0.2,
0.26666666666666666,
0.3333333333333333
],
"_values": [
{
"__uuid__": "2423272e-e63b-4736-b15b-30b40cf98a23@bbefd",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "2423272e-e63b-4736-b15b-30b40cf98a23@d67c5",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "2423272e-e63b-4736-b15b-30b40cf98a23@22d37",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "2423272e-e63b-4736-b15b-30b40cf98a23@9c372",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "2423272e-e63b-4736-b15b-30b40cf98a23@6dcdc",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "2423272e-e63b-4736-b15b-30b40cf98a23@91e6f",
"__expectedType__": "cc.SpriteFrame"
}
]
},
{
"__type__": "cc.AnimationClipAdditiveSettings",
"enabled": false,
"refClip": null
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "2.0.3",
"importer": "animation-clip",
"imported": true,
"uuid": "c2d432a6-b24f-4511-b84f-87a02f9787c3",
"files": [
".cconb"
],
"subMetas": {},
"userData": {
"name": "card_lv_up"
}
}

View File

@@ -53,19 +53,22 @@
},
{
"__id__": 307
},
{
"__id__": 327
}
],
"_active": true,
"_components": [
{
"__id__": 327
"__id__": 345
},
{
"__id__": 329
"__id__": 347
}
],
"_prefab": {
"__id__": 331
"__id__": 349
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -5089,8 +5092,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 86,
"height": 106
"width": 114,
"height": 116
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -5126,7 +5129,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "6165ffc9-a838-4a33-b569-bdbaaab0e6b4@47087",
"__uuid__": "6165ffc9-a838-4a33-b569-bdbaaab0e6b4@e4ed2",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
@@ -5701,7 +5704,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -142.978,
"y": 21.628,
"z": 0
},
"_lrot": {
@@ -5794,8 +5797,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 340,
"height": 100
"width": 320,
"height": 160
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -5834,7 +5837,7 @@
"__uuid__": "6165ffc9-a838-4a33-b569-bdbaaab0e6b4@b2501",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1,
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
@@ -5865,10 +5868,10 @@
"__prefab": {
"__id__": 314
},
"_alignFlags": 40,
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_left": 5,
"_right": 5,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
@@ -5880,7 +5883,7 @@
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 340,
"_originalHeight": 0,
"_originalHeight": 160,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
@@ -6002,7 +6005,7 @@
"b": 255,
"a": 255
},
"_string": "召唤",
"_string": "招募",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 29.8,
@@ -6076,7 +6079,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 170,
"height": 64.8
"height": 80
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -6101,14 +6104,14 @@
"__prefab": {
"__id__": 325
},
"_alignFlags": 40,
"_alignFlags": 42,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_verticalCenter": 21.628,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
@@ -6138,6 +6141,405 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "up",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 328
},
{
"__id__": 334
}
],
"_active": true,
"_components": [
{
"__id__": 340
},
{
"__id__": 342
}
],
"_prefab": {
"__id__": 344
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -68.042,
"y": 94.62,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1.1,
"y": 1.2,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "Effect_UpArrow-0",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 327
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 329
},
{
"__id__": 331
}
],
"_prefab": {
"__id__": 333
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 61.352,
"y": -109.308,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": -0.7071067811865475,
"w": 0.7071067811865476
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1.5,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -90
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 328
},
"_enabled": true,
"__prefab": {
"__id__": 330
},
"_contentSize": {
"__type__": "cc.Size",
"width": 28,
"height": 28
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c77o/UuDZPcodkjKNbk/cX"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 328
},
"_enabled": true,
"__prefab": {
"__id__": 332
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "2423272e-e63b-4736-b15b-30b40cf98a23@bbefd",
"__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": "d31AbwPEBB5ZJ1ePcnXzPB"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "35Ayl/EtpLXa5OUAwPlZCM",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "arrow3",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 327
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 335
},
{
"__id__": 337
}
],
"_prefab": {
"__id__": 339
},
"_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__": 334
},
"_enabled": true,
"__prefab": {
"__id__": 336
},
"_contentSize": {
"__type__": "cc.Size",
"width": 51,
"height": 47
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5d6RIUcK9GlrNqYm3ZvdQW"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 334
},
"_enabled": true,
"__prefab": {
"__id__": 338
},
"_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@22ab3",
"__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": "b3VRkY4rpL4oUPMVExvqoB"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "7fNdM+i9JJG7btdHWt6hMN",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 327
},
"_enabled": true,
"__prefab": {
"__id__": 341
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e01/RemspD/6ASrPn4Quwk"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 327
},
"_enabled": true,
"__prefab": {
"__id__": 343
},
"playOnLoad": true,
"_clips": [
{
"__uuid__": "c2d432a6-b24f-4511-b84f-87a02f9787c3",
"__expectedType__": "cc.AnimationClip"
}
],
"_defaultClip": {
"__uuid__": "c2d432a6-b24f-4511-b84f-87a02f9787c3",
"__expectedType__": "cc.AnimationClip"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "47jXyUHNtKM4JlKoWx6Uir"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "853zzTUkZOwYsnTZ02pMAu",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -6148,7 +6550,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 328
"__id__": 346
},
"_contentSize": {
"__type__": "cc.Size",
@@ -6176,7 +6578,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 330
"__id__": 348
},
"Lock": null,
"unLock": null,
@@ -6201,7 +6603,12 @@
"info_node": {
"__id__": 296
},
"lvl_node": null,
"lvl_node": {
"__id__": 254
},
"up_icon_node": {
"__id__": 327
},
"ap_node": {
"__id__": 195
},

View File

@@ -35,7 +35,6 @@ import { UIID } from "../common/config/GameUIConfig";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { FieldSkillType } from "../common/config/SkillSet";
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
import { getLvColor } from "../common/config/GameSet";
import { MissionEconomy } from "./MissionEconomy";
@@ -62,7 +61,7 @@ export class CardComp extends CCComp {
/** 解锁态图标节点(显示时表示本槽位未锁定,可点击上锁) */
@property(Node)
unLock: Node = null!
@property(Node)
call_btn: Node = null!
/** 英雄卡信息面板(显示 AP / HP 废弃,改用直接绑定 */
@@ -88,10 +87,12 @@ export class CardComp extends CCComp {
info_node = null!
@property(Label)
lvl_node: Label = null! //英雄本身的等级
@property(Node)
up_icon_node: Node = null! //升级 icon
@property(Node)
ap_node = null!
@property(Node)
@@ -683,6 +684,10 @@ export class CardComp extends CCComp {
child.active = (child.name === kindName);
});
}
// 升级标识独立由 up_icon_node 控制,不再挂在 Ckind_node 下
if (this.up_icon_node) {
this.up_icon_node.active = isUpgradeCard;
}
const hbNodeUI = this.node.getChildByName("HB");
if (hbNodeUI) hbNodeUI.active = false;
@@ -747,8 +752,12 @@ export class CardComp extends CCComp {
const heroLv = Math.max(1, this.cardData.hero_lv ?? hero?.lv ?? 1);
this.setLabel(this.name_node, `${hero?.name || ""}`);
if (this.lvl_node) {
this.lvl_node.string = `Lv.${heroLv}`;
this.lvl_node.color = getLvColor(heroLv);
// 升级卡:显示「当前→升级后」;普通英雄卡:显示当前等级。统一使用默认颜色
if (isUpgradeCard && heroLv > 1) {
this.lvl_node.string = `Lv.${heroLv - 1} Lv.${heroLv}`;
} else {
this.lvl_node.string = `Lv.${heroLv}`;
}
this.lvl_node.node.active = true;
}
this.ap_node.getChildByName("val").getComponent(Label).string = `${(hero?.ap ?? 0) * heroLv}`;
@@ -783,6 +792,11 @@ export class CardComp extends CCComp {
}
}
// ---- 召唤按钮文案:英雄卡=招募,升级卡=升级 ----
if (this.call_btn) {
this.setLabel(this.call_btn, isUpgradeCard ? "升级" : "招募");
}
// ---- 图标 ----
const iconNode = this.icon_node as Node;
if (renderType === CardType.Hero) {
@@ -914,6 +928,7 @@ export class CardComp extends CCComp {
if (this.ap_node) this.ap_node.active = false;
if (this.hp_node) this.hp_node.active = false;
if (this.lvl_node) this.lvl_node.node.active = false;
if (this.up_icon_node) this.up_icon_node.active = false;
if (this.Ckind_node) {
this.Ckind_node.children.forEach(child => {
child.active = false;