import { RecordTYPE } from "../datas/CommonData"; import GameM from "../manager/GameM"; import LogUtil from "../utils/LogUtil"; const { ccclass, property } = cc._decorator; @ccclass export default class MoneySaveItem extends cc.Component { @property(cc.Label) labDes: cc.Label = null; @property(cc.Label) labTime: cc.Label = null; @property(cc.Label) labAdd: cc.Label = null; @property(cc.Label) labelTotal: cc.Label = null; @property(cc.Node) readyTixianBtn: cc.Node = null; @property(cc.Label) sourceType: cc.Label = null; @property(cc.Label) yuanlabel: cc.Label = null; num: number tixian: boolean data:any callback: Function = null nodePos = [cc.v3(54,-63),cc.v3(313,57),cc.v3(572,-67),cc.v3(862,-67)] // LIFE-CYCLE CALLBACKS: // onLoad () {} start() { } init(data,tixian, callback: Function,index) { this.callback = callback this.tixian = tixian this.data = data this.labAdd.string = (this.data.amount * 0.01).toFixed(2)+"" // this.yuanlabel.string = "元" if(this.data.cashType == 1){ this.sourceType.string = "武将升级" this.sourceType.node.parent .active = true }else if(this.data.cashType == 2){ this.sourceType.string = "每日提现" this.sourceType.node.parent .active = true }else{ this.sourceType.node.parent .active = false } // if(!this.tixian){ // this.node.runAction(cc.repeatForever(cc.sequence(cc.spawn(cc.fadeTo(1,255),cc.scaleTo(1,1)),cc.spawn(cc.fadeTo(0.5,100),cc.scaleTo(0.5,0.6))))) // } let x = this.node.x this.node.y = - this.node.height * 0.5 * 1.5 this.node.getChildByName("Hand").active = false if(index == 1){ this.node.y = -200 if(!tixian){ this.node.getChildByName("Hand").active = true } this.node.position = this.nodePos[0] }else if(index == 2){ // this.node.y = 0 this.node.position = this.nodePos[1] }else if(index == 3){ // this.node.y = -200 this.node.position = this.nodePos[2] }else{ this.node.position = this.nodePos[3] } let y = this.node.y LogUtil.logV("moneySaveItem", x + " : " + y) let downAction = cc.moveTo(2, cc.v2(x, y - 10)) let upAction = cc.moveBy(0.5, cc.v2(x, y)) // this.node.runAction(cc.repeatForever(cc.sequence(downAction,upAction))) let delayTime = Math.random() this.scheduleOnce(() => { this.node.runAction(cc.repeatForever(cc.sequence(cc.moveTo(1.5, cc.v2(this.node.x, y - 5)), cc.moveTo(1.2, cc.v2(this.node.x, this.node.y + 5))))) }, delayTime) } clickAdd() { if (this.tixian) { // return } // this.node.destroy() this.unscheduleAllCallbacks() this.node.getChildByName("Hand").active = false if (this.callback) { this.callback(this.data, this.node) } } // update (dt) {} }