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_4') export default class DH_4 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_4/sound/医生,我女儿到底怎么了?', delayTime: 1.99, str: '医生,我女儿到底怎么了?', posi: '-1' }, { effectUrl: 'DH/DH_4/sound/目前脱离危险了,不过你女儿的身体状况不容客观。', delayTime: 4.14, str: '目前脱离危险了,不过你女儿的身体状况不容客观。', posi: 'qipao2' }, { effectUrl: 'DH/DH_4/sound/医生您能说具体点吗?她到底怎么了?', delayTime: 2.82, str: '医生您能说具体点吗?她到底怎么了?', posi: '-1' }, { effectUrl: 'DH/DH_4/sound/你女儿患有罕见的先天性疾病,如果不及时治疗,恐怕...', delayTime: 4.98, str: '你女儿患有罕见的先天性疾病,如果不及时治疗,恐怕...', posi: 'qipao2' }, { effectUrl: 'DH/DH_4/sound/目前是有办法有效控制甚至治愈的,但是费用很高。', delayTime: 4.06, str: '目前是有办法有效控制甚至治愈的,但是费用很高。', posi: 'qipao2' }, { effectUrl: 'DH/DH_4/sound/只要能救我女儿,多少钱我都愿意出!', delayTime: 2.31, str: '只要能救我女儿,多少钱我都愿意出!', posi: '-1' }, ] @property(sp.Skeleton) doctor: sp.Skeleton = null @property(cc.Node) m_bg: cc.Node = null @property(cc.Node) MoveNodes: cc.Node = null start() { let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id if (mainId == MainTaskIdEnum.MainTask_701) { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_701) TaskManager.setCurTask(MainTaskIdEnum.MainTask_702) } // Common5.playRemoteAudioMusic("remotesound/effect/轻快-10秒", true) Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_49) // }) } // 继续剧情 continueStory() { // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_5) // }) const dialogEvents = [ (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }) }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.doctor.setAnimation(0, "说话", true) }) }, (func) => { this.doctor.setAnimation(0, "待机", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }) }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.doctor.setAnimation(0, "说话", true) }) }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { }) }, (func) => { this.doctor.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_702) TaskManager.setCurTask(MainTaskIdEnum.MainTask_703) PrefabManage.showBlackGuoDu(() => { PrefabManage.loadPrefabByType(GameType.MainHall) 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_49") // // 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() } }