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_1') export default class DH_1 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_1/sound/厨师长!以您的水平后天夺取厨神称号应该是手拿把掐吧。', delayTime: 6.21, str: '厨师长!以您的水平后天夺取厨神称号应该是手拿把掐吧。', posi: 'qipao1' }, { effectUrl: 'DH/DH_1/sound/那是,等我将厨神称号拿回来,燕子肯定会特别开心。', delayTime: 4.59, str: '那是,等我将厨神称号拿回来,燕子肯定会特别开心。', posi: '-1' }, ] @property(sp.Skeleton) nanzhu: sp.Skeleton = null @property(sp.Skeleton) xiaodi: sp.Skeleton = null @property(sp.Skeleton) xiaojiuzi: sp.Skeleton = null @property(sp.Skeleton) xiaojiuzi_normal: sp.Skeleton = null @property(sp.Skeleton) heiping: sp.Skeleton = null @property(sp.Skeleton) zhuangren_texie: sp.Skeleton = null @property(sp.Skeleton) xiaojiuzi_big: sp.Skeleton = null @property(cc.Node) m_bg: cc.Node = null @property(cc.Node) MoveNodes: cc.Node = null // @property(cc.Camera) // m_camera: cc.Camera = null start() { Common5.ReportDY("inLevel", `任务000-对话1`) Common5.playRemoteAudioMusic("remotesound/effect/小美满-8秒", true) Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.node.getChildByName("guide").active = false this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_29) // }) } // 继续剧情 continueStory() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_2) }) this.nanzhu.setAnimation(0, "下面持续", true) this.xiaodi.setAnimation(0, "小弟待机", true) this.xiaojiuzi_big.node.active = false const dialogEvents = [ (func) => { this.m_bg.getChildByName("namenodes").active = true this.runBg(0, 1.2, this.MoveNodes.getChildByName("男主小弟中间"), () => { func() }) }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.xiaodi.setAnimation(0, "小弟说话", true) }); }, (func) => { this.xiaodi.setAnimation(0, "小弟待机", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "侧头笑说话", true) }); }, (func) => { this.nanzhu.setAnimation(0, "捞面", false) this.nanzhu.setCompleteListener(() => { this.nanzhu.setCompleteListener(null) this.nanzhu.setAnimation(0, "端面", true) this.scheduleOnce(() => { func() }, 0.3) }) }, (func) => { // this.xiaojiuzi_big.setAnimation(0, "厨房", true) // Common5.playRemoteAudioMusic("remotesound/effect/坏人出场1", true) this.runBg(0.5, 1, this.node, () => { func() }) }, (func) => { // this.xiaojiuzi_big.node.active = true // this.nanzhu.node.active = false // this.xiaodi.node.active = false // this.xiaojiuzi_big.setAnimation(0, "厨房2", true) Common5.playRemoteAudioEffect("remotesound/effect/推人声") this.m_bg.getChildByName("namenodes_1").active = true this.runBg(1, 1.5, this.MoveNodes.getChildByName("男主小舅子中间"), () => { this.xiaojiuzi_normal.node.active = false this.xiaojiuzi_big.node.active = true this.xiaojiuzi_big.setAnimation(0, "厨房2", false) Common5.playRemoteAudioEffect("remotesound/effect/阴笑", false) this.xiaojiuzi_big.setCompleteListener(() => { this.xiaojiuzi_big.setCompleteListener(null) this.xiaojiuzi_big.setAnimation(0, "厨房3", true) func() }) }) }, (func) => { this.scheduleOnce(() => { this.xiaojiuzi_big.node.active = false this.xiaojiuzi.node.active = true this.nanzhu.node.active = false this.xiaodi.node.active = false this.runBg(0.5, 1, this.node, () => { func() }) }, 0) }, (func) => { // this.node.getChildByName("guide").active = true // let node = this.node.getChildByName('guide') // this.guideView([node], 100) this.onTouchGuide() }, // (func) => { // this.xiaojiuzi.setAnimation(0, "撞人", false) // this.xiaojiuzi.setCompleteListener(() => { // this.xiaojiuzi.setCompleteListener(null) // this.heiping.node.active = true // this.heiping.setAnimation(0, "animation", false) // this.xiaojiuzi.setCompleteListener(() => { // this.xiaojiuzi.setCompleteListener(null) // func() // }) // }) // }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { // 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_29") // // 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) } }) } onTouchGuide() { // this.xiaojiuzi.setAnimation(0, "撞", false) // this.xiaojiuzi.setCompleteListener(() => { // this.xiaojiuzi.setCompleteListener(null) this.zhuangren_texie.timeScale = 0.5 this.zhuangren_texie.node.active = true this.zhuangren_texie.setAnimation(0, "撞击", false) Common5.playRemoteAudioEffect("remotesound/effect/碎裂声", false) Common5.playRemoteAudioEffect("remotesound/effect/惨叫声", false) this.zhuangren_texie.setCompleteListener(() => { this.zhuangren_texie.setCompleteListener(null) // this.zhuangren_texie.node.active = false // Common5.playRemoteAudioEffect("remotesound/effect/惨叫声", false) // this.heiping.node.active = true // this.heiping.setAnimation(0, "animation", false) // this.heiping.setCompleteListener(() => { // this.heiping.setCompleteListener(null) User.setFirstStepIndex(1) PrefabManage.showBlackGuoDu(() => { PrefabManage.loadPrefabByType(GameType.DH_2) this.node.removeFromParent() this.node.destroy() }) // }) }) // }) } 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() // if (scale == 1) { // let dialog = this.node.getChildByName('对话框'); // // dialog.setPosition(cc.v3(0, -446)) // dialog.scale = 1 / scale // let chatLog = this.node.getChildByName('chatLog') // // chatLog.setPosition(cc.v3(0, -446)) // chatLog.scale = 1 / scale // } else { // let dialog = this.node.getChildByName('对话框'); // // dialog.setPosition(cc.v3(endnode.position.x, -446 * 1 / scale)) // dialog.scale = 1 / scale // let chatLog = this.node.getChildByName('chatLog') // // chatLog.setPosition(cc.v3(endnode.position.x, -446 * 1 / scale)) // chatLog.scale = 1 / scale // } } // /** // * // * @param time 移动时间 // * @param endnode 需要移动到哪个节点的位置 // * @param zoomRatio 摄像头缩放 // * @param callFunc 回调函数 // */ // runCamera(time, zoomRatio, endnode, callFunc) { // cc.tween(this.m_camera) // .to(time, { zoomRatio: zoomRatio }) // .start() // cc.tween(this.m_camera.node) // .sequence( // cc.tween().to(time, { position: endnode.position }), // cc.tween().call(() => { // callFunc() // }) // ) // .start() // if (zoomRatio == 1) { // let dialog = this.node.getChildByName('对话框'); // dialog.setPosition(cc.v3(0, -446)) // dialog.scale = 1 / zoomRatio // // let node = this.node.getChildByName('qipao'); // // node.scale = 1 / zoomRatio // let chatLog = this.node.getChildByName('chatLog') // chatLog.setPosition(cc.v3(0, -446)) // chatLog.scale = 1 / zoomRatio // } else { // let dialog = this.node.getChildByName('对话框'); // dialog.setPosition(cc.v3(endnode.position.x, -446 * 1 / zoomRatio)) // dialog.scale = 1 / zoomRatio // // let node = this.node.getChildByName('qipao'); // // node.scale = 1 / zoomRatio // let chatLog = this.node.getChildByName('chatLog') // chatLog.setPosition(cc.v3(endnode.position.x, -446 * 1 / zoomRatio)) // chatLog.scale = 1 / zoomRatio // } // } }