+刷新次数的增加和广告入口
This commit is contained in:
@@ -9,6 +9,8 @@ import { RandomManager } from "db://oops-framework/core/common/random/RandomMana
|
||||
import { EquipType } from "../common/config/Equips";
|
||||
import { getSkills, Quality } from "../common/config/SkillSet";
|
||||
import { getEnhancement } from "../common/config/LevelUp";
|
||||
import { FightSet } from "../common/config/Mission";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -24,7 +26,9 @@ export class CardsCompComp extends CCComp {
|
||||
card2c:CardComp=null
|
||||
card3c:CardComp=null
|
||||
// card4c:CardComp=null
|
||||
|
||||
more_btn:any=null
|
||||
refresh_btn:any=null
|
||||
cancel_btn:any=null
|
||||
/** 卡牌展示队列 */
|
||||
private cardQueue: Array<{type: GameEvent, data?: any}> = [];
|
||||
/** 是否正在展示卡牌 */
|
||||
@@ -48,6 +52,8 @@ export class CardsCompComp extends CCComp {
|
||||
this.on(GameEvent.EquipSelect, this.addToQueue, this);
|
||||
this.on(GameEvent.EnhancementSelect, this.addToQueue, this);
|
||||
this.on(GameEvent.TalentSelect, this.addToQueue, this);
|
||||
this.on(GameEvent.AD_BACK_TRUE,this.ad_back_true,this)
|
||||
this.on(GameEvent.AD_BACK_FALSE,this.ad_back_false,this)
|
||||
this.card1=this.node.getChildByName("cards").getChildByName("card1")
|
||||
this.card2=this.node.getChildByName("cards").getChildByName("card2")
|
||||
this.card3=this.node.getChildByName("cards").getChildByName("card3")
|
||||
@@ -56,12 +62,13 @@ export class CardsCompComp extends CCComp {
|
||||
this.card2c=this.card2.getComponent(CardComp)
|
||||
this.card3c=this.card3.getComponent(CardComp)
|
||||
// this.card4c=this.card4.getComponent(CardComp)
|
||||
|
||||
|
||||
this.more_btn=this.node.getChildByName("btns").getChildByName("more")
|
||||
this.refresh_btn=this.node.getChildByName("btns").getChildByName("new")
|
||||
this.cancel_btn=this.node.getChildByName("btns").getChildByName("cancel")
|
||||
}
|
||||
|
||||
show_cards(e:GameEvent,data:any,is_refresh:boolean=false){
|
||||
this.node.getChildByName("btns").getChildByName("cancel").active=false
|
||||
this.cancel_btn.active=false
|
||||
switch(e){
|
||||
case GameEvent.HeroSelect:
|
||||
console.log("[CardsComp]:显示英雄选择卡牌",data)
|
||||
@@ -77,25 +84,25 @@ export class CardsCompComp extends CCComp {
|
||||
break
|
||||
case GameEvent.FuncSelect:
|
||||
console.log("[CardsComp]:显示功能卡牌")
|
||||
this.node.getChildByName("btns").getChildByName("cancel").active=true
|
||||
this.cancel_btn.active=true
|
||||
this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string="选择卡牌"
|
||||
this.func_select()
|
||||
break
|
||||
case GameEvent.EquipSelect:
|
||||
console.log("[CardsComp]:显示装备选择卡牌")
|
||||
this.node.getChildByName("btns").getChildByName("cancel").active=true
|
||||
this.cancel_btn.active=true
|
||||
this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string="选择装备"
|
||||
this.equip_select(data)
|
||||
break
|
||||
case GameEvent.EnhancementSelect:
|
||||
console.log("[CardsComp]:显示强化选择卡牌")
|
||||
this.node.getChildByName("btns").getChildByName("cancel").active=true
|
||||
this.cancel_btn.active=true
|
||||
this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string="选择强化"
|
||||
this.enhancement_select()
|
||||
break
|
||||
case GameEvent.TalentSelect:
|
||||
console.log("[CardsComp]:显示天赋选择卡牌")
|
||||
this.node.getChildByName("btns").getChildByName("cancel").active=true
|
||||
this.cancel_btn.active=true
|
||||
this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string="选择天赋"
|
||||
this.talent_select(data)
|
||||
break
|
||||
@@ -220,7 +227,6 @@ export class CardsCompComp extends CCComp {
|
||||
}
|
||||
|
||||
show(){
|
||||
this.node.getChildByName("vip").active=false
|
||||
// 设置初始状态
|
||||
smc.mission.pause=true
|
||||
// this.node.getChildByName("btns").getChildByName("cancel").setPosition(v3(0, this.node.getChildByName("btns").getChildByName("cancel").getPosition().y, 0))
|
||||
@@ -235,13 +241,9 @@ export class CardsCompComp extends CCComp {
|
||||
tween().to(0.3, { position: v3(0, 640, 0) }, { easing: 'backOut' })
|
||||
)
|
||||
.start();
|
||||
let vip = RandomManager.instance.getRandomInt(0,100)
|
||||
console.log("[CardsComp]:vip",vip)
|
||||
if(vip < 30){
|
||||
this.node.getChildByName("vip").active=true
|
||||
this.is_countdown=true
|
||||
this.countdown_time=10
|
||||
}
|
||||
this.is_countdown=true
|
||||
this.countdown_time=10
|
||||
|
||||
}
|
||||
|
||||
hide(){
|
||||
@@ -264,7 +266,34 @@ export class CardsCompComp extends CCComp {
|
||||
this.close_cards(GameEvent.CardsClose,null)
|
||||
}
|
||||
refresh_card(){
|
||||
this.show_cards(this.now_card.type,this.now_card.data,true)
|
||||
if(smc.vmdata.mission_data.refresh_count>0){
|
||||
smc.vmdata.mission_data.refresh_count--
|
||||
this.show_cards(this.now_card.type,this.now_card.data,true)
|
||||
if(smc.vmdata.mission_data.refresh_count==0){
|
||||
this.more_btn.active=true
|
||||
this.refresh_btn.active=false
|
||||
}
|
||||
}else{
|
||||
this.more_btn.active=true
|
||||
this.refresh_btn.active=false
|
||||
}
|
||||
}
|
||||
|
||||
ad_callback(){
|
||||
oops.message.dispatchEvent(GameEvent.DO_AD_BACK)
|
||||
}
|
||||
|
||||
ad_back_true(){
|
||||
this.more_btn.active=false
|
||||
this.refresh_btn.active=true
|
||||
}
|
||||
ad_back_false(){
|
||||
this.more_btn.active=true
|
||||
this.refresh_btn.active=false
|
||||
}
|
||||
//检测广告是否成功观看
|
||||
checkout_ad_back(){
|
||||
return true
|
||||
}
|
||||
//放弃选择
|
||||
give_up_select(){
|
||||
@@ -272,23 +301,12 @@ export class CardsCompComp extends CCComp {
|
||||
// let mission_data=smc.vmdata.mission_data
|
||||
// mission_data.gold+=(mission_data.back_gold+mission_data.buff_back_gold) //返还金币
|
||||
}
|
||||
//点击看视频广告
|
||||
to_do_vip(){
|
||||
if(this.checkout_vip()){
|
||||
console.log("[CardsComp]:vip检查通过")
|
||||
}
|
||||
}
|
||||
//检测广告是否成功观看
|
||||
checkout_vip(){
|
||||
return true
|
||||
}
|
||||
|
||||
update(dt: number) {
|
||||
if(this.is_countdown){
|
||||
this.countdown_time-=dt
|
||||
this.node.getChildByName("vip").getChildByName("num").getComponent(Label).string=Math.floor(this.countdown_time).toString()
|
||||
if(this.countdown_time<=0){
|
||||
this.is_countdown=false
|
||||
this.node.getChildByName("vip").active=false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ export class MissionComp extends CCComp {
|
||||
|
||||
this.on(GameEvent.FightEnd,this.fight_end,this)
|
||||
this.on(GameEvent.MissionEnd,this.mission_end,this)
|
||||
this.on(GameEvent.DO_AD_BACK,this.do_ad,this)
|
||||
// this.on(GameEvent.CanUpdateLv,this.show_uplv_button,this)
|
||||
// this.on(GameEvent.UseEnhancement,this.hide_uplv_button,this)
|
||||
|
||||
@@ -121,7 +122,20 @@ export class MissionComp extends CCComp {
|
||||
this.show_wave_time()
|
||||
}
|
||||
|
||||
do_ad(){
|
||||
if(this.ad_back()){
|
||||
oops.message.dispatchEvent(GameEvent.AD_BACK_TRUE)
|
||||
smc.vmdata.mission_data.refresh_count+=FightSet.MORE_RC
|
||||
}else{
|
||||
oops.message.dispatchEvent(GameEvent.AD_BACK_FALSE)
|
||||
}
|
||||
}
|
||||
|
||||
ad_back(){
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
show_wave_time(){
|
||||
smc.vmdata.mission_data.wave_time_num=FightSet.ONE_WAVE_TIME
|
||||
|
||||
@@ -118,6 +118,8 @@ export class TalsComp extends Component {
|
||||
icon.getChildByName("q5").active=TalentList[uuid].quality==Quality.ORANGE
|
||||
}
|
||||
to_change_tal(){
|
||||
if(smc.vmdata.mission_data.refresh_count<=0) return
|
||||
smc.vmdata.mission_data.refresh_count--
|
||||
console.log("[TalsComp]:to_change_tal")
|
||||
if(this.cur_tal=="") return
|
||||
oops.message.dispatchEvent(GameEvent.TalentSelect,{slot:this.cur_tal})
|
||||
|
||||
Reference in New Issue
Block a user