|
|
@@ -120,6 +120,9 @@ export class GameData {
|
|
|
public orderAinFinishNum = 0;
|
|
|
|
|
|
public welfareOpenLimit = 0;
|
|
|
+
|
|
|
+ public insertAdLimit = 0;
|
|
|
+ public insertAdSwitch: string[] = [];
|
|
|
/**
|
|
|
* 初始化游戏数据:网络配置信息,用户信息
|
|
|
* @returns
|
|
|
@@ -183,7 +186,7 @@ export class GameData {
|
|
|
// console.log('config ', data);
|
|
|
this.configs = data;
|
|
|
this.funOpenData = this.configs.ServerConfig.Functionswitch.split(",");
|
|
|
-
|
|
|
+
|
|
|
//从服务器解析配置
|
|
|
this.setProductMapFromJson();
|
|
|
|
|
|
@@ -201,6 +204,9 @@ export class GameData {
|
|
|
gData.safeDepositBoxData.richBankConfig = this.configs.BankTask;
|
|
|
|
|
|
gData.gameData.welfareOpenLimit = parseInt(this.configs.ServerConfig.welfareOpen);
|
|
|
+
|
|
|
+ gData.gameData.insertAdLimit = parseInt(this.configs.ServerConfig.InsertAdCash);
|
|
|
+ gData.gameData.insertAdSwitch = this.configs.ServerConfig.InsertAdScene.split(",");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -234,7 +240,7 @@ export class GameData {
|
|
|
this.playerProp.userFarmTaskInfo = res_data.userFarmTaskInfo;
|
|
|
this.playerProp.speedUpLeftTimes = res_data.speedUpLeftTimes;
|
|
|
this.playerProp.completeFarmTaskTimes = res_data.completeFarmTaskTimes;
|
|
|
- if(res_data.userOrderTaskInfo){
|
|
|
+ if (res_data.userOrderTaskInfo) {
|
|
|
this.playerProp.orderData = res_data.userOrderTaskInfo;
|
|
|
console.log("============userOrderTaskInfo123");
|
|
|
}
|
|
|
@@ -243,7 +249,7 @@ export class GameData {
|
|
|
//this.playerProp.orderData.overTimes = 3;
|
|
|
//this.cloneOrderData();
|
|
|
this.playerProp.curProductionAdTimes = res_data.dailyProductionTimes;
|
|
|
-
|
|
|
+
|
|
|
mk.data.setTAUserID(gData.loginData.uin);
|
|
|
mk.data.setTAEventUser(0, 'logindays_total', this.playerProp.loginDays);
|
|
|
if (this.playerProp.completeFarmTaskTimes == 0) {
|
|
|
@@ -336,14 +342,13 @@ export class GameData {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public setOrderAniFinishNum()
|
|
|
- {
|
|
|
+ public setOrderAniFinishNum() {
|
|
|
++this.orderAinFinishNum;
|
|
|
- if(this.orderAinFinishNum >= 3){
|
|
|
+ if (this.orderAinFinishNum >= 3) {
|
|
|
this.orderAinFinishNum = 0;
|
|
|
setTimeout(() => {
|
|
|
mk.event.emit("flyOrderAni");
|
|
|
- }, 500)
|
|
|
+ }, 500)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -701,43 +706,41 @@ export class GameData {
|
|
|
}
|
|
|
if (factoryArray.length > 0) {
|
|
|
matchSuccessFactorys = gData.factorySystem.isHaveEmptyFactory(factoryArray);
|
|
|
- if(matchSuccessFactorys.length > 0){
|
|
|
+ if (matchSuccessFactorys.length > 0) {
|
|
|
typeArr.push(1);
|
|
|
}
|
|
|
}
|
|
|
if (animalArray.length > 0) {
|
|
|
matchSuccessPastures = gData.pastureSystem.isHaveEmptyPasture(animalArray);
|
|
|
- if(matchSuccessPastures.length > 0){
|
|
|
+ if (matchSuccessPastures.length > 0) {
|
|
|
typeArr.push(2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(typeArr.length > 0)
|
|
|
- {
|
|
|
- let rand = mk.math.random(0, typeArr.length-1);
|
|
|
+ if (typeArr.length > 0) {
|
|
|
+ let rand = mk.math.random(0, typeArr.length - 1);
|
|
|
let type = typeArr[rand];
|
|
|
if (type == 0) {
|
|
|
- let randCrop = mk.math.random(0, cropArray.length-1);
|
|
|
+ let randCrop = mk.math.random(0, cropArray.length - 1);
|
|
|
id = cropArray[randCrop];
|
|
|
this.nextType = 1
|
|
|
return this.getProductMap(id);
|
|
|
} else if (type == 1) {
|
|
|
- let randFactory = mk.math.random(0, matchSuccessFactorys.length-1);
|
|
|
+ let randFactory = mk.math.random(0, matchSuccessFactorys.length - 1);
|
|
|
let factory = matchSuccessFactorys[randFactory];
|
|
|
this.nextCanProduct = this.getProductMap(factory.picture);
|
|
|
this.nextMake = factory.key;
|
|
|
this.nextType = 3;
|
|
|
return this.nextMake;
|
|
|
} else if (type == 2) {
|
|
|
- let randPasture = mk.math.random(0, matchSuccessPastures.length-1);
|
|
|
+ let randPasture = mk.math.random(0, matchSuccessPastures.length - 1);
|
|
|
let pasture = matchSuccessPastures[randPasture];
|
|
|
this.nextCanProduct = this.getProductMap(pasture.data.productID);
|
|
|
this.nextMake = pasture
|
|
|
this.nextType = 2;
|
|
|
return pasture;
|
|
|
}
|
|
|
- }else
|
|
|
- {
|
|
|
+ } else {
|
|
|
id = Util.rnd(10001, this.getMaxProductExtra(ProductType.nzw));
|
|
|
this.nextType = 1
|
|
|
return this.getProductMap(id);
|
|
|
@@ -748,7 +751,7 @@ export class GameData {
|
|
|
return this.getProductMap(id);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public doJudgeOrderLogic(out?: any) {
|
|
|
let data = this.playerProp.orderData;
|
|
|
if (data) {
|
|
|
@@ -834,7 +837,7 @@ export class GameData {
|
|
|
if (isHaveEmpty && startIndex == value) {
|
|
|
isHaveEmpty.state = true;
|
|
|
}
|
|
|
- if (picId == pastureIconsData[index].data.productID) {
|
|
|
+ if (picId == pastureIconsData[index].data.productID) {
|
|
|
this.nextCanProduct = this.getProductMap(pastureIconsData[index].data.productID);
|
|
|
this.nextMake = pastureIconsData[index];
|
|
|
this.nextType = 2;
|
|
|
@@ -854,7 +857,7 @@ export class GameData {
|
|
|
isHaveEmpty.state = true;
|
|
|
}
|
|
|
let tab = this.getTabByConfigID(factoryIconsData[index].configID);
|
|
|
- if (tab == ProductType[key]) {
|
|
|
+ if (tab == ProductType[key]) {
|
|
|
this.nextCanProduct = this.getProductMap(picId);
|
|
|
this.nextMake = factoryIconsData[index];
|
|
|
this.nextType = 3;
|
|
|
@@ -937,25 +940,25 @@ export class GameData {
|
|
|
flyRed = false;
|
|
|
break;
|
|
|
case 1:
|
|
|
- if(this.popSpeedUpByRate()){
|
|
|
+ if (this.popSpeedUpByRate()) {
|
|
|
flyRed = false;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
flyRed = await gData.farmSystem.btnMake();
|
|
|
gData.adData.checkPopRed();
|
|
|
}
|
|
|
break;
|
|
|
case 2:
|
|
|
- if(this.popSpeedUpByRate()){
|
|
|
+ if (this.popSpeedUpByRate()) {
|
|
|
flyRed = false;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
flyRed = await gData.pastureSystem.btnMake();
|
|
|
gData.adData.checkPopRed();
|
|
|
}
|
|
|
break;
|
|
|
case 3:
|
|
|
- if(this.popSpeedUpByRate()){
|
|
|
+ if (this.popSpeedUpByRate()) {
|
|
|
flyRed = false;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
flyRed = await gData.factorySystem.btnMake();
|
|
|
gData.adData.checkPopRed();
|
|
|
}
|
|
|
@@ -1263,12 +1266,12 @@ export class GameData {
|
|
|
if (this._productMakeTimesData.productUnlockMaxId) {
|
|
|
let productId = this._productMakeTimesData.productUnlockMaxId.get(tab);
|
|
|
if (productId) {
|
|
|
- if(id > productId){
|
|
|
+ if (id > productId) {
|
|
|
this._productMakeTimesData.productUnlockMaxId.set(tab, id);
|
|
|
console.log(`addProductUnlockMaxId====${tab}====${id}`);
|
|
|
return true;
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
console.log(`addProductUnlockMaxId22====${tab}====${id}`);
|
|
|
this._productMakeTimesData.productUnlockMaxId.set(tab, id);
|
|
|
return true;
|
|
|
@@ -1376,18 +1379,17 @@ export class GameData {
|
|
|
let id = 30001;
|
|
|
let data = null;
|
|
|
for (var i = 0; i < len1; i++) {
|
|
|
- if(this.playerProp.orderData)
|
|
|
- {
|
|
|
+ if (this.playerProp.orderData) {
|
|
|
if (this.playerProp.orderData.overTimes < arr[i].value) {
|
|
|
data = { id: id, state: PastureState.Lock, productID: arr[i].picture, growSpan: 0 };
|
|
|
}
|
|
|
else {
|
|
|
data = { id: id, state: PastureState.Empty, productID: arr[i].picture, growSpan: 0 };
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
data = { id: id, state: PastureState.Lock, productID: arr[i].picture, growSpan: 0 };
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this._pastureData.push(data);
|
|
|
this._pastureDataMap.set(id, data);
|
|
|
id++;
|
|
|
@@ -1453,7 +1455,7 @@ export class GameData {
|
|
|
for (var i = 0; i < 6; i++) {
|
|
|
tab = this.getTabByConfigID(id);
|
|
|
let arr = this.getProductArrByType(tab);
|
|
|
- if(this.playerProp.orderData){
|
|
|
+ if (this.playerProp.orderData) {
|
|
|
if (this.playerProp.orderData.overTimes < arr[0].value) {
|
|
|
data = { id: id, state: FactroyState.Lock, productID: 0, growSpan: 0 };
|
|
|
}
|
|
|
@@ -1467,10 +1469,10 @@ export class GameData {
|
|
|
// isUpdate = is;
|
|
|
// }
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
data = { id: id, state: FactroyState.Lock, productID: 0, growSpan: 0 };
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this._factoryData.push(data);
|
|
|
this._factoryDataMap.set(id, data);
|
|
|
id++;
|
|
|
@@ -1690,17 +1692,17 @@ export class GameData {
|
|
|
let maxId = 0;
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
data = this.getPastureDataMap(id);
|
|
|
- if(this.playerProp.orderData){
|
|
|
+ if (this.playerProp.orderData) {
|
|
|
if (this.playerProp.orderData.overTimes >= configArr[i].value) {
|
|
|
if (data.state == PastureState.Lock) {
|
|
|
data = { id: id, state: PastureState.Empty, productID: configArr[i].picture, growSpan: 0 };
|
|
|
this.setPastureDataMap(id, data, false);
|
|
|
needUpdate = true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
maxId = configArr[i].picture;
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
id++;
|
|
|
}
|
|
|
console.log(`checkTaskFinishUnLock11=====${maxId}`);
|
|
|
@@ -1724,7 +1726,7 @@ export class GameData {
|
|
|
needUpdate = false;
|
|
|
let configID = this.getConfigIDByTab(tab);
|
|
|
data = this.getFactoryDataMap(configID);
|
|
|
- if(this.playerProp.orderData){
|
|
|
+ if (this.playerProp.orderData) {
|
|
|
if (this.playerProp.orderData.overTimes >= configArr[0].value) {
|
|
|
if (data.state == FactroyState.Lock) {
|
|
|
data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
|
|
|
@@ -1775,19 +1777,17 @@ export class GameData {
|
|
|
return can;
|
|
|
}
|
|
|
|
|
|
- popSpeedUpByRate()
|
|
|
- {
|
|
|
+ popSpeedUpByRate() {
|
|
|
let isPop = false;
|
|
|
let rate = gData.adData.getPerByEcpm(RateConfig.RC_popSpeedUp);
|
|
|
- if(rate >= Math.random())
|
|
|
- {
|
|
|
+ if (rate >= Math.random()) {
|
|
|
isPop = gData.pastureSystem.canSpeedUp();
|
|
|
if (!isPop) {
|
|
|
isPop = gData.factorySystem.canSpeedUp();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(isPop){
|
|
|
+ if (isPop) {
|
|
|
mk.ui.openPanel('module/speedUpUI/speedUp');
|
|
|
}
|
|
|
return isPop;
|
|
|
@@ -1858,6 +1858,81 @@ export class GameData {
|
|
|
console.log("------");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ popTableScreenADLogic(type: number) {
|
|
|
+ let str = null;
|
|
|
+ switch (type) {
|
|
|
+ case 0:
|
|
|
+ str = InterAdType.interstitial1_click_1;
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ str = InterAdType.interstitial1_click_2;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ str = InterAdType.interstitial1_click_3;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ str = InterAdType.interstitial1_click_4;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ str = InterAdType.interstitial1_click_5;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ str = InterAdType.interstitial1_click_6;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ str = InterAdType.interstitial1_click_7;
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ str = InterAdType.interstitial1_click_8;
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ str = InterAdType.interstitial1_click_9;
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ str = InterAdType.interstitial1_click_10;
|
|
|
+ break;
|
|
|
+ case 10:
|
|
|
+ str = InterAdType.interstitial1_click_11;
|
|
|
+ break;
|
|
|
+ case 11:
|
|
|
+ str = InterAdType.interstitial1_click_12;
|
|
|
+ break;
|
|
|
+ case 12:
|
|
|
+ str = InterAdType.interstitial1_click_13;
|
|
|
+ break;
|
|
|
+ case 13:
|
|
|
+ str = InterAdType.interstitial1_click_14;
|
|
|
+ break;
|
|
|
+ case 14:
|
|
|
+ str = InterAdType.interstitial1_click_15;
|
|
|
+ break;
|
|
|
+ case 15:
|
|
|
+ str = InterAdType.interstitial1_click_16;
|
|
|
+ break;
|
|
|
+ case 16:
|
|
|
+ str = InterAdType.interstitial1_click_17;
|
|
|
+ break;
|
|
|
+ case 17:
|
|
|
+ str = InterAdType.interstitial1_click_18;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ let index = 0;
|
|
|
+ let rateType = null;
|
|
|
+ if(type <= 11){
|
|
|
+ index = type;
|
|
|
+ }else{
|
|
|
+ index = 12;
|
|
|
+ rateType = RateConfig.RC_afterVideo;
|
|
|
+ }
|
|
|
+ if(str != null){
|
|
|
+ let cashTimes = gData.gameData.getProp(GameProp.cashOutTimes);
|
|
|
+ let str = gData.gameData.insertAdSwitch[index];
|
|
|
+ if(str == "1" && cashTimes >= gData.gameData.insertAdLimit){
|
|
|
+ gData.adData.checkPopInter(str, rateType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -2219,7 +2294,9 @@ export enum DataEventId {
|
|
|
/**互推红包弹出位置 */
|
|
|
htRedBag_scene = "htRedBag_scene",
|
|
|
/**互推红包领取次数*/
|
|
|
- htRedBag_eject = "htRedBag_eject"
|
|
|
+ htRedBag_eject = "htRedBag_eject",
|
|
|
+ /**插屏广告弹出*/
|
|
|
+ interstita11_eject = "interstita11_eject"
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2257,9 +2334,26 @@ export enum InterFullAdType {
|
|
|
export enum InterAdType {
|
|
|
interstitial1_click_1 = '恭喜发财红包弹出后',
|
|
|
interstitial1_click_2 = '恭喜获得弹窗弹出后',
|
|
|
- interstitial1_click_3 = '生虫/生病/停电弹出后'
|
|
|
+ interstitial1_click_3 = '生虫/生病/停电弹出后',
|
|
|
+ interstitial1_click_4 = '关闭抽奖界面后',
|
|
|
+ interstitial1_click_5 = '关闭任务红包后',
|
|
|
+ interstitial1_click_6 = '关闭富翁银行后',
|
|
|
+ interstitial1_click_7 = '打开领取生产次数界面',
|
|
|
+ interstitial1_click_8 = '农作物点击可收获',
|
|
|
+ interstitial1_click_9 = '关闭全体加速后',
|
|
|
+ interstitial1_click_10 = '关闭福利后',
|
|
|
+ interstitial1_click_11 = '打开个人资料页',
|
|
|
+ interstitial1_click_12 = '打开更多游戏页',
|
|
|
+ interstitial1_click_13 = '全体加速激励视频播完后',
|
|
|
+ interstitial1_click_14 = '离线奖励激励视频播完后',
|
|
|
+ interstitial1_click_15 = '抽奖激励视频播完后',
|
|
|
+ interstitial1_click_16 = '图鉴领奖激励视频播完后',
|
|
|
+ interstitial1_click_17 = '拓建激励视频播完后',
|
|
|
+ interstitial1_click_18 = '收获超级加倍激励视频播完后',
|
|
|
+ interstitial1_click_19 = '定时弹出插屏',
|
|
|
}
|
|
|
|
|
|
+
|
|
|
export enum BannerAdType {
|
|
|
banner_click_1 = '恭喜获得弹窗弹出后',
|
|
|
banner_click_2 = '任务红包',
|
|
|
@@ -2322,7 +2416,7 @@ export enum FactroyState {
|
|
|
}
|
|
|
|
|
|
//功能开关含义
|
|
|
-export enum FunctionSwitch{
|
|
|
+export enum FunctionSwitch {
|
|
|
FS_farmGrade = 0, //农场等级奖励
|
|
|
FS_cashOutBtn = 1, //主界面提现按钮
|
|
|
FS_sign = 2, //签到
|