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

184 lines
7.1 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 { GameStoryConfigData } from "../../FirstSelectScene/GameStoryConfig";
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";
const { ccclass, property } = cc._decorator;
@ccclass
export default class Room1 extends cc.Component {
finishTaskStep = 0
maskGuideNode: cc.Node = null
onLoad() {
}
start() {
this.showChatBtnStatus()
EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => {
this.showChatBtnStatus()
}, this)
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.ChatList)
PrefabManage.preloadPrefabByType(GameType.ChatDialog)
}, 0.2)
EventMgr.onEvent_custom(ryw_Event.updateMainTask, () => {
this.updateMainTask()
}, this)
}
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_1') {
openBtnSpine.setPosition(cc.v2(0, 0))
openBtnSpine.active = true
shouJi.opacity = 0
openBtnSpine.getComponent(sp.Skeleton).setAnimation(0, '手机呼吸', false)
this.scheduleOnce(() => {
openBtnSpine.getComponent(sp.Skeleton).setAnimation(0, '手机', 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')
}
updateMainTask() {
this.node.getChildByName('手机').active = false
this.node.getChildByName('回家').active = true
}
clickGoHome() {
this.node.getChildByName('回家').active = false
let zhangJie = User.getStatistics("zhangJie")
PrefabManage.loadPrefabByType(GameStoryConfigData[zhangJie].roomIndex);
// PrefabManage.loadPrefabByType(Common5.selectGameInfo.roomIndex)
this.node.removeFromParent()
this.node.destroy()
}
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) {
if (this.maskGuideNode == null) {
PrefabManage.loadPrefabByType(GameType.GuideMskNode, null, (prefab) => {
let guideNodeArray = nodeArray
this.maskGuideNode = prefab
let firstNode = guideNodeArray.shift()
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
})
} else {
this.maskGuideNode.active = true
let guideNodeArray = nodeArray
let firstNode = guideNodeArray.shift()
this.maskGuideNode.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
}
}
}