英雄界面ui修改

This commit is contained in:
2025-01-24 16:48:44 +08:00
parent 399382252d
commit 6ea3e9504d
2 changed files with 5135 additions and 16961 deletions

View File

@@ -37,23 +37,25 @@ export class HeroHomeComp extends CCComp {
parent.getComponent(UITransform).setContentSize(720,Math.ceil(HeroList.length/4)*230)
console.log("parent",parent)
for (let i = 0; i < hc; i++) {
if (HeroInfo[HeroList[i]].quality==3) {
let hcc =ecs.getEntity<HeroCard>(HeroCard)
hcc.load(HeroList[i],parent)
}
}
for (let i = 0; i < hc; i++) {
if (HeroInfo[HeroList[i]].quality==2) {
let hcc =ecs.getEntity<HeroCard>(HeroCard)
hcc.load(HeroList[i],parent)
}
}
for (let i = 0; i < hc; i++) {
if (HeroInfo[HeroList[i]].quality==1) {
let hcc =ecs.getEntity<HeroCard>(HeroCard)
hcc.load(HeroList[i],parent)
}
let hcc =ecs.getEntity<HeroCard>(HeroCard)
hcc.load(HeroList[i],parent)
// if (HeroInfo[HeroList[i]].quality==3) {
// let hcc =ecs.getEntity<HeroCard>(HeroCard)
// hcc.load(HeroList[i],parent)
// }
}
// for (let i = 0; i < hc; i++) {
// if (HeroInfo[HeroList[i]].quality==2) {
// let hcc =ecs.getEntity<HeroCard>(HeroCard)
// hcc.load(HeroList[i],parent)
// }
// }
// for (let i = 0; i < hc; i++) {
// if (HeroInfo[HeroList[i]].quality==1) {
// let hcc =ecs.getEntity<HeroCard>(HeroCard)
// hcc.load(HeroList[i],parent)
// }
// }
}
hero_show(uuid:number) {
this.node.getChildByName("show").active=true
@@ -65,28 +67,29 @@ export class HeroHomeComp extends CCComp {
var sk_path = "game/skills/skill_icon"
// var icon_path = "game/heros/herois"
this.slv = Math.floor((smc.heros[uuid].lv) / 5);
this.node.getChildByName("show").getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name
this.node.getChildByName("show").getChildByName("name").getChildByName("g1").active=HeroInfo[uuid].quality==1
this.node.getChildByName("show").getChildByName("name").getChildByName("g2").active=HeroInfo[uuid].quality==2
this.node.getChildByName("show").getChildByName("name").getChildByName("g3").active=HeroInfo[uuid].quality==3
let content=this.node.getChildByName("show").getChildByName("content")
content.getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name
content.getChildByName("name").getChildByName("g1").active=HeroInfo[uuid].quality==1
content.getChildByName("name").getChildByName("g2").active=HeroInfo[uuid].quality==2
content.getChildByName("name").getChildByName("g3").active=HeroInfo[uuid].quality==3
this.clear_hero()
this.call_hero(uuid)
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = this.node.getChildByName("show").getChildByName("hero").getChildByName("icon").getComponent(Sprite);
// const sprite = content.getChildByName("hero").getChildByName("icon").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(this.hero.path);
// });
resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("show").getChildByName("bottom").getChildByName("sk").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(skill1.path);
});
this.node.getChildByName("show").getChildByName("bottom").getChildByName("sk").getChildByName("name").getComponent(Label).string = skill1.name;
this.node.getChildByName("show").getChildByName("bottom").getChildByName("sk").getChildByName("info").getComponent(Label).string = skill1.info;
resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("show").getChildByName("bottom").getChildByName("sk2").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(skill2.path);
});
this.node.getChildByName("show").getChildByName("bottom").getChildByName("sk2").getChildByName("name").getComponent(Label).string = skill2.name;
this.node.getChildByName("show").getChildByName("bottom").getChildByName("sk2").getChildByName("info").getComponent(Label).string = skill2.info;
// resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = content.getChildByName("bottom").getChildByName("sk").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(skill1.path);
// });
// content.getChildByName("bottom").getChildByName("sk").getChildByName("name").getComponent(Label).string = skill1.name;
// content.getChildByName("bottom").getChildByName("sk").getChildByName("info").getComponent(Label).string = skill1.info;
// resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = content.getChildByName("bottom").getChildByName("sk2").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(skill2.path);
// });
// content.getChildByName("bottom").getChildByName("sk2").getChildByName("name").getComponent(Label).string = skill2.name;
// content.getChildByName("bottom").getChildByName("sk2").getChildByName("info").getComponent(Label).string = skill2.info;
// tal.getChildByName("slv1").getChildByName("val").getComponent(Label).string = this.hero.tals[0]
// tal.getChildByName("slv2").getChildByName("val").getComponent(Label).string = this.hero.tals[1]
@@ -96,24 +99,24 @@ export class HeroHomeComp extends CCComp {
this.update_data()
}
update_data(){
let content=this.node.getChildByName("show").getChildByName("content")
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");
let attr = this.node.getChildByName("show").getChildByName("attr");
let attr2 = this.node.getChildByName("show").getChildByName("attr2").getChildByName("other");
this.node.getChildByName("show").getChildByName("name").getChildByName("lv").getComponent(Label).string = smc.heros[this.h_uuid].lv.toString()+"级";
// let slv_node=content.getChildByName("name").getChildByName("slv");
let lvup=content.getChildByName("lvup");
// let slvup=content.getChildByName("slvup");
let attr = content.getChildByName("attr");
content.getChildByName("name").getChildByName("lv").getComponent(Label).string = smc.heros[this.h_uuid].lv.toString()+"级";
// slv_node.getChildByName("slv").getComponent(Label).string = smc.heros[uuid].slv.toString();
this.node.getChildByName("show").getChildByName("name").getChildByName("quality").getChildByName("q1").active = this.hero.quality == 1;
this.node.getChildByName("show").getChildByName("name").getChildByName("quality").getChildByName("q2").active = this.hero.quality == 2;
this.node.getChildByName("show").getChildByName("name").getChildByName("quality").getChildByName("q3").active = this.hero.quality == 3;
// content.getChildByName("name").getChildByName("quality").getChildByName("q1").active = this.hero.quality == 1;
// content.getChildByName("name").getChildByName("quality").getChildByName("q2").active = this.hero.quality == 2;
// content.getChildByName("name").getChildByName("quality").getChildByName("q3").active = this.hero.quality == 3;
this.node.getChildByName("show").getChildByName("name").getChildByName("quality").getChildByName("k1").active = this.hero.kind == 1;
this.node.getChildByName("show").getChildByName("name").getChildByName("quality").getChildByName("k2").active = this.hero.kind == 2;
this.node.getChildByName("show").getChildByName("name").getChildByName("quality").getChildByName("k3").active = this.hero.kind == 3;
// content.getChildByName("name").getChildByName("quality").getChildByName("k1").active = this.hero.kind == 1;
// content.getChildByName("name").getChildByName("quality").getChildByName("k2").active = this.hero.kind == 2;
// content.getChildByName("name").getChildByName("quality").getChildByName("k3").active = this.hero.kind == 3;
let lvnum=smc.heros[this.h_uuid].num
@@ -158,14 +161,14 @@ export class HeroHomeComp extends CCComp {
// slvup.getChildByName("btned").active=false
// };
// if( smc.heros[uuid].slv==0) {
// this.node.getChildByName("show").getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("need").getComponent(Label).string = ((SlvUp[smc.heros[uuid].slv]-HeroInfo[this.h_uuid].slvexp)*(1+smc.heros[uuid].slv)).toString()
// this.node.getChildByName("show").getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("num").getComponent(Label).string = smc.heros[this.h_uuid].num.toString()
// this.node.getChildByName("show").getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("bar").getComponent(ProgressBar).progress = smc.heros[this.h_uuid].num/((SlvUp[smc.heros[uuid].slv]-HeroInfo[this.h_uuid].slvexp)*(1+smc.heros[uuid].slv))
// let hchipcomp= this.node.getChildByName("show").getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("hchip").getComponent(HChipComp)
// content.getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("need").getComponent(Label).string = ((SlvUp[smc.heros[uuid].slv]-HeroInfo[this.h_uuid].slvexp)*(1+smc.heros[uuid].slv)).toString()
// content.getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("num").getComponent(Label).string = smc.heros[this.h_uuid].num.toString()
// content.getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("bar").getComponent(ProgressBar).progress = smc.heros[this.h_uuid].num/((SlvUp[smc.heros[uuid].slv]-HeroInfo[this.h_uuid].slvexp)*(1+smc.heros[uuid].slv))
// let hchipcomp= content.getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("hchip").getComponent(HChipComp)
// hchipcomp.update_data(this.h_uuid,0)
// this.node.getChildByName("show").getChildByName("call").active=true
// content.getChildByName("call").active=true
// }else{
// this.node.getChildByName("show").getChildByName("call").active=false
// content.getChildByName("call").active=false
// };
attr.getChildByName("ap").getChildByName("val").getComponent(Label).string = ((this.hero.ap+this.hero.ap_up* smc.heros[this.h_uuid].lv)*(1+this.hero.sap_up/100*this.slv)).toFixed(0).toString()
attr.getChildByName("hp").getChildByName("val").getComponent(Label).string = ((this.hero.hp+this.hero.hp_up* smc.heros[this.h_uuid].lv)*(1+this.hero.shp_up/100*this.slv)).toFixed(0).toString()
@@ -174,45 +177,12 @@ export class HeroHomeComp extends CCComp {
attr.getChildByName("speed").getChildByName("val").getComponent(Label).string = this.hero.speed
attr.getChildByName("dis").getChildByName("val").getComponent(Label).string = this.hero.dis
attr2.getChildByName("crit").getChildByName("val").getComponent(Label).string = this.hero.crit+"%"
attr2.getChildByName("ca").getChildByName("val").getComponent(Label).string = (150+this.hero.crit_add).toString()+"%"
attr2.getChildByName("ucr").getChildByName("val").getComponent(Label).string = this.hero.ucr+"%"
attr2.getChildByName("dod").getChildByName("val").getComponent(Label).string = this.hero.dodge+"%"
attr2.getChildByName("aexp").getChildByName("val").getComponent(Label).string = this.hero.aexp
attr2.getChildByName("uaexp").getChildByName("val").getComponent(Label).string = this.hero.uaexp
attr2.getChildByName("cexp").getChildByName("val").getComponent(Label).string = this.hero.cexp
attr2.getChildByName("doexp").getChildByName("val").getComponent(Label).string = this.hero.doexp
attr2.getChildByName("dexp").getChildByName("val").getComponent(Label).string = this.hero.dexp
oops.message.dispatchEvent("hero_card_update_info",{uuid:this.h_uuid})
}
lv_selcet(e:any,val:any){
let active = this.node.getChildByName("show").getChildByName("menu").getChildByName("active")
tween(active).to(0.1,{position:v3(val,0)}).start()
let hero = this.node.getChildByName("show").getChildByName("hero")
let attr = this.node.getChildByName("show").getChildByName("attr")
let attr2 = this.node.getChildByName("show").getChildByName("attr2")
let info = this.node.getChildByName("show").getChildByName("info")
let lvup = this.node.getChildByName("show").getChildByName("lvup")
let sk = this.node.getChildByName("show").getChildByName("bottom").getChildByName("sk")
let slvup = this.node.getChildByName("show").getChildByName("slvup")
if(val < 0){
tween(hero).to(0.2,{position:v3(0,hero.position.y)}).start()
tween(attr).to(0.2,{position:v3(0,attr.position.y)}).start()
tween(attr2).to(0.2,{position:v3(0,attr2.position.y)}).start()
tween(lvup).to(0.2,{position:v3(0,lvup.position.y)}).start()
tween(sk).to(0.2,{position:v3(1000,sk.position.y)}).start()
tween(slvup).to(0.2,{position:v3(1000,slvup.position.y)}).start()
}else{
tween(hero).to(0.2,{position:v3(-1000,hero.position.y)}).start()
tween(attr).to(0.2,{position:v3(-1000,attr.position.y)}).start()
tween(attr2).to(0.2,{position:v3(-1000,attr2.position.y)}).start()
tween(lvup).to(0.2,{position:v3(-1000,lvup.position.y)}).start()
tween(sk).to(0.2,{position:v3(0,sk.position.y)}).start()
tween(slvup).to(0.2,{position:v3(0,slvup.position.y)}).start()
}
}
@@ -220,10 +190,10 @@ export class HeroHomeComp extends CCComp {
var path = "game/heros/uiheros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = this.node.getChildByName("show").getChildByName("hero").getChildByName("node")
node.parent = this.node.getChildByName("show").getChildByName("content").getChildByName("hero").getChildByName("node")
}
clear_hero(){
this.node.getChildByName("show").getChildByName("hero").getChildByName("node").destroyAllChildren()
this.node.getChildByName("show").getChildByName("content").getChildByName("hero").getChildByName("node").destroyAllChildren()
}
pre_hero(){
let hi= HeroList.indexOf(this.h_uuid)