|
|
@@ -1,6 +1,6 @@
|
|
|
import Util from "../../before/util/Util";
|
|
|
import { Data } from "../../mk/data/Data";
|
|
|
-import { GameProp, VideoAdType } from "./GameData";
|
|
|
+import { GameProp, InterAdType, VideoAdType } from "./GameData";
|
|
|
|
|
|
/**
|
|
|
* @description 广告数据
|
|
|
@@ -104,7 +104,7 @@ export class AdData {
|
|
|
this.precision = data.precision;
|
|
|
this.ecpm_level = data.ecpm_level;
|
|
|
this.request_id = '';
|
|
|
- if(data.ext_info && data.ext_info.request_id){
|
|
|
+ if (data.ext_info && data.ext_info.request_id) {
|
|
|
this.request_id = data.ext_info.request_id;
|
|
|
}
|
|
|
}
|
|
|
@@ -157,11 +157,10 @@ export class AdData {
|
|
|
curData.setAdData(response.data);
|
|
|
}
|
|
|
|
|
|
- if(callBack)
|
|
|
- {
|
|
|
+ if (callBack) {
|
|
|
callBack(response.data);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//达到任务之后计算视频
|
|
|
if (gData.safeDepositBoxData.isStartBankTask > 0) {
|
|
|
gData.safeDepositBoxData.richBankDailyVideoTimes++
|
|
|
@@ -231,7 +230,7 @@ export class AdData {
|
|
|
"platformRisk": 1,
|
|
|
"request_id": '',
|
|
|
}
|
|
|
- if(data.ext_info && data.ext_info.request_id){
|
|
|
+ if (data.ext_info && data.ext_info.request_id) {
|
|
|
sData.request_id = data.ext_info.request_id;
|
|
|
}
|
|
|
}
|
|
|
@@ -292,12 +291,16 @@ export class AdData {
|
|
|
/** 检查是否显示插屏、互推(概率弹出)
|
|
|
* @type 1:弹出全屏插屏广告 2:延时弹出大插屏 3:先弹出插屏,再弹出大插屏 4:互推红包
|
|
|
*/
|
|
|
- checkShowFullInter(type, des = null) {
|
|
|
+ checkShowFullInter(type, des = null, rateType = null) {
|
|
|
let per = 0;
|
|
|
let pop = true;
|
|
|
switch (type) {
|
|
|
case 1:
|
|
|
- per = this.getPerByEcpm(RateConfig.RC_fullScreen);
|
|
|
+ if (rateType != null) {
|
|
|
+ per = this.getPerByEcpm(rateType);
|
|
|
+ } else {
|
|
|
+ per = this.getPerByEcpm(RateConfig.RC_fullScreen);
|
|
|
+ }
|
|
|
pop = Math.random() < per;
|
|
|
if (!pop) {
|
|
|
return pop;
|
|
|
@@ -308,7 +311,11 @@ export class AdData {
|
|
|
mk.ad.showInterAd(1, des);
|
|
|
break;
|
|
|
case 2:
|
|
|
- per = this.getPerByEcpm(RateConfig.RC_tableScreen);
|
|
|
+ if (rateType != null) {
|
|
|
+ per = this.getPerByEcpm(rateType);
|
|
|
+ } else {
|
|
|
+ per = this.getPerByEcpm(RateConfig.RC_tableScreen);
|
|
|
+ }
|
|
|
pop = Math.random() < per;
|
|
|
if (!pop) {
|
|
|
return pop;
|
|
|
@@ -322,8 +329,11 @@ export class AdData {
|
|
|
}, delay);
|
|
|
break;
|
|
|
case 3:
|
|
|
-
|
|
|
- per = this.getPerByEcpm(RateConfig.RC_tableScreen);
|
|
|
+ if (rateType != null) {
|
|
|
+ per = this.getPerByEcpm(rateType);
|
|
|
+ } else {
|
|
|
+ per = this.getPerByEcpm(RateConfig.RC_tableScreen);
|
|
|
+ }
|
|
|
pop = Math.random() < per;
|
|
|
if (!pop) {
|
|
|
return pop;
|
|
|
@@ -341,6 +351,11 @@ export class AdData {
|
|
|
}, delay1);
|
|
|
break;
|
|
|
case 4:
|
|
|
+ if (rateType != null) {
|
|
|
+ per = this.getPerByEcpm(rateType);
|
|
|
+ } else {
|
|
|
+ per = this.getPerByEcpm(RateConfig.RC_moreGameRedBag);
|
|
|
+ }
|
|
|
per = this.getPerByEcpm(RateConfig.RC_moreGameRedBag);
|
|
|
pop = Math.random() < per;
|
|
|
if (!pop) {
|
|
|
@@ -354,7 +369,7 @@ export class AdData {
|
|
|
}
|
|
|
|
|
|
/** 弹出插屏 */
|
|
|
- checkPopInter(des) {
|
|
|
+ checkPopInter(des, rateType = null) {
|
|
|
if (this.ABCInsertAdArr.indexOf(this.ecpmLevel.toString()) == -1) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -369,7 +384,7 @@ export class AdData {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.checkShowFullInter(index, des);
|
|
|
+ this.checkShowFullInter(index, des, rateType);
|
|
|
}
|
|
|
|
|
|
/** 点击提现弹出全屏插屏 */
|
|
|
@@ -411,9 +426,21 @@ export class AdData {
|
|
|
let span = this.AutoRedMoneyMap.get(this.ecpmLevel);
|
|
|
if (this.timeAd >= span) {
|
|
|
this.timeAd = 0;
|
|
|
- mk.ad.videoAdType = VideoAdType.video_init_19;
|
|
|
- gData.gameData.init_hideRedBag = true;
|
|
|
- mk.ui.openPanel('module/newOpenRedBag/newOpenRedBag');
|
|
|
+ // mk.ad.videoAdType = VideoAdType.video_init_19;
|
|
|
+ // gData.gameData.init_hideRedBag = true;
|
|
|
+ // mk.ui.openPanel('module/newOpenRedBag/newOpenRedBag');
|
|
|
+
|
|
|
+ //this.checkPopInter(InterAdType.interstitial1_click_19);
|
|
|
+
|
|
|
+ if (gData.gameData.insertAdSwitch[13] == "1") {
|
|
|
+ mk.ad.videoAdType = VideoAdType.video_init_22;
|
|
|
+ mk.ad.watchAd((success: boolean) => {
|
|
|
+ mk.console.log("watchAD:" + success);
|
|
|
+ if (success) {
|
|
|
+ gData.adData.watchVideo(null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -492,10 +519,15 @@ export class AdData {
|
|
|
return per;
|
|
|
}
|
|
|
case RateConfig.RC_popSpeedUp:
|
|
|
- if (gData.gameData.adShowConfig.average_ecpm <= parseInt(forceAd[i].ecpmMax)){
|
|
|
+ if (gData.gameData.adShowConfig.average_ecpm <= parseInt(forceAd[i].ecpmMax)) {
|
|
|
per = parseFloat(forceAd[i].jsPercent);
|
|
|
return per;
|
|
|
}
|
|
|
+ case RateConfig.RC_afterVideo:
|
|
|
+ if (gData.gameData.adShowConfig.average_ecpm <= parseInt(forceAd[i].ecpmMax)) {
|
|
|
+ per = parseFloat(forceAd[i].cpjlPercent);
|
|
|
+ return per;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -508,8 +540,7 @@ export class AdData {
|
|
|
if (!times) {
|
|
|
console.log('savePreLoadEcpm data ', data.adsource_price)
|
|
|
let response = await mk.http.sendData('user/savePreLoadEcpm', data);
|
|
|
- if(response.errcode != 0)
|
|
|
- {
|
|
|
+ if (response.errcode != 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -517,17 +548,15 @@ export class AdData {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async getOrderTaskInfo(isDefault)
|
|
|
- {
|
|
|
- if(!gData.gameData.playerProp.orderData)
|
|
|
- {
|
|
|
+ async getOrderTaskInfo(isDefault) {
|
|
|
+ if (!gData.gameData.playerProp.orderData) {
|
|
|
let data = {};
|
|
|
data["isDefault"] = isDefault;
|
|
|
let response = await mk.http.sendData('orderTask/getUserOrderTaskInfo', data);
|
|
|
- if(response.errcode != 0){
|
|
|
+ if (response.errcode != 0) {
|
|
|
return;
|
|
|
}
|
|
|
- gData.gameData.playerProp.orderData = response.data.userOrderTaskInfo;
|
|
|
+ gData.gameData.playerProp.orderData = response.data.userOrderTaskInfo;
|
|
|
|
|
|
mk.event.emit("initOrderUi");
|
|
|
}
|
|
|
@@ -559,5 +588,6 @@ export enum RateConfig {
|
|
|
RC_splash,
|
|
|
RC_superDouble,
|
|
|
RC_moreGameRedBag,
|
|
|
- RC_popSpeedUp
|
|
|
+ RC_popSpeedUp,
|
|
|
+ RC_afterVideo
|
|
|
}
|