咸鱼的反击
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

169 lines
6.2 KiB

import User from "../../FrameWork/User/User";
import AppPlatform from "../../FrameWork/Util/AppPlatform";
import Common5 from "../../Platform/th/Common5";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import BagManager from "../Manager/BagManager";
import InterfaceManager from "../Manager/InterfaceManager";
import ShipuManager from "../Manager/ShipuManager";
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
import GameBase from "../SCommon/GameBase";
import GetAward from "../SCommon/GetAward";
const {ccclass, property} = cc._decorator;
@ccclass
export default class QinWangLing extends GameBase {
@property(cc.Node)
tipBoxNode:cc.Node = null
@property(cc.Node)
baoXiangNode:cc.Node = null
curSelectId:number = 0
gameType = 'FenTa'
onLoad() {
super.onLoad()
}
setViewData(type){
this.gameType = type
if(type == 'ZhuTa'){
this.node.getChildByName('CurGameJinHuoDesc2').active = true
}else{
this.node.getChildByName('CurGameJinHuoDesc2').active = false
}
}
onDestroy(){
super.onDestroy()
}
start(){
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
this.refreshView()
}
refreshView(){
let statusArr = User.getQingWangLingBaoXiangStatus(6)
for(let i=0;i<statusArr.length;i++){
if(statusArr[i]){
this.baoXiangNode.getChildByName('node_'+i).getChildByName('kai').active = true
this.baoXiangNode.getChildByName('node_'+i).getChildByName('guan').active = false
}else{
this.baoXiangNode.getChildByName('node_'+i).getChildByName('kai').active = false
this.baoXiangNode.getChildByName('node_'+i).getChildByName('guan').active = true
}
}
}
onClickBaoXiang(event,customData){
this.curSelectId = parseInt(customData)
let statusArr = User.getQingWangLingBaoXiangStatus(6)
if(!statusArr[customData]){
this.tipBoxNode.active = true
if(parseInt(customData) > 0){
this.tipBoxNode.getChildByName('宝箱1').active = true
this.tipBoxNode.getChildByName('宝箱2').active = false
}else{
this.tipBoxNode.getChildByName('宝箱1').active = false
this.tipBoxNode.getChildByName('宝箱2').active = true
}
}
let qingQangLingFreeNum = User.getQingQangLingFreeNum()
if(qingQangLingFreeNum > 0){
this.tipBoxNode.getChildByName('btnFree').active = true
this.tipBoxNode.getChildByName('btnFree').getChildByName('label').getComponent(cc.Label).string = `开启${qingQangLingFreeNum}/4`
this.tipBoxNode.getChildByName('btnAd').active = false
}else{
this.tipBoxNode.getChildByName('btnFree').active = false
this.tipBoxNode.getChildByName('btnAd').active = true
}
}
onBtnFreeClick(){
User.setQingWangLingBaoXiangStatus(6,this.curSelectId,true)
this.refreshView()
User.setQingQangLingFreeNum(User.getQingQangLingFreeNum() - 1)
this.tipBoxNode.active = false
let goodArray = InterfaceManager.getMangheGoodsListByType('ChaoFanLin',1,false)
console.log(goodArray,'goodArray++++++++====')
//
if(BagManager.getBagGoodNums(1726)<=0 && Common5.qinwanglinADNum>0){
for(let i = 0; i<goodArray.length;i++){
let dataArray = goodArray[i]
if(dataArray.goodId>=1701 && dataArray.goodId<=1750 ){
}else{
dataArray.goodId = 1726
break
}
}
}
PrefabManage.loadPrefabByType(GameType.GetAward,null,(prefabNode)=>{
prefabNode.getComponent(GetAward).initView(goodArray, ()=>{
ShipuManager.setShipuUnLock()
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if(mainId == MainTaskIdEnum.MainTask_537){
if(BagManager.isHaveAllGood([1716,1717,1718,1719,1720])){
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_537)
TaskManager.setCurTask(MainTaskIdEnum.MainTask_538)
//跳转
PrefabManage.loadPrefabByType(GameType.BoxTipNode, null, (prefab)=>{
prefab.getComponent('BoxTipScript').setViewData(1,'回家把五方神兽鼎交给龙镇南', ()=>{
this.node.removeAllChildren()
this.node.destroy()
PrefabManage.loadPrefabByType(GameType.MyRoom)
})
prefab.getComponent('BoxTipScript').setBtnStr('确定')
prefab.getComponent('BoxTipScript').setCloseBtnView(false)
prefab.zIndex = 100
})
}
}
});
})
}
onBtnAdClick(){
let tab = {
onClose: (finish)=>{
if (finish) {
Common5.ReportDY("inLevel", '秦王陵-AD-获取次数×4');
Common5.qinwanglinADNum++
let num = 4
User.setQingQangLingFreeNum(num)
this.tipBoxNode.getChildByName('btnFree').active = true
this.tipBoxNode.getChildByName('btnFree').getChildByName('label').getComponent(cc.Label).string = `开启${num}/4`
this.tipBoxNode.getChildByName('btnAd').active = false
}
else{
Common5.showTips_custom("广告未观看完");
}
},onFailed:()=>{
}
}
AppPlatform.playVideo_custom(tab)
}
onBtnReFresh(){
User.initQingWangLingBaoXiangStatus(6)
this.refreshView()
}
onBtnCloseBox(){
this.tipBoxNode.active = false
}
}