完成开箱抽卡 和 怪物掉落设置
This commit is contained in:
@@ -37,18 +37,10 @@ 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",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;
|
||||
}
|
||||
// // console.log("hcard start",this.heros[this.hi].HeroView.hero_uuid)
|
||||
// this.node.getChildByName("g1").active=HeroInfo[this.heros[this.hi].HeroView.hero_uuid].quality==1
|
||||
// this.node.getChildByName("g2").active=HeroInfo[this.heros[this.hi].HeroView.hero_uuid].quality==2
|
||||
// this.node.getChildByName("g3").active=HeroInfo[this.heros[this.hi].HeroView.hero_uuid].quality==3
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if(this.is_dead) return
|
||||
|
||||
@@ -36,7 +36,7 @@ export class HeroHomeComp extends CCComp {
|
||||
loads(){
|
||||
let hc:number =HeroList.length
|
||||
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
|
||||
parent.getComponent(UITransform).setContentSize(720,Math.ceil(HeroList.length/4)*200)
|
||||
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) {
|
||||
|
||||
@@ -33,85 +33,42 @@ export class LuckHomeCompComp extends CCComp {
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
this.frist();
|
||||
// this.frist();
|
||||
}
|
||||
frist(){
|
||||
if(smc.items[1001].num > 0){this.select_box(null,"sb");}
|
||||
else if(smc.items[1002].num > 0){this.select_box(null,"mb");}
|
||||
else if(smc.items[1003].num > 0){this.select_box(null,"lb");}
|
||||
this.check_num();
|
||||
this.colse_reward()
|
||||
}
|
||||
check_num(){
|
||||
this.sbn.getChildByName("num").getComponent(Label).string = smc.items[1001].num.toString();
|
||||
this.mbn.getChildByName("num").getComponent(Label).string = smc.items[1002].num.toString();
|
||||
this.lbn.getChildByName("num").getComponent(Label).string = smc.items[1003].num.toString();
|
||||
|
||||
|
||||
}
|
||||
select_box(e:any, val:string){
|
||||
this.sbn.setScale(1,1,1);
|
||||
this.mbn.setScale(1,1,1);
|
||||
this.lbn.setScale(1,1,1);
|
||||
switch(val){
|
||||
case "sb":
|
||||
this.sbn.setScale(1.2,1.2,1);
|
||||
if(smc.items[1001].num > 0){
|
||||
this.btnno.active = false;
|
||||
this.selected="sb"
|
||||
}else{
|
||||
this.btnno.active = true
|
||||
}
|
||||
break;
|
||||
case "mb":
|
||||
this.mbn.setScale(1.2,1.2,1);
|
||||
if(smc.items[1002].num > 0){
|
||||
this.btnno.active = false;
|
||||
this.selected="mb"
|
||||
|
||||
}else{
|
||||
this.btnno.active = true
|
||||
}
|
||||
break;
|
||||
case "lb":
|
||||
this.lbn.setScale(1.2,1.2,1);
|
||||
if(smc.items[1003].num > 0){
|
||||
this.btnno.active = false;
|
||||
this.selected="lb"
|
||||
}else{
|
||||
this.btnno.active = true
|
||||
}
|
||||
break;
|
||||
default:
|
||||
this.selected="";
|
||||
break;
|
||||
}
|
||||
}
|
||||
open_sb() {
|
||||
smc.items[1001].num--;
|
||||
this.show_bbox()
|
||||
this.check_num()
|
||||
this.scheduleOnce(()=>{
|
||||
this.get_reward(1)
|
||||
}, 0.5)
|
||||
smc.vmdata.box.num--;
|
||||
this.open_reward()
|
||||
this.get_reward(1)
|
||||
}
|
||||
open_mb() {
|
||||
smc.items[1002].num--;
|
||||
this.show_bbox()
|
||||
this.check_num()
|
||||
this.scheduleOnce(()=>{
|
||||
if (smc.vmdata.box.num <=0) {oops.gui.toast("宝箱数量不足");return;}
|
||||
smc.vmdata.box.num=smc.vmdata.box.num-5;
|
||||
this.open_reward()
|
||||
for (let x = 0; x < 5; x++) {
|
||||
this.get_reward(2)
|
||||
}, 0.5)
|
||||
|
||||
}
|
||||
}
|
||||
open_lb() {
|
||||
smc.items[1003].num--;
|
||||
this.show_bbox()
|
||||
this.check_num()
|
||||
this.scheduleOnce(()=>{
|
||||
this.get_reward(3)
|
||||
}, 0.5)
|
||||
if (smc.vmdata.box.num <=0) {oops.gui.toast("宝箱数量不足");return;}
|
||||
smc.vmdata.box.num=smc.vmdata.box.num-15;
|
||||
this.open_reward()
|
||||
for (let x = 0; x < 15; x++) {
|
||||
this.get_reward(2)
|
||||
}
|
||||
}
|
||||
colse_reward() {
|
||||
this.node.getChildByName("reward").setScale(0,0,0);
|
||||
this.node.getChildByName("reward").getChildByName("items").removeAllChildren();
|
||||
}
|
||||
open_reward() {
|
||||
this.node.getChildByName("reward").setScale(1,1,1);
|
||||
}
|
||||
get_reward(reward:number){
|
||||
console.log("get_reward",reward)
|
||||
let list =BoxDrop[reward];
|
||||
let uuid= 0
|
||||
let num =1
|
||||
@@ -156,53 +113,30 @@ export class LuckHomeCompComp extends CCComp {
|
||||
}
|
||||
}
|
||||
show_hero_chip(uuid:number,num:number){
|
||||
console.log("show_hero_chip",uuid,num)
|
||||
let path = "game/gui/hchip";
|
||||
let prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
let node = instantiate(prefab);
|
||||
node.setScale(2,2)
|
||||
let hc= node.getComponent(HChipComp)
|
||||
hc.update_data(uuid,num)
|
||||
node.parent = this.node.getChildByName("bbox");
|
||||
this.scheduleOnce(()=>{
|
||||
node.parent = this.node.getChildByName("items");
|
||||
node.setScale(1,1)
|
||||
}, 0.5)
|
||||
this.scheduleOnce(()=>{
|
||||
node.destroy();
|
||||
}, 10)
|
||||
|
||||
node.parent = this.node.getChildByName("reward").getChildByName("items");
|
||||
}
|
||||
show_item(uuid:number,num:number){
|
||||
var path = "game/gui/item";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
node.setScale(2,2)
|
||||
let ic= node.getComponent(ItemComp)
|
||||
ic.update_data(uuid,num)
|
||||
node.parent = this.node.getChildByName("bbox");
|
||||
this.scheduleOnce(()=>{
|
||||
node.parent = this.node.getChildByName("items");
|
||||
node.setScale(1,1)
|
||||
}, 0.5)
|
||||
this.scheduleOnce(()=>{
|
||||
node.destroy();
|
||||
}, 10)
|
||||
node.parent = this.node.getChildByName("reward").getChildByName("items");
|
||||
|
||||
}
|
||||
show_skill_chip(uuid:number,num:number){
|
||||
let path = "game/gui/schip";
|
||||
let prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
let node = instantiate(prefab);
|
||||
node.setScale(2,2)
|
||||
let sc= node.getComponent(SChipComp)
|
||||
sc.update_data(uuid,num)
|
||||
node.parent = this.node.getChildByName("bbox");
|
||||
this.scheduleOnce(()=>{
|
||||
node.parent = this.node.getChildByName("items");
|
||||
node.setScale(1,1)
|
||||
}, 0.5)
|
||||
this.scheduleOnce(()=>{
|
||||
node.destroy();
|
||||
}, 10)
|
||||
node.parent = this.node.getChildByName("reward").getChildByName("items");
|
||||
}
|
||||
show_bbox() {
|
||||
var parent = this.node.getChildByName("bbox")
|
||||
|
||||
@@ -50,41 +50,46 @@ export class VictoryComp extends CCComp {
|
||||
}
|
||||
}
|
||||
do_x10(){
|
||||
for (let i in smc.items) {
|
||||
if(smc.items[i].uuid == 9001){
|
||||
smc.vmdata.gold.num+=smc.items[i].x1*10
|
||||
}
|
||||
if(smc.items[i].uuid == 9003){
|
||||
smc.vmdata.exp.num+=smc.items[i].x1*10
|
||||
}
|
||||
if(smc.items[i].uuid < 9000){
|
||||
smc.items[i].num+=smc.items[i].x1*10
|
||||
// for (let i in smc.items) {
|
||||
// if(smc.items[i].uuid == 9001){
|
||||
// smc.vmdata.gold.num+=smc.items[i].x1*10
|
||||
// }
|
||||
// if(smc.items[i].uuid == 9003){
|
||||
// smc.vmdata.exp.num+=smc.items[i].x1*10
|
||||
// }
|
||||
// if(smc.items[i].uuid == 1003){
|
||||
// smc.vmdata.box.num+=smc.items[i].x1*10
|
||||
// }
|
||||
// if(smc.items[i].uuid < 9000){
|
||||
// smc.items[i].num+=smc.items[i].x1*10
|
||||
|
||||
}
|
||||
}
|
||||
for (let i in smc.heros) {
|
||||
smc.heros[i].num+=smc.heros[i].x1*10
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// for (let i in smc.heros) {
|
||||
// smc.heros[i].num+=smc.heros[i].x1*10
|
||||
// }
|
||||
this.clear_x1()
|
||||
|
||||
}
|
||||
do_x1(){
|
||||
for (let i in smc.items) {
|
||||
if(smc.items[i].uuid == 9001){
|
||||
smc.vmdata.gold.num+=smc.items[i].x1
|
||||
}
|
||||
|
||||
if(smc.items[i].uuid == 9003){
|
||||
smc.vmdata.exp.num+=smc.items[i].x1
|
||||
}
|
||||
if(smc.items[i].uuid < 9000){
|
||||
smc.items[i].num+=smc.items[i].x1
|
||||
// for (let i in smc.items) {
|
||||
// if(smc.items[i].uuid == 9001){
|
||||
// smc.vmdata.gold.num+=smc.items[i].x1
|
||||
// }
|
||||
// if(smc.items[i].uuid == 9003){
|
||||
// smc.vmdata.exp.num+=smc.items[i].x1
|
||||
// }
|
||||
// if(smc.items[i].uuid == 1003){
|
||||
// smc.vmdata.box.num+=smc.items[i].x1
|
||||
// }
|
||||
// if(smc.items[i].uuid < 9000){
|
||||
// smc.items[i].num+=smc.items[i].x1
|
||||
|
||||
}
|
||||
}
|
||||
for (let i in smc.heros) {
|
||||
smc.heros[i].num+=smc.heros[i].x1
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// for (let i in smc.heros) {
|
||||
// smc.heros[i].num+=smc.heros[i].x1
|
||||
// }
|
||||
this.clear_x1()
|
||||
}
|
||||
clear_x1(){
|
||||
|
||||
Reference in New Issue
Block a user