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.
164 lines
5.8 KiB
164 lines
5.8 KiB
import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../../FrameWork/Event/EventMgr";
|
|
import Common5 from "../../../Platform/th/Common5";
|
|
import YiMaJiang from "../../GameMethodRes/YiMaJiang/YiMaJiang";
|
|
import TaskManager, { MainTaskIdEnum } from "../../JuQingChat/TaskManager";
|
|
import JuQingQiPao from "../../JuQingGuanQia/JuQingQiPao";
|
|
import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
|
|
import GameBaseScript from "../GameBaseScript";
|
|
|
|
let gameConfig = {
|
|
chadianLog1: [
|
|
{
|
|
str: "总算到这一步了",
|
|
qiPaoPos: -1,
|
|
delay: 1.2,
|
|
effectUrl: "GameRoomRes/sound/Room25/总算到这一步了"
|
|
},
|
|
{
|
|
str: "还没上菜,麻将,整起来!",
|
|
qiPaoPos: 0,
|
|
delay: 2.5,
|
|
effectUrl: "GameRoomRes/sound/Room25/还没上菜,麻将,整起来!"
|
|
},
|
|
{
|
|
str: "还没到么?",
|
|
qiPaoPos: -1,
|
|
delay: 0.8,
|
|
effectUrl: "GameRoomRes/sound/Room25/还没到么?"
|
|
}
|
|
]
|
|
}
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
@ccclass
|
|
export default class Room25 extends cc.Component {
|
|
|
|
onLoad() {
|
|
GameBaseScript.preLoadRemoteAudio(gameConfig);
|
|
EventMgr.onEvent_custom(ryw_Event.NormalTouchEndCheck, (data_) => {
|
|
this.normalTouchCallback(data_.targetNode);
|
|
}, this);
|
|
EventMgr.onEvent_custom(ryw_Event.DirectTouchMoveCheck, (data_) => {
|
|
this.normalTouchCallback(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_2501) {
|
|
let role = this.node.getChildByName('投资人');
|
|
const dialogEvents = [
|
|
(func) => {
|
|
this.showQiPao(gameConfig.chadianLog1[0], func);
|
|
},
|
|
(func) => {
|
|
role.getComponent(sp.Skeleton).setAnimation(0, '说话', true);
|
|
this.showQiPao(gameConfig.chadianLog1[1], func);
|
|
}
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
role.getComponent(sp.Skeleton).setAnimation(0, '待机', true);
|
|
this.node.getChildByName('开始做菜').active = true;
|
|
}
|
|
});
|
|
}
|
|
dialogCallFunc(dialogEvents);
|
|
} else if (mainId == MainTaskIdEnum.MainTask_2502) {
|
|
this.node.getChildByName('开始做菜').active = false;
|
|
this.node.getChildByName('满汉全席').active = true;
|
|
this.showQiPao(gameConfig.chadianLog1[2]);
|
|
} else if (mainId == MainTaskIdEnum.MainTask_2503) {
|
|
this.node.getChildByName('满汉全席').active = true;
|
|
} else {
|
|
this.node.getChildByName('满汉全席').active = true;
|
|
this.node.getChildByName('投资人').active = false;
|
|
}
|
|
}
|
|
|
|
normalTouchCallback(targetNode) {
|
|
switch (targetNode.name) {
|
|
case "膳食提交":
|
|
// this.showQiPao(gameConfig.chadianLog1[1], () => {
|
|
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_2202);
|
|
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2203);
|
|
// EventMgr.emitEvent_custom(ryw_Event.RefreshJuQingDuiHua);
|
|
// });
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
//展示气泡
|
|
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)
|
|
}
|
|
|
|
onStartGameBtn1(event) {
|
|
// let target = event.target;
|
|
// target.active = false;
|
|
PrefabManage.loadPrefabByType(GameType.YiMaJiang, null, (prefabNode) => {
|
|
prefabNode.getComponent(YiMaJiang).initView(0);
|
|
})
|
|
}
|
|
}
|
|
|