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.
167 lines
6.7 KiB
167 lines
6.7 KiB
import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../../FrameWork/Event/EventMgr";
|
|
import Common5 from "../../../Platform/th/Common5";
|
|
import JuQingManager from "../../JuQingChat/JuQingManager";
|
|
import TaskManager, { MainTaskIdEnum } from "../../JuQingChat/TaskManager";
|
|
import JuQingQiPao from "../../JuQingGuanQia/JuQingQiPao";
|
|
import BagManager from "../../Manager/BagManager";
|
|
import NewGuideScript from "../../NewGuide/NewGuideScript";
|
|
import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
|
|
import GetAward from "../../SCommon/GetAward";
|
|
import GameBaseScript from "../GameBaseScript";
|
|
import RoomBase from "../RoomBase";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
@ccclass
|
|
export default class Room2 extends RoomBase {
|
|
chatConfig = {
|
|
chatConfig_101: [
|
|
// { effectUrl: '', delayTime: 2.4, str: '咳~咳~咳~', posi: 'qipao2' },
|
|
// { effectUrl: 'GameRoomRes/sound/Room2/妈,你脸色怎么这么差?', delayTime: 2.4, str: '妈,你脸色怎么这么差?', posi: '-1' },
|
|
// { effectUrl: 'GameRoomRes/sound/Room2/我没事,你先看看信吧。', delayTime: 3.5, str: '我没事,你先看看信吧。', posi: 'qipao2' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room2/这老神棍消失4年了,居然还给我留了封信!', delayTime: 4.3, str: '这老神棍消失4年了,居然还给我留了封信!', posi: '-1' },
|
|
],
|
|
chatConfig_201: [
|
|
{ effectUrl: 'GameRoomRes/sound/Room2/妈,爷爷给我留了宝物,我去拿下。', delayTime: 2.85, str: '妈,爷爷给我留了宝物,我去拿下。', posi: '-1' },
|
|
]
|
|
}
|
|
|
|
|
|
|
|
@property(cc.Node)
|
|
layerNode: cc.Node[] = [];
|
|
|
|
// finishTaskStep = 0
|
|
// maskGuideNode: cc.Node = null
|
|
|
|
curLayerIndex: number = 0;
|
|
|
|
onLoad() {
|
|
// this.finishTaskStep = 0
|
|
|
|
|
|
}
|
|
|
|
start() {
|
|
this.scheduleOnce(() => {
|
|
PrefabManage.preloadPrefabByType(GameType.Room3)
|
|
PrefabManage.preloadPrefabByType(GameType.DH_1)
|
|
})
|
|
GameBaseScript.preLoadRemoteAudio(this.chatConfig);
|
|
super.start();
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
if (mainId == MainTaskIdEnum.MainTask_None) {
|
|
this.curLayerIndex = 0
|
|
} else if (mainId == MainTaskIdEnum.MainTask_201) {
|
|
this.curLayerIndex = 0
|
|
} else if (mainId >= MainTaskIdEnum.MainTask_202) {
|
|
return
|
|
}
|
|
|
|
this.refreshLayer()
|
|
}
|
|
// 刷新场景
|
|
refreshLayer() {
|
|
for (const node of this.layerNode) {
|
|
node.active = false;
|
|
}
|
|
this.layerNode[this.curLayerIndex].active = true;
|
|
//Common5.playMusicCustom('GameRes', 'GameStory10/sound/背景bgm');
|
|
|
|
this["continueStory" + this.curLayerIndex]();
|
|
}
|
|
// 继续剧情
|
|
continueStory0() {
|
|
let ma = this.layerNode[this.curLayerIndex].getChildByName("妈")
|
|
let maSpine = ma.getComponent(sp.Skeleton)
|
|
maSpine.setAnimation(0, "待机", true)
|
|
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
if (mainId == MainTaskIdEnum.MainTask_201) {
|
|
this.onDoTask201()
|
|
return
|
|
} else if (mainId >= MainTaskIdEnum.MainTask_202 && mainId <= MainTaskIdEnum.MainTask_207) {
|
|
return
|
|
}
|
|
|
|
const dialogEvents = [
|
|
// (func) => {
|
|
// this.scheduleOnce(() => {
|
|
// this.showQiPao(this.chatConfig.chatConfig_101[this.dialogIndex++], null, () => {
|
|
|
|
// });
|
|
// Common5.playRemoteAudioEffect("action_effect/妈妈咳嗽");
|
|
// maSpine.setAnimation(0, "咳嗽", true)
|
|
// maSpine.setCompleteListener(() => {
|
|
// maSpine.setCompleteListener(null)
|
|
// // maSpine.setAnimation(0, "待机", true)
|
|
// func()
|
|
// })
|
|
// }, 1)
|
|
// },
|
|
// (func) => {
|
|
// Common5.ReportDY("inLevel", "任务001-房间二1妈你脸色");
|
|
// this.showClickDialog(this.chatConfig.chatConfig_101[this.dialogIndex++], func);
|
|
// },
|
|
// (func) => {
|
|
// Common5.ReportDY("inLevel", "任务001-房间二2我没事");
|
|
// this.showQiPao(this.chatConfig.chatConfig_101[this.dialogIndex++], func, () => {
|
|
// maSpine.setAnimation(0, "说话", true)
|
|
// });
|
|
// },
|
|
(func) => {
|
|
maSpine.setAnimation(0, "待机", true)
|
|
Common5.ReportDY("inLevel", "任务001-房间二3这老神棍");
|
|
this.showQiPao(this.chatConfig.chatConfig_101[this.dialogIndex++], func);
|
|
},
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_201)
|
|
this.onDoTask201()
|
|
// EventMgr.emitEvent_custom(ryw_Event.EnterNextGame);
|
|
// this.node.destroy()
|
|
}
|
|
});
|
|
}
|
|
dialogCallFunc(dialogEvents);
|
|
}
|
|
|
|
onDoTask201() {
|
|
this.dialogIndex = 0
|
|
//查看爷爷的信
|
|
this.layerNode[this.curLayerIndex].getChildByName("信封").active = true
|
|
let node = this.layerNode[this.curLayerIndex].getChildByName("信封");
|
|
this.guideView([node]);
|
|
}
|
|
onTouchXinFeng() {
|
|
Common5.ReportDY("inLevel", "任务001-房间二4点击信封");
|
|
this.layerNode[this.curLayerIndex].getChildByName("信封").active = false
|
|
this.layerNode[this.curLayerIndex].getChildByName("信").active = true
|
|
}
|
|
onTouchXin() {
|
|
Common5.ReportDY("inLevel", "任务001-房间二5点击信");
|
|
this.layerNode[this.curLayerIndex].getChildByName("信").active = false
|
|
this.showClickDialog(this.chatConfig.chatConfig_201[this.dialogIndex++], () => {
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_202)
|
|
});
|
|
}
|
|
onTouchChuMen() {
|
|
PrefabManage.loadPrefabByType(GameType.CityPrefab)
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
}
|
|
|
|
guideView(nodeArray) {
|
|
PrefabManage.loadPrefabByType(GameType.GuideMskNode, null, (prefab) => {
|
|
let guideNodeArray = nodeArray
|
|
let firstNode = guideNodeArray.shift()
|
|
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
|
|
})
|
|
}
|
|
}
|
|
|