refactor(HInfoComp): 简化卡牌等级显示逻辑
1. 将lv_node从Node改为Label类型,直接通过string属性更新等级文本 2. 移除原有的子节点遍历匹配逻辑,替换为更简洁的文本赋值方式 3. 新增pool_lv_node节点属性用于后续池等级相关逻辑 4. 同步更新了ha2.prefab的预制体结构与meta配置文件
This commit is contained in:
@@ -47,13 +47,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 53
|
"__id__": 53
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 55
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 57
|
"__id__": 55
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -898,32 +895,6 @@
|
|||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "23j+p5lLdC+r4iKSVeLNM4"
|
"fileId": "23j+p5lLdC+r4iKSVeLNM4"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"__type__": "cc.Animation",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"__editorExtras__": {},
|
|
||||||
"node": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"__prefab": {
|
|
||||||
"__id__": 56
|
|
||||||
},
|
|
||||||
"playOnLoad": false,
|
|
||||||
"_clips": [
|
|
||||||
{
|
|
||||||
"__uuid__": "cd3e0604-8840-4794-8755-f2ed86dbe264",
|
|
||||||
"__expectedType__": "cc.AnimationClip"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_defaultClip": null,
|
|
||||||
"_id": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.CompPrefabInfo",
|
|
||||||
"fileId": "49+IQe4gZPPYzJ/FgxeX/O"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
"root": {
|
"root": {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3749
assets/resources/gui/element/pool_lv.prefab
Normal file
3749
assets/resources/gui/element/pool_lv.prefab
Normal file
File diff suppressed because it is too large
Load Diff
13
assets/resources/gui/element/pool_lv.prefab.meta
Normal file
13
assets/resources/gui/element/pool_lv.prefab.meta
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.1.50",
|
||||||
|
"importer": "prefab",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "bf40528a-fcf8-44da-af2e-d6b113904f35",
|
||||||
|
"files": [
|
||||||
|
".json"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"syncNodeName": "pool_lv"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -66,9 +66,11 @@ export class HInfoComp extends CCComp {
|
|||||||
@property(Node)
|
@property(Node)
|
||||||
info_node=null!
|
info_node=null!
|
||||||
|
|
||||||
@property(Node)
|
@property(Label)
|
||||||
lv_node=null!
|
lv_node: Label = null!
|
||||||
|
|
||||||
|
@property(Node)
|
||||||
|
pool_lv_node: Node = null!
|
||||||
@property(Node)
|
@property(Node)
|
||||||
ap_node=null!
|
ap_node=null!
|
||||||
|
|
||||||
@@ -162,12 +164,7 @@ export class HInfoComp extends CCComp {
|
|||||||
// ---- 卡牌等级显示 ----
|
// ---- 卡牌等级显示 ----
|
||||||
if (this.lv_node) {
|
if (this.lv_node) {
|
||||||
const currentLv = this.model.lv ?? 1;
|
const currentLv = this.model.lv ?? 1;
|
||||||
this.lv_node.children.forEach(child => {
|
this.lv_node.string = `Lv.${currentLv}`;
|
||||||
if (child.name.startsWith('lv')) {
|
|
||||||
const nodeLv = parseInt(child.name.substring(2));
|
|
||||||
child.active = !isNaN(nodeLv) && nodeLv <= currentLv;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- 图标动画(仅在 UUID 变化时重新加载) ----
|
// ---- 图标动画(仅在 UUID 变化时重新加载) ----
|
||||||
|
|||||||
Reference in New Issue
Block a user