英雄可升级动画
This commit is contained in:
@@ -108,7 +108,7 @@ export class HeroHomeComp extends CCComp {
|
||||
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;
|
||||
|
||||
let lvneed=((LvUp[0]+this.hero.lvexp)*this.role.lv)
|
||||
let lvneed=(this.hero.lvexp*this.role.lv)
|
||||
// lvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.LvUp*this.role.lv).toString()
|
||||
lvup.getChildByName("item").getChildByName("btn").getChildByName("need").getComponent(Label).string = lvneed.toString()
|
||||
lvup.getChildByName("item").getChildByName("btn").getChildByName("num").getComponent(Label).string = smc.vmdata.exp.num.toString()
|
||||
@@ -117,14 +117,13 @@ export class HeroHomeComp extends CCComp {
|
||||
}else{
|
||||
lvup.getChildByName("item").getChildByName("btn").getChildByName("num").getComponent(Label).color = color(255,0,0);
|
||||
}
|
||||
lvup.getChildByName("item").getChildByName("btn").getChildByName("bar").getComponent(ProgressBar).progress = smc.vmdata.exp.num/lvneed
|
||||
// lvup.getChildByName("item").getChildByName("btn").getChildByName("bar").getComponent(ProgressBar).progress = smc.vmdata.exp.num/lvneed
|
||||
lvup.getChildByName("info").getChildByName("ap").getComponent(Label).string = "+"+this.hero.ap_up
|
||||
lvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.def_up
|
||||
lvup.getChildByName("info").getChildByName("hp").getComponent(Label).string = "+"+this.hero.hp_up
|
||||
lvup.getChildByName("item").getChildByName("btn").getChildByName("bar").getComponent(ProgressBar).progress = smc.vmdata.exp.num/((LvUp[0]+this.hero.lvexp)*this.role.lv)
|
||||
|
||||
// lvup.getChildByName("item").getChildByName("btn").getChildByName("bar").getComponent(ProgressBar).progress = smc.vmdata.exp.num/((LvUp[0]+this.hero.lvexp)*this.role.lv)
|
||||
// slvup.getChildByName("gold").getChildByName("btn").getChildByName("need").getComponent(Label).string = (UpGold.SlvUp*(this.role.slv+1)).toString()
|
||||
let slvneed=((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv))
|
||||
let slvneed=HeroInfo[this.h_uuid].slvexp*this.role.slv
|
||||
let slvnum=smc.heros[this.h_uuid].num
|
||||
if( slvnum>=slvneed) {
|
||||
slvup.getChildByName("cost").getChildByName("btn").getChildByName("num").getComponent(Label).color = color(0,255,0);
|
||||
@@ -133,18 +132,18 @@ export class HeroHomeComp extends CCComp {
|
||||
}
|
||||
slvup.getChildByName("cost").getChildByName("btn").getChildByName("need").getComponent(Label).string = slvneed.toString()
|
||||
slvup.getChildByName("cost").getChildByName("btn").getChildByName("num").getComponent(Label).string = slvnum.toString()
|
||||
slvup.getChildByName("cost").getChildByName("btn").getChildByName("bar").getComponent(ProgressBar).progress = smc.heros[this.h_uuid].num/((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv))
|
||||
// slvup.getChildByName("cost").getChildByName("btn").getChildByName("bar").getComponent(ProgressBar).progress = smc.heros[this.h_uuid].num/((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv))
|
||||
let hchipcomp= slvup.getChildByName("cost").getChildByName("btn").getChildByName("hchip").getComponent(HChipComp)
|
||||
hchipcomp.update_data(this.h_uuid,0)
|
||||
|
||||
slvup.getChildByName("info").getChildByName("ap").getComponent(Label).string = "+"+this.hero.sap_up+"%"
|
||||
slvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.sdef_up+"%"
|
||||
slvup.getChildByName("info").getChildByName("hp").getComponent(Label).string = "+"+this.hero.shp_up+"%"
|
||||
if( this.role.slv==5) {
|
||||
slvup.getChildByName("btned").active=true
|
||||
}else{
|
||||
slvup.getChildByName("btned").active=false
|
||||
};
|
||||
// if( this.role.slv==5) {
|
||||
// slvup.getChildByName("btned").active=true
|
||||
// }else{
|
||||
// slvup.getChildByName("btned").active=false
|
||||
// };
|
||||
if( this.role.slv==0) {
|
||||
this.node.getChildByName("show").getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("need").getComponent(Label).string = ((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv)).toString()
|
||||
this.node.getChildByName("show").getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("num").getComponent(Label).string = smc.heros[this.h_uuid].num.toString()
|
||||
@@ -206,11 +205,11 @@ export class HeroHomeComp extends CCComp {
|
||||
|
||||
|
||||
lv_up(){
|
||||
if(smc.vmdata.exp.num < ((LvUp[0]+this.hero.lvexp)*this.role.lv)){
|
||||
if(smc.vmdata.exp.num < ((this.hero.lvexp)*this.role.lv)){
|
||||
oops.gui.toast("资源不足,升级失败");
|
||||
return
|
||||
}
|
||||
smc.vmdata.exp.num -= ((LvUp[0]+this.hero.lvexp)*this.role.lv)
|
||||
smc.vmdata.exp.num -= ((this.hero.lvexp)*this.role.lv)
|
||||
this.role.lv++
|
||||
this.update_data()
|
||||
}
|
||||
@@ -219,11 +218,11 @@ export class HeroHomeComp extends CCComp {
|
||||
oops.gui.toast("已经满星,升阶失败");
|
||||
return
|
||||
}
|
||||
if(smc.heros[this.h_uuid].num < ((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv))){
|
||||
if(smc.heros[this.h_uuid].num < (HeroInfo[this.h_uuid].slvexp*this.role.slv)){
|
||||
oops.gui.toast("资源不足,升阶失败");
|
||||
return
|
||||
}
|
||||
smc.heros[this.h_uuid].num -= SlvUp[this.role.slv]*(1+this.role.slv)
|
||||
smc.heros[this.h_uuid].num -= (HeroInfo[this.h_uuid].slvexp*this.role.slv)
|
||||
this.role.slv++
|
||||
this.update_data()
|
||||
}
|
||||
|
||||
@@ -276,15 +276,13 @@ export class MissionComp extends CCComp {
|
||||
private addHero(uuid:number=1001,i:number=0) {
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = v3(HeroSet.StartPos[HeroInfo[uuid].type]-i*50,BoxSet.GAME_LINE);
|
||||
console.log("addHero:",pos)
|
||||
let pos:Vec3 = v3(HeroSet.StartPos[1]-i*10,BoxSet.GAME_LINE);
|
||||
hero.load(pos,scale,uuid);
|
||||
}
|
||||
private addMonster(uuid:number=1001,i:number=0) {
|
||||
let mon = ecs.getEntity<Monster>(Monster);
|
||||
let scale = -1
|
||||
let pos:Vec3 = v3(-1*HeroSet.StartPos[HeroInfo[uuid].type]+i*50,BoxSet.GAME_LINE);
|
||||
console.log("addMonster:",pos)
|
||||
let pos:Vec3 = v3(-1*HeroSet.StartPos[1]+i*10,BoxSet.GAME_LINE);
|
||||
mon.load(pos,scale,uuid,false);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,8 +74,9 @@ export class MissionHomeComp extends CCComp {
|
||||
|
||||
let hc:number =HeroList.length
|
||||
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
|
||||
let height=Math.ceil(hc / 4)*135
|
||||
let height=Math.ceil(hc / 4)*140 +100
|
||||
parent.getComponent(UITransform).height=height
|
||||
|
||||
for (let i = 0; i < hc; i++) {
|
||||
if (HeroInfo[HeroList[i]].quality==3) {
|
||||
let hcc =ecs.getEntity<HeroSelect>(HeroSelect)
|
||||
@@ -147,7 +148,6 @@ export class MissionHomeComp extends CCComp {
|
||||
}
|
||||
}
|
||||
call_hero(h_uuid:number,index:number){
|
||||
console.log("call hero",h_uuid,HeroInfo[h_uuid])
|
||||
var path = "game/heros/uiheros/"+HeroInfo[h_uuid].path;
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
@@ -159,7 +159,6 @@ export class MissionHomeComp extends CCComp {
|
||||
this.heros.push(comp)
|
||||
}
|
||||
destory_hero(h_uuid:number){
|
||||
console.log("destory hero",this.heros)
|
||||
for(let i=0;i<this.heros.length;i++){
|
||||
if(this.heros[i].h_uuid==h_uuid){
|
||||
this.heros[i].to_destroy()
|
||||
|
||||
Reference in New Issue
Block a user