refactor(HerosListComp): 重命名职业展示相关变量与方法

1. 将 type_node 重命名为 role_node,updateTypeDisplay 重命名为 updateRoleDisplay
2. 更新注释说明子节点按 HRole 枚举值命名
3. 同步修改调用处的变量名和方法名
This commit is contained in:
panFD
2026-08-30 21:45:55 +08:00
parent 69aa1863b7
commit 5edaae639d
11 changed files with 10072 additions and 5526 deletions

View File

@@ -22,32 +22,32 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 10 "__id__": 22
}, },
{ {
"__id__": 20 "__id__": 32
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 26 "__id__": 38
}, },
{ {
"__id__": 28 "__id__": 40
}, },
{ {
"__id__": 30 "__id__": 42
}, },
{ {
"__id__": 32 "__id__": 44
}, },
{ {
"__id__": 34 "__id__": 46
} }
], ],
"_prefab": { "_prefab": {
"__id__": 36 "__id__": 48
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -86,21 +86,28 @@
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
}, },
"_children": [], "_children": [
"_active": true,
"_components": [
{ {
"__id__": 3 "__id__": 3
}, },
{ {
"__id__": 5 "__id__": 9
}
],
"_active": true,
"_components": [
{
"__id__": 15
}, },
{ {
"__id__": 7 "__id__": 17
},
{
"__id__": 19
} }
], ],
"_prefab": { "_prefab": {
"__id__": 9 "__id__": 21
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -131,6 +138,278 @@
}, },
"_id": "" "_id": ""
}, },
{
"__type__": "cc.Node",
"_name": "ToastMessage_Light2",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
},
{
"__id__": 6
}
],
"_prefab": {
"__id__": 8
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -162.953,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.6,
"y": 0.6,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": {
"__id__": 5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 181,
"height": 120
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "31aIajBhlM25PQzAv2gizj"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 244,
"g": 254,
"b": 85,
"a": 100
},
"_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@e6c0f",
"__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": "e8qeLb/J1LWroLmjz08gT2"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "96FtDD9BlFCJz9ubd/X1Ke",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "ToastMessage_Light2",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
},
{
"__id__": 12
}
],
"_prefab": {
"__id__": 14
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 138.274,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.6,
"y": 0.6,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"_contentSize": {
"__type__": "cc.Size",
"width": 181,
"height": 120
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5bvV0QAbdK04GrK2iF/FLg"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
},
"_enabled": true,
"__prefab": {
"__id__": 13
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 244,
"g": 254,
"b": 85,
"a": 100
},
"_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@e6c0f",
"__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": "dckrzYGUlM/IQJX4SqrVFo"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "afSwCCyzxGNLERWSLEViO0",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -141,7 +420,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 4 "__id__": 16
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -169,7 +448,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 6 "__id__": 18
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -181,7 +460,10 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": null, "_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@6d23b",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
@@ -214,7 +496,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 8 "__id__": 20
}, },
"_alignFlags": 40, "_alignFlags": 40,
"_target": null, "_target": null,
@@ -265,25 +547,25 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 11 "__id__": 23
}, },
{ {
"__id__": 13 "__id__": 25
}, },
{ {
"__id__": 15 "__id__": 27
}, },
{ {
"__id__": 17 "__id__": 29
} }
], ],
"_prefab": { "_prefab": {
"__id__": 19 "__id__": 31
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": -5.807000000000002,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -315,11 +597,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 10 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 12 "__id__": 24
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -343,11 +625,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 10 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 14 "__id__": 26
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -411,11 +693,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 10 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 16 "__id__": 28
}, },
"_params": [], "_params": [],
"_dataID": "", "_dataID": "",
@@ -431,18 +713,18 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 10 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 18 "__id__": 30
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
"_left": 25, "_left": 25,
"_right": 25, "_right": 25,
"_top": 40, "_top": 45.807,
"_bottom": 40, "_bottom": 34.193,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
@@ -486,14 +768,14 @@
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 21 "__id__": 33
}, },
{ {
"__id__": 23 "__id__": 35
} }
], ],
"_prefab": { "_prefab": {
"__id__": 25 "__id__": 37
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -530,11 +812,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 20 "__id__": 32
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 22 "__id__": 34
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -558,11 +840,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 20 "__id__": 32
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 24 "__id__": 36
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -620,7 +902,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 27 "__id__": 39
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -648,7 +930,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 29 "__id__": 41
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -690,7 +972,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 31 "__id__": 43
}, },
"playOnLoad": true, "playOnLoad": true,
"_clips": [ "_clips": [
@@ -719,13 +1001,13 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 33 "__id__": 45
}, },
"lab_content": { "lab_content": {
"__id__": 13 "__id__": 25
}, },
"animation": { "animation": {
"__id__": 30 "__id__": 42
}, },
"_id": "" "_id": ""
}, },
@@ -743,7 +1025,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 35 "__id__": 47
}, },
"_alignFlags": 1, "_alignFlags": 1,
"_target": null, "_target": null,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -73,8 +73,9 @@ export class HerosListComp extends CCComp {
@property(Label) @property(Label)
lv_label = null! lv_label = null!
/** 职业展示节点(子节点按 HRole 枚举值命名 0~5:0=坦克 1=战士 2=刺客 3=射手 4=法师 5=辅助) */
@property(Node) @property(Node)
type_node = null! role_node = null!
/** 升级按钮节点(smalltip 气泡已作为其子节点挂在下面) */ /** 升级按钮节点(smalltip 气泡已作为其子节点挂在下面) */
@property(Node) @property(Node)
@@ -415,7 +416,7 @@ export class HerosListComp extends CCComp {
this.updatePoolLvBg(hero.card_lv ?? 1) this.updatePoolLvBg(hero.card_lv ?? 1)
this.updateLvDisplay(uuid) this.updateLvDisplay(uuid)
this.updateTypeDisplay(hero) this.updateRoleDisplay(hero)
this.updateHeroAnimation(uuid) this.updateHeroAnimation(uuid)
this.updateGrowthPanel(uuid) this.updateGrowthPanel(uuid)
this.updateSkillIcons(hero) this.updateSkillIcons(hero)
@@ -446,12 +447,12 @@ export class HerosListComp extends CCComp {
this.lv_label.string = `lv.${outerLv}` this.lv_label.string = `lv.${outerLv}`
} }
private updateTypeDisplay(hero: typeof HeroInfo[number]) { private updateRoleDisplay(hero: typeof HeroInfo[number]) {
if (!this.type_node) return if (!this.role_node) return
this.type_node.active = true this.role_node.active = true
const typeStr = `${hero.type ?? 0}` const roleStr = `${hero.role ?? 0}`
this.type_node.children.forEach(child => { this.role_node.children.forEach(child => {
child.active = (child.name === typeStr) child.active = (child.name === roleStr)
}) })
} }