@chiyou/minigame-framework 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/dist/Framework/Adapter/AdAdapter/AbsAdAdapter.d.ts +78 -0
- package/dist/Framework/Adapter/AdAdapter/AbsAdAdapter.js +230 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterBilibili.d.ts +31 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterBilibili.js +224 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterDouYin.d.ts +34 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterDouYin.js +524 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterHonor.d.ts +34 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterHonor.js +631 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterHuaWei.d.ts +33 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterHuaWei.js +460 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterJingDong.d.ts +31 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterJingDong.js +227 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterKuaiShou.d.ts +33 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterKuaiShou.js +458 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterOppo.d.ts +35 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterOppo.js +770 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterTapTap.d.ts +33 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterTapTap.js +519 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterVivo.d.ts +33 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterVivo.js +492 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterWeiXin.d.ts +33 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterWeiXin.js +695 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterXiaoMi.d.ts +34 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterXiaoMi.js +597 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterZhiFuBao.d.ts +33 -0
- package/dist/Framework/Adapter/AdAdapter/AdAdapterZhiFuBao.js +458 -0
- package/dist/Framework/Adapter/PlatformAdapter/AbsPlatformAdapter.d.ts +51 -0
- package/dist/Framework/Adapter/PlatformAdapter/AbsPlatformAdapter.js +17 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterBilibili.d.ts +45 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterBilibili.js +555 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDesktopBrowser.d.ts +44 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDesktopBrowser.js +148 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDouYin.d.ts +48 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDouYin.js +715 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHonor.d.ts +44 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHonor.js +296 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHuaWei.d.ts +45 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHuaWei.js +284 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterJingDong.d.ts +44 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterJingDong.js +283 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterKuaiShou.d.ts +43 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterKuaiShou.js +406 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterOppo.d.ts +43 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterOppo.js +248 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterTapTap.d.ts +44 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterTapTap.js +517 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterVivo.d.ts +44 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterVivo.js +295 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterWeiXin.d.ts +55 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterWeiXin.js +964 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterXiaoMi.d.ts +44 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterXiaoMi.js +295 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterZhiFuBao.d.ts +44 -0
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterZhiFuBao.js +393 -0
- package/dist/Framework/Definition/AdDefinition.d.ts +130 -0
- package/dist/Framework/Definition/AdDefinition.js +208 -0
- package/dist/Framework/Definition/FrameworkBase.d.ts +13 -0
- package/dist/Framework/Definition/FrameworkBase.js +23 -0
- package/dist/Framework/Definition/PrivacyDefinition.d.ts +51 -0
- package/dist/Framework/Definition/PrivacyDefinition.js +70 -0
- package/dist/Framework/Definition/SocialDefinition.d.ts +16 -0
- package/dist/Framework/Definition/SocialDefinition.js +2 -0
- package/dist/Framework/Definition/SystemDefinition.d.ts +43 -0
- package/dist/Framework/Definition/SystemDefinition.js +28 -0
- package/dist/Framework/Definition/UIDefinition.d.ts +6 -0
- package/dist/Framework/Definition/UIDefinition.js +7 -0
- package/dist/Framework/Definition/UserDefinition.d.ts +14 -0
- package/dist/Framework/Definition/UserDefinition.js +10 -0
- package/dist/Framework/Manager/AdMgr.d.ts +57 -0
- package/dist/Framework/Manager/AdMgr.js +684 -0
- package/dist/Framework/Manager/AudioMgr.d.ts +28 -0
- package/dist/Framework/Manager/AudioMgr.js +265 -0
- package/dist/Framework/Manager/BaseMgr.d.ts +18 -0
- package/dist/Framework/Manager/BaseMgr.js +114 -0
- package/dist/Framework/Manager/EventMgr.d.ts +18 -0
- package/dist/Framework/Manager/EventMgr.js +90 -0
- package/dist/Framework/Manager/ExcelMgr.d.ts +24 -0
- package/dist/Framework/Manager/ExcelMgr.js +156 -0
- package/dist/Framework/Manager/LifeCycleMgr.d.ts +20 -0
- package/dist/Framework/Manager/LifeCycleMgr.js +110 -0
- package/dist/Framework/Manager/NodePoolMgr.d.ts +53 -0
- package/dist/Framework/Manager/NodePoolMgr.js +279 -0
- package/dist/Framework/Manager/PrivacyMgr.d.ts +15 -0
- package/dist/Framework/Manager/PrivacyMgr.js +176 -0
- package/dist/Framework/Manager/ResMgr.d.ts +49 -0
- package/dist/Framework/Manager/ResMgr.js +337 -0
- package/dist/Framework/Manager/SocialMgr.d.ts +23 -0
- package/dist/Framework/Manager/SocialMgr.js +220 -0
- package/dist/Framework/Manager/SystemMgr.d.ts +24 -0
- package/dist/Framework/Manager/SystemMgr.js +222 -0
- package/dist/Framework/Manager/TimerMgr.d.ts +11 -0
- package/dist/Framework/Manager/TimerMgr.js +63 -0
- package/dist/Framework/Manager/UIMgr.d.ts +33 -0
- package/dist/Framework/Manager/UIMgr.js +223 -0
- package/dist/Framework/Manager/UserMgr.d.ts +15 -0
- package/dist/Framework/Manager/UserMgr.js +148 -0
- package/dist/Framework/Utils/BezierUtils.d.ts +49 -0
- package/dist/Framework/Utils/BezierUtils.js +247 -0
- package/dist/Framework/Utils/CSVUtils.d.ts +35 -0
- package/dist/Framework/Utils/CSVUtils.js +341 -0
- package/dist/Framework/Utils/LogUtils.d.ts +7 -0
- package/dist/Framework/Utils/LogUtils.js +32 -0
- package/dist/Framework/Utils/NumberUtils.d.ts +16 -0
- package/dist/Framework/Utils/NumberUtils.js +44 -0
- package/dist/Framework/Utils/TaskUtils.d.ts +10 -0
- package/dist/Framework/Utils/TaskUtils.js +24 -0
- package/dist/Framework/Utils/TimeUtils.d.ts +19 -0
- package/dist/Framework/Utils/TimeUtils.js +33 -0
- package/dist/Framework/Utils/WXBizDataCryptUtils.d.ts +12 -0
- package/dist/Framework/Utils/WXBizDataCryptUtils.js +37 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +35 -0
- package/package.json +40 -0
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
import { InterstitialAd_Callback_Status, RewardedVideoAd_Callback_Status, AdDefinition } from "../../Definition/AdDefinition";
|
|
2
|
+
import { PlatformID } from "../../Definition/SystemDefinition";
|
|
3
|
+
import { LogUtils } from "../../Utils/LogUtils";
|
|
4
|
+
import { InterstitialAdStatus, RewardedVideoAdStatus, AbsAdAdapter } from "./AbsAdAdapter";
|
|
5
|
+
class HonorBannerAd {
|
|
6
|
+
constructor(adUnitId, ad, isFirstLoad) {
|
|
7
|
+
this.unitId = adUnitId;
|
|
8
|
+
this.ad = ad;
|
|
9
|
+
this.errorListener = null;
|
|
10
|
+
this.loadListener = null;
|
|
11
|
+
this.resizeListener = null;
|
|
12
|
+
this.isRecreating = false;
|
|
13
|
+
this.isFirstLoad = isFirstLoad;
|
|
14
|
+
}
|
|
15
|
+
destroy() {
|
|
16
|
+
if (this.ad !== null) {
|
|
17
|
+
if (this.errorListener !== null) {
|
|
18
|
+
this.ad.offError(this.errorListener);
|
|
19
|
+
this.errorListener = null;
|
|
20
|
+
}
|
|
21
|
+
if (this.loadListener !== null) {
|
|
22
|
+
this.ad.offLoad(this.loadListener);
|
|
23
|
+
this.loadListener = null;
|
|
24
|
+
}
|
|
25
|
+
if (this.resizeListener !== null) {
|
|
26
|
+
this.ad.offResize(this.resizeListener);
|
|
27
|
+
this.resizeListener = null;
|
|
28
|
+
}
|
|
29
|
+
this.ad.destroy();
|
|
30
|
+
this.ad = null;
|
|
31
|
+
}
|
|
32
|
+
this.isRecreating = false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class HonorInterstitialAd {
|
|
36
|
+
constructor(adUnitId, callback) {
|
|
37
|
+
this.unitId = adUnitId;
|
|
38
|
+
this.ad = null;
|
|
39
|
+
this.status = InterstitialAdStatus.Status_Init;
|
|
40
|
+
this.callback = callback;
|
|
41
|
+
this.errorListener = null;
|
|
42
|
+
this.loadListener = null;
|
|
43
|
+
this.closeListener = null;
|
|
44
|
+
this.isShowImmediately = false;
|
|
45
|
+
}
|
|
46
|
+
destroy() {
|
|
47
|
+
if (this.ad !== null) {
|
|
48
|
+
if (this.errorListener !== null) {
|
|
49
|
+
this.ad.offError(this.errorListener);
|
|
50
|
+
this.errorListener = null;
|
|
51
|
+
}
|
|
52
|
+
if (this.loadListener !== null) {
|
|
53
|
+
this.ad.offLoad(this.loadListener);
|
|
54
|
+
this.loadListener = null;
|
|
55
|
+
}
|
|
56
|
+
if (this.closeListener !== null) {
|
|
57
|
+
this.ad.offClose(this.closeListener);
|
|
58
|
+
this.closeListener = null;
|
|
59
|
+
}
|
|
60
|
+
this.ad.destroy();
|
|
61
|
+
this.ad = null;
|
|
62
|
+
}
|
|
63
|
+
this.isShowImmediately = false;
|
|
64
|
+
this.status = InterstitialAdStatus.Status_Destroyed;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class HonorRewardedVideoAd {
|
|
68
|
+
constructor(adUnitId, callback) {
|
|
69
|
+
this.unitId = adUnitId;
|
|
70
|
+
this.ad = null;
|
|
71
|
+
this.status = RewardedVideoAdStatus.Status_Destroyed;
|
|
72
|
+
this.callback = callback;
|
|
73
|
+
this.errorListener = null;
|
|
74
|
+
this.loadListener = null;
|
|
75
|
+
this.closeListener = null;
|
|
76
|
+
this.isShowImmediately = false;
|
|
77
|
+
}
|
|
78
|
+
destroy() {
|
|
79
|
+
if (this.ad !== null) {
|
|
80
|
+
if (this.errorListener !== null) {
|
|
81
|
+
this.ad.offError(this.errorListener);
|
|
82
|
+
this.errorListener = null;
|
|
83
|
+
}
|
|
84
|
+
if (this.loadListener !== null) {
|
|
85
|
+
this.ad.offLoad(this.loadListener);
|
|
86
|
+
this.loadListener = null;
|
|
87
|
+
}
|
|
88
|
+
if (this.closeListener !== null) {
|
|
89
|
+
this.ad.offClose(this.closeListener);
|
|
90
|
+
this.closeListener = null;
|
|
91
|
+
}
|
|
92
|
+
this.ad.destroy();
|
|
93
|
+
this.ad = null;
|
|
94
|
+
}
|
|
95
|
+
this.isShowImmediately = false;
|
|
96
|
+
this.status = RewardedVideoAdStatus.Status_Destroyed;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
class HonorPortalAd {
|
|
100
|
+
constructor(adUnitId, ad) {
|
|
101
|
+
this.unitId = adUnitId;
|
|
102
|
+
this.ad = ad;
|
|
103
|
+
this.errorListener = null;
|
|
104
|
+
this.loadListener = null;
|
|
105
|
+
this.showListener = null;
|
|
106
|
+
this.closeListener = null;
|
|
107
|
+
this.isLoaded = false;
|
|
108
|
+
this.isShowing = false;
|
|
109
|
+
this.isRecreating = false;
|
|
110
|
+
}
|
|
111
|
+
destroy() {
|
|
112
|
+
if (this.ad !== null) {
|
|
113
|
+
if (this.errorListener !== null) {
|
|
114
|
+
this.ad.offError(this.errorListener);
|
|
115
|
+
this.errorListener = null;
|
|
116
|
+
}
|
|
117
|
+
if (this.loadListener !== null) {
|
|
118
|
+
this.ad.offLoad(this.loadListener);
|
|
119
|
+
this.loadListener = null;
|
|
120
|
+
}
|
|
121
|
+
if (this.showListener !== null) {
|
|
122
|
+
this.ad.offShow(this.showListener);
|
|
123
|
+
this.showListener = null;
|
|
124
|
+
}
|
|
125
|
+
if (this.closeListener !== null) {
|
|
126
|
+
this.ad.offClose(this.closeListener);
|
|
127
|
+
this.closeListener = null;
|
|
128
|
+
}
|
|
129
|
+
this.ad.destroy();
|
|
130
|
+
this.ad = null;
|
|
131
|
+
}
|
|
132
|
+
this.isLoaded = false;
|
|
133
|
+
this.isShowing = false;
|
|
134
|
+
this.isRecreating = false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export class AdAdapterHonor extends AbsAdAdapter {
|
|
138
|
+
constructor() {
|
|
139
|
+
super(...arguments);
|
|
140
|
+
this.honorInterstitialAd = null;
|
|
141
|
+
this.honorRewardedVideoAd = null;
|
|
142
|
+
this.honorBannerAds = [];
|
|
143
|
+
this.honorPortalAds = [];
|
|
144
|
+
}
|
|
145
|
+
init(interstitialAdUnitId, interstitialAdCallback, rewardedVideoAdUnitId, rewardedVideoAdCallback) {
|
|
146
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "init()");
|
|
147
|
+
this.honorInterstitialAd = new HonorInterstitialAd(interstitialAdUnitId, interstitialAdCallback);
|
|
148
|
+
this.honorRewardedVideoAd = new HonorRewardedVideoAd(rewardedVideoAdUnitId, rewardedVideoAdCallback);
|
|
149
|
+
this.honorBannerAds = [];
|
|
150
|
+
this.honorPortalAds = [];
|
|
151
|
+
}
|
|
152
|
+
createBannerAd(adUnitId) {
|
|
153
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "createBannerAd()");
|
|
154
|
+
let isFirstLoad = true;
|
|
155
|
+
for (let i = 0; i < this.honorBannerAds.length; i++) {
|
|
156
|
+
if (this.honorBannerAds[i].unitId === adUnitId) {
|
|
157
|
+
isFirstLoad = this.honorBannerAds[i].isFirstLoad;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
this.destroyBannerAd(adUnitId);
|
|
162
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "createBannerAd() adUnitId=" + adUnitId);
|
|
163
|
+
let bannerAdInfo = AdDefinition.AdInfoConfig.BannerAd_Info;
|
|
164
|
+
if (bannerAdInfo === null || !bannerAdInfo.shouldShow) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
let bannerAdPlatformInfo = AdDefinition.BannerAdStyleConfig.get(PlatformID.ID_QuickGame_Honor);
|
|
168
|
+
if (bannerAdPlatformInfo === null) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
let bannerAdPosition = this.calcBannerAdPosition(bannerAdInfo, bannerAdPlatformInfo);
|
|
172
|
+
let bannerAdParam = {
|
|
173
|
+
adUnitId: adUnitId,
|
|
174
|
+
style: {
|
|
175
|
+
width: bannerAdPosition.realWidth,
|
|
176
|
+
left: bannerAdPosition.left,
|
|
177
|
+
top: bannerAdPosition.top,
|
|
178
|
+
gravity: "top|left",
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
if (bannerAdPlatformInfo.canAutoRefresh) {
|
|
182
|
+
bannerAdParam.adIntervals = bannerAdPlatformInfo.refreshInterval;
|
|
183
|
+
}
|
|
184
|
+
let bannerAd = window["qg"].createBannerAd(bannerAdParam);
|
|
185
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "qg.createBannerAd() " + (bannerAd !== null ? "success" : "fail"));
|
|
186
|
+
LogUtils.Instance.log("", bannerAd);
|
|
187
|
+
if (!bannerAd) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
let honorBannerAd = new HonorBannerAd(adUnitId, bannerAd, isFirstLoad);
|
|
191
|
+
this.honorBannerAds.push(honorBannerAd);
|
|
192
|
+
honorBannerAd.errorListener = (err) => {
|
|
193
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorBannerAd.ad.onError()");
|
|
194
|
+
if (err) {
|
|
195
|
+
LogUtils.Instance.log("", err);
|
|
196
|
+
}
|
|
197
|
+
if (!honorBannerAd.isRecreating) {
|
|
198
|
+
honorBannerAd.isRecreating = true;
|
|
199
|
+
this.scheduleOnce(() => {
|
|
200
|
+
honorBannerAd.isRecreating = false;
|
|
201
|
+
this.createBannerAd(adUnitId);
|
|
202
|
+
}, 15);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
honorBannerAd.ad.onError(honorBannerAd.errorListener);
|
|
206
|
+
honorBannerAd.resizeListener = (res) => {
|
|
207
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorBannerAd.ad.onResize()");
|
|
208
|
+
if (res) {
|
|
209
|
+
LogUtils.Instance.log("", res);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
honorBannerAd.ad.onResize(honorBannerAd.resizeListener);
|
|
213
|
+
honorBannerAd.loadListener = () => {
|
|
214
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorBannerAd.ad.onLoad()");
|
|
215
|
+
if (honorBannerAd.isFirstLoad) {
|
|
216
|
+
honorBannerAd.isFirstLoad = false;
|
|
217
|
+
}
|
|
218
|
+
if (this.adMgr.isPermanentAdShowing()) {
|
|
219
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorBannerAd.ad.show()");
|
|
220
|
+
honorBannerAd.ad.show();
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
honorBannerAd.ad.onLoad(honorBannerAd.loadListener);
|
|
224
|
+
honorBannerAd.ad.load();
|
|
225
|
+
if (!bannerAdPlatformInfo.canAutoRefresh) {
|
|
226
|
+
if (!honorBannerAd.isRecreating) {
|
|
227
|
+
honorBannerAd.isRecreating = true;
|
|
228
|
+
this.scheduleOnce(() => {
|
|
229
|
+
honorBannerAd.isRecreating = false;
|
|
230
|
+
this.createBannerAd(adUnitId);
|
|
231
|
+
}, bannerAdPlatformInfo.refreshInterval);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
destroyBannerAd(adUnitId) {
|
|
237
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "destroyBannerAd(): adUnitId=" + adUnitId);
|
|
238
|
+
let index = -1;
|
|
239
|
+
for (let i = 0; i < this.honorBannerAds.length; i++) {
|
|
240
|
+
if (this.honorBannerAds[i].unitId === adUnitId) {
|
|
241
|
+
index = i;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (index >= 0) {
|
|
246
|
+
this.honorBannerAds[index].destroy();
|
|
247
|
+
this.honorBannerAds.splice(index, 1);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
showBannerAd(adUnitId) {
|
|
251
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "showBannerAd(): adUnitId=" + adUnitId);
|
|
252
|
+
for (let i = 0; i < this.honorBannerAds.length; i++) {
|
|
253
|
+
if (this.honorBannerAds[i].unitId === adUnitId) {
|
|
254
|
+
this.honorBannerAds[i].ad.show();
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
hideBannerAd(adUnitId) {
|
|
260
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "hideBannerAd(): adUnitId=" + adUnitId);
|
|
261
|
+
for (let i = 0; i < this.honorBannerAds.length; i++) {
|
|
262
|
+
if (this.honorBannerAds[i].unitId === adUnitId) {
|
|
263
|
+
this.honorBannerAds[i].ad.hide();
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
createInterstitialAd() {
|
|
269
|
+
this.destroyInterstitialAd();
|
|
270
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "createInterstitialAd() adUnitId=" + this.honorInterstitialAd.unitId);
|
|
271
|
+
let interstitialAd = window["qg"].createInterstitialAd({
|
|
272
|
+
adUnitId: this.honorInterstitialAd.unitId
|
|
273
|
+
});
|
|
274
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "qg.createInterstitialAd() " + (interstitialAd !== null ? "success" : "fail"));
|
|
275
|
+
LogUtils.Instance.log("", interstitialAd);
|
|
276
|
+
if (!interstitialAd) {
|
|
277
|
+
this.honorInterstitialAd.status = InterstitialAdStatus.Status_Error;
|
|
278
|
+
this.honorInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
this.honorInterstitialAd.ad = interstitialAd;
|
|
282
|
+
this.honorInterstitialAd.status = InterstitialAdStatus.Status_Init;
|
|
283
|
+
this.honorInterstitialAd.errorListener = (err) => {
|
|
284
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.ad.onError()");
|
|
285
|
+
if (err) {
|
|
286
|
+
LogUtils.Instance.log("", err);
|
|
287
|
+
}
|
|
288
|
+
if (this.honorInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
|
|
289
|
+
this.honorInterstitialAd.status = InterstitialAdStatus.Status_Error;
|
|
290
|
+
this.honorInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
this.honorInterstitialAd.ad.onError(this.honorInterstitialAd.errorListener);
|
|
294
|
+
this.honorInterstitialAd.loadListener = () => {
|
|
295
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.ad.onLoad()");
|
|
296
|
+
this.honorInterstitialAd.status = InterstitialAdStatus.Status_Loaded;
|
|
297
|
+
if (this.honorInterstitialAd.isShowImmediately) {
|
|
298
|
+
this.honorInterstitialAd.isShowImmediately = false;
|
|
299
|
+
this._showInterstitialAd();
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
this.honorInterstitialAd.ad.onLoad(this.honorInterstitialAd.loadListener);
|
|
303
|
+
this.honorInterstitialAd.closeListener = () => {
|
|
304
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.ad.onClose()");
|
|
305
|
+
this.honorInterstitialAd.status = InterstitialAdStatus.Status_Watched;
|
|
306
|
+
this.honorInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Close);
|
|
307
|
+
this.scheduleOnce(() => {
|
|
308
|
+
if (this.honorInterstitialAd.status !== InterstitialAdStatus.Status_Loaded) {
|
|
309
|
+
this._loadInterstitialAd(false);
|
|
310
|
+
}
|
|
311
|
+
}, 2);
|
|
312
|
+
};
|
|
313
|
+
this.honorInterstitialAd.ad.onClose(this.honorInterstitialAd.closeListener);
|
|
314
|
+
this.scheduleOnce(() => {
|
|
315
|
+
if (this.honorInterstitialAd.status !== InterstitialAdStatus.Status_Loaded) {
|
|
316
|
+
this._loadInterstitialAd(false);
|
|
317
|
+
}
|
|
318
|
+
}, 2);
|
|
319
|
+
}
|
|
320
|
+
showInterstitialAd() {
|
|
321
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "showInterstitialAd()");
|
|
322
|
+
if (this.honorInterstitialAd.ad === null) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.status=" + InterstitialAdStatus[this.honorInterstitialAd.status]);
|
|
326
|
+
switch (this.honorInterstitialAd.status) {
|
|
327
|
+
case InterstitialAdStatus.Status_Destroyed:
|
|
328
|
+
case InterstitialAdStatus.Status_Watching:
|
|
329
|
+
case InterstitialAdStatus.Status_StartToWatch:
|
|
330
|
+
break;
|
|
331
|
+
case InterstitialAdStatus.Status_Loaded:
|
|
332
|
+
this._showInterstitialAd();
|
|
333
|
+
break;
|
|
334
|
+
case InterstitialAdStatus.Status_Watched:
|
|
335
|
+
case InterstitialAdStatus.Status_Init:
|
|
336
|
+
case InterstitialAdStatus.Status_Error:
|
|
337
|
+
this._loadInterstitialAd(true);
|
|
338
|
+
break;
|
|
339
|
+
default:
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
destroyInterstitialAd() {
|
|
344
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "destroyInterstitialAd()");
|
|
345
|
+
this.honorInterstitialAd.destroy();
|
|
346
|
+
}
|
|
347
|
+
isIntersititialAdShowing() {
|
|
348
|
+
if (this.honorInterstitialAd.ad === null) {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
if (this.honorInterstitialAd.status === InterstitialAdStatus.Status_Watching) {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
_loadInterstitialAd(isShowImmediately) {
|
|
357
|
+
this.honorInterstitialAd.isShowImmediately = isShowImmediately;
|
|
358
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.ad.load()");
|
|
359
|
+
this.honorInterstitialAd.ad.load()
|
|
360
|
+
.then(() => {
|
|
361
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.ad.load() success");
|
|
362
|
+
}).catch((err) => {
|
|
363
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.ad.load() error");
|
|
364
|
+
if (err) {
|
|
365
|
+
LogUtils.Instance.log("", err);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
_showInterstitialAd() {
|
|
370
|
+
if (this.honorInterstitialAd.status !== InterstitialAdStatus.Status_Loaded) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
this.honorInterstitialAd.status = InterstitialAdStatus.Status_StartToWatch;
|
|
374
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.ad.show()");
|
|
375
|
+
this.honorInterstitialAd.ad.show()
|
|
376
|
+
.then(() => {
|
|
377
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.ad.show() success");
|
|
378
|
+
if (this.honorInterstitialAd.status === InterstitialAdStatus.Status_StartToWatch) {
|
|
379
|
+
this.honorInterstitialAd.status = InterstitialAdStatus.Status_Watching;
|
|
380
|
+
this.honorInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Watching);
|
|
381
|
+
}
|
|
382
|
+
}).catch((err) => {
|
|
383
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorInterstitialAd.ad.show() error");
|
|
384
|
+
if (err) {
|
|
385
|
+
LogUtils.Instance.log("", err);
|
|
386
|
+
}
|
|
387
|
+
if (this.honorInterstitialAd.status === InterstitialAdStatus.Status_StartToWatch) {
|
|
388
|
+
this.honorInterstitialAd.status = InterstitialAdStatus.Status_Loaded;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
createRewardedVideoAd() {
|
|
393
|
+
this.destroyRewardedVideoAd();
|
|
394
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "createRewardedVideoAd() adUnitId=" + this.honorRewardedVideoAd.unitId);
|
|
395
|
+
let rewardedVideoAd = window["qg"].createRewardedVideoAd({
|
|
396
|
+
adUnitId: this.honorRewardedVideoAd.unitId
|
|
397
|
+
});
|
|
398
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "qg.createRewardedVideoAd() " + (rewardedVideoAd !== null ? "success" : "fail"));
|
|
399
|
+
LogUtils.Instance.log("", rewardedVideoAd);
|
|
400
|
+
if (!rewardedVideoAd) {
|
|
401
|
+
this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
|
|
402
|
+
this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
this.honorRewardedVideoAd.ad = rewardedVideoAd;
|
|
406
|
+
this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Init;
|
|
407
|
+
this.honorRewardedVideoAd.errorListener = (err) => {
|
|
408
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.ad.onError()");
|
|
409
|
+
if (err) {
|
|
410
|
+
LogUtils.Instance.log("", err);
|
|
411
|
+
}
|
|
412
|
+
if (this.honorRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
|
|
413
|
+
this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
|
|
414
|
+
this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
this.honorRewardedVideoAd.ad.onError(this.honorRewardedVideoAd.errorListener);
|
|
418
|
+
this.honorRewardedVideoAd.loadListener = () => {
|
|
419
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.ad.onLoad()");
|
|
420
|
+
this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
|
|
421
|
+
if (this.honorRewardedVideoAd.isShowImmediately) {
|
|
422
|
+
this.honorRewardedVideoAd.isShowImmediately = false;
|
|
423
|
+
this._showRewardedVideoAd();
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
this.honorRewardedVideoAd.ad.onLoad(this.honorRewardedVideoAd.loadListener);
|
|
427
|
+
this.honorRewardedVideoAd.closeListener = (res) => {
|
|
428
|
+
let isEnded = (res !== null) ? res.isEnded : false;
|
|
429
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.ad.onClose()");
|
|
430
|
+
LogUtils.Instance.log("", "isEnded=" + isEnded);
|
|
431
|
+
this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
|
|
432
|
+
if (isEnded) {
|
|
433
|
+
this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Complete);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Giveup);
|
|
437
|
+
}
|
|
438
|
+
this.scheduleOnce(() => {
|
|
439
|
+
if (this.honorRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Loaded) {
|
|
440
|
+
this._loadRewardedVideoAd(false);
|
|
441
|
+
}
|
|
442
|
+
}, 2);
|
|
443
|
+
};
|
|
444
|
+
this.honorRewardedVideoAd.ad.onClose(this.honorRewardedVideoAd.closeListener);
|
|
445
|
+
this.scheduleOnce(() => {
|
|
446
|
+
if (this.honorRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Loaded) {
|
|
447
|
+
this._loadRewardedVideoAd(false);
|
|
448
|
+
}
|
|
449
|
+
}, 2);
|
|
450
|
+
}
|
|
451
|
+
showRewardedVideoAd() {
|
|
452
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "showRewardedVideoAd()");
|
|
453
|
+
if (this.honorRewardedVideoAd.ad === null) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.status=" + RewardedVideoAdStatus[this.honorRewardedVideoAd.status]);
|
|
457
|
+
switch (this.honorRewardedVideoAd.status) {
|
|
458
|
+
case RewardedVideoAdStatus.Status_Destroyed:
|
|
459
|
+
case RewardedVideoAdStatus.Status_Watching:
|
|
460
|
+
case RewardedVideoAdStatus.Status_StartToWatch:
|
|
461
|
+
break;
|
|
462
|
+
case RewardedVideoAdStatus.Status_Loaded:
|
|
463
|
+
this._showRewardedVideoAd();
|
|
464
|
+
break;
|
|
465
|
+
case RewardedVideoAdStatus.Status_Watched:
|
|
466
|
+
case RewardedVideoAdStatus.Status_Error:
|
|
467
|
+
case RewardedVideoAdStatus.Status_Init:
|
|
468
|
+
this._loadRewardedVideoAd(true);
|
|
469
|
+
break;
|
|
470
|
+
default:
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
destroyRewardedVideoAd() {
|
|
475
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "destroyRewardedVideoAd()");
|
|
476
|
+
this.honorRewardedVideoAd.destroy();
|
|
477
|
+
}
|
|
478
|
+
isRewardedVideoAdLoaded() {
|
|
479
|
+
if (this.honorRewardedVideoAd.ad === null) {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
if (this.honorRewardedVideoAd.status === RewardedVideoAdStatus.Status_Loaded) {
|
|
483
|
+
return true;
|
|
484
|
+
}
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
isRewardedVideoAdShowing() {
|
|
488
|
+
if (this.honorRewardedVideoAd.ad === null) {
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
if (this.honorRewardedVideoAd.status === RewardedVideoAdStatus.Status_Watching) {
|
|
492
|
+
return true;
|
|
493
|
+
}
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
_loadRewardedVideoAd(isShowImmediately) {
|
|
497
|
+
this.honorRewardedVideoAd.isShowImmediately = isShowImmediately;
|
|
498
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.ad.load()");
|
|
499
|
+
this.honorRewardedVideoAd.ad.load().then(() => {
|
|
500
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.ad.load() success");
|
|
501
|
+
}).catch((err) => {
|
|
502
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.ad.load() error");
|
|
503
|
+
if (err) {
|
|
504
|
+
LogUtils.Instance.log("", err);
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
_showRewardedVideoAd() {
|
|
509
|
+
if (this.honorRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Loaded) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_StartToWatch;
|
|
513
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.ad.show()");
|
|
514
|
+
this.honorRewardedVideoAd.ad.show()
|
|
515
|
+
.then(() => {
|
|
516
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.ad.show() success");
|
|
517
|
+
if (this.honorRewardedVideoAd.status === RewardedVideoAdStatus.Status_StartToWatch) {
|
|
518
|
+
this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
|
|
519
|
+
this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Watching);
|
|
520
|
+
}
|
|
521
|
+
}).catch((err) => {
|
|
522
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorRewardedVideoAd.ad.show() error");
|
|
523
|
+
if (err) {
|
|
524
|
+
LogUtils.Instance.log("", err);
|
|
525
|
+
}
|
|
526
|
+
if (this.honorRewardedVideoAd.status === RewardedVideoAdStatus.Status_StartToWatch) {
|
|
527
|
+
this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
createCustomAd(adUnitId) {
|
|
532
|
+
return false;
|
|
533
|
+
}
|
|
534
|
+
destroyCustomAd(adUnitId) {
|
|
535
|
+
}
|
|
536
|
+
showCustomAd(adUnitId) {
|
|
537
|
+
}
|
|
538
|
+
hideCustomAd(adUnitId) {
|
|
539
|
+
}
|
|
540
|
+
createPortalAd(adUnitId) {
|
|
541
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "createPortalAd()");
|
|
542
|
+
this.destroyPortalAd(adUnitId);
|
|
543
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "createPortalAd() adUnitId=" + adUnitId);
|
|
544
|
+
let portalAdPlatformInfo = AdDefinition.PortalAdStyleConfig.get(PlatformID.ID_QuickGame_Honor);
|
|
545
|
+
if (portalAdPlatformInfo === null) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
let portalAdParam = {
|
|
549
|
+
adUnitId: adUnitId,
|
|
550
|
+
};
|
|
551
|
+
let portalAd = window["qg"].createPortalBoxAd(portalAdParam);
|
|
552
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "qg.createPortalBoxAd() " + (portalAd !== null ? "success" : "fail"));
|
|
553
|
+
LogUtils.Instance.log("", portalAd);
|
|
554
|
+
if (!portalAd) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
let honorPortalAd = new HonorPortalAd(adUnitId, portalAd);
|
|
558
|
+
this.honorPortalAds.push(honorPortalAd);
|
|
559
|
+
honorPortalAd.errorListener = (err) => {
|
|
560
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorPortalAd.ad.onError()");
|
|
561
|
+
if (err) {
|
|
562
|
+
LogUtils.Instance.log("", err);
|
|
563
|
+
}
|
|
564
|
+
if (!honorPortalAd.isRecreating) {
|
|
565
|
+
honorPortalAd.isRecreating = true;
|
|
566
|
+
this.scheduleOnce(() => {
|
|
567
|
+
honorPortalAd.isRecreating = false;
|
|
568
|
+
this.createPortalAd(adUnitId);
|
|
569
|
+
}, 15);
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
honorPortalAd.ad.onError(honorPortalAd.errorListener);
|
|
573
|
+
honorPortalAd.loadListener = () => {
|
|
574
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorPortalAd.ad.onLoad()");
|
|
575
|
+
honorPortalAd.isLoaded = true;
|
|
576
|
+
};
|
|
577
|
+
honorPortalAd.ad.onLoad(honorPortalAd.loadListener);
|
|
578
|
+
honorPortalAd.showListener = () => {
|
|
579
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorPortalAd.ad.onShow()");
|
|
580
|
+
honorPortalAd.isShowing = true;
|
|
581
|
+
};
|
|
582
|
+
honorPortalAd.ad.onShow(honorPortalAd.showListener);
|
|
583
|
+
honorPortalAd.closeListener = () => {
|
|
584
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "honorPortalAd.ad.onClose()");
|
|
585
|
+
honorPortalAd.ad.load();
|
|
586
|
+
};
|
|
587
|
+
honorPortalAd.ad.onClose(honorPortalAd.closeListener);
|
|
588
|
+
honorPortalAd.ad.load();
|
|
589
|
+
}
|
|
590
|
+
destroyPortalAd(adUnitId) {
|
|
591
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "destroyPortalAd(): adUnitId=" + adUnitId);
|
|
592
|
+
let index = -1;
|
|
593
|
+
for (let i = 0; i < this.honorPortalAds.length; i++) {
|
|
594
|
+
if (this.honorPortalAds[i].unitId === adUnitId) {
|
|
595
|
+
index = i;
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if (index >= 0) {
|
|
600
|
+
this.honorPortalAds[index].destroy();
|
|
601
|
+
this.honorPortalAds.splice(index, 1);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
showPortalAd(adUnitId) {
|
|
605
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "showPortalAd(): adUnitId=" + adUnitId);
|
|
606
|
+
for (let i = 0; i < this.honorPortalAds.length; i++) {
|
|
607
|
+
if (this.honorPortalAds[i].unitId === adUnitId) {
|
|
608
|
+
let portalAd = this.honorPortalAds[i];
|
|
609
|
+
if (portalAd.isLoaded) {
|
|
610
|
+
portalAd.isLoaded = false;
|
|
611
|
+
portalAd.ad.show();
|
|
612
|
+
}
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
hidePortalAd(adUnitId) {
|
|
618
|
+
LogUtils.Instance.log(AdAdapterHonor.TAG, "hidePortalAd(): adUnitId=" + adUnitId);
|
|
619
|
+
for (let i = 0; i < this.honorPortalAds.length; i++) {
|
|
620
|
+
if (this.honorPortalAds[i].unitId === adUnitId) {
|
|
621
|
+
let portalAd = this.honorPortalAds[i];
|
|
622
|
+
if (portalAd.isShowing) {
|
|
623
|
+
portalAd.isShowing = false;
|
|
624
|
+
portalAd.ad.hide();
|
|
625
|
+
}
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
AdAdapterHonor.TAG = "AdAdapterHonor";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AbsAdAdapter } from "./AbsAdAdapter";
|
|
2
|
+
export declare class AdAdapterHuaWei extends AbsAdAdapter {
|
|
3
|
+
static TAG: string;
|
|
4
|
+
private hwInterstitialAd;
|
|
5
|
+
private hwRewardedVideoAd;
|
|
6
|
+
private hwBannerAds;
|
|
7
|
+
init(interstitialAdUnitId: string, interstitialAdCallback: Function, rewardedVideoAdUnitId: string, rewardedVideoAdCallback: Function): void;
|
|
8
|
+
createBannerAd(adUnitId: string): boolean;
|
|
9
|
+
destroyBannerAd(adUnitId: string): void;
|
|
10
|
+
showBannerAd(adUnitId: string): void;
|
|
11
|
+
hideBannerAd(adUnitId: string): void;
|
|
12
|
+
createInterstitialAd(): void;
|
|
13
|
+
showInterstitialAd(): void;
|
|
14
|
+
destroyInterstitialAd(): void;
|
|
15
|
+
isIntersititialAdShowing(): boolean;
|
|
16
|
+
protected _loadInterstitialAd(isShowImmediately: boolean): void;
|
|
17
|
+
protected _showInterstitialAd(): void;
|
|
18
|
+
createRewardedVideoAd(): void;
|
|
19
|
+
showRewardedVideoAd(): void;
|
|
20
|
+
destroyRewardedVideoAd(): void;
|
|
21
|
+
isRewardedVideoAdLoaded(): boolean;
|
|
22
|
+
isRewardedVideoAdShowing(): boolean;
|
|
23
|
+
protected _loadRewardedVideoAd(isShowImmediately: boolean): void;
|
|
24
|
+
protected _showRewardedVideoAd(): void;
|
|
25
|
+
createCustomAd(adUnitId: string): boolean;
|
|
26
|
+
destroyCustomAd(adUnitId: string): void;
|
|
27
|
+
showCustomAd(adUnitId: string): void;
|
|
28
|
+
hideCustomAd(adUnitId: string): void;
|
|
29
|
+
createPortalAd(adUnitId: string): void;
|
|
30
|
+
destroyPortalAd(adUnitId: string): void;
|
|
31
|
+
showPortalAd(adUnitId: string): void;
|
|
32
|
+
hidePortalAd(adUnitId: string): void;
|
|
33
|
+
}
|