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 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 } = cc._decorator; @ccclass export default class DH_7 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_7/sound/鬼影都没有,又被骗了!', delayTime: 3.34, str: '鬼影都没有,又被骗了!', posi: '-1' }, { effectUrl: 'DH/DH_7/sound/来..喝..,你们...都是坏…人', delayTime: 7.34, str: '来..喝..,你们...都是坏…人', posi: 'qipao2' }, { effectUrl: 'DH/DH_7/sound/顾老师?贵人是她?', delayTime: 2.25, str: '顾老师?贵人是她?', posi: '-1' }, { effectUrl: 'DH/DH_7/sound/冷,好冷,水,给我水。', delayTime: 5.17, str: '冷,好冷,水,给我水。', posi: 'qipao2' }, { effectUrl: 'DH/DH_7/sound/你等下,我去买。', delayTime: 1.5, str: '你等下,我去买。', posi: '-1' }, { effectUrl: 'DH/DH_7/sound/你是叶辰?让你见笑了。', delayTime: 5.3, str: '你是叶辰?让你见笑了。', posi: 'qipao3' }, { effectUrl: 'DH/DH_7/sound/遇到什么事?我能帮你吗?', delayTime: 2.35, str: '遇到什么事?我能帮你吗?', posi: '-1' }, { effectUrl: 'DH/DH_7/sound/就你个穷学生,省省吧。', delayTime: 3.34, str: '就你个穷学生,省省吧。', posi: 'qipao3' }, { effectUrl: 'DH/DH_7/sound/这是能救妈妈的药?先去医院问问医生。', delayTime: 3.9, str: '这是能救妈妈的药?先去医院问问医生。', posi: '-1' }, ] @property(cc.Node) gushuya: cc.Node = null; @property(cc.Node) zhituan: cc.Node = null; @property(cc.Node) zhituanpos: cc.Node = null; @property(cc.Node) hetong: cc.Node = null; // @property(cc.Node) // yaoshan: cc.Node = null; start() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_8) }) Common5.playRemoteAudioMusic('CommonSound/夜晚') GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.zhituan.active = false this.hetong.active = false let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id if (mainId == MainTaskIdEnum.MainTask_606) { this.dialogIndex = 5; // this.continueStory1(); let gushuyaSpine = this.gushuya.getComponent(sp.Skeleton) gushuyaSpine.setAnimation(0, "跌倒待机", true) // BagManager.addBagList({ goodId: 3027, goodNum: 1 }) this.node.getChildByName("needGoodNode1").active = true } else if (mainId == MainTaskIdEnum.MainTask_607) { this.gushuya.active = false this.zhituan.active = true this.zhituan.position = this.zhituanpos.position } else { this.continueStory(); } // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_59) // }) EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => { this.continueStory1(); }, this); } // 继续剧情 continueStory() { this.zhituan.active = false let gushuyaSpine = this.gushuya.getComponent(sp.Skeleton) gushuyaSpine.node.active = false // gushuyaSpine.setAnimation(0, "待机", true) const dialogEvents = [ (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }); }, (func) => { gushuyaSpine.node.active = true gushuyaSpine.setAnimation(0, "跌倒", false) this.scheduleOnce(()=>{ Common5.playRemoteAudioEffect("action_effect/人摔倒"); },2.5) gushuyaSpine.setCompleteListener(() => { gushuyaSpine.setCompleteListener(null) gushuyaSpine.setAnimation(0, "跌倒待机", true) this.node.getChildByName("nameplate").active = true func() }) }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { }); }, (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }); }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { }); }, (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }); }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_604) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_605) // PrefabManage.loadPrefabByType(GameType.CityPrefab) // this.node.destroy() } }); } dialogCallFunc(dialogEvents); } // 继续剧情 continueStory1() { let gushuyaSpine = this.gushuya.getComponent(sp.Skeleton) gushuyaSpine.setAnimation(0, "有衣服待机", true) this.zhituan.active = false this.node.getChildByName("needGoodNode1").opacity = 0 //needGood脚本调用了active显示.. const dialogEvents = [ (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { // gushuyaSpine.setAnimation(0, "无奈说话", true) }); }, (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }); }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { // gushuyaSpine.setAnimation(0, "无奈说话", true) }); }, (func) => { gushuyaSpine.setAnimation(0, "有衣服走路", false) this.zhituan.active = true this.zhituan.scale = 0.5 let position = this.zhituanpos.position.clone() cc.tween(this.zhituan) .sequence( cc.tween().parallel( cc.tween().to(0.3, { scale: 1 }), cc.tween().to(0.3, { position: position }), ), cc.tween().by(0.05, { position: cc.v2(0, 20) }), cc.tween().by(0.05, { position: cc.v2(0, -20) }), cc.tween().call(() => { func() let node = this.zhituan; this.guideView([node]); }) ) .start() }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_606) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_607) // PrefabManage.loadPrefabByType(GameType.CityPrefab) // this.node.destroy() } }); } dialogCallFunc(dialogEvents); } onTouchZhiTuan() { this.hetong.active = true } onTouchClose() { this.showClickDialog(this.chatConfig[8], () => { TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_607) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_701) User.setRoomBtnIndex(4) EventMgr.emitEvent_custom(ryw_Event.EnterNextGame, true) this.hetong.active = false this.zhituan.active = false // PrefabManage.showBlackGuoDu(() => { // PrefabManage.loadPrefabByType(GameType.CityPrefab) // this.node.destroy() // }) }, () => { }); } guideView(nodeArray) { PrefabManage.loadPrefabByType(GameType.GuideMskNode, this.node, (prefab) => { let guideNodeArray = nodeArray let firstNode = guideNodeArray.shift() prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray) }) } // 震屏效果 // 参数: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); } }