@chiyou/minigame-framework 1.0.2 → 1.0.3

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.
Files changed (114) hide show
  1. package/assets/Scripts/index.ts +2 -5
  2. package/package.json +5 -10
  3. package/dist/Framework/Adapter/AdAdapter/AbsAdAdapter.d.ts +0 -78
  4. package/dist/Framework/Adapter/AdAdapter/AbsAdAdapter.js +0 -230
  5. package/dist/Framework/Adapter/AdAdapter/AdAdapterBilibili.d.ts +0 -31
  6. package/dist/Framework/Adapter/AdAdapter/AdAdapterBilibili.js +0 -224
  7. package/dist/Framework/Adapter/AdAdapter/AdAdapterDouYin.d.ts +0 -34
  8. package/dist/Framework/Adapter/AdAdapter/AdAdapterDouYin.js +0 -524
  9. package/dist/Framework/Adapter/AdAdapter/AdAdapterHonor.d.ts +0 -34
  10. package/dist/Framework/Adapter/AdAdapter/AdAdapterHonor.js +0 -631
  11. package/dist/Framework/Adapter/AdAdapter/AdAdapterHuaWei.d.ts +0 -33
  12. package/dist/Framework/Adapter/AdAdapter/AdAdapterHuaWei.js +0 -460
  13. package/dist/Framework/Adapter/AdAdapter/AdAdapterJingDong.d.ts +0 -31
  14. package/dist/Framework/Adapter/AdAdapter/AdAdapterJingDong.js +0 -227
  15. package/dist/Framework/Adapter/AdAdapter/AdAdapterKuaiShou.d.ts +0 -33
  16. package/dist/Framework/Adapter/AdAdapter/AdAdapterKuaiShou.js +0 -458
  17. package/dist/Framework/Adapter/AdAdapter/AdAdapterOppo.d.ts +0 -35
  18. package/dist/Framework/Adapter/AdAdapter/AdAdapterOppo.js +0 -770
  19. package/dist/Framework/Adapter/AdAdapter/AdAdapterTapTap.d.ts +0 -33
  20. package/dist/Framework/Adapter/AdAdapter/AdAdapterTapTap.js +0 -519
  21. package/dist/Framework/Adapter/AdAdapter/AdAdapterVivo.d.ts +0 -33
  22. package/dist/Framework/Adapter/AdAdapter/AdAdapterVivo.js +0 -492
  23. package/dist/Framework/Adapter/AdAdapter/AdAdapterWeiXin.d.ts +0 -33
  24. package/dist/Framework/Adapter/AdAdapter/AdAdapterWeiXin.js +0 -695
  25. package/dist/Framework/Adapter/AdAdapter/AdAdapterXiaoMi.d.ts +0 -34
  26. package/dist/Framework/Adapter/AdAdapter/AdAdapterXiaoMi.js +0 -597
  27. package/dist/Framework/Adapter/AdAdapter/AdAdapterZhiFuBao.d.ts +0 -33
  28. package/dist/Framework/Adapter/AdAdapter/AdAdapterZhiFuBao.js +0 -458
  29. package/dist/Framework/Adapter/PlatformAdapter/AbsPlatformAdapter.d.ts +0 -51
  30. package/dist/Framework/Adapter/PlatformAdapter/AbsPlatformAdapter.js +0 -17
  31. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterBilibili.d.ts +0 -45
  32. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterBilibili.js +0 -555
  33. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDesktopBrowser.d.ts +0 -44
  34. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDesktopBrowser.js +0 -148
  35. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDouYin.d.ts +0 -48
  36. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDouYin.js +0 -715
  37. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHonor.d.ts +0 -44
  38. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHonor.js +0 -296
  39. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHuaWei.d.ts +0 -45
  40. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHuaWei.js +0 -284
  41. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterJingDong.d.ts +0 -44
  42. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterJingDong.js +0 -283
  43. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterKuaiShou.d.ts +0 -43
  44. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterKuaiShou.js +0 -406
  45. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterOppo.d.ts +0 -43
  46. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterOppo.js +0 -248
  47. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterTapTap.d.ts +0 -44
  48. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterTapTap.js +0 -517
  49. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterVivo.d.ts +0 -44
  50. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterVivo.js +0 -295
  51. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterWeiXin.d.ts +0 -55
  52. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterWeiXin.js +0 -964
  53. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterXiaoMi.d.ts +0 -44
  54. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterXiaoMi.js +0 -295
  55. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterZhiFuBao.d.ts +0 -44
  56. package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterZhiFuBao.js +0 -393
  57. package/dist/Framework/Definition/AdDefinition.d.ts +0 -130
  58. package/dist/Framework/Definition/AdDefinition.js +0 -208
  59. package/dist/Framework/Definition/FrameworkBase.d.ts +0 -13
  60. package/dist/Framework/Definition/FrameworkBase.js +0 -23
  61. package/dist/Framework/Definition/PrivacyDefinition.d.ts +0 -51
  62. package/dist/Framework/Definition/PrivacyDefinition.js +0 -70
  63. package/dist/Framework/Definition/SocialDefinition.d.ts +0 -16
  64. package/dist/Framework/Definition/SocialDefinition.js +0 -2
  65. package/dist/Framework/Definition/SystemDefinition.d.ts +0 -43
  66. package/dist/Framework/Definition/SystemDefinition.js +0 -28
  67. package/dist/Framework/Definition/UIDefinition.d.ts +0 -6
  68. package/dist/Framework/Definition/UIDefinition.js +0 -7
  69. package/dist/Framework/Definition/UserDefinition.d.ts +0 -14
  70. package/dist/Framework/Definition/UserDefinition.js +0 -10
  71. package/dist/Framework/Manager/AdMgr.d.ts +0 -57
  72. package/dist/Framework/Manager/AdMgr.js +0 -684
  73. package/dist/Framework/Manager/AudioMgr.d.ts +0 -28
  74. package/dist/Framework/Manager/AudioMgr.js +0 -265
  75. package/dist/Framework/Manager/BaseMgr.d.ts +0 -18
  76. package/dist/Framework/Manager/BaseMgr.js +0 -114
  77. package/dist/Framework/Manager/EventMgr.d.ts +0 -18
  78. package/dist/Framework/Manager/EventMgr.js +0 -90
  79. package/dist/Framework/Manager/ExcelMgr.d.ts +0 -24
  80. package/dist/Framework/Manager/ExcelMgr.js +0 -156
  81. package/dist/Framework/Manager/LifeCycleMgr.d.ts +0 -20
  82. package/dist/Framework/Manager/LifeCycleMgr.js +0 -110
  83. package/dist/Framework/Manager/NodePoolMgr.d.ts +0 -53
  84. package/dist/Framework/Manager/NodePoolMgr.js +0 -279
  85. package/dist/Framework/Manager/PrivacyMgr.d.ts +0 -15
  86. package/dist/Framework/Manager/PrivacyMgr.js +0 -176
  87. package/dist/Framework/Manager/ResMgr.d.ts +0 -49
  88. package/dist/Framework/Manager/ResMgr.js +0 -337
  89. package/dist/Framework/Manager/SocialMgr.d.ts +0 -23
  90. package/dist/Framework/Manager/SocialMgr.js +0 -220
  91. package/dist/Framework/Manager/SystemMgr.d.ts +0 -24
  92. package/dist/Framework/Manager/SystemMgr.js +0 -222
  93. package/dist/Framework/Manager/TimerMgr.d.ts +0 -11
  94. package/dist/Framework/Manager/TimerMgr.js +0 -63
  95. package/dist/Framework/Manager/UIMgr.d.ts +0 -33
  96. package/dist/Framework/Manager/UIMgr.js +0 -223
  97. package/dist/Framework/Manager/UserMgr.d.ts +0 -15
  98. package/dist/Framework/Manager/UserMgr.js +0 -148
  99. package/dist/Framework/Utils/BezierUtils.d.ts +0 -49
  100. package/dist/Framework/Utils/BezierUtils.js +0 -247
  101. package/dist/Framework/Utils/CSVUtils.d.ts +0 -35
  102. package/dist/Framework/Utils/CSVUtils.js +0 -341
  103. package/dist/Framework/Utils/LogUtils.d.ts +0 -7
  104. package/dist/Framework/Utils/LogUtils.js +0 -32
  105. package/dist/Framework/Utils/NumberUtils.d.ts +0 -16
  106. package/dist/Framework/Utils/NumberUtils.js +0 -44
  107. package/dist/Framework/Utils/TaskUtils.d.ts +0 -10
  108. package/dist/Framework/Utils/TaskUtils.js +0 -24
  109. package/dist/Framework/Utils/TimeUtils.d.ts +0 -19
  110. package/dist/Framework/Utils/TimeUtils.js +0 -33
  111. package/dist/Framework/Utils/WXBizDataCryptUtils.d.ts +0 -12
  112. package/dist/Framework/Utils/WXBizDataCryptUtils.js +0 -37
  113. package/dist/index.d.ts +0 -30
  114. package/dist/index.js +0 -35
@@ -1,460 +0,0 @@
1
- import { AdDefinition, InterstitialAd_Callback_Status, RewardedVideoAd_Callback_Status } from "../../Definition/AdDefinition";
2
- import { PlatformID } from "../../Definition/SystemDefinition";
3
- import { LogUtils } from "../../Utils/LogUtils";
4
- import { AbsAdAdapter, InterstitialAdStatus, RewardedVideoAdStatus } from "./AbsAdAdapter";
5
- class HWBannerAd {
6
- constructor(adUnitId, ad, isFirstLoad) {
7
- this.unitId = adUnitId;
8
- this.ad = ad;
9
- this.errorListener = null;
10
- this.loadListener = null;
11
- this.isRecreating = false;
12
- this.isFirstLoad = isFirstLoad;
13
- }
14
- destroy() {
15
- if (this.ad !== null) {
16
- if (this.errorListener !== null) {
17
- this.ad.offError(this.errorListener);
18
- this.errorListener = null;
19
- }
20
- if (this.loadListener !== null) {
21
- this.ad.offLoad(this.loadListener);
22
- this.loadListener = null;
23
- }
24
- this.ad.destroy();
25
- this.ad = null;
26
- }
27
- this.isRecreating = false;
28
- }
29
- }
30
- class HWInterstitialAd {
31
- constructor(adUnitId, callback) {
32
- this.unitId = adUnitId;
33
- this.ad = null;
34
- this.status = InterstitialAdStatus.Status_Init;
35
- this.callback = callback;
36
- this.errorListener = null;
37
- this.loadListener = null;
38
- this.closeListener = null;
39
- this.isShowImmediately = false;
40
- }
41
- destroy() {
42
- if (this.ad !== null) {
43
- if (this.errorListener !== null) {
44
- this.ad.offError(this.errorListener);
45
- this.errorListener = null;
46
- }
47
- if (this.loadListener !== null) {
48
- this.ad.offLoad(this.loadListener);
49
- this.loadListener = null;
50
- }
51
- if (this.closeListener !== null) {
52
- this.ad.offClose(this.closeListener);
53
- this.closeListener = null;
54
- }
55
- this.ad.destroy();
56
- this.ad = null;
57
- }
58
- this.isShowImmediately = false;
59
- this.status = InterstitialAdStatus.Status_Destroyed;
60
- }
61
- }
62
- class HWRewardedVideoAd {
63
- constructor(adUnitId, callback) {
64
- this.unitId = adUnitId;
65
- this.ad = null;
66
- this.status = RewardedVideoAdStatus.Status_Destroyed;
67
- this.callback = callback;
68
- this.errorListener = null;
69
- this.loadListener = null;
70
- this.closeListener = null;
71
- this.isShowImmediately = false;
72
- }
73
- destroy() {
74
- if (this.ad !== null) {
75
- if (this.errorListener !== null) {
76
- this.ad.offError(this.errorListener);
77
- this.errorListener = null;
78
- }
79
- if (this.loadListener !== null) {
80
- this.ad.offLoad(this.loadListener);
81
- this.loadListener = null;
82
- }
83
- if (this.closeListener !== null) {
84
- this.ad.offClose(this.closeListener);
85
- this.closeListener = null;
86
- }
87
- this.ad.destroy();
88
- this.ad = null;
89
- }
90
- this.isShowImmediately = false;
91
- this.status = RewardedVideoAdStatus.Status_Destroyed;
92
- }
93
- }
94
- export class AdAdapterHuaWei extends AbsAdAdapter {
95
- constructor() {
96
- super(...arguments);
97
- this.hwInterstitialAd = null;
98
- this.hwRewardedVideoAd = null;
99
- this.hwBannerAds = [];
100
- }
101
- init(interstitialAdUnitId, interstitialAdCallback, rewardedVideoAdUnitId, rewardedVideoAdCallback) {
102
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "init()");
103
- this.hwInterstitialAd = new HWInterstitialAd(interstitialAdUnitId, interstitialAdCallback);
104
- this.hwRewardedVideoAd = new HWRewardedVideoAd(rewardedVideoAdUnitId, rewardedVideoAdCallback);
105
- this.hwBannerAds = [];
106
- }
107
- createBannerAd(adUnitId) {
108
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "createBannerAd()");
109
- let isFirstLoad = true;
110
- for (let i = 0; i < this.hwBannerAds.length; i++) {
111
- if (this.hwBannerAds[i].unitId === adUnitId) {
112
- isFirstLoad = this.hwBannerAds[i].isFirstLoad;
113
- break;
114
- }
115
- }
116
- this.destroyBannerAd(adUnitId);
117
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "createBannerAd() adUnitId=" + adUnitId);
118
- let bannerAdInfo = AdDefinition.AdInfoConfig.BannerAd_Info;
119
- if (bannerAdInfo === null || !bannerAdInfo.shouldShow) {
120
- return false;
121
- }
122
- let bannerAdPlatformInfo = AdDefinition.BannerAdStyleConfig.get(PlatformID.ID_QuickGame_HuaWei);
123
- if (bannerAdPlatformInfo === null) {
124
- return false;
125
- }
126
- let bannerAdPosition = this.calcBannerAdPosition(bannerAdInfo, bannerAdPlatformInfo);
127
- let sysInfo = window["qg"].getSystemInfoSync();
128
- let bannerTop = sysInfo.safeArea.height;
129
- let bannerAdParam = {
130
- adUnitId: adUnitId,
131
- style: {
132
- top: bannerTop - bannerAdPosition.realHeight,
133
- left: 0,
134
- width: bannerAdPosition.realWidth,
135
- height: bannerAdPosition.realHeight,
136
- },
137
- };
138
- if (bannerAdPlatformInfo.canAutoRefresh) {
139
- bannerAdParam.adIntervals = bannerAdPlatformInfo.refreshInterval;
140
- }
141
- LogUtils.Instance.log("", "bannerAdParam");
142
- LogUtils.Instance.log("", bannerAdParam);
143
- let bannerAd = window["qg"].createBannerAd(bannerAdParam);
144
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "qg.createBannerAd() " + (bannerAd !== null ? "success" : "fail"));
145
- LogUtils.Instance.log("", bannerAd);
146
- if (!bannerAd) {
147
- return false;
148
- }
149
- let hwBannerAd = new HWBannerAd(adUnitId, bannerAd, isFirstLoad);
150
- this.hwBannerAds.push(hwBannerAd);
151
- hwBannerAd.errorListener = (err) => {
152
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwBannerAd.ad.onError()");
153
- if (err) {
154
- LogUtils.Instance.log("", err);
155
- }
156
- if (hwBannerAd.isFirstLoad) {
157
- hwBannerAd.isFirstLoad = false;
158
- }
159
- if (!hwBannerAd.isRecreating) {
160
- hwBannerAd.isRecreating = true;
161
- this.scheduleOnce(() => {
162
- hwBannerAd.isRecreating = false;
163
- this.createBannerAd(adUnitId);
164
- }, 15);
165
- }
166
- };
167
- hwBannerAd.ad.onError(hwBannerAd.errorListener);
168
- hwBannerAd.loadListener = () => {
169
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwBannerAd.ad.onLoad()");
170
- if (hwBannerAd.isFirstLoad) {
171
- hwBannerAd.isFirstLoad = false;
172
- }
173
- };
174
- hwBannerAd.ad.onLoad(hwBannerAd.loadListener);
175
- if (!bannerAdPlatformInfo.canAutoRefresh) {
176
- if (!hwBannerAd.isRecreating) {
177
- hwBannerAd.isRecreating = true;
178
- this.scheduleOnce(() => {
179
- hwBannerAd.isRecreating = false;
180
- this.createBannerAd(adUnitId);
181
- }, bannerAdPlatformInfo.refreshInterval);
182
- }
183
- }
184
- if (this.adMgr.isPermanentAdShowing()) {
185
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwBannerAd.ad.show()");
186
- hwBannerAd.ad.show();
187
- }
188
- return true;
189
- }
190
- destroyBannerAd(adUnitId) {
191
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "destroyBannerAd(): adUnitId=" + adUnitId);
192
- let index = -1;
193
- for (let i = 0; i < this.hwBannerAds.length; i++) {
194
- if (this.hwBannerAds[i].unitId === adUnitId) {
195
- index = i;
196
- break;
197
- }
198
- }
199
- if (index >= 0) {
200
- this.hwBannerAds[index].destroy();
201
- this.hwBannerAds.splice(index, 1);
202
- }
203
- }
204
- showBannerAd(adUnitId) {
205
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "showBannerAd(): adUnitId=" + adUnitId);
206
- for (let i = 0; i < this.hwBannerAds.length; i++) {
207
- if (this.hwBannerAds[i].unitId === adUnitId) {
208
- this.hwBannerAds[i].ad.show();
209
- break;
210
- }
211
- }
212
- }
213
- hideBannerAd(adUnitId) {
214
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hideBannerAd(): adUnitId=" + adUnitId);
215
- for (let i = 0; i < this.hwBannerAds.length; i++) {
216
- if (this.hwBannerAds[i].unitId === adUnitId) {
217
- this.hwBannerAds[i].ad.hide();
218
- break;
219
- }
220
- }
221
- }
222
- createInterstitialAd() {
223
- this.destroyInterstitialAd();
224
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "createInterstitialAd() adUnitId=" + this.hwInterstitialAd.unitId);
225
- let interstitialAd = window["qg"].createInterstitialAd({
226
- adUnitId: this.hwInterstitialAd.unitId
227
- });
228
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "qg.createInterstitialAd() " + (interstitialAd !== null ? "success" : "fail"));
229
- LogUtils.Instance.log("", interstitialAd);
230
- if (!interstitialAd) {
231
- this.hwInterstitialAd.status = InterstitialAdStatus.Status_Error;
232
- this.hwInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
233
- return;
234
- }
235
- this.hwInterstitialAd.ad = interstitialAd;
236
- this.hwInterstitialAd.status = InterstitialAdStatus.Status_Init;
237
- this.hwInterstitialAd.errorListener = (err) => {
238
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwInterstitialAd.ad.onError()");
239
- if (err) {
240
- LogUtils.Instance.log("", err);
241
- }
242
- if (this.hwInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
243
- this.hwInterstitialAd.status = InterstitialAdStatus.Status_Error;
244
- this.hwInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
245
- }
246
- };
247
- this.hwInterstitialAd.ad.onError(this.hwInterstitialAd.errorListener);
248
- this.hwInterstitialAd.loadListener = () => {
249
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwInterstitialAd.ad.onLoad()");
250
- this.hwInterstitialAd.status = InterstitialAdStatus.Status_Loaded;
251
- if (this.hwInterstitialAd.isShowImmediately) {
252
- this.hwInterstitialAd.isShowImmediately = false;
253
- this._showInterstitialAd();
254
- }
255
- };
256
- this.hwInterstitialAd.ad.onLoad(this.hwInterstitialAd.loadListener);
257
- this.hwInterstitialAd.closeListener = () => {
258
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwInterstitialAd.ad.onClose()");
259
- this.hwInterstitialAd.status = InterstitialAdStatus.Status_Watched;
260
- this.hwInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Close);
261
- this.scheduleOnce(() => {
262
- if (this.hwInterstitialAd.status !== InterstitialAdStatus.Status_Loaded) {
263
- this._loadInterstitialAd(false);
264
- }
265
- }, 2);
266
- };
267
- this.hwInterstitialAd.ad.onClose(this.hwInterstitialAd.closeListener);
268
- this.scheduleOnce(() => {
269
- if (this.hwInterstitialAd.status !== InterstitialAdStatus.Status_Loaded) {
270
- this._loadInterstitialAd(false);
271
- }
272
- }, 2);
273
- }
274
- showInterstitialAd() {
275
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "showInterstitialAd()");
276
- if (this.hwInterstitialAd.ad === null) {
277
- return;
278
- }
279
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwInterstitialAd.status=" + InterstitialAdStatus[this.hwInterstitialAd.status]);
280
- switch (this.hwInterstitialAd.status) {
281
- case InterstitialAdStatus.Status_Destroyed:
282
- case InterstitialAdStatus.Status_Watching:
283
- case InterstitialAdStatus.Status_StartToWatch:
284
- break;
285
- case InterstitialAdStatus.Status_Loaded:
286
- this._showInterstitialAd();
287
- break;
288
- case InterstitialAdStatus.Status_Watched:
289
- case InterstitialAdStatus.Status_Init:
290
- case InterstitialAdStatus.Status_Error:
291
- this._loadInterstitialAd(true);
292
- break;
293
- default:
294
- break;
295
- }
296
- }
297
- destroyInterstitialAd() {
298
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "destroyInterstitialAd()");
299
- this.hwInterstitialAd.destroy();
300
- }
301
- isIntersititialAdShowing() {
302
- if (this.hwInterstitialAd.ad === null) {
303
- return false;
304
- }
305
- if (this.hwInterstitialAd.status === InterstitialAdStatus.Status_Watching) {
306
- return true;
307
- }
308
- return false;
309
- }
310
- _loadInterstitialAd(isShowImmediately) {
311
- this.hwInterstitialAd.isShowImmediately = isShowImmediately;
312
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwInterstitialAd.ad.load()");
313
- this.hwInterstitialAd.ad.load();
314
- }
315
- _showInterstitialAd() {
316
- if (this.hwInterstitialAd.status !== InterstitialAdStatus.Status_Loaded) {
317
- return;
318
- }
319
- this.hwInterstitialAd.status = InterstitialAdStatus.Status_Watching;
320
- this.hwInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Watching);
321
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwInterstitialAd.ad.show()");
322
- this.hwInterstitialAd.ad.show();
323
- }
324
- createRewardedVideoAd() {
325
- this.destroyRewardedVideoAd();
326
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "createRewardedVideoAd() adUnitId=" + this.hwRewardedVideoAd.unitId);
327
- let rewardedVideoAd = window["qg"].createRewardedVideoAd({
328
- adUnitId: this.hwRewardedVideoAd.unitId
329
- });
330
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "qg.createRewardedVideoAd() " + (rewardedVideoAd !== null ? "success" : "fail"));
331
- LogUtils.Instance.log("", rewardedVideoAd);
332
- if (!rewardedVideoAd) {
333
- this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
334
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
335
- return;
336
- }
337
- this.hwRewardedVideoAd.ad = rewardedVideoAd;
338
- this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Init;
339
- this.hwRewardedVideoAd.errorListener = (err) => {
340
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwRewardedVideoAd.ad.onError()");
341
- if (err) {
342
- LogUtils.Instance.log("", err);
343
- }
344
- if (this.hwRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
345
- this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
346
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
347
- }
348
- };
349
- this.hwRewardedVideoAd.ad.onError(this.hwRewardedVideoAd.errorListener);
350
- this.hwRewardedVideoAd.loadListener = () => {
351
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwRewardedVideoAd.ad.onLoad()");
352
- this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
353
- if (this.hwRewardedVideoAd.isShowImmediately) {
354
- this.hwRewardedVideoAd.isShowImmediately = false;
355
- this._showRewardedVideoAd();
356
- }
357
- };
358
- this.hwRewardedVideoAd.ad.onLoad(this.hwRewardedVideoAd.loadListener);
359
- this.hwRewardedVideoAd.closeListener = (res) => {
360
- let isEnded = (res !== null) ? res.isEnded : false;
361
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwRewardedVideoAd.ad.onClose()");
362
- LogUtils.Instance.log("", "isEnded=" + isEnded);
363
- this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
364
- if (isEnded) {
365
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Complete);
366
- }
367
- else {
368
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Giveup);
369
- }
370
- this.scheduleOnce(() => {
371
- if (this.hwRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Loaded) {
372
- this._loadRewardedVideoAd(false);
373
- }
374
- }, 2);
375
- };
376
- this.hwRewardedVideoAd.ad.onClose(this.hwRewardedVideoAd.closeListener);
377
- this.scheduleOnce(() => {
378
- if (this.hwRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Loaded) {
379
- this._loadRewardedVideoAd(false);
380
- }
381
- }, 2);
382
- }
383
- showRewardedVideoAd() {
384
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "showRewardedVideoAd()");
385
- if (this.hwRewardedVideoAd.ad === null) {
386
- return;
387
- }
388
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwRewardedVideoAd.status=" + RewardedVideoAdStatus[this.hwRewardedVideoAd.status]);
389
- switch (this.hwRewardedVideoAd.status) {
390
- case RewardedVideoAdStatus.Status_Destroyed:
391
- case RewardedVideoAdStatus.Status_Watching:
392
- case RewardedVideoAdStatus.Status_StartToWatch:
393
- break;
394
- case RewardedVideoAdStatus.Status_Loaded:
395
- this._showRewardedVideoAd();
396
- break;
397
- case RewardedVideoAdStatus.Status_Watched:
398
- case RewardedVideoAdStatus.Status_Error:
399
- case RewardedVideoAdStatus.Status_Init:
400
- this._loadRewardedVideoAd(true);
401
- break;
402
- default:
403
- break;
404
- }
405
- }
406
- destroyRewardedVideoAd() {
407
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "destroyRewardedVideoAd()");
408
- this.hwRewardedVideoAd.destroy();
409
- }
410
- isRewardedVideoAdLoaded() {
411
- if (this.hwRewardedVideoAd.ad === null) {
412
- return false;
413
- }
414
- if (this.hwRewardedVideoAd.status === RewardedVideoAdStatus.Status_Loaded) {
415
- return true;
416
- }
417
- return false;
418
- }
419
- isRewardedVideoAdShowing() {
420
- if (this.hwRewardedVideoAd.ad === null) {
421
- return false;
422
- }
423
- if (this.hwRewardedVideoAd.status === RewardedVideoAdStatus.Status_Watching) {
424
- return true;
425
- }
426
- return false;
427
- }
428
- _loadRewardedVideoAd(isShowImmediately) {
429
- this.hwRewardedVideoAd.isShowImmediately = isShowImmediately;
430
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwRewardedVideoAd.ad.load()");
431
- this.hwRewardedVideoAd.ad.load();
432
- }
433
- _showRewardedVideoAd() {
434
- if (this.hwRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Loaded) {
435
- return;
436
- }
437
- this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
438
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Watching);
439
- LogUtils.Instance.log(AdAdapterHuaWei.TAG, "hwRewardedVideoAd.ad.show()");
440
- this.hwRewardedVideoAd.ad.show();
441
- }
442
- createCustomAd(adUnitId) {
443
- return false;
444
- }
445
- destroyCustomAd(adUnitId) {
446
- }
447
- showCustomAd(adUnitId) {
448
- }
449
- hideCustomAd(adUnitId) {
450
- }
451
- createPortalAd(adUnitId) {
452
- }
453
- destroyPortalAd(adUnitId) {
454
- }
455
- showPortalAd(adUnitId) {
456
- }
457
- hidePortalAd(adUnitId) {
458
- }
459
- }
460
- AdAdapterHuaWei.TAG = "AdAdapterHuaWei";
@@ -1,31 +0,0 @@
1
- import { AbsAdAdapter } from './AbsAdAdapter';
2
- export declare class AdAdapterJingDong extends AbsAdAdapter {
3
- static TAG: string;
4
- private jdRewardedVideoAd;
5
- init(interstitialAdUnitId: string, interstitialAdCallback: Function, rewardedVideoAdUnitId: string, rewardedVideoAdCallback: Function): void;
6
- createBannerAd(adUnitId: string): boolean;
7
- destroyBannerAd(adUnitId: string): void;
8
- showBannerAd(adUnitId: string): void;
9
- hideBannerAd(adUnitId: string): void;
10
- createInterstitialAd(): void;
11
- showInterstitialAd(): void;
12
- destroyInterstitialAd(): void;
13
- isIntersititialAdShowing(): boolean;
14
- protected _loadInterstitialAd(isShowImmediately: boolean): void;
15
- protected _showInterstitialAd(): void;
16
- createRewardedVideoAd(): void;
17
- showRewardedVideoAd(): void;
18
- destroyRewardedVideoAd(): void;
19
- isRewardedVideoAdLoaded(): boolean;
20
- isRewardedVideoAdShowing(): boolean;
21
- protected _loadRewardedVideoAd(isShowImmediately: boolean): void;
22
- protected _showRewardedVideoAd(): void;
23
- createCustomAd(adUnitId: string): boolean;
24
- destroyCustomAd(adUnitId: string): void;
25
- showCustomAd(adUnitId: string): void;
26
- hideCustomAd(adUnitId: string): void;
27
- createPortalAd(adUnitId: string): void;
28
- destroyPortalAd(adUnitId: string): void;
29
- showPortalAd(adUnitId: string): void;
30
- hidePortalAd(adUnitId: string): void;
31
- }