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.
364 lines
18 KiB
364 lines
18 KiB
import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../../FrameWork/Event/EventMgr";
|
|
import User from "../../../FrameWork/User/User";
|
|
import Common5 from "../../../Platform/th/Common5";
|
|
import ChatManager from "../../JuQingChat/ChatManager";
|
|
import JuQingManager from "../../JuQingChat/JuQingManager";
|
|
import TaskManager, { MainTaskIdEnum } from "../../JuQingChat/TaskManager";
|
|
import NewGuideScript from "../../NewGuide/NewGuideScript";
|
|
import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
|
|
import GameBaseScript from "../GameBaseScript";
|
|
import RoomBase from "../RoomBase";
|
|
import RoomCommon from "../RoomCommon/RoomCommon";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
@ccclass
|
|
export default class Room1 extends RoomBase {
|
|
chatConfig = [
|
|
{ effectUrl: 'GameRoomRes/sound/Room1/老不死的!你走路不长眼睛吗?', delayTime: 3.4, str: '老不死的!你走路不长眼睛吗?', posi: 'qipao1' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room1/柳梦,这是我妈!赶紧道歉!', delayTime: 3.5, str: '柳梦,这是我妈!赶紧道歉!', posi: '-1' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room1/你带我来见家长,就见这么个丢人现眼的玩意?', delayTime: 5.4, str: '你带我来见家长,就见这么个丢人现眼的玩意?', posi: 'qipao1' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room1/你,你……', delayTime: 1.5, str: '你,你……', posi: '-1' },
|
|
// { effectUrl: 'GameRoomRes/sound/Room1/不然什么?分手?你敢说吗?', delayTime: 5.3, str: '不然什么?分手?你敢说吗?', posi: 'qipao1' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room1/晚上我在这等你,满足了我,说不定和你再多处几天。', delayTime: 6, str: '晚上我在这等你,满足了我,说不定和你再多处几天。', posi: 'qipao1' },
|
|
// { effectUrl: 'GameRoomRes/sound/Room1/妈,都是我不好,让你受委屈了。', delayTime: 3.4, str: '妈,都是我不好,让你受委屈了。', posi: '-1' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room1/哎,回家吧,也该打开你爷爷留给你的信了。', delayTime: 6.3, str: '哎,回家吧,也该打开你爷爷留给你的信了。', posi: 'qipao2' },
|
|
]
|
|
|
|
@property(cc.Node)
|
|
m_ma: cc.Node = null;
|
|
@property(cc.Node)
|
|
m_furen: cc.Node = null;
|
|
@property(cc.Node)
|
|
m_liumeng: cc.Node = null;
|
|
@property(cc.Node)
|
|
m_wuping: cc.Node = null;
|
|
@property(cc.Node)
|
|
qianzong: cc.Node = null;
|
|
@property(cc.Node)
|
|
car: cc.Node = null;
|
|
|
|
// finishTaskStep = 0
|
|
// maskGuideNode: cc.Node = null
|
|
onLoad() {
|
|
|
|
}
|
|
|
|
start() {
|
|
this.scheduleOnce(() => {
|
|
PrefabManage.preloadPrefabByType(GameType.Room2)
|
|
//先preload必要的
|
|
let needLoadArr = [GameType.CityPrefab, GameType.GetAward, GameType.TaskInfoNode,
|
|
GameType.JuQingDialog, GameType.ChatList, GameType.Setting, GameType.BeiBao, GameType.CommonTextTips,
|
|
GameType.HuangJinYuFu, GameType.KuaiDiZhan, GameType.Paimaihang, GameType.ShouHuoji, GameType.GuPiao,
|
|
GameType.HuXinGongYuan, GameType.KaiKuangFirstView, GameType.ChoushuiFirst, GameType.CiShanChouJiang
|
|
]
|
|
PrefabManage.preloadPrefabArray(needLoadArr)
|
|
}, 0.5)
|
|
Common5.playRemoteAudioMusic('CommonSound/第一段背景音乐')
|
|
GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig);
|
|
super.start();
|
|
this.continueStory();
|
|
// this.showChatBtnStatus()
|
|
// EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua,()=>{
|
|
// this.showChatBtnStatus()
|
|
// },this)
|
|
// this.scheduleOnce(()=>{
|
|
// PrefabManage.preloadPrefabByType(GameType.ChatList)
|
|
// PrefabManage.preloadPrefabByType(GameType.ChatDialog)
|
|
// },0.2)
|
|
}
|
|
|
|
// 继续剧情
|
|
continueStory() {
|
|
const dialogEvents = [
|
|
(func) => {
|
|
this.m_furen.active = false
|
|
let position1 = this.m_ma.position.clone()
|
|
let position2 = this.m_liumeng.position.clone()
|
|
this.m_ma.getComponent(sp.Skeleton).setAnimation(0, "叶辰妈走路", true)
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "柳梦走路", true)
|
|
cc.tween(this.m_ma)
|
|
.by(0.5, { position: cc.v3(50, 0, 0) })
|
|
.start()
|
|
cc.tween(this.m_liumeng)
|
|
.sequence(
|
|
cc.tween().by(0.5, { position: cc.v3(-50, 0, 0) }),
|
|
cc.tween().call(() => {
|
|
Common5.playRemoteAudioEffect("action_effect/两人相撞");
|
|
this.m_ma.active = false
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "妈柳梦碰撞", false)
|
|
this.m_ma.setPosition(position1)
|
|
this.m_liumeng.setPosition(position2)
|
|
this.m_liumeng.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
this.m_liumeng.getComponent(sp.Skeleton).setCompleteListener(null)
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "妈柳梦待机", true)
|
|
|
|
this.m_wuping.active = true
|
|
// this.scheduleOnce(() => {
|
|
func && func();
|
|
// }, 1);
|
|
})
|
|
})
|
|
)
|
|
.start()
|
|
},
|
|
(func) => {
|
|
Common5.playRemoteAudioEffect("action_effect/扇巴掌");
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "柳梦扇巴掌", false)
|
|
this.m_liumeng.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
this.m_liumeng.getComponent(sp.Skeleton).setCompleteListener(null)
|
|
this.m_ma.getComponent(sp.Skeleton).setAnimation(0, "妈倒地待机", true)
|
|
this.m_ma.active = true
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "妈倒地柳梦待机", true)
|
|
// this.scheduleOnce(() => {
|
|
func && func();
|
|
// }, 1);
|
|
})
|
|
},
|
|
(func) => {
|
|
Common5.ReportDY("inLevel", "任务001-第一幕1老不死的");
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "妈倒地柳梦说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "妈倒地柳梦待机", true)
|
|
this.m_ma.getComponent(sp.Skeleton).setAnimation(0, "叶辰进场", false)
|
|
this.m_ma.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
this.m_ma.getComponent(sp.Skeleton).setCompleteListener(null)
|
|
this.node.getChildByName("nameplate").active = true
|
|
func && func();
|
|
})
|
|
},
|
|
(func) => {
|
|
let node = this.node.getChildByName('对话框');
|
|
this.guideView([node]);
|
|
Common5.ReportDY("inLevel", "任务001-第一幕2柳梦你");
|
|
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.m_ma.getComponent(sp.Skeleton).setAnimation(0, "叶辰指人说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.m_ma.getComponent(sp.Skeleton).setAnimation(0, "叶辰放下手", true)
|
|
this.scheduleOnce(() => {
|
|
func && func();
|
|
}, 1);
|
|
},
|
|
(func) => {
|
|
Common5.ReportDY("inLevel", "任务001-第一幕3你带我来");
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "柳梦指人说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "妈倒地柳梦待机", true)
|
|
Common5.ReportDY("inLevel", "任务001-第一幕4以前我");
|
|
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.m_ma.getComponent(sp.Skeleton).setAnimation(0, "叶辰指人说话", true)
|
|
});
|
|
},
|
|
// (func) => {
|
|
// this.m_ma.getComponent(sp.Skeleton).setAnimation(0, "叶辰放下手", true)
|
|
// Common5.ReportDY("inLevel", "任务001-第一幕5不然什么");
|
|
// this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
// this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "妈倒地柳梦说话", true)
|
|
// });
|
|
// },
|
|
(func) => {
|
|
this.m_ma.getComponent(sp.Skeleton).setAnimation(0, "叶辰放下手", true)
|
|
Common5.ReportDY("inLevel", "任务001-第一幕6晚上我在");
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "妈倒地柳梦说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.m_liumeng.getComponent(sp.Skeleton).setAnimation(0, "柳梦离开", false)
|
|
this.node.getChildByName("nameplate").active = false
|
|
this.m_liumeng.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
this.m_liumeng.getComponent(sp.Skeleton).setCompleteListener(null)
|
|
cc.tween(this.qianzong)
|
|
.sequence(
|
|
cc.tween().to(0.5, { opacity: 0 }),
|
|
cc.tween().call(() => {
|
|
cc.tween(this.car)
|
|
.by(1, { position: cc.v3(1500, -180, 0) })
|
|
.start()
|
|
})
|
|
)
|
|
.start()
|
|
this.m_ma.active = false
|
|
this.m_furen.active = true
|
|
this.m_furen.getComponent(sp.Skeleton).setAnimation(0, "待机", true)
|
|
this.scheduleOnce(() => {
|
|
func && func();
|
|
}, 1);
|
|
})
|
|
},
|
|
// (func) => {
|
|
// Common5.ReportDY("inLevel", "任务001-第一幕7妈都是我");
|
|
// this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
// this.m_furen.getComponent(sp.Skeleton).setAnimation(0, "说话", true)
|
|
// });
|
|
// },
|
|
(func) => {
|
|
this.m_furen.getComponent(sp.Skeleton).setAnimation(0, "妈妈叹气", false)
|
|
this.m_furen.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
this.m_furen.getComponent(sp.Skeleton).setCompleteListener(null)
|
|
Common5.ReportDY("inLevel", "任务001-第一幕8哎回家吧");
|
|
})
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.m_furen.getComponent(sp.Skeleton).setAnimation(0, "妈妈说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.m_furen.getComponent(sp.Skeleton).setAnimation(0, "待机", true)
|
|
func()
|
|
},
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
EventMgr.emitEvent_custom(ryw_Event.EnterNextGame, true);
|
|
PrefabManage.showBlackGuoDu(() => {
|
|
PrefabManage.loadPrefabByType(GameType.RoomCommon, null, (prefab) => {
|
|
let parentNode = prefab.getComponent(RoomCommon).getMainNode()
|
|
PrefabManage.loadPrefabByType(GameType.Room2, parentNode)
|
|
})
|
|
// EventMgr.emitEvent_custom(ryw_Event.EnterNextGame);
|
|
this.node.destroy()
|
|
})
|
|
}
|
|
});
|
|
}
|
|
dialogCallFunc(dialogEvents);
|
|
}
|
|
|
|
// showChatBtnStatus(){
|
|
// let openBtnSpine = this.node.getChildByName('openBtnSpine')
|
|
// let shouJi = this.node.getChildByName('手机')
|
|
|
|
// let indexStr = JuQingManager.getCurJuQingUnLockIndex()
|
|
// if(ChatManager.isChatTypeIncludeEventIndex('WX',indexStr)){
|
|
// let spineNode = this.node.getChildByName('手机').getChildByName('spine')
|
|
// spineNode.getComponent(sp.Skeleton).setAnimation(0,'闪烁',true)
|
|
// Common5.playEffect('sound/手机信息')
|
|
// }else{
|
|
// let spineNode = this.node.getChildByName('手机').getChildByName('spine')
|
|
// spineNode.getComponent(sp.Skeleton).setAnimation(0,'静止',false)
|
|
// }
|
|
|
|
// let isHaveTask = false
|
|
// let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
|
|
// let mainId = mainTaskInfo.Id
|
|
// if(mainId != MainTaskIdEnum.MainTask_None && mainId){
|
|
// isHaveTask = true
|
|
// }
|
|
// if(isHaveTask){
|
|
// let spineNode = this.node.getChildByName('任务助手').getChildByName('spine')
|
|
// spineNode.getComponent(sp.Skeleton).setAnimation(0,'闪烁',true)
|
|
// }else{
|
|
// let spineNode = this.node.getChildByName('任务助手').getChildByName('spine')
|
|
// spineNode.getComponent(sp.Skeleton).setAnimation(0,'静止',false)
|
|
// }
|
|
|
|
// //开放手机按钮
|
|
// if(indexStr == 'WX_101'){
|
|
// openBtnSpine.setPosition(cc.v2(0,0))
|
|
// openBtnSpine.active = true
|
|
// shouJi.opacity = 0
|
|
// openBtnSpine.getComponent(sp.Skeleton).setAnimation(0,'手机1',false)
|
|
// this.scheduleOnce(()=>{
|
|
// openBtnSpine.getComponent(sp.Skeleton).setAnimation(0,'手机2',false)
|
|
|
|
// cc.tween(openBtnSpine)
|
|
// .to(0.5,{x:shouJi.x,y:shouJi.y})
|
|
// .call(()=>{
|
|
// cc.tween(shouJi)
|
|
// .set({active:true,scale:0.5,opacity:255})
|
|
// .to(0.15,{scale:0.9})
|
|
// .to(0.15,{scale:0.8})
|
|
// .start()
|
|
// openBtnSpine.active = false
|
|
// this.guideView([shouJi]);
|
|
// })
|
|
// .start()
|
|
// },1.67)
|
|
// }
|
|
|
|
// let chuMen = this.node.getChildByName('出门')
|
|
// if(User.getFirstStepIndex() >= 2){
|
|
// this.node.getChildByName('出门').active = true
|
|
// }else{
|
|
// this.node.getChildByName('出门').active = false
|
|
// }
|
|
|
|
// //开放出门按钮
|
|
// if(mainId == MainTaskIdEnum.MainTask_102 && User.getFirstStepIndex() == 2){
|
|
// openBtnSpine.setPosition(cc.v2(0,0))
|
|
// openBtnSpine.active = true
|
|
// chuMen.active = true
|
|
// chuMen.opacity = 0
|
|
// openBtnSpine.getComponent(sp.Skeleton).setAnimation(0,'门1',false)
|
|
// this.scheduleOnce(()=>{
|
|
// openBtnSpine.getComponent(sp.Skeleton).setAnimation(0,'门2',false)
|
|
|
|
// cc.tween(openBtnSpine)
|
|
// .to(0.5,{x:chuMen.x,y:chuMen.y})
|
|
// .call(()=>{
|
|
// cc.tween(chuMen)
|
|
// .set({active:true,scale:0.5,opacity:255})
|
|
// .to(0.15,{scale:0.9})
|
|
// .to(0.15,{scale:0.8})
|
|
// .call(()=>{
|
|
// // User.setGameGuideStepIndex(1);
|
|
// User.setFirstStepIndex(3);
|
|
// this.guideView([chuMen]);
|
|
// })
|
|
// .start()
|
|
// openBtnSpine.active = false
|
|
// })
|
|
// .start()
|
|
// },1.67)
|
|
// }
|
|
// }
|
|
// clickWXChat(){
|
|
// JuQingManager.openJuQingOrChat('WX')
|
|
// }
|
|
// chumenClickEvent(){
|
|
|
|
// PrefabManage.loadPrefabByType(GameType.CityPrefab)
|
|
|
|
// if(cc.isValid(this.maskGuideNode)){
|
|
// this.maskGuideNode.removeFromParent()
|
|
// this.maskGuideNode.destroy()
|
|
// }
|
|
|
|
// this.node.removeFromParent()
|
|
// this.node.destroy()
|
|
|
|
// }
|
|
// clickTaskInfoEvent(){
|
|
// let customTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
|
|
// if(customTaskInfo && Object.keys(customTaskInfo).length > 0 && customTaskInfo.Id != MainTaskIdEnum.MainTask_None){
|
|
// PrefabManage.loadPrefabByType(GameType.TaskInfoNode)
|
|
// }else{
|
|
// if(TaskManager.getIsLastTaskFinish()){
|
|
// PrefabManage.showTextTips('后续剧情策划挠头制作中,敬请期待!')
|
|
// }else{
|
|
// PrefabManage.showTextTips('当前无任务')
|
|
// }
|
|
// }
|
|
|
|
// }
|
|
|
|
guideView(nodeArray) {
|
|
PrefabManage.loadPrefabByType(GameType.GuideMskNode, null, (prefab) => {
|
|
let guideNodeArray = nodeArray
|
|
let firstNode = guideNodeArray.shift()
|
|
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
|
|
})
|
|
}
|
|
}
|
|
|