cc.Class({ extends: cc.Component, properties: { snbDaysLabel: { default: null, type: cc.Label, serializable: true, }, receivesSnbLabel: { default: null, type: cc.Label, serializable: true, }, snbProgressBar: { default: null, type: cc.ProgressBar, serializable: true, } }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start() { }, //设置领取snb信息 /** * beginTime: "2022-03-01 00:00:00" id: 163 receivedDay: 0 receivedQuantity: 0 status: 1 totalDay: 100 totalQuantity: 155570 unitQuantity: 1555.7 userId: "4" * @param {*} data */ setVillageReceivesSnbInfo(data) { // this.snbDaysLabel.string = data.receivedDay + '/' + data.totalDay; this.snbDaysLabel.string = data.receivedQuantity + '/' + data.totalQuantity; if(0 != data.totalDay){ this.receivesSnbLabel.string = 'x' + data.totalQuantity/data.totalDay; } if (0 != data.totalQuantity) { // this.snbProgressBar.progress = data.receivedDay / data.totalDay; this.snbProgressBar.progress = data.receivedQuantity / data.totalQuantity; } }, //获取一个收入 onGetReceivesSnbEvent() { GlobalD.GameData.onReceiveCntToSnb((value) => { //领取一个收入状态 // todo 后面完善提示 GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), value.msg, 1); //重新获取一下snb,会自动更新到面板 GlobalD.GameData.onGetUserSnb() GlobalD.GameData.onGetCntToSnb((value) => { console.log("当前用户转换的snb", value); if (value.data != null) { this.setVillageReceivesSnbInfo(value.data); } }) }); } // update (dt) {}, });