英雄和卡片 联动完成
This commit is contained in:
@@ -18,20 +18,21 @@ export class HeroCard extends ecs.Entity {
|
||||
var icon_path = "game/heros/herois"
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
let slv = node.getChildByName("slv");
|
||||
node.parent = parent;
|
||||
node.getChildByName("name").getComponent(Label).string = HeroInfo[uuid].name
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
|
||||
});
|
||||
node.getChildByName("lv").getComponent(Label).string = smc.heros[uuid].lv.toString();
|
||||
if(smc.heros[uuid].slv>=1) node.getChildByName("slv").getChildByName("s1").active=true;
|
||||
if(smc.heros[uuid].slv>=2) node.getChildByName("slv").getChildByName("s2").active=true;
|
||||
if(smc.heros[uuid].slv>=3) node.getChildByName("slv").getChildByName("s3").active=true;
|
||||
if(smc.heros[uuid].slv>=4) node.getChildByName("slv").getChildByName("s4").active=true;
|
||||
if(smc.heros[uuid].slv>=5) node.getChildByName("slv").getChildByName("s5").active=true;
|
||||
node.getChildByName("lv").getComponent(Label).string = smc.heros[uuid].lv.toString()+"级";
|
||||
if(smc.heros[uuid].slv>=1) {slv.getChildByName("s1").active=true} else {slv.getChildByName("s1").active=false};
|
||||
if(smc.heros[uuid].slv>=2) {slv.getChildByName("s2").active=true} else {slv.getChildByName("s2").active=false};
|
||||
if(smc.heros[uuid].slv>=3) {slv.getChildByName("s3").active=true} else {slv.getChildByName("s3").active=false};
|
||||
if(smc.heros[uuid].slv>=4) {slv.getChildByName("s4").active=true} else {slv.getChildByName("s4").active=false};
|
||||
if(smc.heros[uuid].slv>=5) {slv.getChildByName("s5").active=true} else {slv.getChildByName("s5").active=false};
|
||||
let hcc = node.getComponent(HeroCardComp)!;
|
||||
hcc.hcc_uuid = uuid;
|
||||
hcc.h_uuid = uuid;
|
||||
this.add(hcc);
|
||||
}
|
||||
/** 模块资源释放 */
|
||||
|
||||
Reference in New Issue
Block a user