英雄卡牌ui修改,todo 抽卡修改

This commit is contained in:
2025-01-18 23:53:34 +08:00
parent 55061ec37c
commit cebf09a58c
16 changed files with 4544 additions and 1714 deletions

View File

@@ -15,15 +15,19 @@ export class HCard extends ecs.Entity {
}
load(uuid:number=1001,index:number=-1,parent:any) {
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 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 path = "game/heros/uiheros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var snode = instantiate(prefab);
snode.parent = node.getChildByName("Mask")
var hcc = node.getComponent(HCardComp)!;
hcc.hi= index
this.add(hcc)

View File

@@ -61,8 +61,7 @@ export class HeroHomeComp extends CCComp {
this.node.getChildByName("show").active=true
this.h_uuid=uuid
this.hero=HeroInfo[uuid]
this.gold_need=(getUpGoldByRange(smc.heros[uuid].lv)*smc.heros[uuid].lv)
this.chip_need=(getUpChipByLv(smc.heros[uuid].lv)-this.hero.lvexp)*smc.heros[uuid].lv
console.log("hero_show",uuid)
let skill1 = SkillSet[this.hero.sk1[0]]
let skill2 = SkillSet[this.hero.sk2[0]]
@@ -101,6 +100,8 @@ export class HeroHomeComp extends CCComp {
}
update_data(){
this.slv = Math.floor((smc.heros[this.h_uuid].lv) / 5);
this.gold_need=(getUpGoldByRange(smc.heros[this.h_uuid].lv)*smc.heros[this.h_uuid].lv)
this.chip_need=getUpChipByLv(smc.heros[this.h_uuid].lv)-this.hero.lvexp
// let slv_node=this.node.getChildByName("show").getChildByName("name").getChildByName("slv");
let lvup=this.node.getChildByName("show").getChildByName("lvup");
// let slvup=this.node.getChildByName("show").getChildByName("slvup");