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

255 lines
10 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 PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
import GameBaseScript from "../GameBaseScript";
let ChadianConfig = {
chadianLog1701: [
{
str: "卖货郎?你怎么在这",
qiPaoPos: -1,
delay: 1.6,
effectUrl: "GameRoomRes/sound/Room17/卖货郎?你怎么在这"
},
{
str: "你们认识?",
qiPaoPos: 0,
delay: 1,
effectUrl: "GameRoomRes/sound/Room17/你们认识?"
},
{
str: "重新认识一下,我叫刘彩珺,闽菜传承人",
qiPaoPos: 1,
delay: 3.6,
effectUrl: "GameRoomRes/sound/Room17/重新认识一下,我叫刘彩珺,闽菜传承人"
},
{
str: "可以把面具摘了吧",
qiPaoPos: -1,
delay: 1.2,
effectUrl: "GameRoomRes/sound/Room17/可以把面具摘了吧"
},
{
str: "真的假的?",
qiPaoPos: 2,
delay: 0.8,
effectUrl: "GameRoomRes/sound/Room17/真的假的?"
},
{
str: "不会还是假的吧",
qiPaoPos: 2,
delay: 1.4,
effectUrl: "GameRoomRes/sound/Room17/不会还是假的吧"
},
{
str: "还摸,再摸把你手剁了!",
qiPaoPos: 1,
delay: 2.8,
effectUrl: "GameRoomRes/sound/Room17/还摸,再摸把你手剁了!"
}
],
chadianLog1702: [
{
str: "还以为还是假的",
qiPaoPos: -1,
delay: 1.2,
effectUrl: "GameRoomRes/sound/Room17/还以为还是假的"
},
{
str: "梦雪这么看好你,我来看看你和闽菜有没有缘分吧",
qiPaoPos: 1,
delay: 4.3,
effectUrl: "GameRoomRes/sound/Room17/梦雪这么看好你,我来看看你和闽菜有没有缘分吧"
}
]
}
const { ccclass, property } = cc._decorator;
@ccclass
export default class Room17 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_1701) {
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.chadianLog1701[0], () => {
this.showQiPao(ChadianConfig.chadianLog1701[1], () => {
this.showQiPao(ChadianConfig.chadianLog1701[2], () => {
this.showQiPao(ChadianConfig.chadianLog1701[3], () => {
this.node.getChildByName('mainNode').getChildByName('手指箭头').active = true
this.node.getChildByName('mainNode').getChildByName('touchArea1').active = true
});
});
});
});
} else if (mainId == MainTaskIdEnum.MainTask_1702) {
this.showQiPao(ChadianConfig.chadianLog1702[0], () => {
this.showQiPao(ChadianConfig.chadianLog1702[1], () => {
});
});
}
}
showChatBtnStatus() {
this.node.getChildByName('startBtnTask1703').active = false
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_1703 || mainId == MainTaskIdEnum.MainTask_1704) {
this.node.getChildByName('startBtnTask1703').active = true
}
}
normalTouchCheckCallback(targetNode: any) {
console.log("targetNodeName+++++++++++++++++++++>" + targetNode.name);
switch (targetNode.name) {
case 'touchArea1':
this.node.getChildByName('mainNode').getChildByName('手指箭头').active = false
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.chadianLog1701[4], () => {
this.node.getChildByName('mainNode').getChildByName('手指箭头').active = true
this.node.getChildByName('mainNode').getChildByName('touchArea2').active = true
});
}, 1.5)
break;
case 'touchArea2':
this.node.getChildByName('mainNode').getChildByName('手指箭头').active = false
this.node.getChildByName('mainNode').getChildByName('货郎').getComponent(sp.Skeleton).setAnimation(0, '货郎无面具', true)
this.showQiPao(ChadianConfig.chadianLog1701[5], () => {
this.node.getChildByName('mainNode').getChildByName('手指箭头').active = true
this.node.getChildByName('mainNode').getChildByName('touchArea3').active = true
});
break;
case 'touchArea3':
this.node.getChildByName('mainNode').getChildByName('手指箭头').active = false
this.node.getChildByName('mainNode').getChildByName('货郎').getComponent(sp.Skeleton).setAnimation(0, '货郎无面具生气说话', true)
this.showQiPao(ChadianConfig.chadianLog1701[6], () => {
this.node.getChildByName('mainNode').getChildByName('货郎').getComponent(sp.Skeleton).setAnimation(0, '货郎无面具', true)
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1701);
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1702);
});
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
}
}
//展示气泡
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)
}
onStartTask1703() {
PrefabManage.loadPrefabByType(GameType.ChaoCai, null, (prefab) => {
prefab.getComponent(ChaoCai).initView(5)
})
}
}