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.
223 lines
8.2 KiB
223 lines
8.2 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 PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
|
|
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class JuQingRoom2 extends cc.Component {
|
|
@property(cc.ProgressBar)
|
|
juexingPro: cc.ProgressBar = null;
|
|
|
|
clickJueXingIndex = 0
|
|
clickJueXingMax = 20
|
|
juqingIndex = 0
|
|
|
|
meimeiNode:cc.Node = null
|
|
dazuoNode:cc.Node = null
|
|
longgeNode:cc.Node = null
|
|
clickJuqing:cc.Node = null
|
|
nanzhuzuo:cc.Node = null
|
|
|
|
setAnim(node, anim, loop = false){
|
|
|
|
node.getComponent(sp.Skeleton).setAnimation(0,anim,loop)
|
|
}
|
|
|
|
start () {
|
|
this.meimeiNode = this.node.getChildByName('妹妹')
|
|
this.dazuoNode = this.node.getChildByName('打坐')
|
|
this.longgeNode = this.node.getChildByName('男主龙哥')
|
|
this.nanzhuzuo = this.node.getChildByName('男主左')
|
|
this.clickJuqing = this.node.getChildByName('clickJuqing')
|
|
Common5.loadRemoteAudioEffect('sound/diandiandian/龙哥打男主耳光')
|
|
|
|
Common5.playRemoteSpine(this.meimeiNode,'Spine/JuQingRoom2','妹妹', '妹妹')
|
|
this.roomState()
|
|
this.stepGame()
|
|
EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua,()=>{
|
|
this.stepGame()
|
|
},this)
|
|
|
|
EventMgr.onEvent_custom(ryw_Event.NewGuideEvent,(index)=>{
|
|
this.guideNewStep(index)
|
|
},this)
|
|
}
|
|
|
|
guideNewStep(index){
|
|
if(index == 2){
|
|
Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '龙哥离开', false)
|
|
|
|
|
|
}
|
|
}
|
|
roomState(){
|
|
if(User.getRoomGoodStatus() == 0){
|
|
// 妹妹对话
|
|
Common5.ReportDY("inLevel", '关卡00006-开始剧情');
|
|
|
|
JuQingManager.unLockNewJuQing('DH_1')
|
|
|
|
}else if(User.getRoomGoodStatus() == 2){
|
|
Common5.ReportDY("inLevel", '关卡00008-开始剧情');
|
|
JuQingManager.unLockNewJuQing('DH_2')
|
|
|
|
}else if(User.getRoomGoodStatus() == 3){
|
|
Common5.ReportDY("inLevel", '关卡000010-开始剧情');
|
|
JuQingManager.unLockNewJuQing('DH_3')
|
|
}else if(User.getRoomGoodStatus() == 6){
|
|
|
|
JuQingManager.unLockNewJuQing('DH_4')
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
stepGame(){
|
|
let roomGoodStatus = User.getRoomGoodStatus()
|
|
|
|
if(roomGoodStatus == 0){
|
|
// 妹妹对话
|
|
// this.nanzhuzuo.active = true
|
|
// Common5.playRemoteSpine(this.nanzhuzuo,'Spine/roomSpine','男主龙哥', '男主待机')
|
|
|
|
Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '男主沮丧')
|
|
}else if(roomGoodStatus == 1){
|
|
// Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '男主流汗')
|
|
// Common5.playRemoteSpine(this.dazuoNode,'Spine/roomSpine','打坐', '')
|
|
// 二次觉醒
|
|
// this.node.getChildByName('按钮').active = true
|
|
this.longgeComeing()
|
|
}else if(roomGoodStatus== 2){
|
|
|
|
Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '男主沮丧')
|
|
}else if(roomGoodStatus == 3){
|
|
|
|
this.longgeComeing()
|
|
}else if(roomGoodStatus == 4 || roomGoodStatus == 5 || roomGoodStatus == 6 || roomGoodStatus == 7){
|
|
let mainTaskInfo = User.getCurTaskId()
|
|
let mainId = mainTaskInfo[0]
|
|
if(mainId >= MainTaskIdEnum.MainTask_503){
|
|
this.longgeNode.active = false
|
|
this.nanzhuzuo.active = true
|
|
Common5.playRemoteSpine(this.nanzhuzuo,'Spine/roomSpine','男主龙哥', '男主待机')
|
|
this.nanzhuzuo.scaleX = -1
|
|
}else{
|
|
Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '龙哥举刀')
|
|
this.nanzhuzuo.active = true
|
|
Common5.playRemoteSpine(this.nanzhuzuo,'Spine/roomSpine','男主龙哥', '男主待机')
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// if(roomGoodStatus < 5){
|
|
// this.node.getChildByName('标题').active = true
|
|
// this.node.getChildByName('juQingTipNode').active = true
|
|
// }else{
|
|
// this.node.getChildByName('标题').active = false
|
|
// this.node.getChildByName('juQingTipNode').active = false
|
|
// }
|
|
}
|
|
ercijuexingBtnClick(event){
|
|
let target = event.target
|
|
target.active = false
|
|
this.longgeNode.active = false
|
|
this.dazuoNode.active = true
|
|
Common5.playRemoteSpine(this.dazuoNode,'Spine/roomSpine','打坐', '打坐1')
|
|
this.node.getChildByName('clickJueXing').active = true
|
|
|
|
}
|
|
|
|
|
|
|
|
juexingClick(event){
|
|
let target = event.target
|
|
|
|
this.clickJueXingIndex++
|
|
if(this.clickJueXingIndex==1){
|
|
Common5.ReportDY("inLevel", '关卡00007-开始剧情');
|
|
|
|
}
|
|
if(this.clickJueXingIndex == 5){
|
|
//target.getChildByName('手指箭头').active = false
|
|
}else if(this.clickJueXingIndex == 10){
|
|
Common5.playRemoteSpine(this.dazuoNode,'Spine/roomSpine','打坐', '一阶段')
|
|
}else if(this.clickJueXingIndex == 15){
|
|
Common5.playRemoteSpine(this.dazuoNode,'Spine/roomSpine','打坐', '二阶段')
|
|
}else if(this.clickJueXingIndex == 20){
|
|
//this.setAnim(this.dazuo, '二阶段', true)
|
|
Common5.playRemoteSpine(this.dazuoNode,'Spine/roomSpine','打坐', '三阶段')
|
|
this.node.getChildByName('clickJueXing').active = false
|
|
this.scheduleOnce(()=>{
|
|
//站立
|
|
this.dazuoNode.active = false
|
|
this.longgeNode.active = true
|
|
Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '男主沮丧')
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_501)
|
|
User.setRoomGoodStatus(2)
|
|
Common5.ReportDY("inLevel", '关卡00008-开始剧情');
|
|
JuQingManager.unLockNewJuQing('DH_2')
|
|
|
|
},0.5)
|
|
|
|
}
|
|
|
|
this.juexingPro.progress = this.clickJueXingIndex/this.clickJueXingMax
|
|
}
|
|
|
|
|
|
longgeComeing(){
|
|
User.setRoomGoodStatus(4)
|
|
|
|
Common5.ReportDY("inLevel", '关卡00009-开始剧情');
|
|
Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '龙哥进场', false)
|
|
this.scheduleOnce(()=>{
|
|
|
|
Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '龙哥男主待机', false)
|
|
|
|
this.scheduleOnce(()=>{
|
|
Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '龙哥打男主', false)
|
|
Common5.playRemoteAudioEffect('sound/diandiandian/龙哥打男主耳光')
|
|
|
|
this.scheduleOnce(()=>{
|
|
Common5.playRemoteSpine(this.longgeNode,'Spine/roomSpine','男主龙哥', '龙哥举刀')
|
|
this.nanzhuzuo.active = true
|
|
Common5.playRemoteSpine(this.nanzhuzuo,'Spine/roomSpine','男主龙哥', '男主待机')
|
|
JuQingManager.unLockNewJuQing('DH_3')
|
|
Common5.ReportDY("inLevel", '关卡000010-开始剧情');
|
|
//this.node.getChildByName('出门').active = true
|
|
},0.5)
|
|
},0.5)
|
|
},0.5)
|
|
|
|
|
|
}
|
|
|
|
|
|
// chumenClick(){
|
|
// this.node.removeFromParent()
|
|
// this.node.destroy()
|
|
// PrefabManage.loadPrefabByType(GameType.MainHall)
|
|
// }
|
|
|
|
|
|
|
|
// update (dt) {}
|
|
}
|
|
|