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_38') export default class DH_38 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_38/sound/师傅,我已经成为特一级面点师了。', delayTime: 2.97, str: '师傅,我已经成为特一级面点师了。', posi: '-1' }, { effectUrl: 'DH/DH_38/sound/好好好,竟然这么快就到特一级了。', delayTime: 4.9, str: '好好好,竟然这么快就到特一级了。', posi: 'qipao2' }, { effectUrl: 'DH/DH_38/sound/想获得厨神称号要做过协会会长和拥有一个美食街。', delayTime: 6.34, str: '想获得厨神称号要做过协会会长和拥有一个美食街。', posi: 'qipao2' }, { effectUrl: 'DH/DH_38/sound/这样啊,那我去找找看,有就收购一个美食街,没有就买地建一个。', delayTime: 5.42, str: '这样啊,那我去找找看,有就收购一个美食街,没有就买地建一个。', posi: '-1' }, { effectUrl: 'DH/DH_38/sound/你直接去收购我的美食街吧,重新买地建,要的时间太久了。', delayTime: 6.13, str: '你直接去收购我的美食街吧,重新买地建,要的时间太久了。', posi: 'qipao2' }, { effectUrl: 'DH/DH_38/sound/也行,师傅您也该颐养天年了,以后我来孝敬您。', delayTime: 5.53, str: '也行,师傅您也该颐养天年了,以后我来孝敬您。', posi: '-1' }, ] @property(sp.Skeleton) nanzhu: 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.playRemoteAudioMusic("remotesound/effect/茶厅音乐", true) Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_389) // }) } // 继续剧情 continueStory() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_39) }) this.nanzhu.setAnimation(0, "男主待机", true) this.weihuizhang.setAnimation(0, "魏会长待机", true) 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.weihuizhang.setAnimation(0, "魏会长说话", true) }); }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.weihuizhang.setAnimation(0, "魏会长说话", true) }); }, (func) => { this.weihuizhang.setAnimation(0, "魏会长待机", true) 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.weihuizhang.setAnimation(0, "魏会长说话", true) }); }, (func) => { this.weihuizhang.setAnimation(0, "魏会长待机", true) 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 { this.weihuizhang.setAnimation(0, "男主待机", true) TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_550_1) TaskManager.setCurTask(MainTaskIdEnum.MainTask_550_2) 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_389") // // 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() } }