|
|
@@ -244,6 +244,7 @@ export class GameData {
|
|
|
this.setPastureDataMapByServer();
|
|
|
this.setFactoryDataMapByServer();
|
|
|
this.initSetMaxProduct();
|
|
|
+ this.initProductTimes();
|
|
|
this.initLeftTimes();
|
|
|
this.initFarmMapGetRewardData();
|
|
|
}
|
|
|
@@ -409,6 +410,7 @@ export class GameData {
|
|
|
firstCheckNext() {
|
|
|
if (!this.hasFirstCheck && gData.pastureSystem.pastureIcons.length >= 3 && gData.factorySystem.factoryIcons.length >= 6) {
|
|
|
this.hasFirstCheck = true;
|
|
|
+ Util.objSortByKey(gData.pastureSystem.pastureIcons, 'sortID');
|
|
|
gData.gameData.setNextProduct(false);
|
|
|
}
|
|
|
}
|
|
|
@@ -500,6 +502,9 @@ export class GameData {
|
|
|
this._farmDataMap.set(this._farmData[i].id, this._farmData[i]);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //初始化产品最大次数
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -571,14 +576,20 @@ export class GameData {
|
|
|
let curConfig = this.getProductMap(id);
|
|
|
let nextConfig = this.getProductMap(nextID);
|
|
|
|
|
|
- if (id == this.getMaxProduct(this.configs.tab)) {
|
|
|
- gData.plantData.init_itemIndex = id;
|
|
|
+ if (id == this.getMaxProduct(curConfig.tab)) {
|
|
|
+ if (nextConfig) {
|
|
|
+ gData.plantData.init_itemIndex = nextID;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (nextConfig) {
|
|
|
if (nextConfig.tab == curConfig.tab && nextID > this.getMaxProduct(curConfig.tab)) {
|
|
|
if (nextConfig.unlock == 1 && nextConfig.value <= times) {
|
|
|
this.setMaxProduct(curConfig.tab, nextID);
|
|
|
+ let nConfig = this.getProductMap(nextID + 1);
|
|
|
+ if (nConfig) {
|
|
|
+ gData.plantData.init_lock = nextID + 1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -831,6 +842,14 @@ export class GameData {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private initProductTimes() {
|
|
|
+ this._productMakeTimesData = this.getProp(GameProp.productMakeTimes);
|
|
|
+ let len = this._productMakeTimesData.length;
|
|
|
+ for (var i = 0; i < len; i++) {
|
|
|
+ this._productMakeTimesMap.set(this._productMakeTimesData[i].id, this._productMakeTimesData[i].times);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/** 农场升级时解锁工厂,检查最大可种植/生产商品 */
|
|
|
public checkGradeUpUnLock() {
|
|
|
for (var key in ProductType) {
|