com.amanotes.gdk 0.2.37 → 0.2.38
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/CHANGELOG.md +4 -0
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AmaGDKProject.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdRevenuePlugin.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/IronSourceAdapter_v7.2.6.unitypackage +0 -0
- package/Packages/RevenueCatAdapter_v6.0.0.unitypackage +0 -0
- package/Runtime/AmaGDK.Ads.cs +38 -7
- package/Runtime/AmaGDK.cs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/Runtime/AmaGDK.Ads.cs
CHANGED
|
@@ -69,11 +69,23 @@ namespace Amanotes.Core
|
|
|
69
69
|
public static IAdCallback OnAdResult(this IAdCallback ad, Action<bool> callback)
|
|
70
70
|
{
|
|
71
71
|
if (!MakeSureAdNotNull(ad)) return null;
|
|
72
|
-
Ads.context.
|
|
73
|
-
Ads.context.
|
|
72
|
+
Ads.context.onAdResult -= callback;
|
|
73
|
+
Ads.context.onAdResult += callback;
|
|
74
74
|
return ad;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
/// Call right before the ad actually open (that means Ad has already been cached & available to show).
|
|
79
|
+
/// This callback will not be triggered in case Ad is not available or no internet
|
|
80
|
+
/// </summary>
|
|
81
|
+
public static IAdCallback OnBeforeAdOpen(this IAdCallback ad, Action callback)
|
|
82
|
+
{
|
|
83
|
+
if (!MakeSureAdNotNull(ad)) return null;
|
|
84
|
+
Ads.context.onBeforeAdOpen -= callback;
|
|
85
|
+
Ads.context.onBeforeAdOpen += callback;
|
|
86
|
+
return ad;
|
|
87
|
+
}
|
|
88
|
+
|
|
77
89
|
private static bool MakeSureAdNotNull(IAdCallback ad)
|
|
78
90
|
{
|
|
79
91
|
bool isValid = (ad != null);
|
|
@@ -165,6 +177,8 @@ namespace Amanotes.Core
|
|
|
165
177
|
internal static float _savedTimeScale = -1;
|
|
166
178
|
|
|
167
179
|
internal static readonly AdsData localData = new AdsData().LoadJsonFromFile();
|
|
180
|
+
|
|
181
|
+
public static AdAdapterConfig adConfig => _adConfig;
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
public partial class Ads // Public
|
|
@@ -292,7 +306,22 @@ namespace Amanotes.Core
|
|
|
292
306
|
else
|
|
293
307
|
_adapter.rewardVideo.StopShowAd();
|
|
294
308
|
}
|
|
295
|
-
|
|
309
|
+
|
|
310
|
+
/// <summary>
|
|
311
|
+
/// Capping for interstitial ad
|
|
312
|
+
/// - Time since last interstitial show success > interstitialCappingTime
|
|
313
|
+
/// - Time since last rewardedVideo show success > rewardVideoCappingTime (for interstitial)
|
|
314
|
+
/// </summary>
|
|
315
|
+
/// <param name="interstitialCappingTime"></param>
|
|
316
|
+
/// <param name="rewardedVideoCappingTime"></param>
|
|
317
|
+
/// <returns></returns>
|
|
318
|
+
public static bool IsCapped(float interstitialCappingTime = 0, float rewardedVideoCappingTime = 0)
|
|
319
|
+
{
|
|
320
|
+
bool interCapped = (interstitialCappingTime > 0) && TimeSinceLastInterstitialSucceed < interstitialCappingTime;
|
|
321
|
+
bool rewardCapped = (rewardedVideoCappingTime > 0) && TimeSinceLastVideoRewardSucceed < rewardedVideoCappingTime;
|
|
322
|
+
return interCapped || rewardCapped;
|
|
323
|
+
}
|
|
324
|
+
|
|
296
325
|
public static int TimeSinceLastInterstitialSucceed => localData.TimeSinceLastShowSuccess(AdType.Interstitial);
|
|
297
326
|
public static int TimeSinceLastVideoRewardSucceed => localData.TimeSinceLastShowSuccess(AdType.VideoReward);
|
|
298
327
|
public static int TimeSinceLastAdSucceed => Math.Min(TimeSinceLastInterstitialSucceed, TimeSinceLastVideoRewardSucceed) ;
|
|
@@ -388,6 +417,7 @@ namespace Amanotes.Core.Internal
|
|
|
388
417
|
public readonly Dictionary<string, object> userData;
|
|
389
418
|
public AdCallback adCallback;
|
|
390
419
|
|
|
420
|
+
internal Action onBeforeAdOpen;
|
|
391
421
|
internal Action onOpened;
|
|
392
422
|
internal Action onRewardReceived;
|
|
393
423
|
internal Action onClicked;
|
|
@@ -395,7 +425,7 @@ namespace Amanotes.Core.Internal
|
|
|
395
425
|
internal Action onShowFailed;
|
|
396
426
|
internal Action onClosed;
|
|
397
427
|
internal Action<AdShowReadyStatus> onAdShowReadyStatus;
|
|
398
|
-
internal Action<bool>
|
|
428
|
+
internal Action<bool> onAdResult;
|
|
399
429
|
|
|
400
430
|
// Stats
|
|
401
431
|
public float showCallAt;
|
|
@@ -638,8 +668,8 @@ namespace Amanotes.Core.Internal
|
|
|
638
668
|
_showState = ShowAdsState.Showing;
|
|
639
669
|
OnAdShowReadyStatus(true, AdShowReadyStatus.None);
|
|
640
670
|
|
|
641
|
-
ShowAd();
|
|
642
671
|
HandleBeforeAdShow();
|
|
672
|
+
ShowAd();
|
|
643
673
|
|
|
644
674
|
ShowAdContext context = Ads.context;
|
|
645
675
|
while (!context.potentiallyCompleted)
|
|
@@ -694,7 +724,7 @@ namespace Amanotes.Core.Internal
|
|
|
694
724
|
|
|
695
725
|
// Extra callback
|
|
696
726
|
Ads.context.showFinishAt = Time.realtimeSinceStartup;
|
|
697
|
-
Ads.context.
|
|
727
|
+
Ads.context.onAdResult?.Invoke(isSuccess);
|
|
698
728
|
|
|
699
729
|
var localData = Ads.localData;
|
|
700
730
|
var stat = _isInterstitial ? localData.interstitial : localData.reward;
|
|
@@ -740,6 +770,7 @@ namespace Amanotes.Core.Internal
|
|
|
740
770
|
Time.timeScale = 0;
|
|
741
771
|
}
|
|
742
772
|
|
|
773
|
+
Ads.context.onBeforeAdOpen?.Invoke();
|
|
743
774
|
Ads._adapter.HandleBeforeAdShow();
|
|
744
775
|
}
|
|
745
776
|
|
package/Runtime/AmaGDK.cs
CHANGED