英雄上阵选择 基本完成

This commit is contained in:
panw
2024-12-10 16:44:54 +08:00
parent 9cd72c108e
commit 5fdd6486de
26 changed files with 16811 additions and 12790 deletions

View File

@@ -1,8 +1,9 @@
import { instantiate, Prefab } from "cc";
import { instantiate, Prefab, resources, Sprite, SpriteAtlas } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { HCardComp } from "./HCardComp";
import { HeroInfo } from "../common/config/heroSet";
/** HCard 模块 */
@ecs.register(`HCard`)
@@ -13,8 +14,14 @@ export class HCard extends ecs.Entity {
// this.addComponents<ecs.Comp>();
}
load(uuid:number=1001,index:number=-1,parent:any) {
var path = "gui/element/hcard";
var path = "game/gui/hcard";
var icon_path = "game/heros/herois"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
});
var prefab: Prefab = oops.res.get(path, Prefab)!;
console.log("load_hcard",prefab)
var node = instantiate(prefab);
node.parent = parent
var hcc = node.getComponent(HCardComp)!;