咸鱼的反击
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.
 
 
 

216 lines
8.6 KiB

// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
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 JuQingManager from "../JuQingChat/JuQingManager";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import NewGuideScript from "../NewGuide/NewGuideScript";
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
const {ccclass, property} = cc._decorator;
@ccclass
export default class JuQingRoom3 extends cc.Component {
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
isShow = true
isShow506 = true
start () {
this.enterGameRoom()
EventMgr.onEvent_custom(ryw_Event.RefreshMyRoom,()=>{
this.showRoomState()
},this)
this.showRoomState()
this.changeRoomView()
EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua,()=>{
this.changeRoomView()
},this)
EventMgr.onEvent_custom(ryw_Event.updateMainTask,()=>{
this.changeRoomView()
},this)
EventMgr.onEvent_custom(ryw_Event.NewGuideEvent,(index)=>{
this.guideNewStep(index)
},this)
// TaskManager.setCurTask(MainTaskIdEnum.MainTask_512)
// User.setRoomGoodStatus(15)
}
guideNewStep(index){
if(index == 3){
let qiling = this.node.getChildByName('器灵')
qiling.active = true
Common5.playRemoteSpine(qiling, 'Spine/roomSpine','器灵','器灵')
cc.tween(qiling)
.to(0.3, {x:100})
.start()
}
}
changeRoomView(){
let roomGoodStatus = User.getRoomGoodStatus()
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if(mainId == MainTaskIdEnum.MainTask_512 && roomGoodStatus == 15 && this.isShow){
//出现新闻
this.isShow = false
this.node.getChildByName('电视').active = true
let node = this.node.getChildByName('电视')
this.guideView([node])
}else if(mainId == MainTaskIdEnum.MainTask_513){
this.node.getChildByName('按钮').active = true
}else if(mainId == MainTaskIdEnum.MainTask_514){
this.node.getChildByName('按钮').active = false
}else if(mainId == MainTaskIdEnum.MainTask_516 || mainId == MainTaskIdEnum.MainTask_517){
this.node.getChildByName('妹妹冷').active = false
this.node.getChildByName('妹妹').active = false
this.node.getChildByName('女主正常').active = false
this.node.getChildByName('女主坐').active = true
this.node.getChildByName('按钮').active = false
Common5.playRemoteSpine(this.node.getChildByName('女主坐'), 'Spine/LXYfakuang','女主坐','女主坐')
}else if(mainId == MainTaskIdEnum.MainTask_518){
this.node.getChildByName('妹妹冷').active = false
this.node.getChildByName('妹妹').active = false
this.node.getChildByName('女主正常').active = true
this.node.getChildByName('按钮').active = false
if( this.node.getChildByName('女主坐').active){
Common5.playRemoteSpine(this.node.getChildByName('女主坐'), 'Spine/LXYfakuang','女主坐','女主冷静',false)
this.scheduleOnce(()=>{
this.node.getChildByName('女主坐').active = false
Common5.playRemoteSpine(this.node.getChildByName('女主正常'), 'Spine/roomSpine', '女','女待机')
},2.0)
}else{
Common5.playRemoteSpine(this.node.getChildByName('女主正常'), 'Spine/roomSpine', '女','女待机')
}
}else if(mainId == MainTaskIdEnum.MainTask_506&& this.isShow506){
this.isShow506 = false
let node = this.node.getChildByName('needGoodNode')
this.guideView([node])
}
}
guideView(nodeArray){
PrefabManage.loadPrefabByType(GameType.GuideMskNode, null, (prefab)=>{
let guideNodeArray = nodeArray
let firstNode = guideNodeArray.shift()
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
})
}
enterGameRoom(){
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if(mainId == MainTaskIdEnum.MainTask_504){
}else if(mainId == MainTaskIdEnum.MainTask_509 ){
PrefabManage.loadPrefabByType(GameType.JiuZhuLuoxiyan)
}else if(mainId == MainTaskIdEnum.MainTask_515 ){
PrefabManage.loadPrefabByType(GameType.HuanZhuangBei)
}else if(mainId == MainTaskIdEnum.MainTask_515_2 ){
PrefabManage.loadPrefabByType(GameType.HuanZhuangBei)
}
}
showRoomState(){
let roomGoodStatus = User.getRoomGoodStatus()
if(roomGoodStatus == 8 || roomGoodStatus == 9){
this.node.getChildByName('妹妹冷').active = true
this.node.getChildByName('妹妹').active = false
Common5.playRemoteSpine(this.node.getChildByName('妹妹冷'), 'Spine/roomSpine/冻妹妹', '冻妹妹','妹妹')
}else if(roomGoodStatus == 10){
this.node.getChildByName('妹妹冷').active = false
this.node.getChildByName('妹妹').active = true
Common5.playRemoteSpine(this.node.getChildByName('妹妹'), 'Spine/roomSpine/妹妹站立', '妹妹站立','animation')
JuQingManager.unLockNewJuQing('DH_6')
}else if(roomGoodStatus == 11 || roomGoodStatus == 12){
this.node.getChildByName('妹妹冷').active = false
this.node.getChildByName('妹妹').active = true
Common5.playRemoteSpine(this.node.getChildByName('妹妹'), 'Spine/roomSpine/妹妹站立', '妹妹站立','animation')
}else if(roomGoodStatus == 13){
this.node.getChildByName('妹妹冷').active = false
this.node.getChildByName('妹妹').active = false
}else if(roomGoodStatus >= 14 && roomGoodStatus<17){
this.node.getChildByName('妹妹冷').active = false
this.node.getChildByName('妹妹').active = false
this.node.getChildByName('女主正常').active = true
Common5.playRemoteSpine(this.node.getChildByName('女主正常'), 'Spine/roomSpine', '','女待机')
}else if(roomGoodStatus == 17){
this.node.getChildByName('妹妹冷').active = false
this.node.getChildByName('妹妹').active = false
this.node.getChildByName('女主正常').active = false
this.node.getChildByName('女主坐').active = true
Common5.playRemoteSpine(this.node.getChildByName('女主坐'), 'Spine/LXYfakuang','女主坐','女主坐')
}else if(roomGoodStatus >= 18){
this.node.getChildByName('妹妹冷').active = false
this.node.getChildByName('妹妹').active = false
this.node.getChildByName('女主正常').active = true
this.node.getChildByName('女主坐').active = false
Common5.playRemoteSpine(this.node.getChildByName('女主正常'), 'Spine/roomSpine', '女','女待机')
}
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if(mainId == MainTaskIdEnum.MainTask_504){
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_504)
JuQingManager.unLockNewJuQing('DH_5')
}else if(mainId == MainTaskIdEnum.MainTask_509){
}
}
xiezhuSYRClickEvent(){
this.node.getChildByName('按钮').active = false
PrefabManage.loadPrefabByType(GameType.XieZhuShouYeren)
}
dianshiTVClickEvent(){
this.node.getChildByName('电视').active = false
this.node.getChildByName('电视居中').active = true
}
dianshiTVClickEvent2(){
this.node.getChildByName('电视居中').active = false
this.node.getChildByName('按钮').active = true
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_512)
TaskManager.setCurTask(MainTaskIdEnum.MainTask_513)
}
// update (dt) {}
}