feat(地图): 为英雄信息组件添加图标节点属性

在 HInfoComp 组件中新增 icon_node 属性,用于在预制件中引用图标节点。同时更新了 hnode.prefab 的配置,添加了对应的 Sprite 和 Animation 组件,以支持英雄图标的显示和动画效果。
This commit is contained in:
walkpan
2026-03-25 20:37:12 +08:00
parent d5d763a6ef
commit f436e47d8d
2 changed files with 81 additions and 7 deletions

View File

@@ -34,14 +34,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 54 "__id__": 58
}, },
{ {
"__id__": 56 "__id__": 60
} }
], ],
"_prefab": { "_prefab": {
"__id__": 58 "__id__": 62
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1217,10 +1217,16 @@
"_components": [ "_components": [
{ {
"__id__": 51 "__id__": 51
},
{
"__id__": 53
},
{
"__id__": 55
} }
], ],
"_prefab": { "_prefab": {
"__id__": 53 "__id__": 57
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1279,6 +1285,69 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "56gTtOUjNGIJx4xuuZN5eh" "fileId": "56gTtOUjNGIJx4xuuZN5eh"
}, },
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 50
},
"_enabled": true,
"__prefab": {
"__id__": 54
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": null,
"_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": "747U1TyPJCOYb6NqYEk5DD"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 50
},
"_enabled": true,
"__prefab": {
"__id__": 56
},
"playOnLoad": false,
"_clips": [],
"_defaultClip": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2e7ip9iHRCkpgbEWKgWSjG"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
@@ -1302,7 +1371,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 55 "__id__": 59
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1330,7 +1399,10 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 57 "__id__": 61
},
"icon_node": {
"__id__": 50
}, },
"_id": "" "_id": ""
}, },

View File

@@ -3,12 +3,14 @@ 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 { HeroAttrsComp } from "../hero/HeroAttrsComp"; import { HeroAttrsComp } from "../hero/HeroAttrsComp";
const { ccclass } = _decorator; const {property, ccclass } = _decorator;
/** 视图层对象 */ /** 视图层对象 */
@ccclass('HInfoComp') @ccclass('HInfoComp')
@ecs.register('HInfoComp', false) @ecs.register('HInfoComp', false)
export class HInfoComp extends CCComp { export class HInfoComp extends CCComp {
@property(Node)
icon_node=null!
private eid: number = 0; private eid: number = 0;
private model: HeroAttrsComp | null = null; private model: HeroAttrsComp | null = null;
private apLabel: Label | null = null; private apLabel: Label | null = null;