技能ui完成, todo 技能执行

This commit is contained in:
panw
2024-12-16 16:18:37 +08:00
parent b9a188a7bb
commit 70cac957a9
19 changed files with 4310 additions and 25074 deletions

View File

@@ -1,8 +1,10 @@
import { instantiate, Prefab } from "cc";
import { instantiate, Label, 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 { MSCardComp } from "./MSCardComp";
import { smc } from "../common/SingletonModuleComp";
import { HeroInfo } from "../common/config/heroSet";
import { SkillSet } from "../common/config/SkillSet";
/** MSCard 模块 */
@ecs.register(`MSCard`)
@@ -15,17 +17,21 @@ export class MSCard extends ecs.Entity {
}
load(uuid:number=1001,parent:any,zone:number=0) {
var path = "game/gui/MSCard";
// 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 icon_path = "game/skills/skill_icon"
var prefab: Prefab = oops.res.get(path, Prefab)!;
console.log("load_hcard",prefab)
var node = instantiate(prefab);
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
});
node.getChildByName("name").getComponent(Label).string = SkillSet[uuid].name
node.parent = parent
var msc = node.getComponent(MSCardComp)!;
msc.s_uuid= uuid
msc.update_data()
if(zone==1) {msc.is_update=true }else{msc.is_update=false}
if(zone==2) {msc.is_select=true}else{msc.is_select=false}
this.add(msc)