觉醒时刻
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.

289 lines
12 KiB

1 week ago
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 PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
import GameBaseScript from "../GameBaseScript";
let ChadianConfig = {
chadianLog701: [
{
str: "她就是川菜传承人,也是我师妹!",
qiPaoPos: -1,
delay: 2.3,
effectUrl: "GameRoomRes/sound/Room7/她就是川菜传承人,也是我师妹!"
},
{
str: "你这师妹,看起来,怎么像个小孩子?",
qiPaoPos: 0,
delay: 4.9,
effectUrl: "GameRoomRes/sound/Room7/你这师妹,看起来,怎么像个小孩子?"
},
{
str: "师哥,这老女人,就是我们餐馆的投资人?",
qiPaoPos: 1,
delay: 4,
effectUrl: "GameRoomRes/sound/Room7/师哥,这老女人,就是我们餐馆的投资人?"
},
{
str: "停停停,给你们准备了礼物,我去快递站拿!",
qiPaoPos: -1,
delay: 2.6,
effectUrl: "GameRoomRes/sound/Room7/停停停,给你们准备了礼物,我去快递站拿!"
}
],
chadianLog703: [
{
str: "苏总人比花美,国色天香啊",
qiPaoPos: 2,
delay: 2.7,
effectUrl: "GameRoomRes/sound/Room7/苏总人比花美,国色天香啊"
}
],
chadianLog704: [
{
str: "师妹的气质,就如这兰花,清新脱俗",
qiPaoPos: 2,
delay: 3.5,
effectUrl: "GameRoomRes/sound/Room7/师妹的气质,就如这兰花,清新脱俗"
},{
str: "放过你了,看看你准备的什么川菜吧",
qiPaoPos: 0,
delay: 3.5,
effectUrl: "GameRoomRes/sound/Room7/放过你了,看看你准备的什么川菜吧"
}
],
chadianLog709: [
{
str: "看起来应该是中毒了?先去买个解毒药",
qiPaoPos: -1,
delay: 3,
effectUrl: "GameRoomRes/sound/Room7/看起来应该是中毒了?先去买个解毒药"
}
]
}
const { ccclass, property } = cc._decorator;
@ccclass
export default class Room7 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_711 && BagManager.getBagGoodNums(3020) <= 0) {
let bagConfig = {
goodId: 3020,
goodNum: 1,
}
BagManager.addBagList(bagConfig)
}
if (mainId == MainTaskIdEnum.MainTask_701) {
this.node.getChildByName('mainNode').getChildByName('苏梦雪tag').active = true
this.node.getChildByName('mainNode').getChildByName('杨玲倩tag').active = true
this.scheduleOnce(() => {
this.node.getChildByName('mainNode').getChildByName('苏梦雪tag').active = false
this.node.getChildByName('mainNode').getChildByName('杨玲倩tag').active = false
}, 5)
this.showQiPao(ChadianConfig.chadianLog701[0], () => {
this.showQiPao(ChadianConfig.chadianLog701[1], () => {
this.showQiPao(ChadianConfig.chadianLog701[2], () => {
this.showQiPao(ChadianConfig.chadianLog701[3], () => {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_701)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_702)
});
});
});
});
}else if (mainId == MainTaskIdEnum.MainTask_704) {
this.showQiPao(ChadianConfig.chadianLog703[0]);
}else if (mainId == MainTaskIdEnum.MainTask_705) {
this.showQiPao(ChadianConfig.chadianLog704[0],()=>{
this.showQiPao(ChadianConfig.chadianLog704[1]);
});
}else if (mainId == MainTaskIdEnum.MainTask_709) {
this.showQiPao(ChadianConfig.chadianLog709[0], () => {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_709)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_710)
});
}
}
showChatBtnStatus() {
this.node.getChildByName('startBtnTask705').active = false
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_701 || mainId == MainTaskIdEnum.MainTask_702
|| mainId == MainTaskIdEnum.MainTask_703 || mainId == MainTaskIdEnum.MainTask_704) {
this.node.getChildByName('mainNode').getChildByName('师妹站姿').active = true
this.node.getChildByName('mainNode').getChildByName('投资人站姿').active = true
if (mainId == MainTaskIdEnum.MainTask_704) {
this.node.getChildByName('mainNode').getChildByName('投资人站姿').getComponent(sp.Skeleton).setAnimation(0,'待机',true)
}
} else if (mainId == MainTaskIdEnum.MainTask_705 || mainId == MainTaskIdEnum.MainTask_706
|| mainId == MainTaskIdEnum.MainTask_707 || mainId == MainTaskIdEnum.MainTask_708) {
if (mainId == MainTaskIdEnum.MainTask_705 || mainId == MainTaskIdEnum.MainTask_706) {
this.node.getChildByName('startBtnTask705').active = true
}
this.node.getChildByName('mainNode').getChildByName('师妹站姿').active = false
this.node.getChildByName('mainNode').getChildByName('投资人站姿').active = false
this.node.getChildByName('mainNode').getChildByName('师妹坐姿').active = true
this.node.getChildByName('mainNode').getChildByName('投资人坐姿').active = true
this.node.getChildByName('mainNode').getChildByName('中间桌子').active = true
this.node.getChildByName('mainNode').getChildByName('前桌子').active = true
} else if (mainId == MainTaskIdEnum.MainTask_709 || mainId == MainTaskIdEnum.MainTask_710 || mainId == MainTaskIdEnum.MainTask_711) {
this.node.getChildByName('mainNode').getChildByName('师妹坐姿').active = false
this.node.getChildByName('mainNode').getChildByName('投资人坐姿').active = false
this.node.getChildByName('mainNode').getChildByName('中间桌子').active = false
this.node.getChildByName('mainNode').getChildByName('前桌子').active = false
this.node.getChildByName('mainNode').getChildByName('投资人晕倒').active = true
} else if (mainId == MainTaskIdEnum.MainTask_712 || mainId == MainTaskIdEnum.MainTask_713 || mainId == MainTaskIdEnum.MainTask_714) {
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_);
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)
}
onStartTask705() {
PrefabManage.loadPrefabByType(GameType.ChaoCai, null, (prefab) => {
prefab.getComponent(ChaoCai).initView(1)
})
}
}