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_3') export default class DH_3 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_3/sound/为什么!燕子,难道我们这么多年的感情是假的吗?', delayTime: 6.08, str: '为什么!燕子,难道我们这么多年的感情是假的吗?', posi: '-1' }, { effectUrl: 'DH/DH_3/sound/如果不是你有利用价值、我姐会嫁给你?', delayTime: 5.53, str: '如果不是你有利用价值、我姐会嫁给你?', posi: 'qipao2' }, { effectUrl: 'DH/DH_3/sound/什么意思,燕子当初不是喜欢我,才愿意嫁给我的吗?', delayTime: 4.53, str: '什么意思,燕子当初不是喜欢我,才愿意嫁给我的吗?', posi: '-1' }, { effectUrl: 'DH/DH_3/sound/你一个平民窟出来的废物,能配得上我姐吗?', delayTime: 5.26, str: '你一个平民窟出来的废物,能配得上我姐吗?', posi: 'qipao2' }, { effectUrl: 'DH/DH_3/sound/你胡说,不可能。', delayTime: 1.97, str: '你胡说,不可能。', posi: '-1' }, ] @property(sp.Skeleton) nanzhu: sp.Skeleton = null @property(sp.Skeleton) nanzhu_zhuanshen: sp.Skeleton = null @property(sp.Skeleton) chongtu: sp.Skeleton = null @property(sp.Skeleton) xiaojiuzi: sp.Skeleton = null @property(sp.Skeleton) diaoluo: sp.Skeleton = null @property(sp.Skeleton) texie_1: sp.Skeleton = null @property(sp.Skeleton) texie_2: sp.Skeleton = null @property(sp.Skeleton) texie_3: sp.Skeleton = null @property(cc.Node) diaoluobg: cc.Node = null @property(cc.Node) btn_zhiwen: cc.Node = null @property(cc.Node) m_bg: cc.Node = null @property(cc.Node) MoveNodes: cc.Node = null start() { Common5.ReportDY("inLevel", `任务000-对话3`) Common5.playRemoteAudioMusic("remotesound/effect/打雷下雨声", true) Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_39) // }) } // 继续剧情 continueStory() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_4) }) this.nanzhu.setAnimation(0, "待机", true) this.xiaojiuzi.node.active = false this.nanzhu_zhuanshen.node.active = false this.diaoluobg.active = false this.chongtu.node.active = false const dialogEvents = [ (func) => { this.m_bg.getChildByName("namenodes_1").active = true this.m_bg.getChildByName("闪电").scale = 0.5 this.m_bg.getChildByName("下雨").scale = 0.4 this.runBg(0, 3, this.MoveNodes.getChildByName("男主"), () => { func() }) }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "说话", true) }); }, (func) => { this.runBg(1, 3, this.MoveNodes.getChildByName("中间"), () => { this.nanzhu.setAnimation(0, "待机", true) // this.xiaojiuzi.node.active = true this.xiaojiuzi.setAnimation(0, "小舅子", true) let posi = this.xiaojiuzi.node.position.clone() cc.tween(this.xiaojiuzi.node) .sequence( cc.tween().by(0, { position: cc.v3(-1000, 0, 0) }), cc.tween().set({ active: true }), cc.tween().to(1, { position: posi }), cc.tween().call(() => { this.m_bg.getChildByName("namenodes_2").active = true this.scheduleOnce(() => { func() }, 0.5) }) ) .start() }) }, (func) => { Common5.ReportDY("inLevel", `任务000-小舅子第一句对话`) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.xiaojiuzi.setAnimation(0, "小舅子说话", true) }) }, (func) => { this.xiaojiuzi.setAnimation(0, "小舅子", true) this.nanzhu.node.active = false this.nanzhu_zhuanshen.node.active = true this.nanzhu_zhuanshen.setAnimation(0, "男主", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu_zhuanshen.setAnimation(0, "男主说话", true) Common5.ReportDY("inLevel", `任务000-点击男主语音`) }) }, (func) => { this.nanzhu_zhuanshen.setAnimation(0, "男主", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.xiaojiuzi.setAnimation(0, "小舅子说话", true) }) }, (func) => { this.xiaojiuzi.setAnimation(0, "小舅子", true) // this.btn_zhiwen.active = true // this.runBg(1, 1.5, this.MoveNodes.getChildByName("中间"), () => { PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => { let strs = ['质问'] let actives = [true] let funcs = [ () => { this.onTouchZhiWen() }, ] let isvideo = [false] node.getComponent(selectButtons).init(strs, actives, funcs, isvideo) }) // }) }, ] 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_39") // // 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) } }) } onTouchZhiWen() { Common5.ReportDY("inLevel", `任务000-点击质问`) this.btn_zhiwen.active = false this.nanzhu.node.active = false this.nanzhu_zhuanshen.node.active = false this.xiaojiuzi.node.active = false this.chongtu.node.active = true // this.runBg(1, 1, this.node, () => { // this.smallbg.active = true this.chongtu.setAnimation(0, "拉领带", false) this.chongtu.setCompleteListener(() => { this.chongtu.setCompleteListener(null) this.chongtu.setAnimation(0, "拉领带待机", true) this.showQiPao(this.chatConfig[this.dialogIndex++], () => { // this.runBg(1, 1.5, this.MoveNodes.getChildByName("中间"), () => { this.texie_1.node.active = true this.texie_1.setAnimation(0, "1", false) this.texie_1.setCompleteListener(() => { this.texie_1.setCompleteListener(null) this.texie_1.node.active = false this.texie_2.node.active = true Common5.playRemoteAudioEffect("remotesound/effect/推人声") this.texie_2.setAnimation(0, "2", false) this.texie_2.setCompleteListener(() => { this.texie_2.setCompleteListener(null) this.texie_2.node.active = false this.texie_3.node.active = true this.texie_3.setAnimation(0, "3", false) this.texie_3.setCompleteListener(() => { this.texie_3.setCompleteListener(null) this.texie_3.node.active = false this.m_bg.getChildByName("闪电").scale = 1 this.m_bg.getChildByName("下雨").scale = 1 this.runBg(0.5, 3, this.MoveNodes.getChildByName("坠落"), () => { }) this.chongtu.setAnimation(0, "推人", false) this.chongtu.setCompleteListener(() => { this.chongtu.setCompleteListener(null) this.runBg(0, 1, this.node, () => { Common5.playRemoteAudioEffect("remotesound/effect/掉下来", false) this.diaoluobg.active = true this.diaoluo.setAnimation(0, "animation", false) this.diaoluo.setCompleteListener(() => { this.diaoluo.setCompleteListener(null) User.setFirstStepIndex(3) TaskManager.setCurTask(MainTaskIdEnum.MainTask_501) PrefabManage.showBlackGuoDu(() => { PrefabManage.loadPrefabByType(GameType.DH_4) this.node.removeFromParent() this.node.destroy() }) }) }) }) }) }) }) // }) }, () => { this.chongtu.setAnimation(0, "拉领带待说话", true) }) }) // }) } runBg(time, scale, endnode, callFunc) { cc.Tween.stopAllByTarget(this.m_bg) 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() } }