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)] hasClick = false; init(data, tixian, callback: Function, index) { if (this.hasClick) { return } this.hasClick = true; this.callback = callback this.tixian = tixian this.data = data this.labAdd.string = (this.data.amount * 0.01).toFixed(2) + "" this.yuanlabel.string = "元" let cashTypeDes = ''; switch (this.data.cashType) { case 1: cashTypeDes = '常规提现'; break; case 10: cashTypeDes = '福袋提现'; break; case 11: cashTypeDes = '视频红包提现'; break; case 12: cashTypeDes = '金猪币提现'; break; case 13: cashTypeDes = '现金提现'; break; default: cashTypeDes = ''; break; } this.sourceType.string = cashTypeDes; this.sourceType.node.parent.active = true; if (cashTypeDes == '') { this.sourceType.node.parent.active = false; } // if (this.data.cashType == 1) { // this.sourceType.node.parent.active = true // } else if (this.data.cashType == 2) { // this.sourceType.string = "每日提现" // } else { // this.sourceType.node.parent.active = false // } 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 mk.console.logSingle("moneySaveItem", x + " : " + y) 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) } cool = false; clickAdd() { if (this.cool) { return } this.cool = true; this.scheduleOnce(() => { this.cool = false; }, 2) this.unscheduleAllCallbacks() this.node.getChildByName("Hand").active = false if (this.callback) { this.callback(this.data, this.node) this.hasClick = false; } } }