|
|
|
|
@@ -24,69 +24,36 @@ export class EquipsComp extends Component {
|
|
|
|
|
oops.message.on(GameEvent.EquipAdd,this.equip_add,this)
|
|
|
|
|
oops.message.on(GameEvent.EquipRemove,this.equip_remove,this)
|
|
|
|
|
this.boxs=this.node.getChildByName("boxs")
|
|
|
|
|
oops.message.on(GameEvent.EQUIP_STONE_UP,this.equip_stone_up,this)
|
|
|
|
|
oops.message.on(GameEvent.HeroLvUp,this.hero_lv_up,this)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
hero_lv_up(e:GameEvent,data:any){
|
|
|
|
|
switch(data.lv){
|
|
|
|
|
case FightSet.WEAPON_LV:
|
|
|
|
|
this.show_equip_get("weapon")
|
|
|
|
|
break
|
|
|
|
|
case FightSet.ARMOR_LV:
|
|
|
|
|
this.show_equip_get("armor")
|
|
|
|
|
break
|
|
|
|
|
case FightSet.SHIELD_LV:
|
|
|
|
|
this.show_equip_get("shield")
|
|
|
|
|
break
|
|
|
|
|
case FightSet.ACCESSORY_LV:
|
|
|
|
|
this.show_equip_get("accessory")
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
equip_stone_up(e:GameEvent,data:any){
|
|
|
|
|
console.log("[EquipsComp]:equip_stone_up",data)
|
|
|
|
|
smc.vmdata.mission_data.equip_stone+=data
|
|
|
|
|
if(smc.vmdata.mission_data.equip_stone >= smc.vmdata.mission_data.equip_stone_max){
|
|
|
|
|
this.show_equip_get("weapon")
|
|
|
|
|
this.show_equip_get("armor")
|
|
|
|
|
this.show_equip_get("accessory")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
call_equip_card(e:any,data:any){
|
|
|
|
|
let mission_data=smc.vmdata.mission_data
|
|
|
|
|
if(mission_data.equip_stone < mission_data.equip_stone_max){
|
|
|
|
|
oops.gui.toast("装备石不足", false);
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let lv=this.check_lv(data)
|
|
|
|
|
oops.message.dispatchEvent(GameEvent.EquipSelect,{slot:data,lv:lv})
|
|
|
|
|
mission_data.equip_stone-=mission_data.equip_stone_max
|
|
|
|
|
mission_data.equip_stone_max=mission_data.equip_stone_max*2
|
|
|
|
|
|
|
|
|
|
call_equip_card(e:any,data:any){
|
|
|
|
|
oops.message.dispatchEvent(GameEvent.EquipSelect,{slot:data})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
up_equip_card(e:any,data:any){
|
|
|
|
|
let mission_data=smc.vmdata.mission_data
|
|
|
|
|
if(mission_data.equip_stone < mission_data.equip_stone_max){
|
|
|
|
|
oops.gui.toast("装备石不足", false);
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let lv=this.check_lv(data)
|
|
|
|
|
oops.message.dispatchEvent(GameEvent.EquipSelect,{slot:data,lv:lv})
|
|
|
|
|
mission_data.equip_stone-=mission_data.equip_stone_max
|
|
|
|
|
mission_data.equip_stone_max=mission_data.equip_stone_max*2
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
check_lv(data:any){
|
|
|
|
|
let lv=0
|
|
|
|
|
switch(data){
|
|
|
|
|
case "weapon":
|
|
|
|
|
if(this.weapon.uuid==0) return 1
|
|
|
|
|
lv=EquipInfo[this.weapon.uuid].lv+1
|
|
|
|
|
if(lv>5){
|
|
|
|
|
lv=5
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case "armor":
|
|
|
|
|
if(this.armor.uuid==0) return 1
|
|
|
|
|
lv=EquipInfo[this.armor.uuid].lv+1
|
|
|
|
|
if(lv>5){
|
|
|
|
|
lv=5
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case "accessory":
|
|
|
|
|
if(this.accessory.uuid==0) return 4
|
|
|
|
|
lv=EquipInfo[this.accessory.uuid].lv+1
|
|
|
|
|
if(lv>5){
|
|
|
|
|
lv=5
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
return lv
|
|
|
|
|
oops.message.dispatchEvent(GameEvent.EquipSelect,{slot:data})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
start(){
|
|
|
|
|
this.fight_ready()
|
|
|
|
|
@@ -141,7 +108,7 @@ export class EquipsComp extends Component {
|
|
|
|
|
this.accessory.level=data.level
|
|
|
|
|
this.show_accessory(data.uuid)
|
|
|
|
|
}
|
|
|
|
|
this.count_attrs()
|
|
|
|
|
// this.count_attrs()
|
|
|
|
|
}
|
|
|
|
|
show_weapon(uuid:number){
|
|
|
|
|
let icon = this.boxs.getChildByName("weapon").getChildByName("icon")
|
|
|
|
|
@@ -151,11 +118,6 @@ export class EquipsComp extends Component {
|
|
|
|
|
const sprite = icon.getChildByName("icon").getComponent(Sprite);
|
|
|
|
|
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
|
|
|
|
|
});
|
|
|
|
|
icon.getChildByName("lv1").active=EquipInfo[uuid].lv==1
|
|
|
|
|
icon.getChildByName("lv2").active=EquipInfo[uuid].lv==2
|
|
|
|
|
icon.getChildByName("lv3").active=EquipInfo[uuid].lv==3
|
|
|
|
|
icon.getChildByName("lv4").active=EquipInfo[uuid].lv==4
|
|
|
|
|
icon.getChildByName("lv5").active=EquipInfo[uuid].lv==5
|
|
|
|
|
icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE
|
|
|
|
|
icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN
|
|
|
|
|
icon.getChildByName("q3").active=EquipInfo[uuid].quality==Quality.BLUE
|
|
|
|
|
@@ -171,11 +133,7 @@ export class EquipsComp extends Component {
|
|
|
|
|
const sprite = icon.getChildByName("icon").getComponent(Sprite);
|
|
|
|
|
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
|
|
|
|
|
});
|
|
|
|
|
icon.getChildByName("lv1").active=EquipInfo[uuid].lv==1
|
|
|
|
|
icon.getChildByName("lv2").active=EquipInfo[uuid].lv==2
|
|
|
|
|
icon.getChildByName("lv3").active=EquipInfo[uuid].lv==3
|
|
|
|
|
icon.getChildByName("lv4").active=EquipInfo[uuid].lv==4
|
|
|
|
|
icon.getChildByName("lv5").active=EquipInfo[uuid].lv==5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE
|
|
|
|
|
icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN
|
|
|
|
|
@@ -191,11 +149,7 @@ export class EquipsComp extends Component {
|
|
|
|
|
const sprite = icon.getChildByName("icon").getComponent(Sprite);
|
|
|
|
|
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
|
|
|
|
|
});
|
|
|
|
|
icon.getChildByName("lv1").active=EquipInfo[uuid].lv==1
|
|
|
|
|
icon.getChildByName("lv2").active=EquipInfo[uuid].lv==2
|
|
|
|
|
icon.getChildByName("lv3").active=EquipInfo[uuid].lv==3
|
|
|
|
|
icon.getChildByName("lv4").active=EquipInfo[uuid].lv==4
|
|
|
|
|
icon.getChildByName("lv5").active=EquipInfo[uuid].lv==5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE
|
|
|
|
|
icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN
|
|
|
|
|
@@ -309,41 +263,25 @@ export class EquipsComp extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private show_equip_get(e:string){
|
|
|
|
|
if(this.weapon.uuid==0){
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("get").active =true
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("light").active=true
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("tip").active=true
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("tip").getComponent(Label).string="购买"
|
|
|
|
|
}else{
|
|
|
|
|
if(EquipInfo[this.weapon.uuid].lv>=5) return
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("change").active =true
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("light").active=true
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("tip").active=true
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("tip").getComponent(Label).string="升级"
|
|
|
|
|
}
|
|
|
|
|
if(this.armor.uuid==0){
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("get").active =true
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("light").active=true
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("tip").active=true
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("tip").getComponent(Label).string="购买"
|
|
|
|
|
}else{
|
|
|
|
|
if(EquipInfo[this.armor.uuid].lv>=5) return
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("change").active =true
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("light").active=true
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("tip").active=true
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("tip").getComponent(Label).string="升级"
|
|
|
|
|
}
|
|
|
|
|
if(this.accessory.uuid==0 ){
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("get").active =true
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("light").active=true
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("tip").active=true
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("tip").getComponent(Label).string="购买"
|
|
|
|
|
}else{
|
|
|
|
|
if(EquipInfo[this.accessory.uuid].lv>=5) return
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("change").active =true
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("light").active=true
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("tip").active=true
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("tip").getComponent(Label).string="升级"
|
|
|
|
|
switch(e){
|
|
|
|
|
case "weapon":
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("get").active =true
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("light").active=true
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("tip").active=true
|
|
|
|
|
this.boxs.getChildByName("weapon").getChildByName("tip").getComponent(Label).string="获取"
|
|
|
|
|
break
|
|
|
|
|
case "armor":
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("get").active =true
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("light").active=true
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("tip").active=true
|
|
|
|
|
this.boxs.getChildByName("armor").getChildByName("tip").getComponent(Label).string="获取"
|
|
|
|
|
break
|
|
|
|
|
case "accessory":
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("get").active =true
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("light").active=true
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("tip").active=true
|
|
|
|
|
this.boxs.getChildByName("accessory").getChildByName("tip").getComponent(Label).string="获取"
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|