update:新增 INTER 和 RV 广告关闭的回调参数
--story=1020788 --user=yufei.hu 【中台】【SDK】新增INTER 和 RV 广告关闭的回调参数 https://www.tapd.cn/33527076/s/1154205 Signed-off-by: huyufei <yufei.hu@castbox.fm>main
parent
dc47cec8bd
commit
fe691235d6
|
|
@ -93,6 +93,7 @@ namespace Guru
|
||||||
// 初始化Amazon
|
// 初始化Amazon
|
||||||
Amazon.Initialize (AmazonAppID);
|
Amazon.Initialize (AmazonAppID);
|
||||||
Amazon.SetAdNetworkInfo(new AdNetworkInfo(DTBAdNetwork.MAX));
|
Amazon.SetAdNetworkInfo(new AdNetworkInfo(DTBAdNetwork.MAX));
|
||||||
|
Debug.Log($"[Ads] --- Amazon init start isDebug:{isDebug}, AmazonID:{AmazonAppID}");
|
||||||
Amazon.EnableTesting (isDebug); // Make sure to take this off when going live.
|
Amazon.EnableTesting (isDebug); // Make sure to take this off when going live.
|
||||||
Amazon.EnableLogging (isDebug);
|
Amazon.EnableLogging (isDebug);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,12 @@ namespace Guru
|
||||||
public static Action<string> OnInterstitialStartLoad;
|
public static Action<string> OnInterstitialStartLoad;
|
||||||
public static Action OnInterstitialLoaded;
|
public static Action OnInterstitialLoaded;
|
||||||
public static Action OnInterstitialFailed;
|
public static Action OnInterstitialFailed;
|
||||||
|
public static Action OnInterstitialClosed;
|
||||||
|
|
||||||
public static Action<string> OnRewardedStartLoad;
|
public static Action<string> OnRewardedStartLoad;
|
||||||
public static Action OnRewardLoaded;
|
public static Action OnRewardLoaded;
|
||||||
public static Action OnRewardFailed;
|
public static Action OnRewardFailed;
|
||||||
|
public static Action OnRewardClosed;
|
||||||
|
|
||||||
protected AdsModel _model;
|
protected AdsModel _model;
|
||||||
protected AdsInitSpec _initSpec = null;
|
protected AdsInitSpec _initSpec = null;
|
||||||
|
|
@ -426,7 +428,7 @@ namespace Guru
|
||||||
private string _iadsCategory = "main";
|
private string _iadsCategory = "main";
|
||||||
private int _interstitialRetryAttempt;
|
private int _interstitialRetryAttempt;
|
||||||
protected float _iadsLoadStartTime;
|
protected float _iadsLoadStartTime;
|
||||||
private Action _interstitialDismissAction;
|
private Action _interCloseAction;
|
||||||
protected bool _isIadsLoading = false;
|
protected bool _isIadsLoading = false;
|
||||||
public bool IsIadsLoading => _isIadsLoading;
|
public bool IsIadsLoading => _isIadsLoading;
|
||||||
|
|
||||||
|
|
@ -482,7 +484,7 @@ namespace Guru
|
||||||
}
|
}
|
||||||
|
|
||||||
_iadsCategory = category;
|
_iadsCategory = category;
|
||||||
_interstitialDismissAction = dismissAction;
|
_interCloseAction = dismissAction;
|
||||||
MaxSdk.ShowInterstitial(GetInterstitialID());
|
MaxSdk.ShowInterstitial(GetInterstitialID());
|
||||||
|
|
||||||
// RequestInterstitialAD(); // 直接加载下一个广告
|
// RequestInterstitialAD(); // 直接加载下一个广告
|
||||||
|
|
@ -549,7 +551,8 @@ namespace Guru
|
||||||
protected virtual void OnInterstitialDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
protected virtual void OnInterstitialDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||||
{
|
{
|
||||||
// Interstitial ad is hidden. Pre-load the next ad
|
// Interstitial ad is hidden. Pre-load the next ad
|
||||||
_interstitialDismissAction?.Invoke();
|
_interCloseAction?.Invoke();
|
||||||
|
OnInterstitialClosed?.Invoke();
|
||||||
// Analytics.ADIadsClose(adUnitId, _iadsCategory);
|
// Analytics.ADIadsClose(adUnitId, _iadsCategory);
|
||||||
Analytics.ADIadsClose(AdParams.Build(adUnitId, category: _iadsCategory));
|
Analytics.ADIadsClose(AdParams.Build(adUnitId, category: _iadsCategory));
|
||||||
//延时加载下一个广告
|
//延时加载下一个广告
|
||||||
|
|
@ -563,9 +566,9 @@ namespace Guru
|
||||||
private string _rewardCategory = "main";
|
private string _rewardCategory = "main";
|
||||||
private int _rewardRetryAttempt;
|
private int _rewardRetryAttempt;
|
||||||
protected float _radsLoadStartTime;
|
protected float _radsLoadStartTime;
|
||||||
private Action _rewardAction;
|
private Action _rvRewardAction;
|
||||||
private Action<string> _failAction;
|
private Action<string> _rvFailAction;
|
||||||
private Action _dismissAction;
|
private Action _rvDismissAction;
|
||||||
protected bool _isRadsLoading = false;
|
protected bool _isRadsLoading = false;
|
||||||
public bool IsRadsLoading => _isRadsLoading;
|
public bool IsRadsLoading => _isRadsLoading;
|
||||||
|
|
||||||
|
|
@ -629,9 +632,9 @@ namespace Guru
|
||||||
}
|
}
|
||||||
|
|
||||||
_rewardCategory = category;
|
_rewardCategory = category;
|
||||||
_rewardAction = rewardAction;
|
_rvRewardAction = rewardAction;
|
||||||
_failAction = failAction;
|
_rvFailAction = failAction;
|
||||||
_dismissAction = dismissAction;
|
_rvDismissAction = dismissAction;
|
||||||
MaxSdk.ShowRewardedAd(GetRewardedID());
|
MaxSdk.ShowRewardedAd(GetRewardedID());
|
||||||
|
|
||||||
// RequestRewardedAD();
|
// RequestRewardedAD();
|
||||||
|
|
@ -683,7 +686,7 @@ namespace Guru
|
||||||
duration: GetAdsLoadDuration(ref _radsLoadStartTime), category: _rewardCategory,
|
duration: GetAdsLoadDuration(ref _radsLoadStartTime), category: _rewardCategory,
|
||||||
errorCode: (int)errorInfo.Code,
|
errorCode: (int)errorInfo.Code,
|
||||||
waterfallName: errorInfo?.WaterfallInfo?.Name ?? ""));
|
waterfallName: errorInfo?.WaterfallInfo?.Name ?? ""));
|
||||||
_failAction?.Invoke("OnRewardedAdFailedToDisplayEvent");
|
_rvFailAction?.Invoke("OnRewardedAdFailedToDisplayEvent");
|
||||||
DelayCall(2.0f, RequestRewardedAD);
|
DelayCall(2.0f, RequestRewardedAD);
|
||||||
|
|
||||||
OnRewardFailed?.Invoke();
|
OnRewardFailed?.Invoke();
|
||||||
|
|
@ -706,11 +709,17 @@ namespace Guru
|
||||||
protected virtual void OnRewardedAdDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
protected virtual void OnRewardedAdDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||||
{
|
{
|
||||||
this.Log("OnRewardedAdDismissedEvent");
|
this.Log("OnRewardedAdDismissedEvent");
|
||||||
|
|
||||||
|
_rvDismissAction?.Invoke();
|
||||||
|
OnRewardClosed?.Invoke();
|
||||||
|
|
||||||
// Analytics.ADRadsClose(adUnitId, _rewardCategory);
|
// Analytics.ADRadsClose(adUnitId, _rewardCategory);
|
||||||
Analytics.ADRadsClose(AdParams.Build(adUnitId, category: _rewardCategory));
|
Analytics.ADRadsClose(AdParams.Build(adUnitId, category: _rewardCategory));
|
||||||
_dismissAction?.Invoke();
|
|
||||||
//延时加载下一个广告
|
//延时加载下一个广告
|
||||||
DelayCall(2.0f, RequestRewardedAD);
|
DelayCall(2.0f, RequestRewardedAD);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnRewardedAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward,
|
protected virtual void OnRewardedAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward,
|
||||||
|
|
@ -720,7 +729,7 @@ namespace Guru
|
||||||
// Analytics.ADRadsRewarded(adUnitId, _rewardCategory);
|
// Analytics.ADRadsRewarded(adUnitId, _rewardCategory);
|
||||||
Analytics.ADRadsRewarded(AdParams.Build(adUnitId, category: _rewardCategory));
|
Analytics.ADRadsRewarded(AdParams.Build(adUnitId, category: _rewardCategory));
|
||||||
// Rewarded ad was displayed and user should receive the reward
|
// Rewarded ad was displayed and user should receive the reward
|
||||||
_rewardAction?.Invoke();
|
_rvRewardAction?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue