import { ryw_Event } from "../../FrameWork/Event/EventEnum"; import EventMgr from "../../FrameWork/Event/EventMgr"; import User from "../../FrameWork/User/User"; import Common5 from "../../Platform/th/Common5"; import TouZiXieYiShu from "../GameMethodRes/TouZiXieYiShu/TouZiXieYiShu"; import GameBaseScript from "../GameRoomRes/GameBaseScript"; import guiyin from "../GameRoomRes/SuiPian/guiyin"; import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager"; import BagManager from "../Manager/BagManager"; import InterfaceManager from "../Manager/InterfaceManager"; import UserManager from "../Manager/UserManager"; import PrefabManage, { GameType } from "../PrefabManager/PrefabManage"; import GetAward from "../SCommon/GetAward"; import DHBase from "./DHBase"; const { ccclass, property } = cc._decorator; let needIDs = [ { goodids: [3035, 3036, 3037, 3038, 3039], tiaoZhuanGameType: GameType.HuangJinYuFu, huoYuan: "寻宝船", }, ] @ccclass export default class DH_12 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_12/sound/她这么年轻,靠谱吗?', delayTime: 2.75, str: '她这么年轻,靠谱吗?', posi: 'qipao2' }, { effectUrl: 'DH/DH_12/sound/叶辰,你吃软饭的啊。', delayTime: 2.61, str: '叶辰,你吃软饭的啊。', posi: 'qipao1' }, { effectUrl: 'DH/DH_12/sound/还是先聊投资的事吧。', delayTime: 1.8, str: '还是先聊投资的事吧。', posi: '-1' }, { effectUrl: 'DH/DH_12/sound/哼!这是龟印的地址,早去早回。', delayTime: 3.5, str: '哼!这是龟印的地址,早去早回。', posi: 'qipao2' }, { effectUrl: 'DH/DH_12/sound/你们要和平共处啊,我去去就来。', delayTime: 2.7, str: '你们要和平共处啊,我去去就来。', posi: '-1' }, { effectUrl: 'DH/DH_12/sound/你们继续,我去忙了。', delayTime: 2.19, str: '你们继续,我去忙了。', posi: '-1' }, // { effectUrl: 'DH/DH_12/sound/陪我们一起玩,给你追加投资。', delayTime: 3.4, str: '陪我们一起玩,给你追加投资。', posi: 'qipao3' }, ] @property(cc.Node) touziren: cc.Node = null; @property(cc.Node) gushuya: cc.Node = null; @property(cc.Node) needLayer: cc.Node = null; @property(cc.Node) singleItem: cc.Node = null; @property(cc.ScrollView) m_ScrollView: cc.ScrollView = null; curNeedID: number = -1; start() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_13) }) GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id let touzirenSpine = this.touziren.getComponent(sp.Skeleton) if (mainId == MainTaskIdEnum.MainTask_804) { this.dialogIndex = 5 touzirenSpine.setAnimation(0, "两人挽手待机", true) this.gushuya.active = false //点击提交播放合成动画 } else if (mainId >= MainTaskIdEnum.MainTask_805) { touzirenSpine.setAnimation(0, "两人挽手待机", true) this.gushuya.active = false } else if (mainId >= MainTaskIdEnum.MainTask_803) { touzirenSpine.setAnimation(0, "两人挽手待机", true) this.gushuya.active = false } else { this.continueStory(); } // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_59) // }) // EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => { // this.RefreshJuQingDuiHua(); // }, this); this.refreshNeedLayer() EventMgr.onEvent_custom(ryw_Event.refreshNeedLayer, () => { this.refreshNeedLayer() }, this) EventMgr.onEvent_custom(ryw_Event.ZhuiJiaTouZi, () => { // PrefabManage.showBlackGuoDu(() => { // PrefabManage.loadPrefabByType(GameType.CityPrefab) // this.node.destroy() // }) }, this) } refreshNeedLayer() { let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id if (mainId == MainTaskIdEnum.MainTask_803 || mainId == MainTaskIdEnum.MainTask_804) { this.curNeedID = 0 } if (this.curNeedID >= 0) { this.needLayer.active = true this.needLayer.getChildByName("huanYuanNode").getChildByName("huoYuan").getComponent(cc.Label).string = needIDs[this.curNeedID].huoYuan this.initItemContent() } else { this.needLayer.active = false } } // 继续剧情 continueStory() { let touzirenSpine = this.touziren.getComponent(sp.Skeleton) touzirenSpine.setAnimation(0, "投资人待机", true) let gushuyaSpine = this.gushuya.getComponent(sp.Skeleton) gushuyaSpine.setAnimation(0, "顾书雅待机", true) const dialogEvents = [ (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { touzirenSpine.setAnimation(0, "投资人说话", true) }); }, (func) => { touzirenSpine.setAnimation(0, "投资人待机", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { gushuyaSpine.setAnimation(0, "顾书雅说话", true) }); }, (func) => { gushuyaSpine.setAnimation(0, "顾书雅待机", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }) }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { touzirenSpine.setAnimation(0, "投资人说话", true) }); }, (func) => { gushuyaSpine.setAnimation(0, "顾书雅待机", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }) }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_802) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_803) this.refreshNeedLayer() // PrefabManage.showBlackGuoDu(() => { // PrefabManage.loadPrefabByType(GameType.CityPrefab) // this.node.destroy() // }) } }); } dialogCallFunc(dialogEvents); } // 继续剧情 continueStory1() { let touzirenSpine = this.touziren.getComponent(sp.Skeleton) touzirenSpine.setAnimation(0, "两人挽手待机", true) // let gushuyaSpine = this.gushuya.getComponent(sp.Skeleton) // gushuyaSpine.setAnimation(0, "顾书雅待机", true) this.gushuya.active = false const dialogEvents = [ (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }) }, // (func) => { // this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { // touzirenSpine.setAnimation(0, "两人挽手投资人说话", true) // }); // }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { Common5.playRemoteAudioEffect("ZhuiJiaTouZi/陪我们一起玩,给你追加投资哦。"); this.scheduleOnce(() => { TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_805) },3) // PrefabManage.showBlackGuoDu(() => { // PrefabManage.loadPrefabByType(GameType.CityPrefab) // this.node.destroy() // }) } }); } dialogCallFunc(dialogEvents); } initItemContent() { this.m_ScrollView.content.removeAllChildren() let isAllFind = true let propIdArr = needIDs[this.curNeedID].goodids for (let i = 0; i < propIdArr.length; i++) { let item = cc.instantiate(this.singleItem) item.active = true item.parent = this.m_ScrollView.content let spFrame_hui = item.getChildByName('spFrame_hui') let spFrame_liang = item.getChildByName('spFrame_liang') Common5.setRemoteSpriteFrame(spFrame_hui.getComponent(cc.Sprite), 'GoodIcon/' + propIdArr[i]) Common5.setRemoteSpriteFrame(spFrame_liang.getComponent(cc.Sprite), 'GoodIcon/' + propIdArr[i]) let _pro = BagManager.getGoodsProperty(propIdArr[i]) item.getChildByName('nameStr').getComponent(cc.Label).string = _pro.goodName if (BagManager.getBagGoodNums(propIdArr[i]) > 0) { spFrame_liang.active = true spFrame_hui.active = false } else { isAllFind = false spFrame_liang.active = false spFrame_hui.active = true } } if (isAllFind) { this.needLayer.getChildByName("按钮").active = true this.needLayer.getChildByName("huanYuanNode").active = false } } onTouchSubmit() { //碎片合并 let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id let goodArray = [] if (mainId == MainTaskIdEnum.MainTask_804) {//龟印 goodArray = [{ goodId: 3040, goodNum: 1 }] } this.needLayer.active = false //播放合成动画 PrefabManage.loadPrefabByType(GameType.guiyin, this.node, (node) => { node.getComponent(guiyin).run(this.m_ScrollView.content.children, () => { this.scheduleOnce(() => { PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => { prefabNode.getComponent('GetAward').initView(goodArray, () => { //播放完再显示投资协议书 PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu, null, (prefab) => { let money = 4000000 prefab.getComponent(TouZiXieYiShu).initView("叶氏医药", money, () => { UserManager.addMoney(money) PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(money, '1')}`) TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_804) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_805, false) this.continueStory1(); }) }) }); }) }, 1) }) }) // PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => { // this.needLayer.active = false // prefabNode.getComponent('GetAward').initView(goodArray, () => { // //播放完再显示投资协议书 // PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu, null, (prefab) => { // let money = 500000 // prefab.getComponent(TouZiXieYiShu).initView("叶氏医药", money, () => { // UserManager.addMoney(money) // PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(money, '1')}`) // this.continueStory1(); // }) // }) // }); // }) } onBtnHuoYuanTiaoZhuan() { // this.node.removeFromParent() // this.node.destroy() PrefabManage.loadPrefabByType(needIDs[this.curNeedID].tiaoZhuanGameType) } // 震屏效果 // 参数:duration 震屏时间 shakeEffect(duration) { this.node.runAction( cc.repeatForever( cc.sequence( // cc.moveTo(0.02, cc.v2(5, 7)), // cc.moveTo(0.02, cc.v2(-6, 7)), // cc.moveTo(0.02, cc.v2(-13, 3)), // cc.moveTo(0.02, cc.v2(3, -6)), // cc.moveTo(0.02, cc.v2(-5, 5)), // cc.moveTo(0.02, cc.v2(2, -8)), // cc.moveTo(0.02, cc.v2(-8, -10)), // cc.moveTo(0.02, cc.v2(3, 10)), // cc.moveTo(0.02, cc.v2(0, 0)) cc.moveTo(0.2, cc.v2(5, 7)), // cc.moveTo(0.2, cc.v2(-6, 7)), cc.moveTo(0.2, cc.v2(-13, 3)), // cc.moveTo(0.2, cc.v2(3, -6)), cc.moveTo(0.2, cc.v2(-5, 5)), // cc.moveTo(0.2, cc.v2(2, -8)), cc.moveTo(0.2, cc.v2(-8, -10)), // cc.moveTo(0.2, cc.v2(3, 10)), cc.moveTo(0.2, cc.v2(0, 0)) ) ) ); setTimeout(() => { this.node.stopAllActions(); this.node.setPosition(0, 0); }, duration * 1000); } }