import User from "../../FrameWork/User/User"; import Common5 from "../../Platform/th/Common5"; import GameBaseScript from "../GameRoomRes/GameBaseScript"; import JuQingManager from "../JuQingChat/JuQingManager"; import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager"; import UserManager from "../Manager/UserManager"; import NewGuideScript from "../NewGuide/NewGuideScript"; import PrefabManage, { GameType } from "../PrefabManager/PrefabManage"; import GetAward from "../SCommon/GetAward"; import DHBase from "./DHBase"; const { ccclass, property, disallowMultiple, menu } = cc._decorator; @ccclass @disallowMultiple() @menu('对话剧情/DH_34') export default class DH_34 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_34/sound/如燕,没事吧,他们那么对你,你赶紧离开柳家吧。', delayTime: 4.46, str: '如燕,没事吧,他们那么对你,你赶紧离开柳家吧。', posi: '-1' }, { effectUrl: 'DH/DH_34/sound/不行,我妹妹还要靠他们的支持支付医药费。', delayTime: 3.88, str: '不行,我妹妹还要靠他们的支持支付医药费。', posi: 'qipao1' }, { effectUrl: 'DH/DH_34/sound/(妹妹?难到她前世就是因为她妹妹才离开我?)', delayTime: 4.12, str: '(妹妹?难到她前世就是因为她妹妹才离开我?)', posi: '-1' }, { effectUrl: 'DH/DH_34/sound/你妹妹?一起离开吧,钱不用担心,我可以帮你的。', delayTime: 4.14, str: '你妹妹?一起离开吧,钱不用担心,我可以帮你的。', posi: '-1' }, { effectUrl: 'DH/DH_34/sound/真的吗?我妹妹是在国外治疗,需要用很多钱的。', delayTime: 5.29, str: '真的吗?我妹妹是在国外治疗,需要用很多钱的。', posi: 'qipao4' }, { effectUrl: 'DH/DH_34/sound/没问题,我能负担得起,你赶紧去将妹妹转个医院,从柳家离开吧。', delayTime: 5.81, str: '没问题,我能负担得起,你赶紧去将妹妹转个医院,从柳家离开吧。', posi: '-1' }, // { effectUrl: 'DH/DH_34/sound/这不好吧。你为什么这么帮我?', delayTime: 3.46, str: '这不好吧。你为什么这么帮我?', posi: 'qipao4' }, // { effectUrl: 'DH/DH_34/sound/因为我想帮你。', delayTime: 0.9, str: '因为我想帮你。', posi: '-1' }, { effectUrl: 'DH/DH_34/sound/燕子,前世离开我,原来都是为了你妹妹。', delayTime: 3.38, str: '(燕子,前世离开我,原来都是为了你妹妹。)', posi: '-1' }, { effectUrl: 'DH/DH_34/sound/汉升,谢谢你,你放心,这钱我一定会想办法还给你的。', delayTime: 6.36, str: '汉升,谢谢你,你放心,这钱我一定会想办法还给你的。', posi: 'qipao4' }, ] @property(sp.Skeleton) spine: sp.Skeleton = null @property(sp.Skeleton) nanzhu: sp.Skeleton = null @property(sp.Skeleton) liuruyan: sp.Skeleton = null @property(cc.Node) m_bg: cc.Node = null @property(cc.Node) MoveNodes: cc.Node = null start() { Common5.playRemoteAudioMusic("remotesound/effect/轻快-10秒", true) Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_349) // }) } // 继续剧情 continueStory() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_35) }) this.nanzhu.node.active = false this.liuruyan.node.active = false this.spine.node.active = true this.spine.setAnimation(0, "抱柳如燕", true) const dialogEvents = [ (func) => { this.runBg(0, 1.5, this.MoveNodes.getChildByName("男主柳如燕"), () => { func() }) }, (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.spine.setAnimation(0, "抱柳如燕男主说话", true) }); }, (func) => { // this.spine.setAnimation(0, "抱柳如燕摇头", false) // this.spine.setCompleteListener(() => { // this.spine.setCompleteListener(null) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.spine.setAnimation(0, "抱柳如燕女说话", true) }); // }) }, (func) => { this.spine.setAnimation(0, "男主单人", true) func() // this.runBg(1, 3, this.MoveNodes.getChildByName("男主"), () => { // func() // }) }, (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.spine.setAnimation(0, "男主说话", true) }); }, (func) => { this.spine.node.active = false this.nanzhu.node.active = true this.nanzhu.setAnimation(0, "男主", true) this.liuruyan.node.active = true this.liuruyan.setAnimation(0, "柳如燕", true) this.runBg(1, 1, this.node, () => { func() }) }, (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "男主说话", true) }); }, (func) => { this.nanzhu.setAnimation(0, "男主", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.liuruyan.setAnimation(0, "柳如燕说话", true) }); }, (func) => { this.liuruyan.setAnimation(0, "柳如燕", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "男主说话", true) }); }, // (func) => { // this.nanzhu.setAnimation(0, "男主", true) // this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { // this.liuruyan.setAnimation(0, "柳如燕说话", true) // }); // }, // (func) => { // this.liuruyan.setAnimation(0, "柳如燕", true) // this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { // this.nanzhu.setAnimation(0, "男主说话", true) // }); // }, (func) => { this.nanzhu.setAnimation(0, "男主", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { // this.nanzhu.setAnimation(0, "男主说话", true) }); }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.liuruyan.setAnimation(0, "柳如燕说话", true) }); }, (func) => { this.liuruyan.setAnimation(0, "柳如燕鞠躬", false) this.liuruyan.setCompleteListener(() => { this.liuruyan.setCompleteListener(null) func() }) }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_544_1) TaskManager.setCurTask(MainTaskIdEnum.MainTask_544_2) let config = TaskManager.getTaskConfigById(MainTaskIdEnum.MainTask_544_2) if (User.getMoney() >= config.taskNum) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_544_2) TaskManager.setCurTask(MainTaskIdEnum.MainTask_545) } PrefabManage.showBlackGuoDu(() => { this.node.removeFromParent() this.node.destroy() PrefabManage.loadPrefabByType(GameType.MainHall) }) // PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => { // let goods = [{ goodId: 1733, goodNum: 1 }]; // prefabNode.getComponent(GetAward).initView(goods, () => { // // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_530) // // User.setRoomGoodStatus("DH_349") // // UserManager.clearAndaddStructureFlash("cf_FengRenYuan") // }); // }); // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_202) // TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_203) // this.node.destroy() } }); } dialogCallFunc(dialogEvents); } guideView(nodeArray, opacity = -1) { PrefabManage.loadPrefabByType(GameType.GuideMskNode, this.node, (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) } }) } runBg(time, scale, endnode, callFunc) { cc.tween(this.m_bg) .to(time, { scale: scale }) .start() cc.tween(this.m_bg) .sequence( cc.tween().to(time, { position: cc.v2(-endnode.position.x * scale, -endnode.position.y * scale) }), cc.tween().call(() => { callFunc() }) ) .start() } }