|
|
@@ -26,7 +26,7 @@ export class GameData {
|
|
|
/** 功能开启 */
|
|
|
public funOpenData: string[] = [];
|
|
|
|
|
|
- public gameData: PlayerProp = null;
|
|
|
+ public playerProp: PlayerProp = null;
|
|
|
/** 标志位:刷新主界面货币 */
|
|
|
public init_coin: boolean = false;
|
|
|
|
|
|
@@ -85,6 +85,8 @@ export class GameData {
|
|
|
|
|
|
//标志位 生产奖励的任务ui刷新
|
|
|
public init_productTask = false;
|
|
|
+
|
|
|
+ public speedUpLeftTimes = 0;
|
|
|
/**
|
|
|
* 初始化游戏数据:网络配置信息,用户信息
|
|
|
* @returns
|
|
|
@@ -129,7 +131,7 @@ export class GameData {
|
|
|
// if (response.errcode != 0) {
|
|
|
// return;
|
|
|
// }
|
|
|
- // this.gameData.userTuCaoInfo = response.data.userWelFareTaskInfo;
|
|
|
+ // this.playerProp.userTuCaoInfo = response.data.userWelFareTaskInfo;
|
|
|
// mk.console.logSingle("welFare/getUserWelFareTaskInfo", response.data);
|
|
|
gData.guideData.init();
|
|
|
gData.guideWeakData.init();
|
|
|
@@ -152,33 +154,33 @@ 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.initPiggyBank(res_data.piggyBank);
|
|
|
- this.gameData.piggyBankCashTimes = res_data.piggyBankCashTimes;
|
|
|
- this.gameData.redMoney = res_data.redMoney == null ? 0 : res_data.redMoney;
|
|
|
- this.gameData.signInDay = res_data.signInDay;
|
|
|
- this.gameData.totalPiggyBankCashTimes = res_data.totalPiggyBankCashTimes;
|
|
|
- this.gameData.turntableTimes = res_data.turntableTimes;
|
|
|
- this.gameData.versioncfg = res_data.versioncfg;
|
|
|
- this.gameData.isFirstRedMoney = res_data.isFirstRedMoney;
|
|
|
+ this.playerProp = new PlayerProp();
|
|
|
+ this.playerProp.cashIndex = res_data.cashIndex;
|
|
|
+ this.playerProp.gameUserData = res_data.gameUserData;
|
|
|
+ this.playerProp.isSignInToday = res_data.isSignInToday;
|
|
|
+ this.playerProp.isWithdrawable = res_data.isWithdrawable;
|
|
|
+ this.playerProp.lastTime = res_data.lastTime;
|
|
|
+ this.playerProp.loginDays = res_data.loginDays;
|
|
|
+ this.playerProp.newPlayer = res_data.newPlayer;
|
|
|
+ this.playerProp.initPiggyBank(res_data.piggyBank);
|
|
|
+ this.playerProp.piggyBankCashTimes = res_data.piggyBankCashTimes;
|
|
|
+ this.playerProp.redMoney = res_data.redMoney == null ? 0 : res_data.redMoney;
|
|
|
+ this.playerProp.signInDay = res_data.signInDay;
|
|
|
+ this.playerProp.totalPiggyBankCashTimes = res_data.totalPiggyBankCashTimes;
|
|
|
+ this.playerProp.turntableTimes = res_data.turntableTimes;
|
|
|
+ this.playerProp.versioncfg = res_data.versioncfg;
|
|
|
+ this.playerProp.isFirstRedMoney = res_data.isFirstRedMoney;
|
|
|
gData.adData.watchNumToday = res_data.dayVideoTimesForRedMoney == null ? 0 : res_data.dayVideoTimesForRedMoney;
|
|
|
|
|
|
- this.gameData.gradeLevel = res_data.farmLevel
|
|
|
- this.gameData.userTuCaoInfo = res_data.userWelFareTaskInfo;
|
|
|
- this.gameData.farmExpValue = res_data.userExp;
|
|
|
- this.gameData.farmGradeData = res_data.userFarmGrageRewardInfo;
|
|
|
- this.gameData.userNoviceWeFareInfo = res_data.userNoviceWeFareInfo;
|
|
|
- this.gameData.redMoneyCashPayRecordList = res_data.redMoneyCashPayRecordList;
|
|
|
+ this.playerProp.gradeLevel = res_data.farmLevel
|
|
|
+ this.playerProp.userTuCaoInfo = res_data.userWelFareTaskInfo;
|
|
|
+ this.playerProp.farmExpValue = res_data.userExp;
|
|
|
+ this.playerProp.farmGradeData = res_data.userFarmGrageRewardInfo;
|
|
|
+ this.playerProp.userNoviceWeFareInfo = res_data.userNoviceWeFareInfo;
|
|
|
+ this.playerProp.redMoneyCashPayRecordList = res_data.redMoneyCashPayRecordList;
|
|
|
mk.console.logSingle('userNoviceWeFareInfo==>', res_data.userNoviceWeFareInfo);
|
|
|
//mk.console.logSingle('redMoneyCashPayRecordList==>', res_data.redMoneyCashPayRecordList);
|
|
|
- this.gameData.userFarmTaskInfo = res_data.userFarmTaskInfo;
|
|
|
+ this.playerProp.userFarmTaskInfo = res_data.userFarmTaskInfo;
|
|
|
|
|
|
mk.data.setTAUserID(gData.loginData.uin);
|
|
|
|
|
|
@@ -186,7 +188,7 @@ export class GameData {
|
|
|
gData.loginData.isFirstIn = false;
|
|
|
|
|
|
mk.data.setTAEventRegister();
|
|
|
- mk.data.sendDataEvent('ABTest', `触发${this.gameData.groupCode}方案`);
|
|
|
+ mk.data.sendDataEvent('ABTest', `触发${this.playerProp.groupCode}方案`);
|
|
|
|
|
|
//注册时版本号
|
|
|
mk.data.setTAEventUserStr(0, 'regtime_app_id', gData.appData.appVersion);
|
|
|
@@ -365,18 +367,6 @@ export class GameData {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 第二天需要重置的数据
|
|
|
- */
|
|
|
- public resetProps() {
|
|
|
- let arr = [];
|
|
|
- arr.push({ key: GameProp.sign_can, value: 1 });
|
|
|
- arr.push({ key: GameProp.isAutoOpenPanel, value: 1 });
|
|
|
- arr.push({ key: GameProp.isOpenBankOnCloseCash, value: 0 });
|
|
|
-
|
|
|
- this.setProps(arr);
|
|
|
- }
|
|
|
-
|
|
|
/** 是否是新用户 */
|
|
|
public isNewPlayer(): boolean {
|
|
|
let v = this.getProp(GameProp.newPlayer);
|
|
|
@@ -498,9 +488,9 @@ export class GameData {
|
|
|
// if (gData.gameData.init_redBagTask) {
|
|
|
// return;
|
|
|
// }
|
|
|
- if (gData.gameData.gameData.userFarmTaskInfo) {
|
|
|
- let com = gData.gameData.gameData.userFarmTaskInfo.completeCount;
|
|
|
- let count = gData.gameData.gameData.userFarmTaskInfo.taskCount;
|
|
|
+ if (this.playerProp.userFarmTaskInfo) {
|
|
|
+ let com = this.playerProp.userFarmTaskInfo.completeCount;
|
|
|
+ let count = this.playerProp.userFarmTaskInfo.taskCount;
|
|
|
|
|
|
if (com >= count)
|
|
|
return;
|
|
|
@@ -513,7 +503,7 @@ export class GameData {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- gData.gameData.gameData.userFarmTaskInfo = response.data.userFarmTaskInfo;
|
|
|
+ this.playerProp.userFarmTaskInfo = response.data.userFarmTaskInfo;
|
|
|
//gData.gameData.init_task = true;
|
|
|
}
|
|
|
|
|
|
@@ -724,7 +714,7 @@ export class GameData {
|
|
|
let id = 30001;
|
|
|
let data = null;
|
|
|
for (var i = 0; i < len1; i++) {
|
|
|
- if (this.gameData.gradeLevel < arr[i].value) {
|
|
|
+ if (this.playerProp.gradeLevel < arr[i].value) {
|
|
|
data = { id: id, state: PastureState.Lock, productID: arr[i].picture, growSpan: 0 };
|
|
|
}
|
|
|
else {
|
|
|
@@ -790,7 +780,7 @@ export class GameData {
|
|
|
for (var i = 0; i < 6; i++) {
|
|
|
tab = this.getTabByConfigID(id);
|
|
|
let arr = this.getProductArrByType(tab);
|
|
|
- if (this.gameData.gradeLevel < arr[0].value) {
|
|
|
+ if (this.playerProp.gradeLevel < arr[0].value) {
|
|
|
data = { id: id, state: FactroyState.Lock, productID: 0, growSpan: 0 };
|
|
|
}
|
|
|
else {
|
|
|
@@ -945,7 +935,7 @@ export class GameData {
|
|
|
needUpdate = false;
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
data = this.getPastureDataMap(id);
|
|
|
- if (data.state == PastureState.Lock && this.gameData.gradeLevel >= configArr[i].value) {
|
|
|
+ if (data.state == PastureState.Lock && this.playerProp.gradeLevel >= configArr[i].value) {
|
|
|
data = { id: id, state: PastureState.Empty, productID: configArr[i].picture, growSpan: 0 };
|
|
|
this.setPastureDataMap(id, data, false);
|
|
|
needUpdate = true;
|
|
|
@@ -963,7 +953,7 @@ export class GameData {
|
|
|
needUpdate = false;
|
|
|
let configID = this.getConfigIDByTab(tab);
|
|
|
data = this.getFactoryDataMap(configID);
|
|
|
- if (data.state == FactroyState.Lock && this.gameData.gradeLevel >= configArr[0].value) {
|
|
|
+ if (data.state == FactroyState.Lock && this.playerProp.gradeLevel >= configArr[0].value) {
|
|
|
data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
|
|
|
this.setFactoryDataMap(configID, data, false);
|
|
|
needUpdate = true;
|
|
|
@@ -980,6 +970,19 @@ export class GameData {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ checkCanSpeedUp() {
|
|
|
+ let can = false;
|
|
|
+ can = gData.farmSystem.canSpeedUp();
|
|
|
+ if (!can) {
|
|
|
+ can = gData.pastureSystem.canSpeedUp();
|
|
|
+ if (!can) {
|
|
|
+ can = gData.factorySystem.canSpeedUp();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return can;
|
|
|
+ }
|
|
|
+
|
|
|
setHarvest() {
|
|
|
gData.farmSystem.setHarvest();
|
|
|
gData.pastureSystem.setHarvest();
|
|
|
@@ -1029,21 +1032,11 @@ export enum GameProp {
|
|
|
//红包任务tag
|
|
|
redBagTaskRefresh = 18,
|
|
|
|
|
|
-
|
|
|
+ //加速剩余次数
|
|
|
+ speedUpLeftTimes = 19,
|
|
|
|
|
|
/** ------------------ 转盘数据 ------------------------------ */
|
|
|
turnable_leftTimes = 20,
|
|
|
-
|
|
|
- /** ------------------ 存钱罐数据 ----------------------------- */
|
|
|
-
|
|
|
- /** ------------------ 签到数据 ----------------------------- */
|
|
|
- /** 上次签到进度 */
|
|
|
- sign_last_bar = 120,
|
|
|
- /** 当前能否签到 */
|
|
|
- sign_can = 121,
|
|
|
- /** ------------------ 红包提现 ----------------------------- */
|
|
|
- /** 提现进度 */
|
|
|
- redBag_cash_bar = 220,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1072,7 +1065,7 @@ class PlayerProp {
|
|
|
/** 存钱罐存款 */
|
|
|
set piggyBank(value: number) {
|
|
|
if (this._piggyBank === value) return;
|
|
|
- if (gData.gameData.gameData.isWithdrawable && value > 0) return;// 存钱罐可提现状态,不能增加存钱罐金额
|
|
|
+ if (gData.gameData.playerProp.isWithdrawable && value > 0) return;// 存钱罐可提现状态,不能增加存钱罐金额
|
|
|
this._piggyBank = value;
|
|
|
gData.gameData.init_coin = true;
|
|
|
gData.pigbank.init_data = true;
|