咸鱼的反击
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.
 
 
 
xianyudefanji/assets/Scripts/DH/CuiKuanScript.ts

94 lines
3.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 TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import UserManager from "../Manager/UserManager";
const {ccclass, property} = cc._decorator;
@ccclass
export default class CuiKuanScript extends cc.Component {
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
EventMgr.onEvent_custom(ryw_Event.NormalTouchMoveCheck, (data_) => {
this.normalTouchCallback(data_.targetNode);
}, this);
this.powuState()
EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua,()=>{
// this.setNaiNaiSpineStatus()
this.powuState()
},this)
let shenniang = this.node.getChildByName('婶娘')
Common5.playRemoteSpine(shenniang,'Spine/room','撒钱','女生气')
}
powuState(){
let num = User.getRoomGoodStatus()
if(num>=7){
if(num == 9 || num == 10){
}else{
this.node.removeFromParent()
this.node.destroy()
}
}
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if(mainId == MainTaskIdEnum.MainTask_509){
this.node.getChildByName('moneyNode').active = true
this.node.getChildByName('手指箭头').active = true
}
let taskIdArray = User.getCurTaskId()
if((taskIdArray[0] == MainTaskIdEnum.MainTask_509 && taskIdArray[1] == 1)){
// let shenniang = this.node.getChildByName('婶娘')
let shenniang = this.node.getChildByName('婶娘')
Common5.playRemoteSpine(shenniang,'Spine/room','撒钱','女高兴')
}
}
normalTouchCallback(targetNode:cc.Node){
console.log("+++++++++++++++++++++>" + targetNode.name);
if (targetNode.name == "money") {
targetNode.active = false
this.node.getChildByName('moneyNode').active = false
this.node.getChildByName('手指箭头').active = false
let shenniang = this.node.getChildByName('婶娘')
let shaqian = this.node.getChildByName('撒钱')
shaqian.active = true
// shaqian.getComponent(sp.Skeleton).setAnimation(0, '撒钱', false)
Common5.playRemoteSpine(shaqian,'Spine/room','撒钱','撒钱', false)
shaqian.getComponent(sp.Skeleton).setCompleteListener(()=>{
//shenniang.getComponent(sp.Skeleton).setAnimation(0, '女高兴', true)
Common5.playRemoteSpine(shenniang,'Spine/room','撒钱','女高兴')
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_509)
UserManager.subMoney(20000)
})
}
}
// update (dt) {}
}