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 PrefabManage, { GameType } from "../PrefabManager/PrefabManage"; import GetAward from "../SCommon/GetAward"; import DHBase from "./DHBase"; const { ccclass, property } = cc._decorator; @ccclass export default class DH_19 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_19/sound/不错,真像!一表人才!', delayTime: 4.1, str: '不错,真像!一表人才!', posi: 'qipao2' }, { effectUrl: 'DH/DH_19/sound/您老找我有什么事吗?', delayTime: 1.9, str: '您老找我有什么事吗?', posi: '-1' }, { effectUrl: 'DH/DH_19/sound/哈哈,我马上90大寿了,想邀请你参加。', delayTime: 6, str: '哈哈,我马上90大寿了,想邀请你参加。', posi: 'qipao2' }, { effectUrl: 'DH/DH_19/sound/没问题,那我先走了?', delayTime: 2.7, str: '没问题,那我先走了?', posi: '-1' }, { effectUrl: 'DH/DH_19/sound/你们几个留在这里,一定别让那混小子伤害到叶辰!', delayTime: 5.4, str: '你们几个留在这里,一定别让那混小子伤害到叶辰!', posi: 'qipao2' }, { effectUrl: 'DH/DH_19/sound/是,家主!', delayTime: 1.5, str: '是,家主!', posi: 'qipao3' }, ] @property(sp.Skeleton) laoren: sp.Skeleton = null; @property(sp.Skeleton) baobiao_1: sp.Skeleton = null; @property(sp.Skeleton) baobiao_2: sp.Skeleton = null; // @property(cc.Node) // yaoshan: cc.Node = null; start() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_20) }) GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id // if (mainId == MainTaskIdEnum.MainTask_606) { // this.dialogIndex = 4; // // 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.node.getChildByName("nameplate").active = true // } // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_59) // }) // EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => { // this.continueStory1(); // }, this); } // 继续剧情 continueStory() { this.laoren.setAnimation(0, "老人待机", true) this.baobiao_1.setAnimation(0, "保镖1", true) this.baobiao_2.setAnimation(0, "保镖2", true) const dialogEvents = [ (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.laoren.setAnimation(0, "老人说话笑", true) }); }, (func) => { this.laoren.setAnimation(0, "老人待机", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }); }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.laoren.setAnimation(0, "老人说话笑", true) }); }, (func) => { this.laoren.setAnimation(0, "老人待机", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { }); }, (func) => { PrefabManage.showBlackGuoDu(() => { }, () => { this.baobiao_2.setAnimation(0, "保镖2大", false) this.baobiao_2.setCompleteListener(() => { this.baobiao_2.setCompleteListener(null) func() }) },"叶辰离开后...") // cc.tween(this.node) // .sequence( // cc.tween().to(2, { opacity: 0 }), // cc.tween().to(2, { opacity: 255 }), // cc.tween().call(() => { // this.baobiao_2.setAnimation(0, "保镖2大", false) // this.baobiao_2.setCompleteListener(() => { // this.baobiao_2.setCompleteListener(null) // func() // }) // }) // ) // .start() }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.laoren.setAnimation(0, "老人说话皱眉", true) }); }, (func) => { this.laoren.setAnimation(0, "老人待机", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.baobiao_1.setAnimation(0, "保镖1说话", true) }); }, (func) => { this.baobiao_1.setAnimation(0, "保镖1", true) func() }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { PrefabManage.showBlackGuoDu(() => { PrefabManage.loadPrefabByType(GameType.CityPrefab) TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1203) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1204) this.node.destroy() }, () => { }) } }); } dialogCallFunc(dialogEvents); } // 震屏效果 // 参数: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); } }