import User from "../../FrameWork/User/User"; import Common5 from "../../Platform/th/Common5"; import GameBaseScript from "../GameRoomRes/GameBaseScript"; import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager"; import ChuShiXieHuiManager from "../Manager/ChuShiXieHuiManager"; import UserManager from "../Manager/UserManager"; import NewGuideScript from "../NewGuide/NewGuideScript"; import PrefabManage, { GameType } from "../PrefabManager/PrefabManage"; import CommonTips from "../SCommon/CommonTips"; import GetAward from "../SCommon/GetAward"; import DHBase from "./DHBase"; import selectButtons from "./selectButtons"; const { ccclass, property, disallowMultiple, menu } = cc._decorator; @ccclass @disallowMultiple() @menu('对话剧情/DH_11') export default class DH_11 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_11/sound/魏老,听说您是古钱币收藏大师', delayTime: 2.76, str: '魏老,听说您是古钱币收藏大师', posi: '-1' }, { effectUrl: 'DH/DH_11/sound/最近淘到一个错版双面龙的古钱币,请您帮忙掌掌眼。', delayTime: 4.61, str: '最近淘到一个错版双面龙的古钱币,请您帮忙掌掌眼。', posi: '-1' }, { effectUrl: 'DH/DH_11/sound/哦,错版双面龙?快拿出来看看。', delayTime: 4.64, str: '哦,错版双面龙?快拿出来看看。', posi: 'qipao2' }, { effectUrl: 'DH/DH_11/sound/嗯,不错,很开门啊,你小子运气不错啊。这钱币转移吗?', delayTime: 7.17, str: '嗯,不错,很开门啊,你小子运气不错啊。这钱币转移吗?', posi: 'qipao2' }, { effectUrl: 'DH/DH_11/sound/您老喜欢?这是我捡漏的,您喜欢就送给您吧。', delayTime: 3.91, str: '您老喜欢?这是我捡漏的,您喜欢就送给您吧。', posi: '-1' }, { effectUrl: 'DH/DH_11/sound/送我?你小子是有什么事求我吧,直接说吧。', delayTime: 7.01, str: '送我?你小子是有什么事求我吧,直接说吧。', posi: 'qipao2' }, { effectUrl: 'DH/DH_11/sound/其实这是我特意淘的拜师礼,我想跟着您学习白案厨艺。', delayTime: 4.4, str: '其实这是我特意淘的拜师礼,我想跟着您学习白案厨艺。', posi: '-1' }, { effectUrl: 'DH/DH_11/sound/想学厨艺?你要能在美食大赛前,达到三级面点师,我就收你了。', delayTime: 8.24, str: '想学厨艺?你要能在美食大赛前,达到三级面点师,我就收你了。', posi: 'qipao2' }, ] @property(sp.Skeleton) nanzhu: sp.Skeleton = null @property(sp.Skeleton) weihuizhang: sp.Skeleton = null @property(sp.Skeleton) nanzhu_big: sp.Skeleton = null @property(sp.Skeleton) weihuizhang_big: sp.Skeleton = null @property(cc.Node) m_bg: cc.Node = null @property(cc.Node) MoveNodes: cc.Node = null @property(cc.Node) copyNode: cc.Node = null; selectButtonIndex: number; start() { Common5.playRemoteAudioMusic("remotesound/effect/茶厅音乐", true) Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_119) // }) } // 继续剧情 continueStory() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_12) }) this.nanzhu.setAnimation(0, "男主待机", true) this.weihuizhang.setAnimation(0, "魏会长待机", true) const dialogEvents = [ (func) => { // this.nanzhu.node.active = false // this.nanzhu_big.node.active = true // this.runBg(1, 3, this.MoveNodes.getChildByName("男主"), () => { func() // }) }, (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { // this.nanzhu_big.setAnimation(0, "男主说话", true) this.nanzhu.setAnimation(0, "男主说话", true) }); }, (func) => { this.nanzhu_big.node.active = false this.nanzhu.node.active = true this.nanzhu.setAnimation(0, "男主待机", true) // this.runBg(1, 1, this.node, () => { func() // }) }, // (func) => { // this.nanzhu.setAnimation(0, "男主拿钱币", false) // this.nanzhu.setCompleteListener(() => { // this.nanzhu.setCompleteListener(null) // this.nanzhu.setAnimation(0, "男主拿钱币待机", true) // func() // }) // }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { // this.nanzhu.setAnimation(0, "男主拿钱币说话", true) this.nanzhu.setAnimation(0, "男主说话", true) }); }, (func) => { // this.nanzhu.setAnimation(0, "男主拿钱币待机", true) this.nanzhu.setAnimation(0, "男主待机", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.weihuizhang.setAnimation(0, "魏会长说话", true) }); }, (func) => { this.nanzhu.setAnimation(0, "男主拿钱币", false) this.nanzhu.setCompleteListener(() => { this.nanzhu.setCompleteListener(null) this.nanzhu.setAnimation(0, "男主拿钱币待机", true) this.scheduleOnce(() => { func() }, 1) }) }, (func) => { this.weihuizhang.setAnimation(0, "魏会长拿钱币", true) this.nanzhu.setAnimation(0, "男主待机", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.weihuizhang.setAnimation(0, "魏会长拿钱币说话", true) }); }, (func) => { this.selectButtonIndex = 0 PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => { let strs = ['转移', '不转移'] let actives = [true, true] let funcs = [ () => { this.selectButtonIndex = 1 PrefabManage.loadPrefabByType(GameType.commonTips, null, (node) => { node.getComponent(CommonTips).init(`恭喜转移成功获得5000万`, () => { UserManager.addMoney(50000000) this.copyNode.getChildByName("lab").getComponent(cc.Label).string = `+${Common5.getNumberChangeHanzi(50000000)}` this.copyNode.active = true cc.tween(this.copyNode) .by(0.5, { y: 30 }) .call(() => { this.copyNode.active = false }) .start() func() }) }) }, () => { this.selectButtonIndex = 2 func() }, ] let isvideo = [true, false] node.getComponent(selectButtons).init(strs, actives, funcs, isvideo) }) }, (func) => { if (this.selectButtonIndex == 2) { this.weihuizhang.setAnimation(0, "魏会长拿钱币", true) this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.nanzhu.setAnimation(0, "男主说话", true) }); } else { this.dialogIndex++ func() } }, (func) => { if (this.selectButtonIndex == 2) { this.nanzhu.setAnimation(0, "男主待机", true) this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.weihuizhang.setAnimation(0, "魏会长拿钱币说话", true) }); } else { this.dialogIndex++ func() } }, (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) }); }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { // PrefabManage.showTextTips("认证三级面点师需要人物等级200,报名费") TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_510) TaskManager.setCurTask(MainTaskIdEnum.MainTask_511) PrefabManage.loadPrefabByType(GameType.commonTips, null, (node) => { let config = ChuShiXieHuiManager.getManagerConfigById(0) node.getComponent(CommonTips).init(`认证三级面点师需要达到的条件:人物等级${config.dengji},报名费用:${Common5.getNumberChangeHanzi(config.moneystr)}`, () => { 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_119") // // 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() } }