|
|
@@ -12,6 +12,8 @@ export class RedBagCashData extends Data {
|
|
|
* 数据初始化
|
|
|
*/
|
|
|
public init() {
|
|
|
+ // 签到进度
|
|
|
+ this.cash_bar = gData.gameData.getProp(GameProp.redBag_cash_bar);
|
|
|
// 签到配置表
|
|
|
if (gData.gameData.configs.CashCfg) {
|
|
|
gData.gameData.configs.CashCfg.forEach(item_data => {
|
|
|
@@ -23,7 +25,6 @@ export class RedBagCashData extends Data {
|
|
|
this.sortList();
|
|
|
this.init_list = true;
|
|
|
}
|
|
|
- this.cash_bar = gData.gameData.getProp(GameProp.redBag_cash_bar);
|
|
|
// this.cash_bar = gData.gameData.gameData.cashIndex;// 服务端数据
|
|
|
}
|
|
|
/** 标志位:初始化列表 */
|
|
|
@@ -32,10 +33,15 @@ export class RedBagCashData extends Data {
|
|
|
/** 配置表数据 */
|
|
|
public c_data: Array<CDataType> = [];
|
|
|
|
|
|
- /** 标志位:初始化指定列表 */
|
|
|
- public old_index = null;
|
|
|
+ private _cash_bar: number = 0;
|
|
|
/** 提现进度 */
|
|
|
- cash_bar: number = 0;
|
|
|
+ set cash_bar(value: number) {
|
|
|
+ this._cash_bar = value;
|
|
|
+ this.init_list = true;
|
|
|
+ }
|
|
|
+ get cash_bar() {
|
|
|
+ return this._cash_bar;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 提现操作
|
|
|
@@ -43,7 +49,6 @@ export class RedBagCashData extends Data {
|
|
|
public cashOP() {
|
|
|
/** 提现档位 */
|
|
|
const cash_index = this.cash_bar;
|
|
|
- this.old_index = cash_index;
|
|
|
this.cash_bar++;
|
|
|
gData.gameData.setProp(GameProp.redBag_cash_bar, this.cash_bar);
|
|
|
|
|
|
@@ -60,11 +65,14 @@ export class RedBagCashData extends Data {
|
|
|
*/
|
|
|
private sortList() {
|
|
|
const l_count = this.c_data.length;
|
|
|
+ let index = 0;
|
|
|
for (let i = 0; i < l_count; i++) {
|
|
|
- if (this.c_data[i].index <= gData.redBagCash.cash_bar) {
|
|
|
- let item_data = this.c_data.splice(i, 1) as any;
|
|
|
- this.c_data.push(item_data);
|
|
|
+ if (this.c_data[index].index <= gData.redBagCash.cash_bar) {
|
|
|
+ let item_data = this.c_data.splice(index, 1);
|
|
|
+ this.c_data.push(item_data[0]);
|
|
|
+ index--;
|
|
|
}
|
|
|
+ index++;
|
|
|
}
|
|
|
}
|
|
|
|