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 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 ChaDianListScript2 from "../WenZiRes/WenZiCommon/ChaDianListScript2"; import DHBase from "./DHBase"; const { ccclass, property } = cc._decorator; let ChadianConfig = { chadianIconList: [ { bandleName: "DH_21", name: "茬点1", url: "res/茬点1", isCheck: false }, { bandleName: "DH_21", name: "茬点2", url: "res/茬点2", isCheck: false }, { bandleName: "DH_21", name: "茬点3", url: "res/茬点3", isCheck: false }, ], chadianLog: [ { str: "谁给妈妈注射了什么?", posi: -1, delayTime: 1.95, effectUrl: "DH/DH_21/sound/谁给妈妈注射了什么?" }, { str: "看样子是个女人。", posi: -1, delay: 2.4, effectUrl: "DH/DH_21/sound/看样子是个女人。" }, { str: "妈妈好像很难受。", posi: -1, delayTime: 1.4, effectUrl: "DH/DH_21/sound/妈妈好像很难受。" }, ] } @ccclass export default class DH_21 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_21/sound/这是哪个混蛋干的!', delayTime: 2.8, str: '这是哪个混蛋干的!', posi: '-1' }, { effectUrl: 'DH/DH_21/sound/阿姨病重,先救命要紧!', delayTime: 2.5, str: '阿姨病重,先救命要紧!', posi: 'qipao1' }, { effectUrl: 'DH/DH_21/sound/孩子,你辛苦了。', delayTime: 3.4, str: '孩子,你辛苦了。', posi: 'qipao2' }, { effectUrl: 'DH/DH_21/sound/妈,你好了,一切都值得!', delayTime: 2.8, str: '妈,你好了,一切都值得!', posi: '-1' }, ] @property(sp.Skeleton) gushiya: sp.Skeleton = null; @property(sp.Skeleton) mama_1: sp.Skeleton = null; @property(sp.Skeleton) mama_2: sp.Skeleton = null; @property(sp.Skeleton) mama_2_zhanqi: sp.Skeleton = null; chadianStep: number = 0 start() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_22) }) Common5.playRemoteAudioMusic('CommonSound/11月21日') GameBaseScript.preLoadRemoteAudio(ChadianConfig); GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.node.getChildByName("layer_1").active = false this.node.getChildByName("layer_2").active = false let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id if (mainId == MainTaskIdEnum.MainTask_1402) { this.node.getChildByName("layer_1").active = true let chadianIconList = this.node.getChildByName('chadianIconList'); let scr: ChaDianListScript2 = chadianIconList.getComponent(ChaDianListScript2); scr.setChaDianData(ChadianConfig.chadianIconList); chadianIconList.active = true; this.chadianStep = 0; } else if (mainId == MainTaskIdEnum.MainTask_1407) { this.node.getChildByName("layer_2").active = true this.mama_2_zhanqi.node.active = false this.dialogIndex = 2 EventMgr.onceEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => { this.RefreshJuQingDuiHua(); }, this); } // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_59) // }) EventMgr.onEvent_custom(ryw_Event.NormalTouchEndCheck, (data_) => { this.normalTouchCallback(data_.targetNode); }, this); } // 继续剧情 continueStory() { this.gushiya.setAnimation(0, "待机", true) this.mama_1.setAnimation(0, "呼吸机待机", true) const dialogEvents = [ (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }); }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.gushiya.setAnimation(0, "说话", true) }); }, (func) => { this.gushiya.setAnimation(0, "待机", true) func() }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { // let chadianIconList = this.node.getChildByName('chadianIconList'); // let scr: ChaDianListScript2 = chadianIconList.getComponent(ChaDianListScript2); // scr.setChaDianData(ChadianConfig.chadianIconList); // chadianIconList.active = true; // this.chadianStep = 0; TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1402) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1403) // PrefabManage.showBlackGuoDu(() => { // PrefabManage.loadPrefabByType(GameType.CityPrefab) // this.node.destroy() // }) } }); } dialogCallFunc(dialogEvents); } // 继续剧情 continueStory1() { this.mama_2.node.active = false this.mama_2_zhanqi.node.active = true this.mama_2_zhanqi.setAnimation(0, "待机", true) const dialogEvents = [ (func) => { this.scheduleOnce(()=>{ this.node.getChildByName("needGoodNode1").active = false }) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.mama_2_zhanqi.setAnimation(0, "说话", true) }); }, (func) => { this.mama_2_zhanqi.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_1407) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1501) // PrefabManage.showBlackGuoDu(() => { // PrefabManage.loadPrefabByType(GameType.CityPrefab) // this.node.destroy() // }) } }); } dialogCallFunc(dialogEvents); } RefreshJuQingDuiHua() { this.continueStory1() } normalTouchCallback(targetNode) { switch (targetNode.name) { case "zhenguan": EventMgr.emitEvent_custom(ryw_Event.touchChaDianCheck, { touchIndex: 0 }) this.showQiPao(ChadianConfig.chadianLog[0], this.gameChaDianCallback.bind(this)); break; case "jiaoyin": EventMgr.emitEvent_custom(ryw_Event.touchChaDianCheck, { touchIndex: 1 }); this.showQiPao(ChadianConfig.chadianLog[1], this.gameChaDianCallback.bind(this)); break; case "mama": EventMgr.emitEvent_custom(ryw_Event.touchChaDianCheck, { touchIndex: 2 }) this.showQiPao(ChadianConfig.chadianLog[2], this.gameChaDianCallback.bind(this)); break; default: break; } } gameChaDianCallback() { this.chadianStep++; if (this.chadianStep >= 3) { this.node.getChildByName("chadianIconList").active = false; this.continueStory() } } // 震屏效果 // 参数: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); } }