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

137 lines
5.1 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";
const {ccclass, property} = cc._decorator;
@ccclass
export default class WuXingYuanShi extends cc.Component {
@property(cc.Node)
chadianIcon:cc.Node[] = []
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
iconArray = ['金','木','水','火','土']
nanzhuSpine:cc.Node = null
dazuoSpine:cc.Node = null
longzhennanSpine:cc.Node = null
rongheSpine:cc.Node = null
yuanshiNode:cc.Node = null
chooseIndex = 0
start () {
this.nanzhuSpine = this.node.getChildByName('男主')
this.dazuoSpine = this.node.getChildByName('打坐')
this.longzhennanSpine = this.node.getChildByName('龙镇南') // 待机 进场
this.rongheSpine = this.node.getChildByName('融合spine')
this.yuanshiNode = this.node.getChildByName('原石背景')
EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua,()=>{
this.scheduleOnce(()=>{
this.endGame()
},2.0)
},this)
EventMgr.onEvent_custom(ryw_Event.NormalTouchMoveCheck,(obj)=>{
this.checkTouchMove(obj)
},this)
for(let i= 0; i<this.iconArray.length;i++){
let node = this.chadianIcon[i]
let str = this.iconArray[i]
Common5.addUrlSprite_custom('Spine/WuXingYuanShi/icon/'+str,node.getComponent(cc.Sprite))
}
this.duihuaView()
}
duihuaView(){
let indexStr = JuQingManager.getCurJuQingUnLockIndex()
if(indexStr == 'DH_17'){
this.yuanshiNode.active = false
this.node.getChildByName('道具框2').active = false
this.node.getChildByName('chadianIconArray').active = false
this.rongheSpine.active = false
this.nanzhuSpine.active = true
this.dazuoSpine.active = false
Common5.playRemoteSpine( this.nanzhuSpine, 'Spine/roomSpine','男主','男主')
this.longzhennanSpine.active = true
Common5.playRemoteSpine( this.longzhennanSpine, 'Spine/WuXingYuanShi','龙镇南','待机')
}
}
endGame(){
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if(mainId == MainTaskIdEnum.MainTask_537){
let name = this.node.name
this.node.removeFromParent()
this.node.destroy()
EventMgr.emitEvent_custom(ryw_Event.ChuMenEvent)
EventMgr.emitEvent_custom(ryw_Event.ExitBtnEvent, name);
}
}
checkTouchMove(obj){
let targetNode = obj.targetNode
if(targetNode.checkNode){
targetNode.checkNode.active = true
let icon = targetNode.checkNode.getChildByName('icon').getComponent(cc.Sprite)
Common5.addUrlSprite_custom('Spine/WuXingYuanShi/icon/'+targetNode.name,icon)
}
console.log(targetNode.name)
this.chooseIndex++
if(this.chooseIndex == 1){
Common5.loadRemoteSpine('Spine/WuXingYuanShi','融合')
}else if(this.chooseIndex == 3){
Common5.loadRemoteSpine('Spine/roomSpine','男主')
}else if(this.chooseIndex == 5){
Common5.loadRemoteSpine('Spine/WuXingYuanShi','龙镇南')
this.rongheSpine.active = true
this.yuanshiNode.active = false
this.node.getChildByName('道具框2').active = false
this.node.getChildByName('chadianIconArray').active = false
Common5.playRemoteSpine( this.rongheSpine, 'Spine/WuXingYuanShi','融合','融合',false)
this.rongheSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
this.scheduleOnce(()=>{
this.rongheSpine.active = false
this.nanzhuSpine.active = true
this.dazuoSpine.active = false
Common5.playRemoteSpine( this.nanzhuSpine, 'Spine/roomSpine','男主','男主')
this.scheduleOnce(()=>{
this.longzhennanSpine.active = true
Common5.playRemoteSpine( this.longzhennanSpine, 'Spine/WuXingYuanShi','龙镇南','进场',false)
this.scheduleOnce(()=>{
Common5.playRemoteSpine( this.longzhennanSpine, 'Spine/WuXingYuanShi','龙镇南','待机')
JuQingManager.unLockNewJuQing('DH_17')
},0.5)
},0.5)
},1.0)
})
}
}
// update (dt) {}
}