|
|
@@ -21,7 +21,9 @@ export class GameData {
|
|
|
/** 功能开启 */
|
|
|
public funOpenData: string[] = [];
|
|
|
|
|
|
- public gameData: PlayerInfoType;
|
|
|
+ public gameData: PlayerProp = null;
|
|
|
+ /** 标志位:刷新主界面货币 */
|
|
|
+ public init_coin: boolean = false;
|
|
|
|
|
|
public props: Map<number, number>;
|
|
|
|
|
|
@@ -38,6 +40,7 @@ export class GameData {
|
|
|
* @returns
|
|
|
*/
|
|
|
public async init() {
|
|
|
+
|
|
|
let data: any = { "versionCode": gData.appData.version };
|
|
|
let response = await mk.http.sendData('getAllConfigInfo', data);
|
|
|
if (response.errcode != 0) {
|
|
|
@@ -64,7 +67,7 @@ export class GameData {
|
|
|
return;
|
|
|
}
|
|
|
mk.console.logSingle("getInfoCrypt", response.data);
|
|
|
- this.gameData = response.data;
|
|
|
+ this.initPlayerProp(response.data)
|
|
|
|
|
|
if (this.props == null) {
|
|
|
this.props = new Map<number, number>();
|
|
|
@@ -84,6 +87,28 @@ export class GameData {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 初始化玩家数据
|
|
|
+ */
|
|
|
+ private initPlayerProp(res_data) {
|
|
|
+ this.gameData = new PlayerProp();
|
|
|
+ this.gameData.cashIndex = res_data.cashIndex;
|
|
|
+ this.gameData.gameUserData = res_data.gameUserData;
|
|
|
+ this.gameData.isSignInToday = res_data.isSignInToday;
|
|
|
+ this.gameData.isWithdrawable = res_data.isWithdrawable;
|
|
|
+ this.gameData.lastTime = res_data.lastTime;
|
|
|
+ this.gameData.loginDays = res_data.loginDays;
|
|
|
+ this.gameData.newPlayer = res_data.newPlayer;
|
|
|
+ this.gameData.piggyBank = res_data.piggyBank;
|
|
|
+ this.gameData.piggyBankCashTimes = res_data.piggyBankCashTimes;
|
|
|
+ this.gameData.redMoney = res_data.redMoney;
|
|
|
+ this.gameData.signInDay = res_data.signInDay;
|
|
|
+ this.gameData.totalPiggyBankCashTimes = res_data.totalPiggyBankCashTimes;
|
|
|
+ this.gameData.turntableTimes = res_data.turntableTimes;
|
|
|
+ this.gameData.userTuCaoInfo = res_data.userTuCaoInfo;
|
|
|
+ this.gameData.versioncfg = res_data.versioncfg;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 保存单个数据
|
|
|
*/
|
|
|
public async setProp(key: GameProp, value: number) {
|
|
|
@@ -184,6 +209,58 @@ export enum GameProp {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 玩家数据
|
|
|
+ */
|
|
|
+class PlayerProp {
|
|
|
+ /** 自定义不需要校验的数据 */
|
|
|
+ gameUserData = 0;
|
|
|
+ /** 今日是否有签到 */
|
|
|
+ isSignInToday = 0;
|
|
|
+
|
|
|
+ private _piggyBank: number = 0;
|
|
|
+ /** 存钱罐存款 */
|
|
|
+ set piggyBank(value: number) {
|
|
|
+ this._piggyBank = value;
|
|
|
+ gData.gameData.init_coin = true;
|
|
|
+ }
|
|
|
+ get piggyBank(): number {
|
|
|
+ return this._piggyBank;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 存钱罐能否提现 */
|
|
|
+ isWithdrawable = 0;
|
|
|
+ /** 存钱罐每日提现次数 */
|
|
|
+ piggyBankCashTimes = 0;
|
|
|
+ /** 累计存钱罐每日提现次数 */
|
|
|
+ totalPiggyBankCashTimes = 0;
|
|
|
+ /** 提现进度 */
|
|
|
+ cashIndex = 0;
|
|
|
+ /** 上次登录时间 */
|
|
|
+ lastTime = 0;
|
|
|
+ /** 登录天数 */
|
|
|
+ loginDays = 0;
|
|
|
+ newPlayer = 0;
|
|
|
+
|
|
|
+ private _redMoney: number = 0;
|
|
|
+ /** 红包币数量 */
|
|
|
+ set redMoney(value: number) {
|
|
|
+ this._redMoney = value;
|
|
|
+ gData.gameData.init_coin = true;
|
|
|
+ }
|
|
|
+ get redMoney(): number {
|
|
|
+ return this._redMoney;
|
|
|
+ }
|
|
|
+ /** 累计签到次数 客户端理解 上次签到天数 */
|
|
|
+ signInDay = 0;
|
|
|
+ /** 转盘次数 */
|
|
|
+ turntableTimes = 0;
|
|
|
+ /** 版本号 */
|
|
|
+ versioncfg = 0;
|
|
|
+ /** 福袋数据 */
|
|
|
+ userTuCaoInfo = 0;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
* 奖励状态
|
|
|
*/
|
|
|
export enum RewardState {
|