// Learn TypeScript: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html import { ryw_Event } from "../../FrameWork/Event/EventEnum"; import EventMgr from "../../FrameWork/Event/EventMgr"; import GameReport from "../../FrameWork/Report/ZyZyReport"; import User from "../../FrameWork/User/User"; import AppPlatform from "../../FrameWork/Util/AppPlatform"; import Common5 from "../../Platform/th/Common5"; import TaskManager, { MainTaskIdEnum } from "../../Scripts/JuQingChat/TaskManager"; import BagManager from "../../Scripts/Manager/BagManager"; import ChouShuiDataManager, { ShuiTangType } from "../../Scripts/Manager/ChouShuiDataManager"; import InterfaceManager from "../../Scripts/Manager/InterfaceManager"; import PrefabManage, { GameType } from "../../Scripts/PrefabManager/PrefabManage"; const { ccclass, property } = cc._decorator; @ccclass export default class ChoushuiTwo extends cc.Component { // @property(cc.Node) // guandao:cc.Node = null; @property([cc.Node]) guandao: cc.Node[] = []; @property(cc.Node) shuiGuanSpine: cc.Node = null; @property(cc.Node) shuiGuanguSpine: cc.Node = null; @property(cc.Node) taiPingYangSpine: cc.Node = null; @property(cc.Node) taipingyang: cc.Node = null; @property(cc.Node) shuiChiSpine: cc.Node = null; @property(cc.Node) shuichi: cc.Node = null; @property(cc.Node) CSGSpine: cc.Node = null; @property(cc.Node) choushuikeng: cc.Node = null; @property(cc.Node) dongtinghu: cc.Node = null; @property(cc.Node) dongtinghuSpine: cc.Node = null; @property(cc.Node) jilebi: cc.Node = null; @property(cc.Node) jlbSpine: cc.Node = null; @property(cc.Node) sihai: cc.Node = null; @property(cc.Node) sihaiSpine: cc.Node = null; @property(cc.Node) shanghuhai: cc.Node = null; @property(cc.Node) shanhuhaiSpine: cc.Node = null; @property(cc.Node) jiaoshihai: cc.Node = null; @property(cc.Node) jiaoshihaiSpine: cc.Node = null; curTypeIndex: number = 0 curPosIndex: number = 0 isAD: any; onLoad() { } start() { } onBtnchoushui(event) { Common5.playRemoteAudioEffect("action_effect/鱼塘抽水", false); // this.shuiChiSpine.getChildByName('guandao').active = true // this.guandao[0].active = true; event.target.active = false // this.shuiGuanSpine.getComponent(sp.Skeleton).setAnimation(0,'水管',false); // this.shuiGuanguSpine.getComponent(sp.Skeleton).setAnimation(0,'水管鼓',false); let spindeIndex = 0 if (this.curTypeIndex == ShuiTangType.TaiPingYang) { this.guandao[0].active = true; spindeIndex = 0 this.taiPingYangSpine.getComponent(sp.Skeleton).setAnimation(0, '太平洋', false); this.scheduleOnce(() => { this.getReward(this.guandao[0]) }, 3.3) //传递广播 // EventMgr.emitEvent_custom(ryw_Event.refreshChoushui,ShuiTangType.TaiPingYang) } else if (this.curTypeIndex == ShuiTangType.ShuiChi) { this.guandao[1].active = true; spindeIndex = 1 this.shuiChiSpine.getComponent(sp.Skeleton).setAnimation(0, '池塘', false); this.scheduleOnce(() => { this.getReward(this.guandao[1]) }, 3.3) //传递广播 // EventMgr.emitEvent_custom(ryw_Event.refreshChoushui,ShuiTangType.ShuiChi) } else if (this.curTypeIndex == ShuiTangType.csg) { this.guandao[2].active = true; spindeIndex = 2 this.CSGSpine.getComponent(sp.Skeleton).setAnimation(0, '臭水沟', false); this.scheduleOnce(() => { this.getReward(this.guandao[2]) }, 3.3) //传递广播 // EventMgr.emitEvent_custom(ryw_Event.refreshChoushui,ShuiTangType.csg) } else if (this.curTypeIndex == ShuiTangType.dongtinghu) { this.guandao[3].active = true; spindeIndex = 3 this.dongtinghuSpine.getComponent(sp.Skeleton).setAnimation(0, '洞庭湖', false); this.scheduleOnce(() => { this.getReward(this.guandao[3]) }, 3.3) //传递广播 // EventMgr.emitEvent_custom(ryw_Event.refreshChoushui,ShuiTangType.dongtinghu) } else if (this.curTypeIndex == ShuiTangType.jialebihai) { this.guandao[4].active = true; spindeIndex = 4 this.jlbSpine.getComponent(sp.Skeleton).setAnimation(0, '加勒比海', false); this.scheduleOnce(() => { this.getReward(this.guandao[4]) }, 3.3) //传递广播 // EventMgr.emitEvent_custom(ryw_Event.refreshChoushui,ShuiTangType.jialebihai) } else if (this.curTypeIndex == ShuiTangType.sihai) { this.guandao[5].active = true; spindeIndex = 5 this.sihaiSpine.getComponent(sp.Skeleton).setAnimation(0, 'animation', false); this.scheduleOnce(() => { this.getReward(this.guandao[5]) }, 3.3) //传递广播 // EventMgr.emitEvent_custom(ryw_Event.refreshChoushui,ShuiTangType.sihai) } else if (this.curTypeIndex == ShuiTangType.shanhuhai) { this.guandao[6].active = true; spindeIndex = 6 this.shanhuhaiSpine.getComponent(sp.Skeleton).setAnimation(0, '珊瑚海静止', false); this.scheduleOnce(() => { this.getReward(this.guandao[6]) }, 3.3) //传递广播 // EventMgr.emitEvent_custom(ryw_Event.refreshChoushui,ShuiTangType.shanhuhai) } else if (this.curTypeIndex == ShuiTangType.jiaoshihai) { this.guandao[7].active = true; spindeIndex = 7 this.jiaoshihaiSpine.getComponent(sp.Skeleton).setAnimation(0, '礁石海', false); this.scheduleOnce(() => { this.getReward(this.guandao[7]) }, 3.3) //传递广播 // EventMgr.emitEvent_custom(ryw_Event.refreshChoushui,ShuiTangType.jiaoshihai) } this.guandao[spindeIndex].getChildByName('shuiGuanSpine').getComponent(sp.Skeleton).paused = false this.guandao[spindeIndex].getChildByName('shuiGuanguSpine').getComponent(sp.Skeleton).paused = false this.guandao[spindeIndex].getChildByName('shuiGuanSpine').getComponent(sp.Skeleton).timeScale = 1 this.guandao[spindeIndex].getChildByName('shuiGuanguSpine').getComponent(sp.Skeleton).timeScale = 1 this.guandao[spindeIndex].getChildByName('shuiGuanSpine').getComponent(sp.Skeleton).setAnimation(0, '水管鼓', true); this.guandao[spindeIndex].getChildByName('shuiGuanguSpine').getComponent(sp.Skeleton).setAnimation(0, '水管', true); //传递广播typeIndex //EventMgr.emitEvent_custom(ryw_Event.refreshChoushui,this.curPosIndex,this.curTypeIndex) ChouShuiDataManager.changeChoushuiState(this.curPosIndex) // (typeIndex) => { // }); } getgoodArray getReward(node) { node.getChildByName('shuiGuanSpine').getComponent(sp.Skeleton).paused = true node.getChildByName('shuiGuanguSpine').getComponent(sp.Skeleton).paused = true let goodArray = InterfaceManager.getMangheGoodsListByType('IceWorld', 1, false) let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id let configData = TaskManager.getTaskConfigById(mainId) let GMGoodIdArray = configData.GMGoodIdArray let taskCaiGouDan = configData.taskCaiGouDan if (taskCaiGouDan && taskCaiGouDan.length > 0) { if (ChouShuiDataManager.getIsAD()) { let isfind = false for (let i = 0; i < GMGoodIdArray.length; i++) { if (BagManager.getBagGoodNums(GMGoodIdArray[i]) <= 0 && (configData.GMGameType.includes('YuTang') || configData.GMGameType.includes('鱼塘'))) { goodArray = [{ goodId: GMGoodIdArray[i], goodNum: 1 }] ChouShuiDataManager.setIsAD(false) isfind = true break } } if (!isfind) { for (let i = 0; i < taskCaiGouDan.length; i++) { if (BagManager.getBagGoodNums(taskCaiGouDan[i]) <= 0 && GMGoodIdArray.indexOf(taskCaiGouDan[i]) == -1) { goodArray = [{ goodId: taskCaiGouDan[i], goodNum: 1 }] break } } } } else { for (let i = 0; i < taskCaiGouDan.length; i++) { if (BagManager.getBagGoodNums(taskCaiGouDan[i]) <= 0 && GMGoodIdArray.indexOf(taskCaiGouDan[i]) == -1) { goodArray = [{ goodId: taskCaiGouDan[i], goodNum: 1 }] break } } } } // if (this.curTypeIndex == ShuiTangType.jiaoshihai) { // if (mainId == MainTaskIdEnum.MainTask_509) { // // 极品鲍鱼 // if (BagManager.getBagGoodNums(1705) <= 0) { // goodArray = [{ goodId: 1705, goodNum: 1 }] // } else if (BagManager.getBagGoodNums(1706) <= 0) { // goodArray = [{ goodId: 1706, goodNum: 1 }] // } // } // } // if(mainId == MainTaskIdEnum.MainTask_510){ // if(BagManager.getBagGoodNums(1780)<=0){ // goodArray =[ {goodId:1780,goodNum:1}] // }else if(BagManager.getBagGoodNums(1781)<=0){ // goodArray = [{goodId:1781,goodNum:1}] // }else if(BagManager.getBagGoodNums(1782)<=0){ // goodArray = [{goodId:1782,goodNum:1}] // } // } PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => { prefabNode.getComponent('GetAward').initView(goodArray, () => { if (taskCaiGouDan && taskCaiGouDan.length > 0) { let isHave = true for (let i = 0; i < taskCaiGouDan.length; i++) { if (BagManager.getBagGoodNums(taskCaiGouDan[i]) <= 0) { isHave = false break } } if (isHave) { if (mainId == MainTaskIdEnum.MainTask_307) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_307) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_308) User.setRoomBtnIndex(3) } else if (mainId == MainTaskIdEnum.MainTask_602) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_602) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_603) } else if (mainId == MainTaskIdEnum.MainTask_807) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_807) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_808) } else if (mainId == MainTaskIdEnum.MainTask_1308) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1308) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1309) EventMgr.emitEvent_custom(ryw_Event.refreshNeedLayer) }else if (mainId == MainTaskIdEnum.MainTask_2704) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_2704) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2705) } EventMgr.emitEvent_custom(ryw_Event.refreshButton) } } this.node.removeFromParent() this.node.destroy() }); }) } onButtonlingqu() { PrefabManage.showTextTips("物品已放入背包"); this.node.removeFromParent() this.node.destroy() // //传递广播 // EventMgr.emitEvent_custom(ryw_Event.refreshChoushui) } onButtondoublelingqu() { let tab = { onClose: (finish) => { if (finish) { let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id Common5.ReportDY("inLevel", `任务${mainId}-AD-鱼塘双倍领取`); PrefabManage.showTextTips("物品已放入背包"); GameReport.ADReport(''); this.node.removeFromParent(); this.node.destroy(); } else { GameReport.ADReport(""); PrefabManage.showTextTips("广告未观看完"); } }, onFailed: (finish) => { } } AppPlatform.playVideo_custom(tab); // PrefabManage.loadPrefabByType(GameType.ChoushuiFirst); } initView(index, type, isAD) { //索引0,1,2,3, this.curPosIndex = index //类型 this.curTypeIndex = type this.isAD = isAD console.log(type + "type0000000000000000000000000"); let spindeIndex = 0 if (this.curTypeIndex == ShuiTangType.TaiPingYang) { console.log('进入太平洋') this.taipingyang.active = true; spindeIndex = 0 } else if (this.curTypeIndex == ShuiTangType.ShuiChi) { // this.taipingyang.active = false; this.shuichi.active = true; spindeIndex = 1 console.log('进入池塘') } else if (this.curTypeIndex == ShuiTangType.csg) { // this.taipingyang.active = false; this.choushuikeng.active = true; console.log("进入臭水沟"); spindeIndex = 2 } else if (this.curTypeIndex == ShuiTangType.dongtinghu) { this.dongtinghu.active = true; // this.taipingyang.active = false; console.log("进入洞庭湖"); spindeIndex = 3 } else if (this.curTypeIndex == ShuiTangType.jialebihai) { this.jilebi.active = true; // this.taipingyang.active = false; console.log("进入加勒比海"); spindeIndex = 4 } else if (this.curTypeIndex == ShuiTangType.sihai) { this.sihai.active = true; // this.taipingyang.active = false; console.log("进入死海"); spindeIndex = 5 } else if (this.curTypeIndex == ShuiTangType.shanhuhai) { this.shanghuhai.active = true; // this.taipingyang.active = false; console.log("进入珊瑚海"); spindeIndex = 6 } else if (this.curTypeIndex == ShuiTangType.jiaoshihai) { this.jiaoshihai.active = true; // this.taipingyang.active = false; console.log("进入礁石海"); spindeIndex = 7 } this.guandao[spindeIndex].active = true this.guandao[spindeIndex].getChildByName('shuiGuanSpine').getComponent(sp.Skeleton).paused = true this.guandao[spindeIndex].getChildByName('shuiGuanguSpine').getComponent(sp.Skeleton).paused = true } // update (dt) {} }