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"; const { ccclass, property, disallowMultiple, menu } = cc._decorator; @ccclass @disallowMultiple() @menu('对话剧情/DH_21') export default class DH_21 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_21/sound/魏会长,我稍后会准备一份厚礼给陈小友赔礼道歉。', delayTime: 5.66, str: '魏会长,我稍后会准备一份厚礼给陈小友赔礼道歉。', posi: 'qipao3' }, { effectUrl: 'DH/DH_21/sound/哼!就这样吧,别再让我看见你们仗势欺人。', delayTime: 4.35, str: '哼!就这样吧,别再让我看见你们仗势欺人。', posi: 'qipao1' }, { effectUrl: 'DH/DH_21/sound/师傅,那等下他们准备的赔礼我给您送来。', delayTime: 3.52, str: '师傅,那等下他们准备的赔礼我给您送来。', posi: '-1' }, { effectUrl: 'DH/DH_21/sound/给你的赔礼,你自己收着,我用不着。', delayTime: 4.61, str: '给你的赔礼,你自己收着,我用不着。', posi: 'qipao1' }, ] @property(sp.Skeleton) nanzhu: sp.Skeleton = null @property(sp.Skeleton) liujiahao: sp.Skeleton = null @property(sp.Skeleton) liuhongfu: sp.Skeleton = null @property(sp.Skeleton) weihuizhang: sp.Skeleton = null @property(cc.Node) m_bg: cc.Node = null @property(cc.Node) MoveNodes: cc.Node = null start() { Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_219) // }) } // 继续剧情 continueStory() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_20) }) this.nanzhu.setAnimation(0, "男主", true) // this.liujiahao.setAnimation(0, "豪待机", true) this.liujiahao.setAnimation(0, "豪挨打跪下待机", true) this.liuhongfu.setAnimation(0, "柳鸿福", true) this.weihuizhang.setAnimation(0, "魏老待机2", true) const dialogEvents = [ (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.liuhongfu.setAnimation(0, "柳鸿福说话", true) }); }, (func) => { this.liuhongfu.setAnimation(0, "柳鸿福", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.weihuizhang.setAnimation(0, "魏老说话2", true) }); }, (func) => { this.weihuizhang.setAnimation(0, "魏老待机2", true) this.liujiahao.setAnimation(0, "豪待机", true) cc.tween(this.liuhongfu.node) .by(0.5, { position: cc.v3(-1000, 0, 0) }) .start() cc.tween(this.liujiahao.node) .sequence( cc.tween().by(0.5, { position: cc.v3(-1000, 0, 0) }), cc.tween().call(() => { cc.tween(this.nanzhu.node) .sequence( cc.tween().by(0.5, { position: cc.v3(-120, -50, 0) }), cc.tween().set({ scaleX: -1, position: cc.v3(61, this.nanzhu.node.position.y - 50, 0) }), cc.tween().call(() => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "男主说话", true) }); }) ) .start() }) ) .start() }, (func) => { this.nanzhu.setAnimation(0, "男主", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.weihuizhang.setAnimation(0, "魏老说话2", true) }); }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { this.weihuizhang.setAnimation(0, "魏老待机2", true) TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_521) TaskManager.setCurTask(MainTaskIdEnum.MainTask_522) PrefabManage.showBlackGuoDu(() => { this.node.removeFromParent() this.node.destroy() PrefabManage.loadPrefabByType(GameType.MainHall) }) // 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_219") // // 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() } }