|
|
@@ -42,6 +42,8 @@ export default class PiggyBankModel {
|
|
|
public static deposit: Map<number, number> = new Map();
|
|
|
/** 存入存钱罐内的红包币【服务端累加值】 */
|
|
|
public static piggyBox: number = 0;
|
|
|
+ /** 上一次存入的红包 */
|
|
|
+ private static last_piggyBox: number = 0;
|
|
|
/** 是否达到存储上限 */
|
|
|
public static piggyBoxFull: boolean = false;
|
|
|
/** 当前请求红包币的概率【百分比】 */
|
|
|
@@ -63,11 +65,17 @@ export default class PiggyBankModel {
|
|
|
cc.log('训练获得红包币:', reply)
|
|
|
let data = reply.data;
|
|
|
if (data && data.code === 1) {
|
|
|
- this.piggyBoxFull = !!data.piggyBoxFull;
|
|
|
- this.piggyBox = data.piggyBox;
|
|
|
- let size = this.deposit.size;
|
|
|
- this.deposit.set(size, this.piggyBox);
|
|
|
- this.flyRedBagToMain();
|
|
|
+ let data2 = data.data;
|
|
|
+ this.piggyBoxFull = !!data2.piggyBoxFull;
|
|
|
+ this.piggyBox = data2.piggyBox;
|
|
|
+ if (!this.piggyBoxFull) {
|
|
|
+ let gap = this.piggyBox - this.last_piggyBox;
|
|
|
+ let size = this.deposit.size;
|
|
|
+ this.deposit.set(size, gap);
|
|
|
+ this.flyRedBagToMain();
|
|
|
+ this.last_piggyBox = this.piggyBox;
|
|
|
+ }
|
|
|
+ this.bank_cash_value = data2.piggyBoxYesterday;
|
|
|
} else {
|
|
|
|
|
|
}
|