This commit is contained in:
2024-12-05 23:35:56 +08:00
parent 1a9d2679b5
commit 0079dc2231
2 changed files with 3072 additions and 1919 deletions

View File

@@ -38,20 +38,30 @@ export class HeroHomeComp extends CCComp {
}
hero_show(uuid:number) {
console.log("hero_home hero_show:",uuid)
let lv = smc.vmdata.heros[uuid].lv
let slv = smc.vmdata.heros[uuid].slv
let hero =smc.heros[uuid]
this.h_uuid=uuid
var icon_path = "game/heros/herois"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("hero").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(smc.heros[uuid].path);
sprite.spriteFrame = atlas.getSpriteFrame(hero.path);
});
this.node.getChildByName("name").getChildByName("value").getComponent(Label).string=smc.heros[uuid].name
this.node.getChildByName("hero").getChildByName("lv").getComponent(Label).string = smc.vmdata.heros[uuid].lv.toString()+"级";
let slv=this.node.getChildByName("hero").getChildByName("slv");
if(smc.vmdata.heros[uuid].slv>=1) {slv.getChildByName("s1").active=true}else{slv.getChildByName("s1").active=false};
if(smc.vmdata.heros[uuid].slv>=2) {slv.getChildByName("s2").active=true}else{slv.getChildByName("s2").active=false};
if(smc.vmdata.heros[uuid].slv>=3) {slv.getChildByName("s3").active=true}else{slv.getChildByName("s3").active=false};
if(smc.vmdata.heros[uuid].slv>=4) {slv.getChildByName("s4").active=true}else{slv.getChildByName("s4").active=false};
if(smc.vmdata.heros[uuid].slv>=5) {slv.getChildByName("s5").active=true}else{slv.getChildByName("s5").active=false};
this.node.getChildByName("name").getChildByName("value").getComponent(Label).string=hero.name
this.node.getChildByName("hero").getChildByName("lv").getComponent(Label).string = lv.toString()+"级";
let slv_node=this.node.getChildByName("hero").getChildByName("slv");
if(smc.vmdata.heros[uuid].slv>=1) {slv_node.getChildByName("s1").active=true}else{slv_node.getChildByName("s1").active=false};
if(slv>=1) {slv_node.getChildByName("s1").active=true}else{slv_node.getChildByName("s1").active=false};
if(slv>=2) {slv_node.getChildByName("s2").active=true}else{slv_node.getChildByName("s2").active=false};
if(slv>=3) {slv_node.getChildByName("s3").active=true}else{slv_node.getChildByName("s3").active=false};
if(slv>=4) {slv_node.getChildByName("s4").active=true}else{slv_node.getChildByName("s4").active=false};
if(slv>=5) {slv_node.getChildByName("s5").active=true}else{slv_node.getChildByName("s5").active=false};
this.node.getChildByName("attr").getChildByName("ap").getChildByName("val").getComponent(Label).string = hero.ap+hero.ap_up*lv
this.node.getChildByName("attr").getChildByName("hp").getChildByName("val").getComponent(Label).string = hero.hp+hero.hp_up*lv
this.node.getChildByName("attr").getChildByName("def").getChildByName("val").getComponent(Label).string = hero.ap+hero.ap_up*lv
this.node.getChildByName("attr").getChildByName("acd").getChildByName("val").getComponent(Label).string = hero.a_cd
this.node.getChildByName("attr").getChildByName("speed").getChildByName("val").getComponent(Label).string = hero.speed
this.node.getChildByName("attr").getChildByName("dis").getChildByName("val").getComponent(Label).string = hero.dis
}
lv_up(){
console.log("lvup h_uuid:",this.h_uuid)