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 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_6') export default class DH_6 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_6/sound/瑶瑶,你暂时先住我这吧。', delayTime: 1.92, str: '瑶瑶,你暂时先住我这吧。', posi: '-1' }, { effectUrl: 'DH/DH_6/sound/汉升哥哥是要去摆摊了吗?', delayTime: 2.1, str: '汉升哥哥是要去摆摊了吗?', posi: 'qipao2' }, { effectUrl: 'DH/DH_6/sound/我可以跟你一起去吗?我想赚钱将50万还回去。', delayTime: 4.61, str: '我可以跟你一起去吗?我想赚钱将50万还回去。', posi: 'qipao2' }, { effectUrl: 'DH/DH_6/sound/(摆摊?哦,想起来了,我现在是靠摆摊买拉面在赚钱)', delayTime: 5.87, str: '(摆摊?哦,想起来了,我现在是靠摆摊买拉面在赚钱)', posi: '-1' }, { effectUrl: 'DH/DH_6/sound/嗯,这样也行,瑶瑶你也别急,我会帮你一起还的。', delayTime: 4.06, str: '嗯,这样也行,瑶瑶你也别急,我会帮你一起还的。', posi: '-1' }, ] @property(sp.Skeleton) nanzhu: sp.Skeleton = null @property(sp.Skeleton) suyao: sp.Skeleton = null @property(cc.Node) m_bg: cc.Node = null @property(cc.Node) uiNode: cc.Node = null // @property(cc.Node) // buttons: cc.Node = null start() { Common5.playRemoteAudioMusic("remotesound/effect/轻快-10秒", true) Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.uiNode.getChildByName('出门').active = false this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_69) // }) } // 继续剧情 continueStory() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_7) let arr = [GameType.FirstSelectScene_LevelView, GameType.FirstSelectScene_StartAnimation, GameType.FirstSelectScene_CloudAnimation, GameType.FirstSelectScene_LeftBtnUI, GameType.MainHall,GameType.ChaoFanWang,GameType.ChaoFanDesk ] PrefabManage.preloadPrefabArray(arr) }, 1) const dialogEvents = [ (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "说话", true) }); }, (func) => { this.nanzhu.setAnimation(0, "待机", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.suyao.setAnimation(0, "说话", true) }); }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.suyao.setAnimation(0, "说话", true) }); }, (func) => { this.suyao.setAnimation(0, "待机", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { // this.nanzhu.setAnimation(0, "说话", true) }); }, (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "说话", true) }); }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_503) // TaskManager.setCurTask(MainTaskIdEnum.MainTask_504) User.setFirstStepIndex(6) this.uiNode.getChildByName('出门').active = true let node = this.uiNode.getChildByName('出门') this.guideView([node]) // 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() } chuMenFuncEvent() { this.node.removeFromParent() this.node.destroy() // PrefabManage.loadPrefabByType(GameType.MainHall) let prefabLayer = cc.director.getScene().getChildByName("Canvas").getChildByName('prefabLayer_1') PrefabManage.loadPrefabByType(GameType.FirstSelectScene_LevelView, prefabLayer, (levelView) => { (levelView as cc.Node).opacity = 0; PrefabManage.loadPrefabByType(GameType.FirstSelectScene_StartAnimation, prefabLayer, (startAnimation) => { PrefabManage.loadPrefabByType(GameType.FirstSelectScene_LeftBtnUI, prefabLayer, () => { PrefabManage.loadPrefabByType(GameType.FirstSelectScene_CloudAnimation, prefabLayer); }); cc.tween(startAnimation).delay(1.7) .call(() => { (levelView as cc.Node).opacity = 255; levelView.getComponent('LevelView').playguide() }).removeSelf().start(); }); }); } }