dd
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,ProgressBar,resources,Sprite,SpriteAtlas,UITransform,v3 } from "cc";
|
||||
import { _decorator,Button,Color,EventHandler,EventTouch,Label,NodeEventType,ProgressBar,resources,Sprite,SpriteAtlas,UITransform,v3 } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { HeroModelComp } from "../hero/HeroModelComp";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { ColorSet } from "../common/config/BoxSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -35,7 +37,18 @@ export class HCardComp extends CCComp {
|
||||
this.pw=this.node.getChildByName("pow").getComponent(ProgressBar)!
|
||||
this.hc_name.string= this.heros[this.hi].HeroView.hero_name
|
||||
// this.node.getChildByName("lv").getComponent(Label).string=this.heros[this.hi].HeroView.lv.toString()+"级";
|
||||
console.log("hcard start")
|
||||
// console.log("hcard start",this.heros[this.hi].HeroView.hero_uuid)
|
||||
switch(HeroInfo[this.heros[this.hi].HeroView.hero_uuid].quality){
|
||||
case 1:
|
||||
this.node.getChildByName("bg").getComponent(Sprite).color= new Color().fromHEX(ColorSet["BLUE"]);
|
||||
break;
|
||||
case 2:
|
||||
this.node.getChildByName("bg").getComponent(Sprite).color= new Color().fromHEX(ColorSet["YELLOW"]);
|
||||
break;
|
||||
case 3:
|
||||
this.node.getChildByName("bg").getComponent(Sprite).color= new Color().fromHEX(ColorSet["RED"]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if(this.is_dead) return
|
||||
@@ -53,6 +66,7 @@ export class HCardComp extends CCComp {
|
||||
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.rhp_max
|
||||
this.pw.progress=this.heros[this.hi].HeroView.pw/this.heros[this.hi].HeroView.pwm
|
||||
|
||||
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
|
||||
@@ -25,22 +25,36 @@ export class HeroHomeComp extends CCComp {
|
||||
start() {
|
||||
// this.load_talents()
|
||||
console.log("hero_home start")
|
||||
this.h_uuid=5001
|
||||
this.hero_show(this.h_uuid)
|
||||
// this.h_uuid=5001
|
||||
// this.hero_show(this.h_uuid)
|
||||
this.loads()
|
||||
}
|
||||
loads(){
|
||||
let heros:any=HeroList
|
||||
let hc:number =HeroList.length
|
||||
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
|
||||
parent.getComponent(UITransform).setContentSize(hc*150,200)
|
||||
parent.getComponent(UITransform).setContentSize(720,Math.ceil(HeroList.length/5)*180)
|
||||
console.log("parent",parent)
|
||||
for (let i = 0; i < hc; i++) {
|
||||
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
|
||||
this.h_uuid=uuid
|
||||
this.role=smc.heros[uuid]
|
||||
this.hero=HeroInfo[uuid]
|
||||
@@ -50,24 +64,24 @@ export class HeroHomeComp extends CCComp {
|
||||
var sk_path = "game/skills/skill_icon"
|
||||
var icon_path = "game/heros/herois"
|
||||
|
||||
this.node.getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name
|
||||
this.node.getChildByName("show").getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name
|
||||
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("hero").getChildByName("icon").getComponent(Sprite);
|
||||
const sprite = this.node.getChildByName("show").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("bottom").getChildByName("sk").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
|
||||
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("bottom").getChildByName("sk").getChildByName("name").getComponent(Label).string = skill1.name;
|
||||
this.node.getChildByName("bottom").getChildByName("sk").getChildByName("info").getComponent(Label).string = skill1.info;
|
||||
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("bottom").getChildByName("sk2").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
|
||||
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("bottom").getChildByName("sk2").getChildByName("name").getComponent(Label).string = skill2.name;
|
||||
this.node.getChildByName("bottom").getChildByName("sk2").getChildByName("info").getComponent(Label).string = skill2.info;
|
||||
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;
|
||||
|
||||
// tal.getChildByName("slv1").getChildByName("val").getComponent(Label).string = this.hero.tals[0]
|
||||
// tal.getChildByName("slv2").getChildByName("val").getComponent(Label).string = this.hero.tals[1]
|
||||
@@ -77,19 +91,23 @@ export class HeroHomeComp extends CCComp {
|
||||
this.update_data()
|
||||
}
|
||||
update_data(){
|
||||
let slv_node=this.node.getChildByName("name").getChildByName("slv");
|
||||
let lvup=this.node.getChildByName("lvup");
|
||||
let slvup=this.node.getChildByName("slvup");
|
||||
let attr = this.node.getChildByName("attr");
|
||||
let attr2 = this.node.getChildByName("attr2").getChildByName("other");
|
||||
this.node.getChildByName("name").getChildByName("lv").getComponent(Label).string = this.role.lv.toString()+"级";
|
||||
if( this.role.slv==0) {
|
||||
slv_node.getChildByName("slv").active=false
|
||||
}else{
|
||||
slv_node.getChildByName("slv").active=true
|
||||
slv_node.getChildByName("slv").getComponent(Label).string = this.role.slv.toString();
|
||||
};
|
||||
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 = this.role.lv.toString()+"级";
|
||||
slv_node.getChildByName("slv").getComponent(Label).string = this.role.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;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
// lvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.LvUp*this.role.lv).toString()
|
||||
lvup.getChildByName("item").getChildByName("need").getComponent(Label).string = ((LvUp[0]+this.hero.lvexp)*this.role.lv).toString()
|
||||
lvup.getChildByName("info").getChildByName("ap").getComponent(Label).string = "+"+this.hero.ap_up
|
||||
@@ -103,7 +121,6 @@ export class HeroHomeComp extends CCComp {
|
||||
slvup.getChildByName("cost").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("hchip").getComponent(HChipComp)
|
||||
hchipcomp.update_data(this.h_uuid,0)
|
||||
//todo cost icon 需要通过预制体进行变更
|
||||
|
||||
slvup.getChildByName("info").getChildByName("ap").getComponent(Label).string = "+"+this.hero.sap_up+"%"
|
||||
slvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.sdef_up+"%"
|
||||
@@ -114,14 +131,14 @@ export class HeroHomeComp extends CCComp {
|
||||
slvup.getChildByName("btned").active=false
|
||||
};
|
||||
if( this.role.slv==0) {
|
||||
this.node.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("call").getChildByName("Node").getChildByName("cost").getChildByName("num").getComponent(Label).string = smc.heros[this.h_uuid].num.toString()
|
||||
this.node.getChildByName("call").getChildByName("Node").getChildByName("cost").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= this.node.getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("hchip").getComponent(HChipComp)
|
||||
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()
|
||||
this.node.getChildByName("show").getChildByName("call").getChildByName("Node").getChildByName("cost").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= this.node.getChildByName("show").getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("hchip").getComponent(HChipComp)
|
||||
hchipcomp.update_data(this.h_uuid,0)
|
||||
this.node.getChildByName("call").active=true
|
||||
this.node.getChildByName("show").getChildByName("call").active=true
|
||||
}else{
|
||||
this.node.getChildByName("call").active=false
|
||||
this.node.getChildByName("show").getChildByName("call").active=false
|
||||
};
|
||||
attr.getChildByName("ap").getChildByName("val").getComponent(Label).string = ((this.hero.ap+this.hero.ap_up* this.role.lv)*(1+this.hero.sap_up/100*this.role.slv)).toFixed(0).toString()
|
||||
attr.getChildByName("hp").getChildByName("val").getComponent(Label).string = ((this.hero.hp+this.hero.hp_up* this.role.lv)*(1+this.hero.shp_up/100*this.role.slv)).toFixed(0).toString()
|
||||
@@ -144,15 +161,15 @@ export class HeroHomeComp extends CCComp {
|
||||
oops.message.dispatchEvent("hero_card_update_info",{uuid:this.h_uuid})
|
||||
}
|
||||
lv_selcet(e:any,val:any){
|
||||
let active = this.node.getChildByName("menu").getChildByName("active")
|
||||
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("hero")
|
||||
let attr = this.node.getChildByName("attr")
|
||||
let attr2 = this.node.getChildByName("attr2")
|
||||
let info = this.node.getChildByName("info")
|
||||
let lvup = this.node.getChildByName("lvup")
|
||||
let sk = this.node.getChildByName("bottom").getChildByName("sk")
|
||||
let slvup = this.node.getChildByName("slvup")
|
||||
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()
|
||||
@@ -198,6 +215,9 @@ export class HeroHomeComp extends CCComp {
|
||||
item_show(e:any,val:any){
|
||||
oops.gui.open(UIID.ItemInfo, {uuid:val,type:0});
|
||||
}
|
||||
close_show(){
|
||||
this.node.getChildByName("show").active=false
|
||||
}
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user