From f436e47d8d9b44da1e564c0b7d1e4999c5c26da4 Mon Sep 17 00:00:00 2001 From: walkpan Date: Wed, 25 Mar 2026 20:37:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9C=B0=E5=9B=BE):=20=E4=B8=BA=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E4=BF=A1=E6=81=AF=E7=BB=84=E4=BB=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E8=8A=82=E7=82=B9=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 HInfoComp 组件中新增 icon_node 属性,用于在预制件中引用图标节点。同时更新了 hnode.prefab 的配置,添加了对应的 Sprite 和 Animation 组件,以支持英雄图标的显示和动画效果。 --- assets/resources/gui/element/hnode.prefab | 84 +++++++++++++++++++++-- assets/script/game/map/HInfoComp.ts | 4 +- 2 files changed, 81 insertions(+), 7 deletions(-) diff --git a/assets/resources/gui/element/hnode.prefab b/assets/resources/gui/element/hnode.prefab index 69c49574..95dbe7f6 100644 --- a/assets/resources/gui/element/hnode.prefab +++ b/assets/resources/gui/element/hnode.prefab @@ -34,14 +34,14 @@ "_active": true, "_components": [ { - "__id__": 54 + "__id__": 58 }, { - "__id__": 56 + "__id__": 60 } ], "_prefab": { - "__id__": 58 + "__id__": 62 }, "_lpos": { "__type__": "cc.Vec3", @@ -1217,10 +1217,16 @@ "_components": [ { "__id__": 51 + }, + { + "__id__": 53 + }, + { + "__id__": 55 } ], "_prefab": { - "__id__": 53 + "__id__": 57 }, "_lpos": { "__type__": "cc.Vec3", @@ -1279,6 +1285,69 @@ "__type__": "cc.CompPrefabInfo", "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", "root": { @@ -1302,7 +1371,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 55 + "__id__": 59 }, "_contentSize": { "__type__": "cc.Size", @@ -1330,7 +1399,10 @@ }, "_enabled": true, "__prefab": { - "__id__": 57 + "__id__": 61 + }, + "icon_node": { + "__id__": 50 }, "_id": "" }, diff --git a/assets/script/game/map/HInfoComp.ts b/assets/script/game/map/HInfoComp.ts index 0afa6746..c766185a 100644 --- a/assets/script/game/map/HInfoComp.ts +++ b/assets/script/game/map/HInfoComp.ts @@ -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 { HeroAttrsComp } from "../hero/HeroAttrsComp"; -const { ccclass } = _decorator; +const {property, ccclass } = _decorator; /** 视图层对象 */ @ccclass('HInfoComp') @ecs.register('HInfoComp', false) export class HInfoComp extends CCComp { + @property(Node) + icon_node=null! private eid: number = 0; private model: HeroAttrsComp | null = null; private apLabel: Label | null = null;