import User from "../../FrameWork/User/User"; import Common5 from "../../Platform/th/Common5"; import GameBaseScript from "../GameRoomRes/GameBaseScript"; 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"; import selectButtons from "./selectButtons"; const { ccclass, property, disallowMultiple, menu } = cc._decorator; @ccclass @disallowMultiple() @menu('对话剧情/DH_2') export default class DH_2 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_2/sound/女儿的棒棒糖都丢了?', delayTime: 7.07, str: '女儿的棒棒糖都丢了?', posi: '-1' }, { effectUrl: 'DH/DH_2/sound/看着不止一个人', delayTime: 1.28, str: '看着不止一个人', posi: '-1' }, { effectUrl: 'DH/DH_2/sound/难道是陈霸天这个畜生!', delayTime: 7.3, str: '难道是陈霸天这个畜生!', posi: '-1' }, { effectUrl: 'DH/DH_2/sound/这是什么?', delayTime: 4.61, str: '这是什么?', posi: '-1' }, ] @property(cc.Node) m_bg: cc.Node = null @property(cc.Node) MoveNodes: cc.Node = null // @property(cc.Camera) // m_camera: cc.Camera = null start() { // Common5.playRemoteAudioMusic("remotesound/effect/BGM_1", true) Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_29) // }) } // 继续剧情 continueStory() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_3) }) // this.m_bg.getChildByName("namenodes").active = true this.nanzhu.setAnimation(0, "主角躺床", true) this.xiaojiuzi.setAnimation(0, "小舅子待机", true) this.yuefu.setAnimation(0, "岳父待机", true) this.yanzi.setAnimation(0, "燕子", true) const dialogEvents = [ (func) => { this.scheduleOnce(() => { func() }, 2) }, (func) => { this.texie.node.active = true this.xiaojiuzi.node.active = false this.texie.setAnimation(0, "病房", true) this.runBg(1, 3, this.texie.node, () => { this.m_bg.getChildByName("namenodes_1").active = true this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.texie.setAnimation(0, "说话", true) }); }) }, (func) => { this.texie.node.active = false this.xiaojiuzi.node.active = true this.runBg(0.5, 2, this.MoveNodes.getChildByName("男主小舅子"), () => { this.m_bg.getChildByName("namenodes_2").active = true this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "主角说话", true) }) }) }, (func) => { Common5.playRemoteAudioEffect("remotesound/effect/重音转场") this.runBg(0.5, 1, this.node, () => { this.m_bg.getChildByName("namenodes_3").active = true this.nanzhu.setAnimation(0, "主角躺床", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.yuefu.setAnimation(0, "岳父说话", true) }) }) }, (func) => { this.yuefu.setAnimation(0, "岳父待机", true) this.runBg(0, 1, this.node, () => { Common5.playRemoteAudioEffect("remotesound/effect/丢纸张") this.yuefu.setAnimation(0, "岳父丢文件", false) this.yuefu.setCompleteListener(() => { this.yuefu.setCompleteListener(null) this.yuefu.setAnimation(0, "岳父无文件待机", true) func() }) }) }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.yuefu.setAnimation(0, "岳父无文件说话", true) }) }, (func) => { this.yuefu.setAnimation(0, "岳父无文件待机", true) this.runBg(1, 2, this.MoveNodes.getChildByName("男主岳父"), () => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "主角看岳父说话", true) }) }) }, (func) => { this.nanzhu.setAnimation(0, "主角躺床", true) Common5.playRemoteAudioEffect("remotesound/effect/推人声") this.runBg(0.5, 2, this.MoveNodes.getChildByName("三人"), () => { this.m_bg.getChildByName("namenodes_4").active = true this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "主角伸手说话", true) }) }) }, (func) => { // this.runBg(1, 2, this.MoveNodes.getChildByName("三人"), () => { PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => { let strs = ['挽留'] let actives = [true] let funcs = [ () => { this.onTouchWanLiu() }, ] let isvideo = [false] node.getComponent(selectButtons).init(strs, actives, funcs, isvideo) }) // }) this.nanzhu.setAnimation(0, "主角伸手", true) // this.btn_wanliu.active = true }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { // 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_29") // // UserManager.clearAndaddStructureFlash("cf_FengRenYuan") // }); // }); // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_202) // TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_203) // this.node.destroy() } }); } dialogCallFunc(dialogEvents); } // 继续剧情 continueStory2() { const dialogEvents = [ (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.xiaojiuzi.setAnimation(0, "小舅子说话", true) }); }, (func) => { this.xiaojiuzi.setAnimation(0, "小舅子待机", true) Common5.playRemoteAudioEffect("remotesound/effect/重音转场") this.runBg(1, 1, this.node, () => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.yuefu.setAnimation(0, "岳父无文件说话", true) }); }) }, (func) => { this.xiaojiuzi.node.active = false this.yuefu.node.active = false this.yanzi.node.active = false this.likai.node.active = true this.likai.setAnimation(0, "三人离开", false) Common5.playRemoteAudioMusic("remotesound/effect/伤感-9秒", false) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "主角惨叫说话", true) }); this.scheduleOnce(() => { this.likai.setAnimation(0, "三人离开2", false) }, 1.5) }, (func) => { this.nanzhu.setAnimation(0, "主角伸手", true) this.scheduleOnce(() => { func() }, 2) }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { User.setFirstStepIndex(2) PrefabManage.showBlackGuoDu(() => { PrefabManage.loadPrefabByType(GameType.DH_3) this.node.removeFromParent() this.node.destroy() }) // 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_29") // // 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) } }) } onTouchWanLiu() { this.btn_wanliu.active = false // this.showQiPao(this.chatConfig[this.dialogIndex++], () => { // this.scheduleOnce(() => { // this.xiaojiuzi.node.active = false // this.nanzhu.setAnimation(0, "主角被扇", false) Common5.playRemoteAudioEffect("remotesound/effect/打耳光", false) // this.nanzhu.setCompleteListener(() => { // this.nanzhu.setCompleteListener(null) this.daren_texie.timeScale = 0.7 this.daren_texie.node.active = true this.daren_texie.setAnimation(0, "撞击2", false) this.daren_texie.setCompleteListener(() => { this.daren_texie.setCompleteListener(null) this.daren_texie.node.active = false this.xiaojiuzi.node.active = true this.nanzhu.setAnimation(0, "主角被扇待机", true) this.continueStory2() }) // }) // }) // }, 1) // }, () => { // this.nanzhu.setAnimation(0, "主角伸手说话", true) // }); } 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() // if (scale == 1) { // let dialog = this.node.getChildByName('对话框'); // // dialog.setPosition(cc.v3(0, -446)) // dialog.scale = 1 / scale // let chatLog = this.node.getChildByName('chatLog') // // chatLog.setPosition(cc.v3(0, -446)) // chatLog.scale = 1 / scale // } else { // let dialog = this.node.getChildByName('对话框'); // // dialog.setPosition(cc.v3(endnode.position.x, -446 * 1 / scale)) // dialog.scale = 1 / scale // let chatLog = this.node.getChildByName('chatLog') // // chatLog.setPosition(cc.v3(endnode.position.x, -446 * 1 / scale)) // chatLog.scale = 1 / scale // } } // /** // * // * @param time 移动时间 // * @param endnode 需要移动到哪个节点的位置 // * @param zoomRatio 摄像头缩放 // * @param callFunc 回调函数 // */ // runCamera(time, zoomRatio, endnode, callFunc) { // cc.tween(this.m_camera) // .to(time, { zoomRatio: zoomRatio }) // .start() // cc.tween(this.m_camera.node) // .sequence( // cc.tween().to(time, { position: endnode.position }), // cc.tween().call(() => { // callFunc() // }) // ) // .start() // if (zoomRatio == 1) { // let dialog = this.node.getChildByName('对话框'); // dialog.setPosition(cc.v3(0, -446, 1)) // dialog.scale = 1 / zoomRatio // // let node = this.node.getChildByName('qipao'); // // node.scale = 1 / zoomRatio // let chatLog = this.node.getChildByName('chatLog') // chatLog.setPosition(cc.v3(0, -446, 1)) // chatLog.scale = 1 / zoomRatio // } else { // let dialog = this.node.getChildByName('对话框'); // dialog.setPosition(cc.v3(endnode.position.x, -446 * 1 / zoomRatio, 1)) // dialog.scale = 1 / zoomRatio // // let node = this.node.getChildByName('qipao'); // // node.scale = 1 / zoomRatio // let chatLog = this.node.getChildByName('chatLog') // chatLog.setPosition(cc.v3(endnode.position.x, -446 * 1 / zoomRatio, 1)) // chatLog.scale = 1 / zoomRatio // } // } }