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

214 lines
8.3 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 Common5 from "../../Platform/th/Common5";
import JuQingManager from "../JuQingChat/JuQingManager";
const {ccclass, property} = cc._decorator;
@ccclass
export default class HuanZhuangBei extends cc.Component {
// LIFE-CYCLE CALLBACKS:
@property (cc.Node)
chadianIconArray:cc.Node = null
// onLoad () {}
@property (cc.Node)
shouzhiAnim:cc.Node = null
isShow = false
checkInde = 0
isShowZuo = false
isShowSpine = false
isShowSpine_0 = false
start () {
JuQingManager.unLockNewJuQing('DH_9')
this.isShow = true
EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua,()=>{
this.checkChat()
},this)
EventMgr.onEvent_custom(ryw_Event.NormalTouchMoveCheck,(data)=>{
this.checkHz(data.targetNode)
},this)
EventMgr.onEvent_custom(ryw_Event.NewGuideEvent,(index)=>{
this.guideNewStep(index)
},this)
Common5.proLoadPicBuyUrl('huanZhuangBei/大剑')
Common5.proLoadPicBuyUrl('huanZhuangBei/徽章')
Common5.proLoadPicBuyUrl('huanZhuangBei/男主衣服')
Common5.proLoadPicBuyUrl('huanZhuangBei/披风1')
Common5.proLoadPicBuyUrl('huanZhuangBei/披风2')
// this.node.getChildByName('装备剑').getComponent(cc.Sprite)
// this.node.getChildByName('装备披风2').getComponent(cc.Sprite)
// this.node.getChildByName('装备衣服').getComponent(cc.Sprite)
// this.node.getChildByName('装备披风1').getComponent(cc.Sprite)
// this.node.getChildByName('装备徽章').getComponent(cc.Sprite)
this.loadSpien()
}
guideNewStep(index){
if(index == 4){
this.node.getChildByName('女主正常').active = false
this.node.getChildByName('女主头疼待机').active = true
Common5.playRemoteSpine(this.node.getChildByName('女主头疼待机'), 'Spine/LXYfakuang','女主站','女待机')
}
}
checkChat(){
let indexStr = JuQingManager.getCurJuQingUnLockIndex()
console.log(indexStr,'indexStr++++++++++++++')
if(this.isShow){
this.isShow = false
this.shouzhiAnim.active = true
this.node.getChildByName('guan').getComponent(cc.Button).interactable = true
}else if(this.isShowSpine_0){
this.isShowSpine_0 = false
// this.scheduleOnce(()=>{
// JuQingManager.unLockNewJuQing('DH_100')
// this.isShowSpine = true
// },0.5)
}else if(this.isShowSpine){
this.isShowSpine = false
this.node.getChildByName('女主正常').active = false
//this.node.getChildByName('女主头疼待机').active = false
//this.node.getChildByName('女主站发狂').active = true
//Common5.playRemoteSpine(this.node.getChildByName('女主站发狂'), 'Spine/HuanZhuangBei','女主站','女抓狂')
Common5.playRemoteSpine(this.node.getChildByName('女主头疼待机'), 'Spine/LXYfakuang','女主站','女抓狂')
this.node.getChildByName('器灵').active = true
Common5.playRemoteSpine(this.node.getChildByName('器灵'), 'Spine/HuanZhuangBei','器灵','animation')
this.scheduleOnce(()=>{
JuQingManager.unLockNewJuQing('DH_23')
this.isShowZuo = true
},0.5)
}else if(this.isShowZuo){
this.isShowZuo = false
this.node.getChildByName('女主站发狂').active = false
this.node.getChildByName('女主头疼待机').active = false
this.node.getChildByName('器灵').active = false
this.node.getChildByName('女主坐').active = true
this.node.getChildByName('器灵2').active = true
Common5.playRemoteSpine(this.node.getChildByName('器灵2'), 'Spine/HuanZhuangBei','器灵','animation')
Common5.playRemoteSpine(this.node.getChildByName('女主坐'), 'Spine/LXYfakuang','女主坐','女主坐')
this.scheduleOnce(()=>{
this.endGame()
},1.0)
}
}
loadSpien(){
Common5.loadRemoteSpine('Spine/HuanZhuangBei','穿衣服')
Common5.loadRemoteSpine('Spine/HuanZhuangBei','器灵')
}
checkHz(childNode){
this.checkInde++
let targetNode = childNode.parent
if(targetNode.name == '剑'){
Common5.addUrlSprite_custom('huanZhuangBei/大剑', this.node.getChildByName('装备剑').getComponent(cc.Sprite))
this.node.getChildByName('装备剑').active = true
}else if(targetNode.name == '徽章'){
Common5.addUrlSprite_custom('huanZhuangBei/徽章', this.node.getChildByName('装备徽章').getComponent(cc.Sprite))
this.node.getChildByName('装备徽章').active = true
}else if(targetNode.name == '披风'){
Common5.addUrlSprite_custom('huanZhuangBei/披风2', this.node.getChildByName('装备披风2').getComponent(cc.Sprite))
Common5.addUrlSprite_custom('huanZhuangBei/披风1', this.node.getChildByName('装备披风1').getComponent(cc.Sprite))
this.node.getChildByName('装备披风2').active = true
this.node.getChildByName('装备披风1').active = true
}else if(targetNode.name == '衣服'){
Common5.addUrlSprite_custom('huanZhuangBei/男主衣服', this.node.getChildByName('装备衣服').getComponent(cc.Sprite))
this.node.getChildByName('装备衣服').active = true
this.node.getChildByName('男主1').active = false
}
this.shouzhiAnim.active = false
if(this.checkInde == 4){
JuQingManager.unLockNewJuQing('DH_22')
this.isShowSpine = true
this.node.getChildByName('装备剑').active= false
this.node.getChildByName('装备披风2').active= false
this.node.getChildByName('装备衣服').active= false
this.node.getChildByName('装备披风1').active= false
this.node.getChildByName('装备徽章').active= false
this.node.getChildByName('男主1').active = false
this.node.getChildByName('穿衣服').active = true
this.node.getChildByName('kai').active = false
this.chadianIconArray.active = false
Common5.playRemoteSpine(this.node.getChildByName('穿衣服'), 'Spine/HuanZhuangBei','穿衣服','穿衣服')
Common5.loadRemoteSpine('Spine/LXYfakuang','女主坐')
//Common5.loadRemoteSpine('Spine/HuanZhuangBei','女主站')
Common5.loadRemoteSpine('Spine/LXYfakuang','女主站')
}
}
endGame(){
let name = this.node.name
this.node.removeFromParent()
this.node.destroy()
//EventMgr.emitEvent_custom(ryw_Event.ChuMenEvent)
EventMgr.emitEvent_custom(ryw_Event.ExitBtnEvent, name);
}
clickBoxEvent(){
this.shouzhiAnim.active = false
this.node.getChildByName('guan').active = false
this.node.getChildByName('kai').active = true
this.chadianIconArray.active = true
let kaiNode = this.node.getChildByName('kai')
for(let i= 0;i<kaiNode.childrenCount;i++){
let moveNode = kaiNode.children[i]
let endNode = this.chadianIconArray.children[i].getChildByName('icon')
let posi = Common5.getNodeToTargetPos(moveNode, endNode)
cc.tween(moveNode)
.to(0.5,{x:posi.x, y:posi.y,scale:1})
.call(()=>{
moveNode.active = false
endNode.active = true
})
.start()
}
this.scheduleOnce(()=>{
this.node.getChildByName('kai').active = false
},0.6)
}
// update (dt) {}
}