ui修复
This commit is contained in:
@@ -13,6 +13,7 @@ import { Talent } from "../Role/Talent";
|
||||
import { Talents } from "../common/config/TalentSet";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { Position } from "../../../../extensions/oops-plugin-framework/assets/libs/gui/badge/Badge";
|
||||
import { MissionHomeComp } from "./MissionHomeComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -81,6 +82,7 @@ export class CardControllerComp extends CCComp {
|
||||
case "home":
|
||||
this.node.getChildByName("mission_home").active = true
|
||||
this.bbg.setPosition(v3(this.bbg_x[2],this.bbg_y))
|
||||
this.node.getChildByName("mission_home").getComponent(MissionHomeComp).load_hero_card()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ export class HeroHomeComp extends CCComp {
|
||||
let heros:any=HeroList
|
||||
let hc:number =HeroList.length
|
||||
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
|
||||
parent.getComponent(UITransform).width=hc*150
|
||||
parent.getComponent(UITransform).setContentSize(hc*150,200)
|
||||
console.log("parent",parent)
|
||||
for (let i = 0; i < hc; i++) {
|
||||
let hcc =ecs.getEntity<HeroCard>(HeroCard)
|
||||
hcc.load(HeroList[i],parent)
|
||||
@@ -104,7 +105,16 @@ export class HeroHomeComp extends CCComp {
|
||||
}else{
|
||||
slvup.getChildByName("btned").active=false
|
||||
};
|
||||
|
||||
if( this.role.slv==0) {
|
||||
this.node.getChildByName("call").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("cost").getChildByName("num").getComponent(Label).string = smc.heros[this.h_uuid].num.toString()
|
||||
this.node.getChildByName("call").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("cost").getChildByName("hchip").getComponent(HChipComp)
|
||||
hchipcomp.update_data(this.h_uuid,0)
|
||||
this.node.getChildByName("call").active=true
|
||||
}else{
|
||||
this.node.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()
|
||||
attr.getChildByName("def").getChildByName("val").getComponent(Label).string = ((this.hero.ap+this.hero.ap_up* this.role.lv)*(1+this.hero.sdef_up/100*this.role.slv)).toFixed(0).toString()
|
||||
|
||||
@@ -138,7 +138,16 @@ export class LuckHomeCompComp extends CCComp {
|
||||
break;
|
||||
case 1:
|
||||
this.show_item(uuid,num)
|
||||
smc.items[uuid].num += num
|
||||
if(uuid ==9001){
|
||||
smc.vmdata.gold.num+=num
|
||||
}
|
||||
if(uuid ==9003){
|
||||
smc.vmdata.exp.num+=num
|
||||
}
|
||||
if(uuid < 9000){
|
||||
smc.items[uuid].num+=num
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { MSCard } from "./MSCard";
|
||||
import { CardControllerComp } from "./CardController";
|
||||
import { MissionComp } from "./MissionComp";
|
||||
import { MSCardComp } from "./MSCardComp";
|
||||
import { HeroSelectComp } from "../hero/HeroSelectComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -63,20 +64,29 @@ export class MissionHomeComp extends CCComp {
|
||||
this.node.active=false;
|
||||
}
|
||||
load_hero_card(){
|
||||
let loaded:any = ecs.query(ecs.allOf(HeroSelectComp));
|
||||
if(loaded.length>0){
|
||||
for(let i=0;i<loaded.length;i++){
|
||||
loaded[i].HeroSelectComp.reset()
|
||||
loaded[i].HeroSelectComp.ent.destroy()
|
||||
}
|
||||
}
|
||||
let hc:number =HeroList.length
|
||||
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
|
||||
let height=Math.ceil(hc / 4)*135
|
||||
parent.getComponent(UITransform).width=height
|
||||
parent.getComponent(UITransform).height=height
|
||||
for (let i = 0; i < hc; i++) {
|
||||
let hcc =ecs.getEntity<HeroSelect>(HeroSelect)
|
||||
hcc.load(HeroList[i],parent)
|
||||
if(smc.heros[HeroList[i]].slv > 0) {
|
||||
let hcc =ecs.getEntity<HeroSelect>(HeroSelect)
|
||||
hcc.load(HeroList[i],parent)
|
||||
}
|
||||
}
|
||||
}
|
||||
load_skill_card(){
|
||||
let ms_num:number =MSklist.length
|
||||
let parent= this.node.getChildByName("skills").getChildByName("view").getChildByName("content")
|
||||
let height=ms_num*135
|
||||
parent.getComponent(UITransform).width=height
|
||||
parent.getComponent(UITransform).height=height
|
||||
for (let i = 0; i < ms_num; i++) {
|
||||
let msc =ecs.getEntity<MSCard>(MSCard)
|
||||
msc.load(MSklist[i],parent,2)
|
||||
|
||||
@@ -70,6 +70,17 @@ export class ShopHomeComp extends CCComp {
|
||||
oops.gui.toast("今日领取次数已用完");
|
||||
return
|
||||
}
|
||||
for (let x = 0; x < smc.goods.free.length; x++) {
|
||||
if(smc.goods.free[x].uuid ==9001){
|
||||
smc.vmdata.gold.num+=smc.goods.free[x].num
|
||||
}
|
||||
if(smc.goods.free[x].uuid ==9003){
|
||||
smc.vmdata.exp.num+=smc.goods.free[x].num
|
||||
}
|
||||
if(smc.goods.free[x].uuid < 9000){
|
||||
smc.items[smc.goods.free[x].uuid].num+=smc.goods.free[x].num
|
||||
}
|
||||
}
|
||||
smc.vmdata.free.buy--
|
||||
}
|
||||
get_goods1(){
|
||||
@@ -78,23 +89,57 @@ export class ShopHomeComp extends CCComp {
|
||||
oops.gui.toast("今日购买次数已用完");
|
||||
return
|
||||
}
|
||||
if(smc.vmdata.gold.num < smc.vmdata.goods1.cost){
|
||||
oops.gui.toast("金币不足");
|
||||
return
|
||||
}
|
||||
for (let x = 0; x < smc.goods.goods1.length; x++) {
|
||||
if(smc.goods.goods1[x].uuid ==9001){
|
||||
smc.vmdata.gold.num+=smc.goods.goods1[x].num
|
||||
}
|
||||
if(smc.goods.goods1[x].uuid ==9003){
|
||||
smc.vmdata.exp.num+=smc.goods.goods1[x].num
|
||||
}
|
||||
if(smc.goods.goods1[x].uuid < 9000){
|
||||
smc.items[smc.goods.goods1[x].uuid].num+=smc.goods.goods1[x].num
|
||||
}
|
||||
}
|
||||
smc.vmdata.goods1.buy--
|
||||
smc.vmdata.gold.num-=smc.vmdata.goods1.cost
|
||||
}
|
||||
get_goods2(){
|
||||
console.log("购买商品2")
|
||||
if(smc.vmdata.goods2.buy <= 0){
|
||||
if(smc.vmdata.herochips.buy <= 0){
|
||||
oops.gui.toast("今日购买次数已用完");
|
||||
return
|
||||
}
|
||||
smc.vmdata.goods2.buy--
|
||||
if(smc.vmdata.gold.num < smc.vmdata.herochips.cost){
|
||||
oops.gui.toast("金币不足");
|
||||
return
|
||||
}
|
||||
for (let x = 0; x < smc.goods.herochips.length; x++) {
|
||||
smc.heros[smc.goods.herochips[x].uuid].num += smc.goods.herochips[x].num
|
||||
}
|
||||
smc.vmdata.herochips.buy--
|
||||
smc.vmdata.gold.num-=smc.vmdata.herochips.cost
|
||||
}
|
||||
|
||||
get_goods3(){
|
||||
console.log("购买商品3")
|
||||
if(smc.vmdata.goods3.buy <= 0){
|
||||
if(smc.vmdata.skillchips.buy <= 0){
|
||||
oops.gui.toast("今日购买次数已用完");
|
||||
return
|
||||
}
|
||||
smc.vmdata.goods3.buy--
|
||||
if(smc.vmdata.gold.num < smc.vmdata.skillchips.cost){
|
||||
oops.gui.toast("金币不足");
|
||||
return
|
||||
}
|
||||
for (let x = 0; x < smc.goods.skillchips.length; x++) {
|
||||
smc.skills[smc.goods.skillchips[x].uuid].num += smc.goods.skillchips[x].num
|
||||
}
|
||||
smc.vmdata.skillchips.buy--
|
||||
smc.vmdata.gold.num-=smc.vmdata.skillchips.cost
|
||||
|
||||
}
|
||||
get_goods4(){
|
||||
console.log("购买商品4")
|
||||
|
||||
Reference in New Issue
Block a user