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"; let ChadianConfig = { chadianLog1: [ { str: "我可以开始了吗", qiPaoPos: -1, delay:3, effectUrl: "sound/我可以开始了吗" }, { str: "开始吧,人家还真有点迫不及待了呢", qiPaoPos: 0, delay:3, effectUrl: "sound/开始吧,人家还真有点迫不及待了呢" } ], chadianLog2: [ { str: "爸爸,妈妈呢,妈妈答应给我买裙子的", qiPaoPos: 0, delay:3, effectUrl: "sound/爸爸,妈妈呢,妈妈答应给我买裙子的" }, { str: "爸爸给你买裙子吧", qiPaoPos: -1, delay:3, effectUrl: "sound/爸爸给你买裙子吧" } ] } const {ccclass, property} = cc._decorator; @ccclass export default class Room2 extends cc.Component { finishTaskStep = 0 onLoad () { this.finishTaskStep = 0 EventMgr.onEvent_custom(ryw_Event.NormalTouchEndCheck, (data_) => { this.normalTouchCallback(data_.targetNode); }, this); EventMgr.onEvent_custom(ryw_Event.DirectTouchMoveCheck, (data_) => { this.normalTouchCheckCallback(data_.targetNode); }, this); } start () { this.showChatBtnStatus() EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua,()=>{ this.showChatBtnStatus() },this) } showChatBtnStatus(){ let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id // if(mainId == MainTaskIdEnum.MainTask_301){ // this.showQiPao(ChadianConfig.chadianLog1[0],()=>{ // this.showQiPao(ChadianConfig.chadianLog1[1],()=>{ // this.node.getChildByName('startBtnTask301').active = true // }) // }) // }else{ // this.node.getChildByName('startBtnTask301').active = false // } } normalTouchCheckCallback(targetNode: any) { console.log("targetNodeName+++++++++++++++++++++>" + targetNode.name); switch (targetNode.name) { case 'xxxxx': break; default: break; } if(this.finishTaskStep == 4){ // this.node.getChildByName('task202Node').getChildByName('砖块').active = true } } normalTouchCallback(targetNode) { switch (targetNode.name) { case "xxxx": // let goodArray = [{goodId:1737, goodNum:1}] // PrefabManage.loadPrefabByType(GameType.GetAward,null,(prefabNode)=>{ // prefabNode.getComponent(GetAward).initView(goodArray, ()=>{ // console.log('完成剧情任务202') // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_202) // TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_203) // }); // }) break; default: break; } } onStartTask301(){ // this.node.getChildByName('startBtnTask301').active = false console.log('进入做菜玩法123') PrefabManage.loadPrefabByType(GameType.ChaoCai,null,(prefab)=>{ prefab.getComponent(ChaoCai).initView(0) }) } //展示气泡 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_); qiPao.stopAllActions() this.showDialogStr(string_,qiPao.getChildByName("str")) // qiPao.getChildByName("str").getComponent(cc.Label).string = string_ qiPao.active = true qiPao.scale = 0 cc.tween(qiPao) .to(0.2, { scale: 1 }) .delay(curLog.delay) .call(() => { qiPao.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) } }