|
|
@@ -1,3 +1,5 @@
|
|
|
+import { Data } from "../../mk/data/Data";
|
|
|
+
|
|
|
/**
|
|
|
* @description 广告数据
|
|
|
* @author 邹勇
|
|
|
@@ -33,11 +35,15 @@ export class AdData {
|
|
|
return this._watchNumToday;
|
|
|
}
|
|
|
|
|
|
- private datas: any[];
|
|
|
-
|
|
|
+ private adMap: Map<number, Data>;
|
|
|
|
|
|
public init() {
|
|
|
- this.datas = [, gData.reward, gData.reward, gData.reward, gData.turnable, gData.sign, gData.blessingBag];
|
|
|
+ this.adMap.set(AdFun.bubble, gData.reward)
|
|
|
+ this.adMap.set(AdFun.checkpoint, gData.reward)
|
|
|
+ this.adMap.set(AdFun.settlement, gData.reward)
|
|
|
+ this.adMap.set(AdFun.turntable, gData.turnable)
|
|
|
+ this.adMap.set(AdFun.sign, gData.sign)
|
|
|
+ this.adMap.set(AdFun.bigCash, gData.blessingBag)
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -47,12 +53,12 @@ export class AdData {
|
|
|
public checkAdMax() {
|
|
|
this.watchNumToday++;
|
|
|
let max = parseInt(gData.gameData.configs.ServerConfig.VideoTimesMax);
|
|
|
- if(this.watchNumToday > max){
|
|
|
- mk.tip.pop("今日看广告获得奖励的次数已用完",1);
|
|
|
+ if (this.watchNumToday > max) {
|
|
|
+ mk.tip.pop("今日看广告获得奖励的次数已用完", 1);
|
|
|
mk.ui.closeAllUI();
|
|
|
return true;
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -108,11 +114,11 @@ export class AdData {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (this.datas[this.ad_subType]) {
|
|
|
- this.datas[this.ad_subType].setAdData(response.data);
|
|
|
+ let curData = this.adMap.get(this.ad_subType)
|
|
|
+ if (curData) {
|
|
|
+ curData.setAdData(response.data);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|