// 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 User from "../../FrameWork/User/User"; import AppPlatform from "../../FrameWork/Util/AppPlatform"; import Common5 from "../../Platform/th/Common5"; import UiBase from "../GameBase/UiBase"; import JuQingManager from "../JuQingChat/JuQingManager"; import TaskManager, { MainTaskIdEnum, MainTaskWZEnum } from "../JuQingChat/TaskManager"; import ChallengeManager from "../Manager/ChallengeManager"; import ChuShiXieHuiManager from "../Manager/ChuShiXieHuiManager"; import DiaoLuoManager from "../Manager/DiaoLuoManager"; import FangChanManager from "../Manager/FangChanManager"; import LevelUpManager from "../Manager/LevelUpManager"; import MiShuManager from "../Manager/MiShuManager"; import ShipuManager from "../Manager/ShipuManager"; import TanWeiManager from "../Manager/TanWeiManager"; import UserManager from "../Manager/UserManager"; import ZaoCanManager from "../Manager/ZaoCanManager"; import ZiChanManager from "../Manager/ZiChanManager"; import NewGuideScript from "../NewGuide/NewGuideScript"; import NewGuideScript_NoSwallow from "../NewGuide/NewGuideScript_NoSwallow"; //import NewGuideScript2 from "../NewGuide/NewGuideScript2"; import PrefabManage, { GameType } from "../PrefabManager/PrefabManage"; import CommonTips from "../SCommon/CommonTips"; import ZiChan from "../ZiChan/ZiChan"; import ChaoFanWangScript from "./ChaoFanWangScript"; const { ccclass, property } = cc._decorator; @ccclass export default class MainHall extends UiBase { // LIFE-CYCLE CALLBACKS: @property(cc.Label) clickMoneyLab: cc.Label = null; // onLoad () {} @property(cc.Label) secondMoneyLab: cc.Label = null; @property(cc.Label) danJiaMoneyLab: cc.Label = null; @property(cc.Sprite) chenghaoPic: cc.Sprite = null; @property(cc.Label) levelLab: cc.Label = null; @property(cc.Label) chenghao: cc.Label = null; @property(cc.Node) qipaoNode: cc.Node = null; @property(cc.ProgressBar) qian_ProgressBar: cc.ProgressBar = null; @property(cc.ProgressBar) level_ProgressBar: cc.ProgressBar = null; isUpdate = false dtTime = 0 dtTimeLevel = 0 isGuide = false isUpdateLevel = false isGuideTanWei = false isGuideShiPu = false clickNum = 0 dialogIndex: number = 0; duihuakuang1: cc.Node; duihuakuang2: cc.Node; selectIndex: number = 0; guideArr = [] chatConfig = [ // { effectUrl: 'DH/MainHall/sound/老板你终于来了,顾客都在排队等着买早餐呢!', delayTime: 2.21, str: '老板你终于来了,顾客都在排队等着买早餐呢!', posi: '员工对话' }, // { effectUrl: 'DH/MainHall/sound/客人都等着急', delayTime: 2.83, str: '客人都等着急', posi: '员工对话' }, // { effectUrl: 'DH/MainHall/sound/油条出锅了,快点击油条递给客人吧!', delayTime: 2.68, str: '油条出锅了,快点击油条递给客人吧!', posi: '员工对话' }, // { effectUrl: 'DH/MainHall/sound/接下来我们来升级摊位,能提升早餐售卖单价哦!', delayTime: 4.35, str: '接下来我们来升级摊位,能提升早餐售卖单价哦!', posi: '员工对话' }, // { effectUrl: 'DH/MainHall/sound/升级可以获得永久点击收益提升哦', delayTime: 3, str: '升级可以获得永久点击收益提升哦', posi: 'qipao3' }, // { effectUrl: 'DH/MainHall/sound/(我记得前世柳家对付别的竞争对手喜欢从原材料下手。)', delayTime: 3.98, str: '(我记得前世柳家对付别的竞争对手喜欢从原材料下手。)', posi: '-1' }, // { effectUrl: 'DH/MainHall/sound/(得先去收购一个农贸市场,不然到时候就被柳家父子打脸了)', delayTime: 4.74, str: '(得先去收购一个农贸市场,不然到时候就被柳家父子打脸了)', posi: '-1' }, // { effectUrl: 'DH/MainHall/sound/(柳家豪,竟然如此没有底线,那就别怪我不客气了。)', delayTime: 4.66, str: '(柳家豪,竟然如此没有底线,那就别怪我不客气了。)', posi: '-1' }, // { effectUrl: 'DH/MainHall/sound/(等我达到一级面点师,再来收拾你们。)', delayTime: 2.57, str: '(等我达到一级面点师,再来收拾你们。)', posi: '-1' }, // { effectUrl: 'DH/MainHall/sound/哥哥,点击这个按钮可以抽取点击收益和秒赚收益的翻倍哦!', delayTime: 4.95, str: '哥哥,点击这个按钮可以抽取点击收益和秒赚收益的翻倍哦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,解锁面点可以将秒赚收益翻倍哦!', delayTime: 3.59, str: '哥哥,解锁面点可以将秒赚收益翻倍哦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,解锁摊位物品可以增加点击收益翻倍哦!', delayTime: 3.91, str: '哥哥,解锁摊位物品可以增加点击收益翻倍哦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,点击这个掉落物品,打开可以获得高品质面点和摊位物品,还有神秘七彩龙珠物品哦!', delayTime: 7.2, str: '哥哥,点击这个掉落物品,打开可以获得高品质面点和摊位物品,还有神秘七彩龙珠物品哦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,在这里达到成就可以用领取丰厚奖励哦!', delayTime: 3.67, str: '哥哥,在这里达到成就可以用领取丰厚奖励哦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,点击这个按钮可以升级点击收益翻倍哦!', delayTime: 3.65, str: '哥哥,点击这个按钮可以升级点击收益翻倍哦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,点击这个可以进行自动点击哦,这样你就可以去干点别的啦!', delayTime: 5.74, str: '哥哥,点击这个可以进行自动点击哦,这样你就可以去干点别的啦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,购买资产可以增加点击收益和秒赚收益倍数哦!', delayTime: 4.69, str: '哥哥,购买资产可以增加点击收益和秒赚收益倍数哦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,缺钱可以投资房产进行买卖,赚取差价哦!', delayTime: 4.35, str: '哥哥,缺钱可以投资房产进行买卖,赚取差价哦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,努力提升等级获取高级称号可以提升你的排名哦,排名越高领取的奖励越丰厚哦!', delayTime: 8.56, str: '哥哥,努力提升等级获取高级称号可以提升你的排名哦,排名越高领取的奖励越丰厚哦!', posi: 'qipao2' }, // { effectUrl: 'DH/MainHall/sound/哥哥,点击这里进入里面有多种小游戏可以赚钱哦!', delayTime: 4.56, str: '哥哥,点击这里进入里面有多种小游戏可以赚钱哦!', posi: 'qipao2' }, ] guideZiChan: any; curStayTime: number; tween_ShouYiUpState: boolean; clickTimeOutEvent: number; start() { cc.audioEngine.stopMusic() EventMgr.emitEvent_custom(ryw_Event.changeScene); EventMgr.onEvent_custom(ryw_Event.changeScene, () => { console.log('changeScene++=MainHall') this.node.removeFromParent() this.node.destroy() }, this) this.curStayTime = Date.now() PrefabManage.loadPrefabByType(GameType.ZaoCanDian, this.node.getChildByName('prefabNode'), (node) => { }) // if (User.getRoomGoodStatus() == 0) { // PrefabManage.loadPrefabByType(GameType.chatLongGe) // this.hideSomeBtn(true) // } this.refreshView() EventMgr.onEvent_custom(ryw_Event.MainHallRefreshView, () => { this.refreshView() }, this) let caishen = this.node.getChildByName('财神').getComponent(cc.Animation) caishen.on(cc.Animation.EventType.FINISHED, () => { this.isUpdate = false console.log('财神动画结束') }, this); EventMgr.onEvent_custom(ryw_Event.ChaiShenEvent, (isUse) => { let caishen = this.node.getChildByName('财神') if (isUse) { this.isUpdate = false caishen.active = false } else { caishen.getComponent(cc.Animation).resume() } }, this) this.refreshHead() EventMgr.onEvent_custom(ryw_Event.setHeadImg, () => { this.refreshHead() }, this) this.refreshChengHao() EventMgr.onEvent_custom(ryw_Event.levelUpChange, () => { this.refreshChengHao() this.refreshView() this.updateTaskJinDu() this.refreshShouYiTiSheng() }, this) EventMgr.onEvent_custom(ryw_Event.mishuLock, () => { this.refreshView() }, this) EventMgr.onEvent_custom(ryw_Event.mishuLevelUp, () => { this.refreshView() }, this) EventMgr.onEvent_custom(ryw_Event.unlockItem, () => { this.refreshView() }, this) EventMgr.onEvent_custom(ryw_Event.levelUpitem, () => { this.refreshView() }, this) EventMgr.onEvent_custom(ryw_Event.MultipleIncomeEvent, () => { this.refreshView() }, this) EventMgr.onEvent_custom(ryw_Event.MishuPeixun, () => { this.refreshView() }, this) if (User.getDeskReward()) { this.node.getChildByName("UINode").getChildByName("添加桌面").active = false } EventMgr.onEvent_custom(ryw_Event.updateMoney, () => { // this.checkIsMainTask502Finish() // this.checkIsMainTask101Finish() this.checkTaskFinish() this.updateTaskJinDu() }, this) this.checkTaskFinish() // this.checkIsMainTask502Finish() // this.checkIsMainTask101Finish let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id if (mainId == MainTaskIdEnum.MainTask_502) { this.isGuide = true } EventMgr.onEvent_custom(ryw_Event.NewGuideEvent, (index) => { this.guideNewStep(index) }, this) this.guideStep() this.loadPrefabs() EventMgr.onEvent_custom(ryw_Event.swallowToucheEvent, () => { let index = User.getFirstStepIndex() if (index == 6 || index == 7) { this.clickNum++ } // console.log(Common5.CommonGuideIndex, 'Common5.CommonGuideIndex++++++++==') // if (Common5.CommonGuideIndex == 3) { // let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('秘书') // this.guideView([node], 150) // } }, this) EventMgr.onEvent_custom(ryw_Event.swallowToucheFinishEvent, () => { this.guideStep() }, this) this.guideTask() EventMgr.onEvent_custom(ryw_Event.GuideTask, () => { this.guideTask() }, this) this.guideShipu() EventMgr.onEvent_custom(ryw_Event.ExitBtnEvent, () => { this.guideShipu() if (User.getFirstStepIndex() == 11 && !Common5.isCeBianLanEnter) { PrefabManage.loadPrefabByType(GameType.CeBianLan) // let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('成就') // this.guideView([node], 100) } let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id if (mainId == MainTaskIdEnum.MainTask_507) { let node = this.node.getChildByName('UINode').getChildByName('主线剧情') this.guideView([node], 150) } }, this) // this.checkTaskQiPao() this.updateMainTask() EventMgr.onEvent_custom(ryw_Event.updateMainTask, () => { this.updateMainTask() }, this) EventMgr.onEvent_custom(ryw_Event.JuQingGuide, () => { this.isGuide = true this.hideSomeBtn(false) }, this) EventMgr.onEvent_custom(ryw_Event.My_Guide, () => { this.My_Guide() }, this) this.My_Guide() this.schedule(() => { this.runGuideArr() // //计时当前界面停留时间 // if (TaskManager.getCurUnLockMainTaskId() == MainTaskIdEnum.MainTask_511 && User.getStatistics("isJoinDH46") == 0 && // (Date.now() / 1000 - this.curStayTime / 1000 >= 1 * 60 || User.getMyLevel() >= 200)) { // Common5.stopMusic() // this.node.removeFromParent() // this.node.destroy() // PrefabManage.loadPrefabByType(GameType.DH_46) // } // else if (TaskManager.getCurUnLockMainTaskId() == MainTaskIdEnum.MainTask_511 && User.getStatistics("smallgameguide") == 0 && // !this.node.getChildByName('UINode').getChildByName('小游戏').active && // (Date.now() / 1000 - this.curStayTime / 1000 >= 3 * 60 || User.getMyLevel() >= 250)) { // let node = this.node.getChildByName('UINode').getChildByName('小游戏') // node.active = true // this.guideView([node], 0, this.chatConfig[19], "小游戏引导") // } }, 1) // let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('升级') // //等级 // let lv = node.getChildByName('lv') // lv.getComponent(cc.Label).string = `Lv:${User.getMyLevel()}` // //升级的钱数 // let money = node.getChildByName('str') // let levelUpSpned = LevelUpManager.levelUpSpned() // money.getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(levelUpSpned)}` // //点击收益 // let dianji = node.getChildByName('点击收益').getChildByName('str') // dianji.getComponent(cc.Label).string = `点击收益:${Common5.getNumberChangeHanzi(LevelUpManager.getCurClickIncome())}` + '/次' // PrefabManage.loadPrefabByType(GameType.GetDiaoLuo) EventMgr.onEvent_custom(ryw_Event.RefreshJieDao, () => { this.refreshChengHao() this.refreshView() }, this) EventMgr.onEvent_custom(ryw_Event.refreshZaoCan, () => { this.refreshView() }, this) } My_Guide() { let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id let index = User.getFirstStepIndex() if (index == 3) { } else if (index == 1000) { // this.scheduleOnce(() => { // this.showYuanGongChat(0) // User.setFirstStepIndex(1001) // }, 1) // this.scheduleOnce(() => { // let zhuanpan = User.getZhuanPanFree() // if (zhuanpan) { // Common5.ReportDY("inLevel", "任务" + TaskManager.getCurUnLockMainTaskId() + '-引导收益翻倍'); // let node = this.node.getChildByName('UINode').getChildByName('多倍收益') // // this.showQiPao(this.chatConfig[9], "qipao_people", () => { // // }) // this.guideView([node], 150, this.chatConfig[9], "多倍收益引导") // } // }, 1) } else if (index == 1001 && this.node.getChildByName('UINode').getChildByName('diaoLuoNode').children[0].active) { // let node = this.node.getChildByName('UINode').getChildByName('diaoLuoNode').getChildByName('礼盒') // // this.showQiPao(this.chatConfig[12], "qipao_people", () => { // // }) // this.guideView([node], 150, this.chatConfig[12], "掉落引导") } else if (index == 1002) { let node = this.node.getChildByName('UINode').getChildByName('成就') // this.showQiPao(this.chatConfig[13], "qipao_people", () => { // }) this.guideView([node], 0, this.chatConfig[13], "成就引导") } else if (index == 1003) { let chengjiu1 = cc.sys.localStorage.getItem("成就首次点击收益") ?? '0' let chengjiu2 = cc.sys.localStorage.getItem("成就首次自动点击") ?? '0' if (chengjiu1 == '1') { let node = this.node.getChildByName('UINode').getChildByName('点击收益') // this.showQiPao(this.chatConfig[14], "qipao_people", () => { // }) this.guideView([node], 150, this.chatConfig[14], "成就首次点击收益引导") } else if (chengjiu2 == '1') { let node = this.node.getChildByName('UINode').getChildByName('自动点击') // this.showQiPao(this.chatConfig[15], "qipao_people", () => { // }) this.guideView([node], 150, this.chatConfig[15], "成就首次自动点击引导") } } else if (index == 1101) { let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('资产') this.guideView([node], 100, this.chatConfig[16], "资产引导") // this.showQiPao(this.chatConfig[16], "qipao_people", () => { // }) } else if (index == 1102) { let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('房产') this.guideView([node], 100, this.chatConfig[17], "房产引导") // this.showQiPao(this.chatConfig[17], "qipao_people", () => { // }) } else if (index == 1103) { let node = this.node.getChildByName('UINode').getChildByName('排行榜') this.guideView([node], 100, this.chatConfig[18], "排行榜引导") // this.showQiPao(this.chatConfig[18], "qipao_people", () => { // }) } } guideTask() { let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id // let index = User.getFirstStepIndex() // if (mainId == MainTaskIdEnum.MainTask_506) { // let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('对战') // this.guideView([node], 0) // } else if (mainId == MainTaskIdEnum.MainTask_507) { // let node = this.node.getChildByName('UINode').getChildByName('主线剧情') // this.guideView([node], 150) // } else if (mainId == MainTaskIdEnum.MainTask_508) { // let node = this.node.getChildByName('UINode').getChildByName('主线剧情') // this.guideView([node], 150) // } else if (mainId == MainTaskIdEnum.MainTask_509 && User.getFirstStepIndex() == 20) { // // let node = this.node.getChildByName('UINode').getChildByName('点击收益') // // this.guideView([node], 150) // // node.getChildByName("黄色按钮视频").active = false // // this.showQiPao(this.chatConfig[4], "qipao_guide", () => { // // }) // } else if (mainId == MainTaskIdEnum.MainTask_509 && User.getFirstStepIndex() == 21) { // let node = this.node.getChildByName('UINode').getChildByName('城市') // this.guideView([node], 0) // } else if (mainId == MainTaskIdEnum.MainTask_None) { // let curstate = User.getCurTaskId() // } } guideShipu() { } checkTaskQiPao() { let str = this.getTaskStr() if (str) { this.qipaoAnimForever(str) } else { this.qipaoNode.stopAllActions() this.qipaoNode.active = false } } getTaskStr() { let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id let money = UserManager.getCurMoney() let CurClickIncome = LevelUpManager.getCurClickIncome() if (mainId == MainTaskIdEnum.MainTask_507) { let data = ChallengeManager.getCurChallengeConfigDateById(4) let attackNum = data.attackNum if (CurClickIncome >= attackNum) { return '老板,洛北辰太嚣张了,快去干他吧' } else { return '洛北辰的攻击力只有2万/点击,轻松吊打他' } } else if (mainId == MainTaskWZEnum.MainTaskWZ_101) { let attackNum = 500000000 if (money >= attackNum) { return '夕颜姐姐太苦了,快去接她回来吧' } else { return '只要努力升级,赚够3亿还是很轻松的' } } else if (mainId == MainTaskIdEnum.MainTask_510) { let data = ChallengeManager.getCurChallengeConfigDateById(6) let attackNum = data.attackNum if (CurClickIncome >= attackNum) { return '你现在足以对付暗月长老了,快去救夕颜吧' } else { return '暗月长老的攻击力只有300万/点击,轻松吊打他' } } if (mainId == MainTaskIdEnum.MainTask_519) { let data = ChallengeManager.getCurChallengeConfigDateById(9) let attackNum = data.attackNum if (CurClickIncome >= attackNum) { return '你现在足以对付江啸天了,探寻真相吧' } else { return '江啸天的攻击力只有100亿/点击,轻松吊打他' } } else { return null } } qipaoAnimForever(str) { this.qipaoNode.active = true this.qipaoNode.scale = 0.1 let lab = this.qipaoNode.getChildByName('lab').getComponent(cc.Label) lab.string = str this.qipaoNode.stopAllActions() cc.tween(this.qipaoNode) .to(0.2, { scale: 1, opacity: 255 }) .delay(5.0) .call(() => { this.qipaoNode.opacity = 0 this.qipaoNode.scale = 0.1 let str = this.getTaskStr() lab.string = str }) .delay(20) .union() .repeatForever() .start() } qipaoAnim(str) { this.qipaoNode.active = true this.qipaoNode.scale = 0.1 this.qipaoNode.stopAllActions() let lab = this.qipaoNode.getChildByName('lab').getComponent(cc.Label) lab.string = str cc.tween(this.qipaoNode) .to(0.2, { scale: 1 }) .delay(5.0) .call(() => { this.qipaoNode.active = false }) .start() } guideNewStep(index) { if (index == 1) { let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('升级') this.guideView([node]) } } loadPrefabs() { this.scheduleOnce(() => { let curSignDay = -1 let signList = User.getSignList() for (let i = 0; i < 7; i++) { if (signList[i] == 0) { curSignDay = i break } } let index = User.getFirstStepIndex() if (index == 1) { let array = [GameType.MishuGame, GameType.MultipleIncome] PrefabManage.preloadPrefabArray(array) } else { let array = [GameType.MishuGame, GameType.MultipleIncome, GameType.ChatList] if (curSignDay == -1) { array = [GameType.MishuGame, GameType.MultipleIncome, GameType.ChatList] } PrefabManage.preloadPrefabArray(array) } }, 0.5) } checkTaskFinish() { let mainId = TaskManager.getCurUnLockMainTaskId() let config = TaskManager.getTaskConfigById(mainId) let money = UserManager.getCurMoney() let getCurTaskId = User.getCurTaskId() if (mainId == MainTaskIdEnum.MainTask_301 && money >= config.taskNum) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_301) TaskManager.setCurTask(MainTaskIdEnum.MainTask_302) } else if (mainId == MainTaskIdEnum.MainTask_502 && money >= config.taskNum) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_502) TaskManager.setCurTask(MainTaskIdEnum.MainTask_503) } else if (mainId == MainTaskIdEnum.MainTask_604 && money >= config.taskNum) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_604) TaskManager.setCurTask(MainTaskIdEnum.MainTask_605) } let myMoney = UserManager.getCurMoney() let levelUpSpned = LevelUpManager.levelUpSpned() let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('升级') if (myMoney - levelUpSpned >= 0) { node.getChildByName("黄色按钮视频").active = false // node.getChildByName("升级").getComponent(cc.Label).string = '升级' } else { node.getChildByName("黄色按钮视频").active = true // let level = 5 // if (User.getMyLevel() < 600) { // level = 5 // } else if (User.getMyLevel() >= 600 && User.getMyLevel() < 900) { // level = 3 // } else { // level = 2 // } // node.getChildByName("升级").getComponent(cc.Label).string = `升级+${level}` } } guideStep() { let index = User.getFirstStepIndex() if (index == 3) { this.node.getChildByName('UINode').active = false } else if (index == 5) { this.node.getChildByName('UINode').active = true let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('升级') this.scheduleOnce(() => { User.setFirstStepIndex(6) this.guideView([node, node, node, node, node], 150) }, 1) } else if (index == 7) { let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('秘书') this.scheduleOnce(() => { User.setFirstStepIndex(8) this.guideView([node], 150, null, null, null, true) }, 1) } else { } } runGuideArr() { if (this.guideArr.length > 0) { let prefabLayer = cc.director.getScene().getChildByName("Canvas").getChildByName('prefabLayer') console.log("prefabLayer.children=", prefabLayer.children) if (this.guideArr.length == 1 && prefabLayer.childrenCount == 1 && prefabLayer.children[0].name == 'MainHall' && this.node.getChildByName("蒙版父节点").childrenCount == 0) { let _guide = this.guideArr.shift() if (_guide) { this.guideView(_guide.nodeArray, _guide.opacity, _guide.qiPao, _guide.name, true) } } else { this.scheduleOnce(() => { let prefabLayer = cc.director.getScene().getChildByName("Canvas").getChildByName('prefabLayer') console.log("prefabLayer.children=", prefabLayer.children) if (prefabLayer.childrenCount == 1 && prefabLayer.children[0].name == 'MainHall' && this.node.getChildByName("蒙版父节点").childrenCount == 0) { let _guide = this.guideArr.shift() if (_guide) { this.guideView(_guide.nodeArray, _guide.opacity, _guide.qiPao, _guide.name, true) } } }, 3) } } } // guideView(nodeArray, opacity = -1, qiPao?, name?, isRun?) { // return // if (!isRun) { // if (nodeArray && nodeArray.length > 0 && this.guideArr && this.guideArr.length > 0) { // for (let i = 0; i < this.guideArr.length; i++) { // if (name && this.guideArr[i].name && name == this.guideArr[i].name) { // console.log("已有相同的引导不再添加") // return // } // } // } // this.guideArr.push({ nodeArray: nodeArray, opacity: opacity, qiPao: qiPao, name: name }) // // this.runGuideArr() // } else { // PrefabManage.loadPrefabByType(GameType.GuideMskNode, this.node.getChildByName("蒙版父节点"), (prefab) => { // // prefab.zIndex = 199 // let guideNodeArray = nodeArray // let firstNode = guideNodeArray.shift() // prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray) // if (opacity != -1) { // prefab.getComponent(NewGuideScript).setOpacityMaskNode(opacity) // } // }) // if (qiPao) { // this.showQiPao(qiPao, "qipao_people", () => { // }) // } // } // } guideView(nodeArray, opacity = -1, qiPao?, name?, isRun?, isNotTouch?) { if (isNotTouch) { PrefabManage.loadPrefabByType(GameType.GuideMskNode_NoSwallow, this.node.getChildByName("蒙版父节点"), (prefab) => { // prefab.zIndex = 199 let guideNodeArray = nodeArray let firstNode = guideNodeArray.shift() prefab.getComponent(NewGuideScript_NoSwallow).setBindNode(firstNode, guideNodeArray) if (opacity != -1) { prefab.getComponent(NewGuideScript_NoSwallow).setOpacityMaskNode(opacity) } }) } else { PrefabManage.loadPrefabByType(GameType.GuideMskNode, this.node.getChildByName("蒙版父节点"), (prefab) => { // prefab.zIndex = 199 let guideNodeArray = nodeArray let firstNode = guideNodeArray.shift() prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray) if (opacity != -1) { prefab.getComponent(NewGuideScript).setOpacityMaskNode(opacity) } }) } } refreshChengHao() { let chenghao = LevelUpManager.getChengHao() //this.chenghaoPic.string = chenghao // Common5.addUrlSprite_custom('jingjie/' + chenghao, this.chenghaoPic) this.chenghao.string = chenghao let levelLab = User.getMyLevel() this.levelLab.string = 'Lv.' + levelLab + '' let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('升级') //等级 let lv = node.getChildByName('lv') lv.getComponent(cc.Label).string = `Lv:${User.getMyLevel()}` //升级的钱数 let money = node.getChildByName('str') let levelUpSpned = LevelUpManager.levelUpSpned() money.getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(levelUpSpned)}` let danjia = node.getChildByName('单价') let danjianum = ZaoCanManager.getDanJia() danjia.getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(danjianum)}/个` // let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() // let mainId = mainTaskInfo.Id // let config = TaskManager.getTaskConfigById(mainId) // if (mainId == MainTaskIdEnum.MainTask_511 && User.getMyLevel() >= config.levelNum && User.getMoney() >= config.taskNum) { // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_511) // TaskManager.setCurTask(MainTaskIdEnum.MainTask_512) // let node = this.node.getChildByName('UINode').getChildByName('城市') // this.guideView([node], 100) // } } refreshHead() { let headSpr = this.node.getChildByName("UINode").getChildByName("head").getChildByName("头像").getComponent(cc.Sprite) Common5.addUrlSprite_custom("head/" + User.getHeadImg(), headSpr); } refreshView() { //189465465132184884545 //let shouyi = LevelUpManager.getCurClickIncome() let str1 = LevelUpManager.getCurClickIncome() //人物点击收益(按等级算的) * 属性秘书加成属性摊位加成 * 出摊界面的点击收益按钮倍数 * 出摊界面的收益翻倍 let allshouyi1 = MiShuManager.getAllIncomeMishu()//秘书秒赚总收益(包含出摊界面的收益翻倍) // let allshouyi2 = MiShuManager.getAllIncomeDuiyou()//队友秒赚总收益(包含出摊界面的收益翻倍) // let allNum = allshouyi1 + allshouyi2 let allNum = allshouyi1 // let beishuSP = ShipuManager.getAllShipuInCome()//面点界面的物品秒赚加成 // let beishuTW = TanWeiManager.getAllShipuInCome() //摊位界面的物品点击加成 // let chenghaoInCome = LevelUpManager.getAllChengHaoinCome() //称号倍数 // let zichan = ZiChanManager.getZiChanBeiShu() let yewu = ZaoCanManager.getAllZaoCanJiaCheng() // let mzNum = Math.floor(allNum * beishuSP * beishuTW) let clickNum = Math.floor(str1) //点击收益 // let mzNum = Math.floor(allNum * beishuSP * chenghaoInCome * zichan) //秒赚收益 let mzNum = Math.floor(allNum * yewu) //秒赚收益 this.clickMoneyLab.string = '' + Common5.getNumberChangeHanzi(clickNum) + '/次' this.secondMoneyLab.string = '' + Common5.getNumberChangeHanzi(mzNum) + '/秒' //单价 let danjia = ZaoCanManager.getDanJia() this.danJiaMoneyLab.string = '' + Common5.getNumberChangeHanzi(danjia) + '/个' //点击收益 let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('升级') let dianji = node.getChildByName('点击收益').getChildByName('str') dianji.getComponent(cc.Label).string = `点击收益:${Common5.getNumberChangeHanzi(clickNum)}` + '/次' } // update(dt) { if (this.isUpdate) { } else { this.dtTime += dt if (this.dtTime >= 25) { this.isUpdate = true // this.playCSAnim() this.dtTime = 0 } } if (this.isUpdateLevel) { } else { this.dtTimeLevel += dt if (this.dtTimeLevel >= 90) { this.isUpdateLevel = true // this.playLevelBtnAnim() this.dtTimeLevel = 0 } } } playLevelBtnAnim() { let index = User.getFirstStepIndex() if (index <= 3) { this.isUpdateLevel = false return } let posiNode = this.node.getChildByName('等级posi') let levelUp9 = this.node.getChildByName('等级加9') let lab = levelUp9.getChildByName('lab').getComponent(cc.Label) let endPosi = levelUp9.getPosition() let strPosi = posiNode.getPosition() let qipaoAddLevelNum = LevelUpManager.getQipaoAddLevelNum() lab.string = '等级+' + qipaoAddLevelNum levelUp9.setPosition(strPosi) levelUp9.scale = 0.3 levelUp9.active = true levelUp9.stopAllActions() levelUp9.getComponent(cc.Button).interactable = false cc.tween(levelUp9) .to(1.0, { x: endPosi.x, y: endPosi.y, scale: 1 }, { easing: 'backOut' }) .call(() => { levelUp9.getComponent(cc.Button).interactable = true }) .delay(15) .call(() => { levelUp9.active = false this.isUpdateLevel = false }) .start() cc.tween(levelUp9) .repeatForever( cc.tween() .to(0.6, { scale: 1.05 }) .to(0.6 * 1.5, { scale: 1 }) ) .start() } playCSAnim() { let index = User.getFirstStepIndex() if (index <= 3) { this.isUpdate = false return } let caishen = this.node.getChildByName('财神') caishen.active = true Common5.playRemoteSpine(caishen, 'Spine/chaishen', '财神', '财神') caishen.getComponent(cc.Animation).play('shishenAnim') } onAnimationFinished() { } chaishenClickEvent() { PrefabManage.loadPrefabByType(GameType.ShiShenSC) let caishen = this.node.getChildByName('财神') caishen.getComponent(cc.Animation).pause() } hideSomeBtn(isHide) { let uiNode = this.node.getChildByName("UINode") if (isHide == true) { for (let i = 0; i < uiNode.childrenCount; i++) { let node = uiNode.children[i] if (i == 0 || i == 1 || i == 2) { } else { node.active = !isHide } } } else { for (let i = 0; i < uiNode.childrenCount; i++) { let node = uiNode.children[i] if (i == 0 || i == 1 || i == 2) { } else { node.active = !isHide } } let bottom = uiNode.getChildByName('bottom') let renwu = uiNode.getChildByName('任务') let fuli = uiNode.getChildByName('领取福利') let qiandao = uiNode.getChildByName('签到') let paihangbang = uiNode.getChildByName('排行榜') let shouyi = uiNode.getChildByName('点击收益') let duobei = uiNode.getChildByName('多倍收益') let city = uiNode.getChildByName('城市') let zaixian = uiNode.getChildByName('在线奖励') let zidong = uiNode.getChildByName('自动点击') let shishen = uiNode.getChildByName('食神赐福') bottom.opacity = 0 // let arrayNode1 = [renwu, fuli, qiandao, paihangbang, shouyi, duobei] // let arrayNode2 = [city, zaixian, zidong, shishen] let arrayNode1 = [renwu, fuli, paihangbang, shouyi, duobei] let arrayNode2 = [city, zidong, shishen] this.btnMoveAnim(bottom, 'down') arrayNode1.forEach(element => { element.opacity = 0 this.btnMoveAnim(element, 'left') }); arrayNode2.forEach(element => { element.opacity = 0 this.btnMoveAnim(element, 'right') }); } } btnMoveAnim(node, type) { this.scheduleOnce(() => { let nodePosix = node.getPosition().x let nodePosiy = node.getPosition().y if (type == 'down') { node.setPosition(cc.v2(nodePosix, nodePosiy - 200)) } else if (type == 'left') { node.setPosition(cc.v2(nodePosix - 200, nodePosiy)) } if (type == 'right') { node.setPosition(cc.v2(nodePosix + 200, nodePosiy)) } node.opacity = 255 node.active = true cc.tween(node) .to(0.5, { x: nodePosix, y: nodePosiy }, { easing: 'elasticOut' }) .start() }, 0.1) } levelUpBtnClick(event) { let tab = { onClose: (finish) => { if (finish) { User.setShowAdNum(User.getShowAdNum() + 1) Common5.ReportDY("inLevel", `任务${TaskManager.getCurUnLockMainTaskId()}-AD-主界面升级`) // Common5.ReportDY("inLevel", "主界面升级-AD-升级加9"); let qipaoAddLevelNum = LevelUpManager.getQipaoAddLevelNum() LevelUpManager.peopleLevelUp(qipaoAddLevelNum) event.target.active = false event.target.stopAllActions() this.isUpdateLevel = false } else { event.target.active = false event.target.stopAllActions() this.isUpdateLevel = false Common5.showTips_custom("广告未观看完"); } }, onFailed: () => { } } AppPlatform.playVideo_custom(tab) } // 展示气泡 showQiPao(curLog, qipaoname, func?, aniFunc?) { //cc.audioEngine.stopAllEffects(); if (curLog != null && curLog != undefined && typeof (curLog) == "number") { curLog = this.chatConfig[curLog] } // if (!curLog) { // return // } if (curLog.effectUrl && curLog.effectUrl.length > 0) { Common5.playRemoteAudioEffect(curLog.effectUrl); // Common5.playEffectCustom("GameRes", curLog.effectUrl); } let string_ = curLog.str let qiPaoPos_ = curLog.posi ?? curLog.qiPaoPos let delayTime_ = curLog.delayTime ?? curLog.delay if (aniFunc) { aniFunc() } if (qiPaoPos_ != '-1') { let node = this.node.getChildByName(qipaoname); let qiPao = node.getChildByName(qiPaoPos_); qiPao.stopAllActions() this.showDialogStr(string_, qiPao.getChildByName("str")) // qiPao.getChildByName("str").getComponent(cc.Label).string = string_ qiPao.active = true // let scale = qiPao.scale qiPao.scale = 0 cc.tween(qiPao) .to(0.2, { scale: 1 / this.node.scale }) .delay(delayTime_) .call(() => { qiPao.active = false; }) .start(); } else { let chatLog = this.node.getChildByName('chatLog') chatLog.active = true if (curLog.endStr) { chatLog.getChildByName("str").getComponent(cc.Label).string = curLog.endStr } else { if (this.selectIndex == 1) { chatLog.getChildByName("str").getComponent(cc.Label).string = curLog.str1 } else { chatLog.getChildByName("str").getComponent(cc.Label).string = string_ } } //this.showDialogStr(string_, chatLog.getChildByName("str")) chatLog.stopAllActions() cc.tween(chatLog) .delay(delayTime_) .call(() => { chatLog.active = false; }) .start(); } this.scheduleOnce(() => { func && func(); }, delayTime_ + 0.2); } // 逐字显示 showDialogStr(str, dialogStr, finishFunc?) { let curStr = "" let curIndex = 0 let callFunc = () => { curStr += str[curIndex++] dialogStr.getComponent(cc.Label).string = curStr if (curIndex >= str.length) { finishFunc && finishFunc() } } this.schedule(callFunc, 0.05, str.length - 1); } // 展示点击说话 showClickDialog(curLog, func?, aniFunc?) { let text = curLog.str; if (text.length > 7) { text = curLog.str.slice(0, 6) + '...'; } let dialog = this.node.getChildByName('对话框'); dialog.getChildByName('lab').getComponent(cc.Label).string = text; dialog.active = true; this["_clickDialog"] = curLog; this["_clickDialogCallback"] = func; this["_clickDialogAniCallback"] = aniFunc; this.duihuakuang1 = dialog if (curLog.str1) { let text = curLog.str1; if (text.length > 7) { text = curLog.str1.slice(0, 6) + '...'; } let node = cc.instantiate(dialog) node.name = "第二个选择" this.node.addChild(node) let position = dialog.position.clone() position.y += dialog.getContentSize().height node.setPosition(position) node.getChildByName('lab').getComponent(cc.Label).string = text; this.duihuakuang2 = node } } // 点击展示对话 onClickShowDialog(event) { let target = event.target; target.active = false; if (this.duihuakuang1) { this.duihuakuang1.active = false } if (this.duihuakuang2) { this.duihuakuang2.active = false } if (target.name == "第二个选择") { this.selectIndex = 1 } else { this.selectIndex = 0 } let clickDialog = this["_clickDialog"]; let clickDialogCallback = this["_clickDialogCallback"]; let clickDialogAniCallback = this["_clickDialogAniCallback"]; if (clickDialog) { this.showQiPao(clickDialog, "", () => { clickDialogCallback && clickDialogCallback(); }, clickDialogAniCallback); } } updateMainTask() { let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id let ziChanData = User.getZiChanData() let config = TaskManager.getTaskConfigById(mainId) if (mainId == MainTaskIdEnum.MainTask_303) { let node = this.node.getChildByName('UINode').getChildByName('主线剧情') this.guideView([node], 150) } else if (mainId == MainTaskIdEnum.MainTask_532 && ziChanData.unLockNum[1] >= 1) { // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_532) // TaskManager.setCurTask(MainTaskIdEnum.MainTask_533) } else if (mainId == MainTaskIdEnum.MainTask_542 && ziChanData.unLockNum[2] >= 1) { // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_542) // TaskManager.setCurTask(MainTaskIdEnum.MainTask_543_1) } else if (mainId == MainTaskIdEnum.MainTask_539) { if (User.getMoney() >= config.taskNum && User.getMyLevel() >= config.levelNum) { // UserManager.subMoney(config.taskNum) TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_539) TaskManager.setCurTask(MainTaskIdEnum.MainTask_540) } } else if (mainId == MainTaskIdEnum.MainTask_554_2 && config.taskXuanPiaoNum && User.getUserIQ() >= config.taskXuanPiaoNum) { //选票 TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_554_2) TaskManager.setCurTask(MainTaskIdEnum.MainTask_555) } this.updateTaskJinDu() //刷新称号 let chenghao = LevelUpManager.getChengHao() this.chenghao.string = chenghao // //小游戏图标显示 // if (mainId > MainTaskIdEnum.MainTask_511) { // let node = this.node.getChildByName('UINode').getChildByName('小游戏') // node.active = true // } //任务显示 this.refreshTaskView() } refreshTaskView() { let customTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let taskId = customTaskInfo.Id console.log(taskId, 'TaskInfoView') let node = this.node.getChildByName('UINode').getChildByName('bottom').getChildByName('任务') node.getChildByName("未完成").active = true let config = TaskManager.getTaskConfigById(taskId) if (config) { let lab = node.getChildByName("任务描述").getChildByName("lab") lab.getComponent(cc.Label).string = config.TaskDesc // this.contentDesc.string = config.TaskDesc if (config.taskNum) { lab.setPosition(cc.v2(lab.x, 11)) } else { lab.setPosition(cc.v2(lab.x, 0)) } } } updateTaskJinDu() { let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id let config = TaskManager.getTaskConfigById(mainId) // if (config && config.levelNum) { // this.level_ProgressBar.node.active = true // this.level_ProgressBar.progress = User.getMyLevel() / config.levelNum // this.level_ProgressBar.node.getChildByName("jindu").getComponent(cc.Label).string = `${User.getMyLevel()}/${config.levelNum}` // } else { // this.level_ProgressBar.node.active = false // } if (config && config.taskNum) { this.qian_ProgressBar.node.active = true this.qian_ProgressBar.progress = Number((User.getMoney() / config.taskNum).toFixed(2)) this.qian_ProgressBar.node.getChildByName("jindu").getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(User.getMoney())}/${Common5.getNumberChangeHanzi(config.taskNum)}` } else { this.qian_ProgressBar.node.active = false } // if (mainId == MainTaskIdEnum.MainTask_516_2 && config && User.getMyLevel() >= config.levelNum && User.getMoney() >= config.taskNum) { // } } refreshShouYiTiSheng() { cc.Tween.stopAllByTarget(this.danJiaMoneyLab.node) cc.tween(this.danJiaMoneyLab.node) .sequence( cc.tween().set({ scale: 1 }), cc.tween().to(0.1, { scale: 1.1 }), cc.tween().to(0.1, { scale: 1 }), ) .start() cc.Tween.stopAllByTarget(this.levelLab.node) cc.tween(this.levelLab.node) .sequence( cc.tween().set({ scale: 1 }), cc.tween().to(0.1, { scale: 1.1 }), cc.tween().to(0.1, { scale: 1 }), ) .start() //收入提升 this.node.getChildByName('收入提升').active = true // this.node.getChildByName('收入提升').getComponent(cc.Widget).updateAlignment() let uplab = this.node.getChildByName('收入提升').getChildByName('提升').getChildByName("lab") let addlab = this.node.getChildByName('收入提升').getChildByName('提升').getChildByName("addlab") let cha = ZaoCanManager.getDanJia() - ZaoCanManager.getLastDanJia() uplab.getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(ZaoCanManager.getDanJia())}` // let str = '' // for (let i = 0; i < cha.toString().length; i++) { // if (Number(cha.toString()[i]) > 1) { // str += String(Number(cha.toString()[i]) - 1) // } else { // str += cha.toString()[i] // } // } // addlab.getComponent(cc.Label).string = `+${str}元` if (this.tween_ShouYiUpState) { clearTimeout(this.clickTimeOutEvent); addlab.getComponent(cc.Label).string = `+${Common5.getNumberChangeHanzi(cha)}` } else { cc.Tween.stopAllByTarget(this.node.getChildByName('收入提升')) this.tween_ShouYiUpState = true cc.tween(this.node.getChildByName('收入提升')) .sequence( cc.tween().set({ scale: 0 }), cc.tween().to(0.2, { scale: 1.4 }), cc.tween().to(0.03, { scale: 1.2 }), // cc.tween().delay(0.3), cc.tween().call(() => { addlab.getComponent(cc.Label).string = `+${Common5.getNumberChangeHanzi(cha)}` }), cc.tween().delay(1), cc.tween().call(() => { }), ) .start() } this.clickTimeOutEvent = setTimeout(() => { this.node.getChildByName('收入提升').active = false this.tween_ShouYiUpState = false }, 1200); } }