觉醒时刻
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

208 lines
8.0 KiB

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 BagManager from "../../Manager/BagManager";
import InterfaceManager from "../../Manager/InterfaceManager";
import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
import GetAward from "../../SCommon/GetAward";
import GameBaseScript from "../GameBaseScript";
let ChadianConfig = {
chadianLog2401: [
{
str: "陈天霸,你又想打什么歪主意",
qiPaoPos: -1,
delay: 3,
effectUrl: "GameRoomRes/sound/Room24/陈天霸,你又想打什么歪主意"
},
{
str: "林老板,求您高抬贵手!",
qiPaoPos: 0,
delay: 3,
effectUrl: "GameRoomRes/sound/Room24/林老板,求您高抬贵手!"
},
{
str: "现在求饶?晚了,陈氏西餐很快就不复存在!",
qiPaoPos: -1,
delay: 6,
effectUrl: "GameRoomRes/sound/Room24/现在求饶?晚了,陈氏西餐很快就不复存在!"
},
{
str: "姓林的,等我带着玉器回到海外,你就会知道我为什么叫陈天霸",
qiPaoPos: 1,
delay: 7.1,
effectUrl: "GameRoomRes/sound/Room24/姓林的,等我带着玉器回到海外,你就会知道我为什么叫陈天霸"
}
],
chadianLog2405: [
{
str: "八大菜系菜谱和御厨匾都集齐了,是时候解开传家宝的秘密了",
qiPaoPos: -1,
delay: 3.5,
effectUrl: "GameRoomRes/sound/Room24/八大菜系菜谱和御厨匾都集齐了,是时候解开传家宝的秘密了"
}
]
}
const { ccclass, property } = cc._decorator;
@ccclass
export default class Room24 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_2401) {
this.node.getChildByName('mainNode').getChildByName('老板求饶').active = true
this.showQiPao(ChadianConfig.chadianLog2401[0], () => {
this.node.getChildByName('mainNode').getChildByName('老板求饶').getComponent(sp.Skeleton).setAnimation(0, '下跪', false)
this.scheduleOnce(() => {
this.node.getChildByName('mainNode').getChildByName('老板求饶').getComponent(sp.Skeleton).setAnimation(0, '下跪待机', true)
this.showQiPao(ChadianConfig.chadianLog2401[1], () => {
this.showQiPao(ChadianConfig.chadianLog2401[2], () => {
this.node.getChildByName('mainNode').getChildByName('老板求饶').active = false
this.node.getChildByName('mainNode').getChildByName('老板站').active = true
this.showQiPao(ChadianConfig.chadianLog2401[3], () => {
this.node.getChildByName('mainNode').getChildByName('老板站').getComponent(sp.Skeleton).setAnimation(0, '老板消失', false)
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_2401);
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2402);
InterfaceManager.setDaoyeList('快递站', 4)
});
});
});
}, 0.5)
});
}else if (mainId == MainTaskIdEnum.MainTask_2405) {
this.showQiPao(ChadianConfig.chadianLog2405[0]);
}
}
showChatBtnStatus() {
// this.node.getChildByName('startBtnTask2301').active = false
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_2404) {
this.node.getChildByName('mainNode').getChildByName('muBanTouchArea').active = true
}
}
normalTouchCheckCallback(targetNode: any) {
console.log("targetNodeName+++++++++++++++++++++>" + targetNode.name);
switch (targetNode.name) {
case 'xxxx':
break;
default:
break;
}
}
normalTouchCallback(targetNode) {
switch (targetNode.name) {
case "muBanTouchArea":
let goodArray = [{ goodId: 3608, goodNum: 1 }]
PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => {
prefabNode.getComponent(GetAward).initView(goodArray, () => {
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_2404) {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_2404);
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2405);
}
});
})
break;
default:
break;
}
if (this.finishTaskStep == 4) {
// this.node.getChildByName('mainNode').getChildByName('touchArea_菜谱').active = true
}
}
//展示气泡
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)
}
onStartTask2301() {
}
}