觉醒时刻
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.
 
 
 

858 lines
38 KiB

// 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 ChongWuZhaoMuManager from "../ChongWuGuan/ChongWuZhaoMuManager";
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
import EventMgr from "../../FrameWork/Event/EventMgr";
import GameReport, { ENTERTYPE } from "../../FrameWork/Report/ZyZyReport";
import User, { RoomBtnIndexEnum } from "../../FrameWork/User/User";
import AppPlatform from "../../FrameWork/Util/AppPlatform";
import Common5 from "../../Platform/th/Common5";
import CommonDefine from "../../Platform/th/CommonDefine";
// import FangChanManager from "../Fangchan/FangChanManager";
import InterfaceManager from "../Manager/InterfaceManager";
// import KaiGongSiManager from "../Manager/KaiGongSiManager";
// import QunYingJiuDianManager from "../Manager/QunYingJiuDianManager";
import UserManager from "../Manager/UserManager";
// import MeiNvZhaoMuManager from "../MeiNvZhaoMu/MeiNvZhaoMuManager";
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
// import YingshiManager from "../dianyingTouzi/YingshiManager";
// import CaiChaConfigManage from "../game/caicha/CaiChaConfigManage";
// import CaiChaManage from "../game/caicha/CaiChaManage";
// import YouTingJiDiManager from "../Manager/YouTingJiDiManager";
import { GameStoryConfigData } from "../FirstSelectScene/GameStoryConfig";
import RoomCommon from "../GameRoomRes/RoomCommon/RoomCommon";
import ZhongCanTingManager from "../GameMethodRes/ZhongCanTing/ZhongCanTingManager";
import { AutoShouYiConfig } from "./CityPrefab";
import StockManager from "../GameMethodRes/stock/StockManager";
import YiMaJiangManager from "../GameMethodRes/YiMaJiang/YiMaJiangManager";
import LiXianShouYiManager from "../GameMethodRes/LiXianShouYi/LiXianShouYiManager";
import MeiNvZhaoMuManager from "../MeiNvZhaoMu/MeiNvZhaoMuManager";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import JuQingManager from "../JuQingChat/JuQingManager";
import BagManager from "../Manager/BagManager";
import TaskInfoView from "../JuQingChat/TaskInfoView";
const { ccclass, property } = cc._decorator;
@ccclass
export default class MainScene extends cc.Component {
// LIFE-CYCLE CALLBACKS:
hour: number = 0;
min: number = 0;
time_ = 0
qipaoTime = 0
isShowCFHMFail: boolean = false
isNewDay = false
onLoad() {
// InterfaceManager.setDaoyeList("寻宝船1", 3)
//追加投资1
// let data = 'money:665;userIQ:50;day:3;proper_TiLi:50;proper_NaoLi:50;curGameLevelIndex:2;bagGood:0,null?3004,1?3203,2?3208,1?3213,3?3211,2?3005,1?3214,2?3210,1?3006,1?3207,1;curJuQingUnLockIndex:;curUnLockMainTaskInfo:304?3?10003?false;ChatRecordData:;daoyeGoodList:;daoYeIndex:0;firstStepIndex:3;GameGuideStepIndex:0;myStockData:;curTaskIndex:9;wanFaShouYiData:;finishTaskId:304?0;qieLevel:0;treeLevel:1;roomBtnIndex:2;baDaCaiXiUnlockStatus:false?false?false?false?false?false?false;baDaCaiXiLevelInfo:1?1?1?1?1?1?1?1;'
//追加投资2
// let data = 'money:820381;userIQ:50;day:5;proper_TiLi:50;proper_NaoLi:50;curGameLevelIndex:4;bagGood:0,null?3016,1?3017,1?3018,1?3019,1?3311,1?3314,1?3020,1?3021,1;curJuQingUnLockIndex:;curUnLockMainTaskInfo:505?5?10005?false;ChatRecordData:;daoyeGoodList:;daoYeIndex:0;firstStepIndex:2;GameGuideStepIndex:0;myStockData:;curTaskIndex:28;wanFaShouYiData:中餐厅&2496?;finishTaskId:505?0;qieLevel:0;treeLevel:1;roomBtnIndex:2;baDaCaiXiUnlockStatus:false?true?false?false?false?false?false;baDaCaiXiLevelInfo:5?1?1?1?1?1?1?1;'
//追加投资3
// let data = '4048155;userIQ:50;day:9;proper_TiLi:50;proper_NaoLi:50;curGameLevelIndex:7;bagGood:0,NaN?3038,1?3036,1?3035,1?3037,1?3506,1?3039,1?3509,1?3512,1?3508,1?3502,1?3040,1;curJuQingUnLockIndex:;curUnLockMainTaskInfo:805?9?10009?false;ChatRecordData:;daoyeGoodList:;daoYeIndex:0;firstStepIndex:3;GameGuideStepIndex:0;myStockData:;curTaskIndex:63;wanFaShouYiData:中餐厅&55110?;finishTaskId:805?0;qieLevel:0;treeLevel:1;roomBtnIndex:2;baDaCaiXiUnlockStatus:true?true?false?false?false?false?false;baDaCaiXiLevelInfo:5?5?1?1?1?1?1?1;'
//追加投资4
// let data = 'money:605485;userIQ:50;day:11;proper_TiLi:50;proper_NaoLi:50;curGameLevelIndex:9;bagGood:0,NaN?3048,1?3208,3?3213,3?3207,3?3210,3?3049,1?3203,4?3214,4?3050,1?3764,1?3765,1?3051,1;curJuQingUnLockIndex:;curUnLockMainTaskInfo:1005?11?10011?false;ChatRecordData:;daoyeGoodList:;daoYeIndex:0;firstStepIndex:3;GameGuideStepIndex:0;myStockData:;curTaskIndex:84;wanFaShouYiData:中餐厅&331670?;finishTaskId:1005?0;qieLevel:0;treeLevel:1;roomBtnIndex:2;baDaCaiXiUnlockStatus:true?true?false?false?false?false?false;baDaCaiXiLevelInfo:5?5?2?1?1?1?1?1;'
//追加投资5
// let data = 'money:1059440000;userIQ:50;day:17;proper_TiLi:50;proper_NaoLi:50;curGameLevelIndex:12;bagGood:0,NaN?1717,115?3770,5?3065,1?3066,1?3072,1?3069,1?3070,1?3073,1?3071,1?1515,1?3074,1;curJuQingUnLockIndex:;curUnLockMainTaskInfo:1310?17?10017?false;ChatRecordData:WX_LiManNi&WX_32,true#;daoyeGoodList:;daoYeIndex:0;firstStepIndex:2;GameGuideStepIndex:0;myStockData:;curTaskIndex:110;wanFaShouYiData:中餐厅&2877150.5?;finishTaskId:1310?0;qieLevel:3;treeLevel:1;roomBtnIndex:2;baDaCaiXiUnlockStatus:true?true?true?false?false?false?false;baDaCaiXiLevelInfo:5?5?2?5?1?1?1?1;'
// UserManager.readDataByUrl(data)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_504)
// InterfaceManager.setDaoyeList("慈善抽奖", 1)
// for (let i = 3029; i <= 3033; i++) {
// BagManager.addBagList({ goodId: i, goodNum: 1 })
// }
// // UserManager.addMoney(100000000000)
// User.setBaDaCaiXiUnlockStatus({
// ShiPingChang: true, YaoShan: true, YiYao: true, WenYu: true,
// JingRong: true, WeiLai: false, DianZi: true, WangLuo: true,
// })
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2902)
// BagManager.subBagList(3006, 1)
// JuQingManager.unLockNewJuQing("WX_70")
// EventMgr.emitEvent_custom(ryw_Event.EnterNextGame, true)
// User.setRoomBtnIndex(RoomBtnIndexEnum.huigongsi)
// let suipians = [3069, 3070, 3071, 3072, 3073]
// for (let i = 0; i < suipians.length; i++) {
// BagManager.addBagList({ goodId: suipians[i], goodNum: 1 })
// }
// BagManager.subBagList(3073, 1)
// BagManager.subBagList(3020, 1)
// // User.restartGame()
// BagManager.addBagList({ goodId: 3083, goodNum: 1 })
// JuQingManager.unLockNewJuQing("WX_21")
// User.setRoomBtnIndex(RoomBtnIndexEnum.fushijiazu)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1303)
// InterfaceManager.setDaoyeList("慈善抽奖", 1)
// InterfaceManager.setDaoyeList("鱼塘", 2)
// InterfaceManager.setDaoyeList("寻宝船1", 3)
// InterfaceManager.setDaoyeList("快递站", 4)
// InterfaceManager.setDaoyeList("鱼塘1", 5)
// InterfaceManager.setDaoyeList("快递站1", 6)
// InterfaceManager.setDaoyeList("慈善抽奖1", 7)
// InterfaceManager.setDaoyeList("鱼塘2", 8)
// InterfaceManager.setDaoyeList("快递站2", 9)
// for (let i = 3075; i <= 3082; i++) {
// BagManager.addBagList({ goodId: i, goodNum: 1 })
// }
// BagManager.addBagList({ goodId: 3021, goodNum: 1 })
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2503)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_604)
// User.setRoomBtnIndex(1)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1402)
// JuQingManager.unLockNewJuQing("WX_32")
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_911)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1203)
// User.setRoomBtnIndex(RoomBtnIndexEnum.touzirenjia)
// let list = []
// User.setDaoyeGoodList(list)
// User.setDaoyeJiaoHuo(true)
// User.setDaoyeShuaXin(0)
// StockManager.refreshAllStocksData(1, true)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_803)
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1001)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1004)
// User.setRoomBtnIndex(3)
// User.setBaDaCaiXiUnlockStatus({
// ShiPingChang: false, YaoShan: true, YiYao: false, WenYu: false,
// JingRong: false, WeiLai: false, DianZi: false, WangLuo: false,
// })
// ZhongCanTingManager.setBaDaCaiXiLevelInfo(0, 8)
// ZhongCanTingManager.setBaDaCaiXiLevelInfo(1, 8)
// ZhongCanTingManager.setBaDaCaiXiLevelInfo(2, 8)
// ZhongCanTingManager.setBaDaCaiXiLevelInfo(3, 8)
// ZhongCanTingManager.setBaDaCaiXiLevelInfo(4, 8)
// ZhongCanTingManager.setBaDaCaiXiLevelInfo(5, 8)
// ZhongCanTingManager.setBaDaCaiXiLevelInfo(7, 7)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2501)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_705)
// let curGameLevelIndex = 28
// User.setCurGameLevelIndex(curGameLevelIndex)
// Common5.selectGameInfo = GameStoryConfigData[curGameLevelIndex]
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_503)
// User.setRoomBtnIndex(1)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_3003)
let finishTaskId = User.getCurTaskId()
if (finishTaskId[0] == MainTaskIdEnum.MainTask_2503 && finishTaskId[1] == 1) {
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2601)
JuQingManager.unLockNewJuQing("WX_61")
}
EventMgr.onEvent_custom(ryw_Event.updateMainTask, (data) => {
console.log("MainScene更新任务+", data)
let customTaskInfo = data.taskInfo
let prefabLayer = cc.director.getScene().getChildByName("Canvas").getChildByName('prefabLayer')
let guwan = prefabLayer.getChildByName("huxingongyuanLayer")
let kuangshan = prefabLayer.getChildByName("kaiKuangFirstView")
let yutang = prefabLayer.getChildByName("ChoushuiFirst")
let cishanchoujiang = prefabLayer.getChildByName("CiShanChouJiang")
let maoyi = prefabLayer.getChildByName("DaoYeShouGou")
let zhongcanting = prefabLayer.getChildByName("ZhongCanTing")
let gupiao = prefabLayer.getChildByName("stockNode")
let huangjinyufu = prefabLayer.getChildByName("HuangJinYuFu")
let KuaiDiZhan = prefabLayer.getChildByName("KuaiDiZhan")
let paimaihang = prefabLayer.getChildByName("paimaichang")
let ShouHuoji = prefabLayer.getChildByName("ShouHuoji")
if (customTaskInfo && Object.keys(customTaskInfo).length > 0 && customTaskInfo.Id != 0 && data.isAutoTanChu &&
(guwan || kuangshan || yutang || cishanchoujiang || maoyi || zhongcanting || gupiao || huangjinyufu || KuaiDiZhan || paimaihang || ShouHuoji)
) {
PrefabManage.loadPrefabByType(GameType.TaskInfoNode, null, (node) => {
node.getComponent(TaskInfoView).init(1.5)
})
} else {
//PrefabManage.showTextTips('当前无任务')
}
}, this)
EventMgr.onEvent_custom(ryw_Event.addDay, () => {
StockManager.refreshAllStocksData(User.getDay(), false)
// this.updateFangchan()
}, this)
}
oldLoad() {
this.hour = User.getTimeHour();
this.min = User.getTimeMin();
this.schedule(() => {
if (Common5.isVideoAdStopTime) {
return
}
this.min += 5;
if (this.min >= 60) {
this.hour += 1;
this.min = 0;
//EventMgr.emitEvent_custom(ryw_Event.updateDayOrNight);
}
if (Common5.saveTime > 0) {
Common5.saveTime--
if (Common5.saveTime < 0) {
Common5.saveTime = 0
}
}
if (this.hour >= 24) {
console.log('又是一天')
this.hour = 0;
this.refreshData()
this.saveData()
if (!this.isNewDay) {
this.isNewDay = true
}
UserManager.setCurDay(UserManager.getCurDay() + 1);
EventMgr.emitEvent_custom(ryw_Event.addDay);
}
// this.chanye_update();
this.updateAddShouYi()
let times = User.getHuangjinGouTime();
if (times > 0) {
User.setHuangjinGouTime(times - 1);
}
// ZhongCanTingManager.updateBaDaCaiXiTime()
// YouTingJiDiManager.updateFanHangTime()
MeiNvZhaoMuManager.updateAllZhaoMuTime()
// User.updateChaChangZhaoMuTime()
// User.updateYeLianChangZhaoMuTime()
// let times = User.getChongFanHaoMenTimes()
// if(times > 0){
// User.setChongFanHaoMenTimes(times - 1)
// }else{
// let isChongFanHaoMen = User.getIsChongFanHaoMen()
// //第一章节需要弹失败
// if(!isChongFanHaoMen){
// if(!this.isShowCFHMFail){
// this.isShowCFHMFail = true
// PrefabManage.loadPrefabByType(GameType.CFHMFailNode)
// }
// //第二章节不需要弹失败,重新倒计时
// }else{
// User.setChongFanHaoMenTimes(86400)
// }
// }
User.setTime(this.hour, this.min);
User.setLiXianTime(new Date().getTime())
// this.caicha_update();
}, 1)
}
start() {
EventMgr.onEvent_custom(ryw_Event.EnterNextGame, (notEnter) => {
this.enterNextGame(notEnter)
}, this);
EventMgr.onEvent_custom(ryw_Event.EnterCurGame, () => {
this.enterCurGame()
}, this);
this.enterCurGame()
// //0走开始剧情
// if(User.getFirstStepIndex() == 0){
// PrefabManage.loadPrefabByType(GameType.KaiChangGuanQia1,null,()=>{
//
// })
// }else if(User.getFirstStepIndex() == 1){
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia1,null,()=>{
// })
// }else{
// PrefabManage.loadPrefabByType(GameType.MyRoom)
// }
this.oldLoad();
this.scheduleOnce(() => {
InterfaceManager.initManager()
})
// InterfaceManager.setDaoyeList('酒瓶回收',1)
// PrefabManage.loadPrefabByType(GameType.DiaoYu)
// this.scheduleOnce(()=>{
// cc.assetManager.loadBundle('GoodIcon', function (err: Error, bundle: cc.AssetManager.Bundle) {
// })
// },1.5)
// this.scheduleOnce(()=>{
// cc.assetManager.loadBundle('WordGame', function (err: Error, bundle: cc.AssetManager.Bundle) {
// })
// },3)
// this.checkTask604()
// this.checkTask606()
// this.checkTask607()
// this.checkTask609()
// this.checkTask612()
// this.checkTask615()
// this.checkTask623()
// this.checkTask624()
// this.checkTask625()
// this.checkTask633()
// this.checkTask634()
// this.checkTask636()
// // this.checkTask642()
// this.checkTask643()
// this.checkTask649()
// this.checkTask652()
// EventMgr.onEvent_custom(ryw_Event.CheckTuFaShiJian, () => {
// this.checkTask604()
// this.checkTask606()
// this.checkTask607()
// this.checkTask609()
// this.checkTask612()
// this.checkTask615()
// this.checkTask623()
// this.checkTask624()
// this.checkTask625()
// this.checkTask633()
// this.checkTask634()
// this.checkTask636()
// // this.checkTask642()
// this.checkTask643()
// this.checkTask649()
// this.checkTask652()
// }, this);
}
updateAddShouYi() {
// //累计美食街产生收益
// User.addShouYiMoneyCount('美食街',IndustryManager.allIndustryMoney())
let baDaCaiXiUnlockStatus = User.getBaDaCaiXiUnlockStatus()
for (let i = 0; i < AutoShouYiConfig.length; i++) {
if (AutoShouYiConfig[i].gameTittle == '中餐厅' && baDaCaiXiUnlockStatus.YaoShan) {
let money = ZhongCanTingManager.getPerSecondShouYi()
User.addShouYiMoneyCount(AutoShouYiConfig[i].gameTittle, money)
}
}
// //快递,顾氏水产,下水道
// let localZhaoMuData = MeiNvZhaoMuManager.getMeiNvZhaoMuData()
// for(let i=0;i<AutoShouYiConfig.length;i++){
// let zhaoMuBeiShu = localZhaoMuData[i].zhaoMuBeiShu
// let money = AutoShouYiConfig[i].money * zhaoMuBeiShu
// if(AutoShouYiConfig[i].gameTittle == '快递' && !UserHeTong.buyKuaiDiZhan){
// continue
// }
// if(AutoShouYiConfig[i].gameTittle == '顾氏水产' && !UserHeTong.buyChiTang){
// continue
// }
// if(AutoShouYiConfig[i].gameTittle == '下水道' && !UserHeTong.buyXiaShuiDao){
// continue
// }
// User.addShouYiMoneyCount(AutoShouYiConfig[i].gameTittle,money)
// }
// //茶场
// let chaChangZhaoMuData = User.getChaChangZhaoMuData()
// for(let i=0;i<ChaChangAutoShouYiConfig.length;i++){
// let zhaoMuBeiShu = chaChangZhaoMuData.zhaoMuBeiShu
// let yuanBao = ChaChangAutoShouYiConfig[i].yuanBao * zhaoMuBeiShu
// if(ChaChangAutoShouYiConfig[i].gameTittle == '茶场' && !UserHeTong.buyChaChang){
// continue
// }
// User.addShouYiMoneyCount(ChaChangAutoShouYiConfig[i].gameTittle,yuanBao)
// }
// //群英酒店
// let jiuDianMoney = QunYingJiuDianManager.getPerSecondShouYi()
// User.addShouYiMoneyCount('群英酒店',jiuDianMoney)
// //影视投资(收益_凤凰足浴)
// let yingShiMoney = YingshiManager.getYingShiPerSecondMoney()
// User.addShouYiMoneyCount('凤凰足浴',yingShiMoney)
//移麻将(收益_王氏产业)
// let yiMaJiangMoney = YiMaJiangManager.getYiMaJiangPerSecondMoney()
// User.addShouYiMoneyCount('王氏产业',yiMaJiangMoney)
// //公司(收益_出售)
// let gongSiMoney = KaiGongSiManager.getShouyiAllMoney()
// User.addShouYiMoneyCount('出售',gongSiMoney)
// //(收益_萌宠生活馆)
// let chongWuMoney = ChongWuZhaoMuManager.getChongWuPerSecondMoney()
// User.addShouYiMoneyCount('萌宠生活馆',chongWuMoney)
}
// updateFangchan(){
// FangChanManager.refreshAllFangChansData(UserManager.getCurDay(),false)
// }
saveData() {
if (this.isNewDay) {
InterfaceManager.saveData()
}
}
// chanye_update(){
// FengWeiManager.zhuangxiuDaoJiShiProgress()
// FengWeiManager.updateFengWeiTime()
// let hechengLeftTime = User.getAutoHeChangLeftTime()
// let jinkuangID = 1717
// let yuanliaoId = jinkuangID
// let num = BagManager.getBagGoodNums(yuanliaoId)
// if(hechengLeftTime>0){
// hechengLeftTime--
// User.setAutoHeChangLeftTime(hechengLeftTime)
// if(num>0){
// let localZhaoMuData = User.getYeLianChangZhaoMuData()
// let zhaoMuBeiShu = localZhaoMuData.zhaoMuBeiShu
// let cangchuMax = 5*zhaoMuBeiShu
// let yuanbao = User.getAutoHeChangYuanbao()
// yuanbao = yuanbao+cangchuMax
// User.setAutoHeChangYuanbao(yuanbao)
// BagManager.subBagList(yuanliaoId,zhaoMuBeiShu)
// UserManager.addYuanBao(cangchuMax)
// }
// EventMgr.emitEvent_custom(ryw_Event.autoAddYuanBao);
// }
// }
refreshData() {
// let daoyeJiaohuo = User.getDaoyeJiaoHuo()
// if(daoyeJiaohuo){
// User.setDaoyeJiaoHuo(false)
// let daoyeGoodList = User.getDaoyeGoodList()
// if(daoyeGoodList.length == 0){
// let list = InterfaceManager.getDaoyeList()
// let tempList = []
// for(let i = 0; i<list.length;i++){
// let obj = {
// goodId:0,
// buyNum:0,
// buyPercent:10,
// }
// obj.goodId = list[i].goodId
// obj.buyNum = list[i].buyNum
// tempList[tempList.length] = obj
// }
// User.setDaoyeGoodList(tempList)
// User.setDaoyeJiaoHuo(false)
// console.log('倒爷加货了++++=====')
// }else{
// console.log('倒爷有货了++++=====')
// }
// }
}
// checkTask604(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_604){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia3)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView1(2,false,successFunc)
// })
// },1)
// }
// }
// checkTask606(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_606){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// let num = BagManager.getBagGoodNums(1737)
// BagManager.subBagList(1737,num)
// UserManager.addMoney(50000,this.node)
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_606)
// }
// let adBtnFunc = ()=>{
// let num = BagManager.getBagGoodNums(1737)
// BagManager.subBagList(1737,num)
// UserManager.addMoney(100000,this.node)
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_606)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView4(4,true,successFunc,adBtnFunc)
// })
// },1)
// }
// }
// checkTask607(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_607){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// // UserManager.subMoney(50000)
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia4)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView1(3,false,successFunc)
// })
// },1)
// }
// }
// checkTask609(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_609){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// // console.log('成功!')
// UserManager.subMoney(10000)
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_609)
// }
// let failFunc = ()=>{
// // console.log('失败!')
// UserManager.subMoney(50000)
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_609)
// }
// let adBtnFunc = ()=>{
// // console.log('广告!')
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_609)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView5(0,successFunc,failFunc,adBtnFunc)
// })
// },1)
// }
// }
// checkTask612(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_612){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia5)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView1(8,false,successFunc)
// })
// },1)
// }
// }
// checkTask615(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_615){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia6)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView1(10,false,successFunc)
// })
// },1)
// }
// }
// checkTask623(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_623){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia9)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView1(12,false,successFunc)
// })
// },1)
// }
// }
// checkTask625(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_625){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia10)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView1(18,false,successFunc)
// })
// },1)
// }
// }
// checkTask633(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_633){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// //TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_633)
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia13)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView1(50,false,successFunc)
// })
// },1)
// }
// }
// checkTask634(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_634){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// let money = UserManager.getCurMoney()
// UserManager.subMoney(Math.floor(money*0.2))
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_634)
// }
// let adBtnFunc = ()=>{
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_634)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView4(51,true,successFunc,adBtnFunc)
// })
// },1)
// }
// //TaskManager.checkIsFinish635(User.getUserIQ())
// }
// checkTask636(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_636){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// //TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_636)
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia14)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView1(52,false,successFunc)
// })
// },1)
// }
// }
// checkTask624(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_624){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// let money = Math.floor(0.8 * UserManager.getCurMoney())
// UserManager.subMoney(money)
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_624)
// }
// let adBtnFunc = ()=>{
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_624)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView4(17,true,successFunc,adBtnFunc)
// })
// },1)
// }
// }
// // checkTask642(){
// // let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// // let mainId = mainTaskInfo.Id
// // if(mainId == MainTaskIdEnum.MainTask_642){
// // this.scheduleOnce(()=>{
// // let successFunc = ()=>{
// // //TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_642)
// // PrefabManage.loadPrefabByType(GameType.JuQingGuanQia16)
// // }
// // PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// // prefabNode.getComponent(TaskResult).initView1(58,true,successFunc)
// // })
// // },1)
// // }
// // }
// checkTask643(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_643){
// let successFunc = ()=>{
// // console.log('成功!')
// let money = UserManager.getCurMoney()
// UserManager.subMoney(Math.floor(money*0.4))
// this.finishTask643()
// }
// let failFunc = ()=>{
// // console.log('失败!')
// let money = UserManager.getCurMoney()
// UserManager.subMoney(Math.floor(money*0.4))
// this.finishTask643()
// }
// let adBtnFunc = ()=>{
// // console.log('广告!')
// this.finishTask643()
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView5(59,successFunc,failFunc,adBtnFunc)
// prefabNode.zIndex = 1
// })
// }
// }
// finishTask643(){
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_643)
// User.setChatImgIndex(4)
// }
// checkTask649(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_649){
// let successFunc = ()=>{
// let money = UserManager.getCurMoney()
// UserManager.subMoney(Math.floor(money*0.5))
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_649)
// }
// let adBtnFunc = ()=>{
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_649)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent('TaskResult').initView4(60,true,successFunc,adBtnFunc)
// })
// }
// }
// checkTask652(){
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_652){
// this.scheduleOnce(()=>{
// let successFunc = ()=>{
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia17)
// }
// PrefabManage.loadPrefabByType(GameType.TaskResult,null,(prefabNode)=>{
// prefabNode.getComponent(TaskResult).initView1(61,false,successFunc)
// })
// },1)
// }
// }
// 采茶时间计算
// caicha_update(){
// let chayuanArr = CaiChaManage.getChayuan()
// //console.log('game_init chayuan', chayuanArr);
// for(let i=0;i<chayuanArr.length;i++){
// let data = chayuanArr[i];
// // 如果种植了
// let isFinished = data.isFinished; // 是否成熟
// if(data.zhongzi != -1 && !isFinished){
// // 没有成熟
// data.time += 1.0;
// let zhongziConfig = CaiChaConfigManage.getChaZhongById(data.zhongzi);
// let timeSpan = zhongziConfig.totalTime - data.time;
// if(timeSpan <= 0){
// data.isFinished = true;
// CaiChaManage.setChayuanTimeById(data.id, 0);
// CaiChaManage.setChayuanIsFinishedById(data.id, true);
// }
// }
// }
// }
enterCurGame() {
console.log('Common5.selectGameInfo===', Common5.selectGameInfo)
//第一章特殊处理
if (Common5.selectGameInfo.index == 0) {
if (User.getFirstStepIndex() == 1) {
//第一次进入,初始化股票
StockManager.refreshAllStocksData(1, true)
// PrefabManage.loadPrefabByType(Common5.selectGameInfo.kaiChangIndex)
PrefabManage.loadPrefabByType(Common5.selectGameInfo.roomIndex)
} else {
PrefabManage.loadPrefabByType(Common5.selectGameInfo.roomIndex)
}
return
}
//无房间直接进入剧情关卡
if (!Common5.selectGameInfo.roomIndex || Common5.selectGameInfo.roomIndex == GameType.RoomNone) {
PrefabManage.loadPrefabByType(Common5.selectGameInfo.kaiChangIndex)
//有房间直接进入
} else {
if (Common5.selectGameInfo.roomIndex == GameType.CityPrefab) {
PrefabManage.loadPrefabByType(GameType.CityPrefab)
} else {
PrefabManage.loadPrefabByType(GameType.RoomCommon, null, (prefab) => {
let parentNode = prefab.getComponent(RoomCommon).getMainNode()
PrefabManage.loadPrefabByType(Common5.selectGameInfo.roomIndex, parentNode)
})
}
}
}
enterNextGame(notEnter) {
//解锁下个房间时先永久释放上个房间资源
// Common5.releaseBundleAssets(GameStoryConfigData[User.getCurGameLevelIndex()].releaseBundleName)
let curGameLevelIndex = User.getCurGameLevelIndex() + 1
User.setCurGameLevelIndex(curGameLevelIndex)
console.log("到哪个章节了===", curGameLevelIndex + 1)
Common5.selectGameInfo = GameStoryConfigData[curGameLevelIndex]
if (!notEnter) {
this.enterCurGame()
}
}
testSaveBtn() {
UserManager.sendDataToUrl()
}
testReadBtn() {
UserManager.readDataByUrl('')
}
test(event, custom) {
// JuQingManager.unLockNewJuQing('WX_26')
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_620)
// PrefabManage.loadPrefabByType(GameType.JuQingGuanQia4)
// User.restartGame()
// User.setFirstStepIndex(2)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_610)
// console.log('解锁主任务610')
// UserManager.setCanInterGameList(GameType.Game_xpz)
// cc.director.loadScene("MainScene", function (err, scene) {
// console.log("重置场景");
// Common5.isVideoAdStopTime = false
// });
// User.restartGame()
// User.setFirstStepIndex(2)
// JuQingManager.unLockNewJuQing('DH_3')
// cc.director.loadScene("MainScene", function (err, scene) {
// console.log("重置场景");
// Common5.isVideoAdStopTime = false
// });
// // JuQingManager.unLockNewJuQing('WX_1')
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_607)
// PrefabManage.loadPrefabByType(GameType.KaiChangGuanQia4)
return
}
}