@chiyou/minigame-framework 1.4.7 → 1.4.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chiyou/minigame-framework",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "description": "基于 Cocos Creator 3.x 的小游戏开发框架,支持多平台发布",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -7,23 +7,25 @@ import { BaseMgr } from "../../Manager/BaseMgr";
7
7
  import { LogUtils } from "../../Utils/LogUtils";
8
8
 
9
9
  export enum InterstitialAdStatus {
10
- Status_Error = -1,
10
+ Status_New = -1,
11
11
  Status_Init = 0,
12
12
  Status_Loaded = 1,
13
- Status_StartToWatch = 2,
14
- Status_Watching = 3,
15
- Status_Watched = 4,
16
- Status_Destroyed = 5,
13
+ Status_LoadError = 2,
14
+ Status_StartToWatch = 3,
15
+ Status_Watching = 4,
16
+ Status_Watched = 5,
17
+ Status_Destroyed = 6,
17
18
  }
18
19
 
19
20
  export enum RewardedVideoAdStatus {
20
- Status_Error = -1,
21
+ Status_New = -1,
21
22
  Status_Init = 0,
22
23
  Status_Loaded = 1,
23
- Status_StartToWatch = 2,
24
- Status_Watching = 3,
25
- Status_Watched = 4,
26
- Status_Destroyed = 5,
24
+ Status_LoadError = 2,
25
+ Status_StartToWatch = 3,
26
+ Status_Watching = 4,
27
+ Status_Watched = 5,
28
+ Status_Destroyed = 6,
27
29
  }
28
30
 
29
31
  export type BannerAdPosition = {
@@ -249,13 +251,13 @@ export abstract class AbsAdAdapter extends Component {
249
251
  top = yMargin;
250
252
  break;
251
253
  case CustomAd_YPosition.Center:
252
- top = 0;
254
+ top = yMargin;
253
255
  if (this.screenInfo !== null) {
254
256
  top = this.screenInfo.windowHeight / 2 - realHeight / 2;
255
257
  }
256
258
  break;
257
259
  case CustomAd_YPosition.Bottom:
258
- top = 0;
260
+ top = yMargin;
259
261
  if (this.screenInfo !== null) {
260
262
  top = this.screenInfo.windowHeight - realHeight - yMargin;
261
263
  }
@@ -16,7 +16,7 @@ class BLRewardedVideoAd {
16
16
  constructor(adUnitId: string, callback: Function) {
17
17
  this.unitId = adUnitId;
18
18
  this.ad = null;
19
- this.status = RewardedVideoAdStatus.Status_Destroyed;
19
+ this.status = RewardedVideoAdStatus.Status_New;
20
20
  this.callback = callback;
21
21
  this.errorListener = null;
22
22
  this.loadListener = null;
@@ -117,8 +117,7 @@ export class AdAdapterBilibili extends AbsAdAdapter {
117
117
  adUnitId: this.blRewardedVideoAd.unitId
118
118
  });
119
119
 
120
- this.blRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
121
- this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
120
+ this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_NotSupport);
122
121
  return;
123
122
  }
124
123
 
@@ -126,7 +125,7 @@ export class AdAdapterBilibili extends AbsAdAdapter {
126
125
  this.blRewardedVideoAd.status = RewardedVideoAdStatus.Status_Init;
127
126
 
128
127
  this.blRewardedVideoAd.errorListener = (err) => {
129
- LogUtils.Instance.error(AdAdapterBilibili.TAG, FwkErrorCode.Bilibili_Ad.ShowFailed, {
128
+ LogUtils.Instance.error(AdAdapterBilibili.TAG, FwkErrorCode.Bilibili_Ad.LoadFailed, {
130
129
  operation: "blRewardedVideoAd.ad.onError",
131
130
  reason: "激励视频广告加载失败",
132
131
  adUnitId: this.blRewardedVideoAd.unitId,
@@ -134,8 +133,8 @@ export class AdAdapterBilibili extends AbsAdAdapter {
134
133
  });
135
134
 
136
135
  if (this.blRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
137
- this.blRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
138
- this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
136
+ this.blRewardedVideoAd.status = RewardedVideoAdStatus.Status_LoadError;
137
+ this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadError, err?.errCode, err?.errMsg);
139
138
  }
140
139
  };
141
140
  this.blRewardedVideoAd.ad.onError(this.blRewardedVideoAd.errorListener);
@@ -147,6 +146,7 @@ export class AdAdapterBilibili extends AbsAdAdapter {
147
146
  });
148
147
 
149
148
  this.blRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
149
+ this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadSuccess);
150
150
 
151
151
  if (this.blRewardedVideoAd.isShowImmediately) {
152
152
  this.blRewardedVideoAd.isShowImmediately = false;
@@ -166,9 +166,9 @@ export class AdAdapterBilibili extends AbsAdAdapter {
166
166
 
167
167
  this.blRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
168
168
  if (isEnded) {
169
- this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Complete);
169
+ this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Complete);
170
170
  } else {
171
- this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Giveup);
171
+ this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Giveup);
172
172
  }
173
173
 
174
174
  this.scheduleOnce(() => {
@@ -205,7 +205,7 @@ export class AdAdapterBilibili extends AbsAdAdapter {
205
205
  this._showRewardedVideoAd();
206
206
  break;
207
207
  case RewardedVideoAdStatus.Status_Watched:
208
- case RewardedVideoAdStatus.Status_Error:
208
+ case RewardedVideoAdStatus.Status_LoadError:
209
209
  case RewardedVideoAdStatus.Status_Init:
210
210
  this._loadRewardedVideoAd(true);
211
211
  break;
@@ -248,12 +248,7 @@ export class AdAdapterBilibili extends AbsAdAdapter {
248
248
  this.blRewardedVideoAd.ad.load().then(() => {
249
249
 
250
250
  }).catch((err) => {
251
- LogUtils.Instance.error(AdAdapterBilibili.TAG, FwkErrorCode.Bilibili_Ad.LoadFailed, {
252
- operation: "blRewardedVideoAd.ad.load",
253
- reason: "激励视频广告加载失败",
254
- adUnitId: this.blRewardedVideoAd.unitId,
255
- error: err
256
- });
251
+
257
252
  });
258
253
  }
259
254
 
@@ -272,7 +267,7 @@ export class AdAdapterBilibili extends AbsAdAdapter {
272
267
 
273
268
  if (this.blRewardedVideoAd.status === RewardedVideoAdStatus.Status_StartToWatch) {
274
269
  this.blRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
275
- this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Watching);
270
+ this.blRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Watching);
276
271
  }
277
272
  }).catch((err) => {
278
273
  LogUtils.Instance.error(AdAdapterBilibili.TAG, FwkErrorCode.Bilibili_Ad.ShowFailed, {
@@ -16,7 +16,7 @@ class TTInterstitialAd {
16
16
  constructor(adUnitId: string, callback: Function) {
17
17
  this.unitId = adUnitId;
18
18
  this.ad = null;
19
- this.status = InterstitialAdStatus.Status_Destroyed;
19
+ this.status = InterstitialAdStatus.Status_New;
20
20
  this.callback = callback;
21
21
  this.errorListener = null;
22
22
  this.loadListener = null;
@@ -68,7 +68,7 @@ class TTRewardedVideoAd {
68
68
  constructor(adUnitId: string, callback: Function) {
69
69
  this.unitId = adUnitId;
70
70
  this.ad = null;
71
- this.status = RewardedVideoAdStatus.Status_Destroyed;
71
+ this.status = RewardedVideoAdStatus.Status_New;
72
72
  this.callback = callback;
73
73
  this.errorListener = null;
74
74
  this.loadListener = null;
@@ -165,8 +165,7 @@ export class AdAdapterDouYin extends AbsAdAdapter {
165
165
  reason: "平台API返回null",
166
166
  adUnitId: this.ttInterstitialAd.unitId
167
167
  });
168
- this.ttInterstitialAd.status = InterstitialAdStatus.Status_Error;
169
- this.ttInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
168
+ this.ttInterstitialAd.callback(InterstitialAd_Callback_Status.Status_NotSupport);
170
169
  return;
171
170
  }
172
171
 
@@ -174,15 +173,15 @@ export class AdAdapterDouYin extends AbsAdAdapter {
174
173
  this.ttInterstitialAd.status = InterstitialAdStatus.Status_Init;
175
174
 
176
175
  this.ttInterstitialAd.errorListener = (err) => {
177
- LogUtils.Instance.error(AdAdapterDouYin.TAG, FwkErrorCode.DouYin_Ad.ShowFailed, {
176
+ LogUtils.Instance.error(AdAdapterDouYin.TAG, FwkErrorCode.DouYin_Ad.LoadFailed, {
178
177
  operation: "ttInterstitialAd.ad.onError",
179
- reason: "插屏广告错误",
178
+ reason: "插屏广告加载失败",
180
179
  adUnitId: this.ttInterstitialAd.unitId,
181
180
  error: err
182
181
  });
183
182
 
184
183
  if (this.ttInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
185
- this.ttInterstitialAd.status = InterstitialAdStatus.Status_Error;
184
+ this.ttInterstitialAd.status = InterstitialAdStatus.Status_LoadError;
186
185
  this.ttInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
187
186
  }
188
187
  };
@@ -244,7 +243,7 @@ export class AdAdapterDouYin extends AbsAdAdapter {
244
243
  case InterstitialAdStatus.Status_Watched:
245
244
  this.createInterstitialAd();
246
245
  break;
247
- case InterstitialAdStatus.Status_Error:
246
+ case InterstitialAdStatus.Status_LoadError:
248
247
  case InterstitialAdStatus.Status_Init:
249
248
  this._loadInterstitialAd(true);
250
249
  break;
@@ -277,12 +276,7 @@ export class AdAdapterDouYin extends AbsAdAdapter {
277
276
  this.ttInterstitialAd.ad.load().then(() => {
278
277
 
279
278
  }).catch((err) => {
280
- LogUtils.Instance.error(AdAdapterDouYin.TAG, FwkErrorCode.DouYin_Ad.LoadFailed, {
281
- operation: "ttInterstitialAd.ad.load",
282
- reason: "插屏广告加载失败",
283
- adUnitId: this.ttInterstitialAd.unitId,
284
- error: err
285
- });
279
+
286
280
  });
287
281
  }
288
282
 
@@ -334,8 +328,7 @@ export class AdAdapterDouYin extends AbsAdAdapter {
334
328
  reason: "平台API返回null",
335
329
  adUnitId: this.ttRewardedVideoAd.unitId
336
330
  });
337
- this.ttRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
338
- this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
331
+ this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_NotSupport);
339
332
  return;
340
333
  }
341
334
 
@@ -343,16 +336,16 @@ export class AdAdapterDouYin extends AbsAdAdapter {
343
336
  this.ttRewardedVideoAd.status = RewardedVideoAdStatus.Status_Init;
344
337
 
345
338
  this.ttRewardedVideoAd.errorListener = (err) => {
346
- LogUtils.Instance.error(AdAdapterDouYin.TAG, FwkErrorCode.DouYin_Ad.ShowFailed, {
339
+ LogUtils.Instance.error(AdAdapterDouYin.TAG, FwkErrorCode.DouYin_Ad.LoadFailed, {
347
340
  operation: "ttRewardedVideoAd.ad.onError",
348
- reason: "激励视频广告错误",
341
+ reason: "激励视频广告加载失败",
349
342
  adUnitId: this.ttRewardedVideoAd.unitId,
350
343
  error: err
351
344
  });
352
345
 
353
346
  if (this.ttRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
354
- this.ttRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
355
- this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
347
+ this.ttRewardedVideoAd.status = RewardedVideoAdStatus.Status_LoadError;
348
+ this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadError, err?.errCode, err?.errMsg);
356
349
  }
357
350
  };
358
351
  this.ttRewardedVideoAd.ad.onError(this.ttRewardedVideoAd.errorListener);
@@ -364,6 +357,7 @@ export class AdAdapterDouYin extends AbsAdAdapter {
364
357
  });
365
358
 
366
359
  this.ttRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
360
+ this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadSuccess);
367
361
 
368
362
  if (this.ttRewardedVideoAd.isShowImmediately) {
369
363
  this.ttRewardedVideoAd.isShowImmediately = false;
@@ -383,9 +377,9 @@ export class AdAdapterDouYin extends AbsAdAdapter {
383
377
 
384
378
  this.ttRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
385
379
  if (isEnded) {
386
- this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Complete);
380
+ this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Complete);
387
381
  } else {
388
- this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Giveup);
382
+ this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Giveup);
389
383
  }
390
384
 
391
385
  this.scheduleOnce(() => {
@@ -421,7 +415,7 @@ export class AdAdapterDouYin extends AbsAdAdapter {
421
415
  case RewardedVideoAdStatus.Status_Loaded:
422
416
  this._showRewardedVideoAd();
423
417
  break;
424
- case RewardedVideoAdStatus.Status_Error:
418
+ case RewardedVideoAdStatus.Status_LoadError:
425
419
  case RewardedVideoAdStatus.Status_Init:
426
420
  case RewardedVideoAdStatus.Status_Watched:
427
421
  this._loadRewardedVideoAd(true);
@@ -465,12 +459,7 @@ export class AdAdapterDouYin extends AbsAdAdapter {
465
459
  this.ttRewardedVideoAd.ad.load().then(() => {
466
460
 
467
461
  }).catch((err) => {
468
- LogUtils.Instance.error(AdAdapterDouYin.TAG, FwkErrorCode.DouYin_Ad.LoadFailed, {
469
- operation: "ttRewardedVideoAd.ad.load",
470
- reason: "激励视频广告加载失败",
471
- adUnitId: this.ttRewardedVideoAd.unitId,
472
- error: err
473
- });
462
+
474
463
  });
475
464
  }
476
465
 
@@ -489,7 +478,7 @@ export class AdAdapterDouYin extends AbsAdAdapter {
489
478
 
490
479
  if (this.ttRewardedVideoAd.status === RewardedVideoAdStatus.Status_StartToWatch) {
491
480
  this.ttRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
492
- this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Watching);
481
+ this.ttRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Watching);
493
482
  }
494
483
  }).catch((err) => {
495
484
  LogUtils.Instance.error(AdAdapterDouYin.TAG, FwkErrorCode.DouYin_Ad.ShowFailed, {
@@ -65,7 +65,7 @@ class HonorInterstitialAd {
65
65
  constructor(adUnitId: string, callback: Function) {
66
66
  this.unitId = adUnitId;
67
67
  this.ad = null;
68
- this.status = InterstitialAdStatus.Status_Init;
68
+ this.status = InterstitialAdStatus.Status_New;
69
69
  this.callback = callback;
70
70
  this.errorListener = null;
71
71
  this.loadListener = null;
@@ -109,7 +109,7 @@ class HonorRewardedVideoAd {
109
109
  constructor(adUnitId: string, callback: Function) {
110
110
  this.unitId = adUnitId;
111
111
  this.ad = null;
112
- this.status = RewardedVideoAdStatus.Status_Destroyed;
112
+ this.status = RewardedVideoAdStatus.Status_New;
113
113
  this.callback = callback;
114
114
  this.errorListener = null;
115
115
  this.loadListener = null;
@@ -428,8 +428,7 @@ export class AdAdapterHonor extends AbsAdAdapter {
428
428
  adUnitId: this.honorInterstitialAd.unitId,
429
429
  reason: "平台API返回null"
430
430
  });
431
- this.honorInterstitialAd.status = InterstitialAdStatus.Status_Error;
432
- this.honorInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
431
+ this.honorInterstitialAd.callback(InterstitialAd_Callback_Status.Status_NotSupport);
433
432
  return;
434
433
  }
435
434
 
@@ -445,7 +444,7 @@ export class AdAdapterHonor extends AbsAdAdapter {
445
444
  });
446
445
 
447
446
  if (this.honorInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
448
- this.honorInterstitialAd.status = InterstitialAdStatus.Status_Error;
447
+ this.honorInterstitialAd.status = InterstitialAdStatus.Status_LoadError;
449
448
  this.honorInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
450
449
  }
451
450
  };
@@ -510,7 +509,7 @@ export class AdAdapterHonor extends AbsAdAdapter {
510
509
  break;
511
510
  case InterstitialAdStatus.Status_Watched:
512
511
  case InterstitialAdStatus.Status_Init:
513
- case InterstitialAdStatus.Status_Error:
512
+ case InterstitialAdStatus.Status_LoadError:
514
513
  this._loadInterstitialAd(true);
515
514
  break;
516
515
  default:
@@ -543,12 +542,7 @@ export class AdAdapterHonor extends AbsAdAdapter {
543
542
  .then(() => {
544
543
 
545
544
  }).catch((err) => {
546
- LogUtils.Instance.error(AdAdapterHonor.TAG, FwkErrorCode.Honor_Ad.LoadFailed, {
547
- operation: "honorInterstitialAd.ad.load",
548
- adUnitId: this.honorInterstitialAd.unitId,
549
- reason: "插屏广告加载失败",
550
- error: err
551
- });
545
+
552
546
  });
553
547
  }
554
548
 
@@ -601,8 +595,7 @@ export class AdAdapterHonor extends AbsAdAdapter {
601
595
  adUnitId: this.honorRewardedVideoAd.unitId,
602
596
  reason: "平台API返回null"
603
597
  });
604
- this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
605
- this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
598
+ this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_NotSupport);
606
599
  return;
607
600
  }
608
601
 
@@ -618,8 +611,8 @@ export class AdAdapterHonor extends AbsAdAdapter {
618
611
  });
619
612
 
620
613
  if (this.honorRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
621
- this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
622
- this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
614
+ this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_LoadError;
615
+ this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadError, err?.errCode, err?.errMsg);
623
616
  }
624
617
  };
625
618
  this.honorRewardedVideoAd.ad.onError(this.honorRewardedVideoAd.errorListener);
@@ -631,6 +624,7 @@ export class AdAdapterHonor extends AbsAdAdapter {
631
624
  });
632
625
 
633
626
  this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
627
+ this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadSuccess);
634
628
 
635
629
  if (this.honorRewardedVideoAd.isShowImmediately) {
636
630
  this.honorRewardedVideoAd.isShowImmediately = false;
@@ -650,9 +644,9 @@ export class AdAdapterHonor extends AbsAdAdapter {
650
644
 
651
645
  this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
652
646
  if (isEnded) {
653
- this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Complete);
647
+ this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Complete);
654
648
  } else {
655
- this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Giveup);
649
+ this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Giveup);
656
650
  }
657
651
 
658
652
  this.scheduleOnce(() => {
@@ -689,7 +683,7 @@ export class AdAdapterHonor extends AbsAdAdapter {
689
683
  this._showRewardedVideoAd();
690
684
  break;
691
685
  case RewardedVideoAdStatus.Status_Watched:
692
- case RewardedVideoAdStatus.Status_Error:
686
+ case RewardedVideoAdStatus.Status_LoadError:
693
687
  case RewardedVideoAdStatus.Status_Init:
694
688
  this._loadRewardedVideoAd(true);
695
689
  break;
@@ -732,12 +726,7 @@ export class AdAdapterHonor extends AbsAdAdapter {
732
726
  this.honorRewardedVideoAd.ad.load().then(() => {
733
727
 
734
728
  }).catch((err) => {
735
- LogUtils.Instance.error(AdAdapterHonor.TAG, FwkErrorCode.Honor_Ad.LoadFailed, {
736
- operation: "honorRewardedVideoAd.ad.load()",
737
- adUnitId: this.honorRewardedVideoAd.unitId,
738
- reason: "激励视频广告加载失败",
739
- error: err
740
- });
729
+
741
730
  });
742
731
  }
743
732
 
@@ -756,7 +745,7 @@ export class AdAdapterHonor extends AbsAdAdapter {
756
745
 
757
746
  if (this.honorRewardedVideoAd.status === RewardedVideoAdStatus.Status_StartToWatch) {
758
747
  this.honorRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
759
- this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Watching);
748
+ this.honorRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Watching);
760
749
  }
761
750
  }).catch((err) => {
762
751
  LogUtils.Instance.error(AdAdapterHonor.TAG, FwkErrorCode.Honor_Ad.ShowFailed, {
@@ -60,7 +60,7 @@ class HWInterstitialAd {
60
60
  constructor(adUnitId: string, callback: Function) {
61
61
  this.unitId = adUnitId;
62
62
  this.ad = null;
63
- this.status = InterstitialAdStatus.Status_Init;
63
+ this.status = InterstitialAdStatus.Status_New;
64
64
  this.callback = callback;
65
65
  this.errorListener = null;
66
66
  this.loadListener = null;
@@ -104,7 +104,7 @@ class HWRewardedVideoAd {
104
104
  constructor(adUnitId: string, callback: Function) {
105
105
  this.unitId = adUnitId;
106
106
  this.ad = null;
107
- this.status = RewardedVideoAdStatus.Status_Destroyed;
107
+ this.status = RewardedVideoAdStatus.Status_New;
108
108
  this.callback = callback;
109
109
  this.errorListener = null;
110
110
  this.loadListener = null;
@@ -364,8 +364,7 @@ export class AdAdapterHuaWei extends AbsAdAdapter {
364
364
  adUnitId: this.hwInterstitialAd.unitId,
365
365
  reason: "平台API返回null"
366
366
  });
367
- this.hwInterstitialAd.status = InterstitialAdStatus.Status_Error;
368
- this.hwInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
367
+ this.hwInterstitialAd.callback(InterstitialAd_Callback_Status.Status_NotSupport);
369
368
  return;
370
369
  }
371
370
 
@@ -381,7 +380,7 @@ export class AdAdapterHuaWei extends AbsAdAdapter {
381
380
  });
382
381
 
383
382
  if (this.hwInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
384
- this.hwInterstitialAd.status = InterstitialAdStatus.Status_Error;
383
+ this.hwInterstitialAd.status = InterstitialAdStatus.Status_LoadError;
385
384
  this.hwInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
386
385
  }
387
386
  };
@@ -446,7 +445,7 @@ export class AdAdapterHuaWei extends AbsAdAdapter {
446
445
  break;
447
446
  case InterstitialAdStatus.Status_Watched:
448
447
  case InterstitialAdStatus.Status_Init:
449
- case InterstitialAdStatus.Status_Error:
448
+ case InterstitialAdStatus.Status_LoadError:
450
449
  this._loadInterstitialAd(true);
451
450
  break;
452
451
  default:
@@ -513,8 +512,7 @@ export class AdAdapterHuaWei extends AbsAdAdapter {
513
512
  adUnitId: this.hwRewardedVideoAd.unitId,
514
513
  reason: "平台API返回null"
515
514
  });
516
- this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
517
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
515
+ this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_NotSupport);
518
516
  return;
519
517
  }
520
518
 
@@ -530,8 +528,8 @@ export class AdAdapterHuaWei extends AbsAdAdapter {
530
528
  });
531
529
 
532
530
  if (this.hwRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
533
- this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
534
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
531
+ this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_LoadError;
532
+ this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadError, err?.errCode, err?.errMsg);
535
533
  }
536
534
  };
537
535
  this.hwRewardedVideoAd.ad.onError(this.hwRewardedVideoAd.errorListener);
@@ -543,6 +541,7 @@ export class AdAdapterHuaWei extends AbsAdAdapter {
543
541
  });
544
542
 
545
543
  this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
544
+ this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadSuccess);
546
545
 
547
546
  if (this.hwRewardedVideoAd.isShowImmediately) {
548
547
  this.hwRewardedVideoAd.isShowImmediately = false;
@@ -562,9 +561,9 @@ export class AdAdapterHuaWei extends AbsAdAdapter {
562
561
 
563
562
  this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
564
563
  if (isEnded) {
565
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Complete);
564
+ this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Complete);
566
565
  } else {
567
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Giveup);
566
+ this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Giveup);
568
567
  }
569
568
 
570
569
  this.scheduleOnce(() => {
@@ -601,7 +600,7 @@ export class AdAdapterHuaWei extends AbsAdAdapter {
601
600
  this._showRewardedVideoAd();
602
601
  break;
603
602
  case RewardedVideoAdStatus.Status_Watched:
604
- case RewardedVideoAdStatus.Status_Error:
603
+ case RewardedVideoAdStatus.Status_LoadError:
605
604
  case RewardedVideoAdStatus.Status_Init:
606
605
  this._loadRewardedVideoAd(true);
607
606
  break;
@@ -653,7 +652,7 @@ export class AdAdapterHuaWei extends AbsAdAdapter {
653
652
  }
654
653
 
655
654
  this.hwRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
656
- this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Watching);
655
+ this.hwRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Watching);
657
656
 
658
657
  LogUtils.Instance.info(AdAdapterHuaWei.TAG, "激励视频广告展示", {
659
658
  operation: "hwRewardedVideoAd.ad.show",
@@ -65,7 +65,7 @@ class KSInterstitialAd {
65
65
  constructor(adUnitId: string, callback: Function) {
66
66
  this.unitId = adUnitId;
67
67
  this.ad = null;
68
- this.status = InterstitialAdStatus.Status_Destroyed;
68
+ this.status = InterstitialAdStatus.Status_New;
69
69
  this.callback = callback;
70
70
  this.errorListener = null;
71
71
  this.closeListener = null;
@@ -103,7 +103,7 @@ class KSRewardedVideoAd {
103
103
  constructor(adUnitId: string, callback: Function) {
104
104
  this.unitId = adUnitId;
105
105
  this.ad = null;
106
- this.status = RewardedVideoAdStatus.Status_Destroyed;
106
+ this.status = RewardedVideoAdStatus.Status_New;
107
107
  this.callback = callback;
108
108
  this.errorListener = null;
109
109
  this.closeListener = null;
@@ -358,8 +358,7 @@ export class AdAdapterKuaiShou extends AbsAdAdapter {
358
358
  reason: "平台API返回null",
359
359
  adUnitId: this.ksInterstitialAd.unitId
360
360
  });
361
- this.ksInterstitialAd.status = InterstitialAdStatus.Status_Error;
362
- this.ksInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
361
+ this.ksInterstitialAd.callback(InterstitialAd_Callback_Status.Status_NotSupport);
363
362
  return;
364
363
  }
365
364
 
@@ -367,15 +366,15 @@ export class AdAdapterKuaiShou extends AbsAdAdapter {
367
366
  this.ksInterstitialAd.status = InterstitialAdStatus.Status_Init;
368
367
 
369
368
  this.ksInterstitialAd.errorListener = (err) => {
370
- LogUtils.Instance.error(AdAdapterKuaiShou.TAG, FwkErrorCode.KuaiShou_Ad.ShowFailed, {
369
+ LogUtils.Instance.error(AdAdapterKuaiShou.TAG, FwkErrorCode.KuaiShou_Ad.LoadFailed, {
371
370
  operation: "ksInterstitialAd.ad.onError",
372
- reason: "插屏广告错误",
371
+ reason: "插屏广告加载失败",
373
372
  adUnitId: this.ksInterstitialAd.unitId,
374
373
  error: err
375
374
  });
376
375
 
377
376
  if (this.ksInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
378
- this.ksInterstitialAd.status = InterstitialAdStatus.Status_Error;
377
+ this.ksInterstitialAd.status = InterstitialAdStatus.Status_LoadError;
379
378
  this.ksInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
380
379
  }
381
380
  };
@@ -410,7 +409,7 @@ export class AdAdapterKuaiShou extends AbsAdAdapter {
410
409
  break;
411
410
  case InterstitialAdStatus.Status_Loaded:
412
411
  case InterstitialAdStatus.Status_Watched:
413
- case InterstitialAdStatus.Status_Error:
412
+ case InterstitialAdStatus.Status_LoadError:
414
413
  case InterstitialAdStatus.Status_Init:
415
414
  this._showInterstitialAd();
416
415
  break;
@@ -486,8 +485,7 @@ export class AdAdapterKuaiShou extends AbsAdAdapter {
486
485
  reason: "平台API返回null",
487
486
  adUnitId: this.ksRewardedVideoAd.unitId
488
487
  });
489
- this.ksRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
490
- this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
488
+ this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_NotSupport);
491
489
  return;
492
490
  }
493
491
 
@@ -495,16 +493,16 @@ export class AdAdapterKuaiShou extends AbsAdAdapter {
495
493
  this.ksRewardedVideoAd.status = RewardedVideoAdStatus.Status_Init;
496
494
 
497
495
  this.ksRewardedVideoAd.errorListener = (err) => {
498
- LogUtils.Instance.error(AdAdapterKuaiShou.TAG, FwkErrorCode.KuaiShou_Ad.ShowFailed, {
496
+ LogUtils.Instance.error(AdAdapterKuaiShou.TAG, FwkErrorCode.KuaiShou_Ad.LoadFailed, {
499
497
  operation: "ksRewardedVideoAd.ad.onError",
500
- reason: "激励视频广告错误",
498
+ reason: "激励视频广告加载失败",
501
499
  adUnitId: this.ksRewardedVideoAd.unitId,
502
500
  error: err
503
501
  });
504
502
 
505
503
  if (this.ksRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
506
- this.ksRewardedVideoAd.status = RewardedVideoAdStatus.Status_Error;
507
- this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
504
+ this.ksRewardedVideoAd.status = RewardedVideoAdStatus.Status_LoadError;
505
+ this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadError, err?.code, err?.msg);
508
506
  }
509
507
  };
510
508
  this.ksRewardedVideoAd.ad.onError(this.ksRewardedVideoAd.errorListener);
@@ -520,9 +518,9 @@ export class AdAdapterKuaiShou extends AbsAdAdapter {
520
518
 
521
519
  this.ksRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
522
520
  if (isEnded) {
523
- this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Complete);
521
+ this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Complete);
524
522
  } else {
525
- this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Giveup);
523
+ this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Giveup);
526
524
  }
527
525
  };
528
526
  this.ksRewardedVideoAd.ad.onClose(this.ksRewardedVideoAd.closeListener);
@@ -544,7 +542,7 @@ export class AdAdapterKuaiShou extends AbsAdAdapter {
544
542
  case RewardedVideoAdStatus.Status_StartToWatch:
545
543
  break;
546
544
  case RewardedVideoAdStatus.Status_Watched:
547
- case RewardedVideoAdStatus.Status_Error:
545
+ case RewardedVideoAdStatus.Status_LoadError:
548
546
  case RewardedVideoAdStatus.Status_Init:
549
547
  case RewardedVideoAdStatus.Status_Loaded:
550
548
  this._showRewardedVideoAd();
@@ -589,7 +587,7 @@ export class AdAdapterKuaiShou extends AbsAdAdapter {
589
587
 
590
588
  // Android上无法实时触发then回调
591
589
  this.ksRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
592
- this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Watching);
590
+ this.ksRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Watching);
593
591
 
594
592
  this.ksRewardedVideoAd.ad.show()
595
593
  .then(() => {