import { ryw_Event } from "../../../FrameWork/Event/EventEnum"; import EventMgr from "../../../FrameWork/Event/EventMgr"; import Common5 from "../../../Platform/th/Common5"; import ChaoCai from "../../GameMethodRes/ChaoCai/ChaoCai"; import TaskManager, { MainTaskIdEnum } from "../../JuQingChat/TaskManager"; import JuQingQiPao from "../../JuQingGuanQia/JuQingQiPao"; import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage"; import GameBaseScript from "../GameBaseScript"; let ChadianConfig = { chadianLog301: [ { str: "你知道我爷爷?你又是谁?这么漂亮", qiPaoPos: -1, delay: 3.4, effectUrl: "GameRoomRes/sound/Room3/你知道我爷爷?你又是谁?这么漂亮" }, { str: "油嘴滑舌的,在你担起振兴中餐的重任后,都会知道的", qiPaoPos: 0, delay: 5.4, effectUrl: "GameRoomRes/sound/Room3/油嘴滑舌的,在你担起振兴中餐的重任后,都会知道的" }, { str: "那我要怎么做?", qiPaoPos: -1, delay: 1, effectUrl: "GameRoomRes/sound/Room3/那我要怎么做?" }, { str: "展示下你的实力,我会给你相应的投资", qiPaoPos: 0, delay: 3.2, effectUrl: "GameRoomRes/sound/Room3/展示下你的实力,我会给你相应的投资" } ], chadianLog306: [ { str: "感谢苏总的投资,给你带了点礼物", qiPaoPos: -1, delay: 2.3, effectUrl: "GameRoomRes/sound/Room3/感谢苏总的投资,给你带了点礼物" }, { str: "哦?是衣服啊,你帮我选选看吧", qiPaoPos: 0, delay: 3.8, effectUrl: "GameRoomRes/sound/Room3/哦?是衣服啊,你帮我选选看吧" } ], } const { ccclass, property } = cc._decorator; @ccclass export default class Room3 extends cc.Component { finishTaskStep = 0 onLoad() { this.finishTaskStep = 0 } start() { GameBaseScript.preLoadRemoteAudio(ChadianConfig); EventMgr.onEvent_custom(ryw_Event.NormalTouchEndCheck, (data_) => { this.normalTouchCallback(data_.targetNode); }, this); EventMgr.onEvent_custom(ryw_Event.DirectTouchMoveCheck, (data_) => { this.normalTouchCheckCallback(data_.targetNode); }, this); this.showChatBtnStatus() EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => { this.showChatBtnStatus() }, this) EventMgr.onEvent_custom(ryw_Event.updateMainTask, () => { this.showChatBtnStatus() this.duiHuaInfo() }, this) this.duiHuaInfo() } duiHuaInfo() { let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id if (mainId == MainTaskIdEnum.MainTask_301) { this.node.getChildByName('mainNode').getChildByName('苏梦雪tag').active = true this.scheduleOnce(() => { this.node.getChildByName('mainNode').getChildByName('苏梦雪tag').active = false }, 5) this.showQiPao(ChadianConfig.chadianLog301[0], () => { this.node.getChildByName('mainNode').getChildByName('站姿').getComponent(sp.Skeleton).setAnimation(0, '说话', true) this.showQiPao(ChadianConfig.chadianLog301[1], () => { this.node.getChildByName('mainNode').getChildByName('站姿').getComponent(sp.Skeleton).setAnimation(0, '待机', true) this.showQiPao(ChadianConfig.chadianLog301[2], () => { this.node.getChildByName('mainNode').getChildByName('站姿').getComponent(sp.Skeleton).setAnimation(0, '说话', true) this.showQiPao(ChadianConfig.chadianLog301[3], () => { this.node.getChildByName('mainNode').getChildByName('站姿').getComponent(sp.Skeleton).setAnimation(0, '待机', true) TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_301) TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_302) }); }); }); }); } else if (mainId == MainTaskIdEnum.MainTask_306) { this.showQiPao(ChadianConfig.chadianLog306[0], () => { this.node.getChildByName('mainNode').getChildByName('站姿').getComponent(sp.Skeleton).setAnimation(0, '说话', true) this.showQiPao(ChadianConfig.chadianLog306[1], () => { this.node.getChildByName('mainNode').getChildByName('站姿').getComponent(sp.Skeleton).setAnimation(0, '待机', true) this.node.getChildByName('startBtnTask306').active = true }); }); } } showChatBtnStatus() { this.node.getChildByName('startBtnTask302').active = false let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id if (mainId == MainTaskIdEnum.MainTask_301) { } else if (mainId == MainTaskIdEnum.MainTask_302 || mainId == MainTaskIdEnum.MainTask_303) { this.node.getChildByName('startBtnTask302').active = true } if(mainId < MainTaskIdEnum.MainTask_307){ this.node.getChildByName('mainNode').getChildByName('站姿').active = true this.node.getChildByName('mainNode').getChildByName('投资人站姿').active = false }else{ this.node.getChildByName('mainNode').getChildByName('站姿').active = false this.node.getChildByName('mainNode').getChildByName('投资人站姿').active = true } } normalTouchCheckCallback(targetNode: any) { console.log("targetNodeName+++++++++++++++++++++>" + targetNode.name); switch (targetNode.name) { case 'xxxxx': break; default: break; } } normalTouchCallback(targetNode) { // let xiangZi = this.node.getChildByName('mainNode').getChildByName('行李箱') switch (targetNode.name) { case "xxxx": // this.finishTaskStep++ // cc.tween(this.node.getChildByName('mainNode').getChildByName('化妆品')) // .to(0.6, { x:xiangZi.x,y:xiangZi.y,angle:360,scale:0.2}) // .call(()=>{ // xiangZi.getComponent(sp.Skeleton).setAnimation(0,'抖动',false) // }) // .set({active:false}) // .start(); break; default: break; } if (this.finishTaskStep == 4) { this.node.getChildByName('mainNode').getChildByName('touchArea_菜谱').active = true } } // onStartTask201(){ // this.node.getChildByName('startBtnTask201').active = false // } onStartTask306() { this.node.getChildByName('startBtnTask306').active = false PrefabManage.loadPrefabByType(GameType.GameStory3) } // onStartTask208(){ // this.node.getChildByName('startBtnTask208').active = false // let goodArray = [{goodId:3005, goodNum:1}] // PrefabManage.loadPrefabByType(GameType.GetAward,null,(prefabNode)=>{ // prefabNode.getComponent(GetAward).initView(goodArray, ()=>{ // console.log('完成剧情任务208') // }); // }) // } //展示气泡 showQiPao(curLog, func?) { console.log("curLog==", curLog) if (!curLog) { console.log("xxxxxx") return; } let string_ = curLog.str let qiPaoPos_ = curLog.qiPaoPos if (qiPaoPos_ != -1) { if (curLog.effectUrl && curLog.effectUrl.length > 0) { Common5.playRemoteAudioEffect(curLog.effectUrl); } let node = this.node let qiPao = node.getChildByName("qiPao").getChildByName("qiPao_" + qiPaoPos_); let effect = node.getChildByName("声效").getChildByName("声效" + qiPaoPos_); qiPao.stopAllActions() this.showDialogStr(string_, qiPao.getChildByName("str")) // qiPao.getChildByName("str").getComponent(cc.Label).string = string_ qiPao.active = true qiPao.scale = 0 effect.active = true cc.tween(qiPao) .to(0.2, { scale: 1 }) .delay(curLog.delay) .call(() => { qiPao.active = false; effect.active = false; if (func) { func(); } }) .start(); } else { let qiPao = this.node.getChildByName("dh_qiPao") qiPao.getComponent(JuQingQiPao).initView(curLog, func) } } showDialogStr(str, dialogStr, finishFunc?) { let curStr = "" let curIndex = 0 let callFunc = () => { curStr += str[curIndex++] dialogStr.getComponent(cc.Label).string = curStr if (curIndex >= str.length) { finishFunc && finishFunc() } } this.schedule(callFunc, 0.07, str.length - 1) } onStartTask302() { PrefabManage.loadPrefabByType(GameType.ChaoCai, null, (prefab) => { prefab.getComponent(ChaoCai).initView(0) }) } }