Compare commits
2 Commits
bca15e9e14
...
3d1b40102e
| Author | SHA1 | Date |
|---|---|---|
|
|
3d1b40102e | |
|
|
ed21281638 |
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using SDKManager.AdsSDKManager.Constant;
|
||||||
namespace Script.Common
|
namespace Script.Common
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -60,7 +61,7 @@ namespace Script.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示插页广告
|
/// 显示插页广告
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void DisplayInterstitial();
|
void DisplayInterstitial(string _adPos, IvType _IvType = IvType.IV1, Action _closeCallback = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取插页广告收益信息
|
/// 获取插页广告收益信息
|
||||||
|
|
@ -84,7 +85,7 @@ namespace Script.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示激励广告
|
/// 显示激励广告
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void DisplayRewarded();
|
void DisplayRewarded(string _adPos, Action<bool> _rewardCallback = null, Action _showFailedCallback = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取激励广告收益信息
|
/// 获取激励广告收益信息
|
||||||
|
|
@ -192,4 +193,11 @@ namespace Script.Common
|
||||||
public int Height;
|
public int Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public struct HandCallbackInfo
|
||||||
|
{
|
||||||
|
public string msg;
|
||||||
|
public bool isReady;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GoogleMobileAds.Api;
|
using GoogleMobileAds.Api;
|
||||||
using Script.Common;
|
using Script.Common;
|
||||||
|
|
@ -5,6 +6,7 @@ using Script.SDKManager.AdsSDKManager.Utils;
|
||||||
using Script.Utils;
|
using Script.Utils;
|
||||||
using SDK.Utils;
|
using SDK.Utils;
|
||||||
using SDKManager.AdsSDKManager.Constant;
|
using SDKManager.AdsSDKManager.Constant;
|
||||||
|
using Unity.VisualScripting;
|
||||||
|
|
||||||
namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
||||||
{
|
{
|
||||||
|
|
@ -22,6 +24,12 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
||||||
private List<string> _nativeAdUnits;
|
private List<string> _nativeAdUnits;
|
||||||
private List<string> _splashAdUnits;
|
private List<string> _splashAdUnits;
|
||||||
private List<string> _bannerAdUnits;
|
private List<string> _bannerAdUnits;
|
||||||
|
|
||||||
|
private string _rvPos;
|
||||||
|
private string _ivPos;
|
||||||
|
private Action<bool> _rvCloseCallback = null;
|
||||||
|
private Action _ivCloseCallback = null;
|
||||||
|
private Action _rvShowFailedCallback = null;
|
||||||
private bool _initialized;
|
private bool _initialized;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -68,8 +76,11 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
||||||
OnRewardedAdClicked
|
OnRewardedAdClicked
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
public void DisplayRewarded()
|
public void DisplayRewarded(string adPos, Action<bool> rewardCallback = null, Action showFailedCallback = null)
|
||||||
{
|
{
|
||||||
|
_rvPos = adPos;
|
||||||
|
_rvCloseCallback = rewardCallback;
|
||||||
|
_rvShowFailedCallback = showFailedCallback;
|
||||||
_admobRewardedAdManager.ShowHighestPayingAd();
|
_admobRewardedAdManager.ShowHighestPayingAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,12 +113,18 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
||||||
private void OnRewardedAdDismissed(string adUnitId)
|
private void OnRewardedAdDismissed(string adUnitId)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
_rvCloseCallback?.Invoke(true);
|
||||||
|
_rvCloseCallback = null;
|
||||||
|
_admobRewardedAdManager.Destroy();
|
||||||
|
LoadRewarded();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRewardedAdError(string adUnitId, int errorCode, string errorMsg)
|
private void OnRewardedAdError(string adUnitId, int errorCode, string errorMsg)
|
||||||
{
|
{
|
||||||
|
_rvShowFailedCallback?.Invoke();
|
||||||
|
_rvShowFailedCallback = null;
|
||||||
|
_admobRewardedAdManager.Destroy();
|
||||||
|
LoadRewarded();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRewardedAdClicked(string adUnitId)
|
private void OnRewardedAdClicked(string adUnitId)
|
||||||
|
|
@ -143,8 +160,10 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
||||||
return _admobInterstitialAdManager.GetHighestPayingAdRevenue();
|
return _admobInterstitialAdManager.GetHighestPayingAdRevenue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayInterstitial()
|
public void DisplayInterstitial(string ivPos, IvType _IvType = IvType.IV1, Action closeCallback = null)
|
||||||
{
|
{
|
||||||
|
_ivPos = ivPos;
|
||||||
|
_ivCloseCallback = closeCallback;
|
||||||
_admobInterstitialAdManager.ShowHighestPayingAd();
|
_admobInterstitialAdManager.ShowHighestPayingAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,12 +199,18 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
||||||
|
|
||||||
private void OnInterstitialAdDismissed(string adUnitId)
|
private void OnInterstitialAdDismissed(string adUnitId)
|
||||||
{
|
{
|
||||||
|
_ivCloseCallback?.Invoke();
|
||||||
|
_ivCloseCallback = null;
|
||||||
|
_admobInterstitialAdManager.Destroy();
|
||||||
|
LoadInterstitial();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInterstitialAdError(string adUnitId, int errorCode, string errorMsg)
|
private void OnInterstitialAdError(string adUnitId, int errorCode, string errorMsg)
|
||||||
{
|
{
|
||||||
|
_ivCloseCallback?.Invoke();
|
||||||
|
_ivCloseCallback = null;
|
||||||
|
_admobInterstitialAdManager.Destroy();
|
||||||
|
LoadInterstitial();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
||||||
{
|
{
|
||||||
return revenue;
|
return revenue;
|
||||||
}
|
}
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清理资源
|
// 清理资源
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,20 @@
|
||||||
using System;
|
using System;
|
||||||
using SDK.Utils;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using DKManager.AdsSDKManager.Constant;
|
||||||
|
using Script.Common;
|
||||||
|
using Script.SDKManager.AdsSDKManager.AdmobAdsManager;
|
||||||
|
using Script.SDKManager.AdsSDKManager.BigoAdsManager;
|
||||||
|
using Script.SDKManager.AdsSDKManager.MaxAdsManager;
|
||||||
|
using Script.SDKManager.AdsSDKManager.TpnAdsManager;
|
||||||
|
using Script.SDKManager.AdsSDKManager.Utils;
|
||||||
|
using SDKManager.AdsSDKManager.Constant;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class AdsSDKManager : NormalSingleton<AdsSDKManager>
|
public class AdsSDKManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static AdsSDKManager instance;
|
public static AdsSDKManager instance;
|
||||||
|
private List<IAdService> _adNetworks = new List<IAdService>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 看完广告的回调
|
/// 看完广告的回调
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -26,17 +35,128 @@ public class AdsSDKManager : NormalSingleton<AdsSDKManager>
|
||||||
|
|
||||||
private void InitSDK()
|
private void InitSDK()
|
||||||
{
|
{
|
||||||
KwaiAdsManager.Instance.Init();
|
KwaiAdsManager.Init();
|
||||||
|
AdmobAdsManager.Instance.Initialize();
|
||||||
|
BigoAdsManager.Instance.Initialize();
|
||||||
|
TpnAdsManager.Instance.Initialize();
|
||||||
|
MaxAdsManager.Instance.Initialize();
|
||||||
|
_adNetworks.Add(AdmobAdsManager.Instance);
|
||||||
|
_adNetworks.Add(BigoAdsManager.Instance);
|
||||||
|
_adNetworks.Add(TpnAdsManager.Instance);
|
||||||
|
_adNetworks.Add(MaxAdsManager.Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsRewardAdReady()
|
||||||
|
{
|
||||||
|
return _adNetworks.Any(network => network.IsRewardedAvailable());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 展示激励广告
|
/// 展示激励广告
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="callback"></param>
|
/// <param name="callback"></param>
|
||||||
private void ShowRewardAd(Action<double> callback)
|
public void ShowRewardAd(string _adPos, Action<bool> _rewardCallback = null, Action _showFailedCallback = null)
|
||||||
{
|
{
|
||||||
AdRewardCallback = callback;
|
if (!IsRewardAdReady())
|
||||||
|
{
|
||||||
|
_showFailedCallback?.Invoke();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlatformType result = GetBestPlatformType(false);
|
||||||
|
if (result == PlatformType.Max)
|
||||||
|
{
|
||||||
|
MaxAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
|
||||||
|
}
|
||||||
|
else if (result == PlatformType.Admob)
|
||||||
|
{
|
||||||
|
AdmobAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
|
||||||
|
}
|
||||||
|
else if (result == PlatformType.Bigo)
|
||||||
|
{
|
||||||
|
BigoAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
|
||||||
|
}
|
||||||
|
else if (result == PlatformType.Tpn)
|
||||||
|
{
|
||||||
|
TpnAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
|
||||||
|
}
|
||||||
|
else if (result == PlatformType.Kwai)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_showFailedCallback?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInterstitialReady()
|
||||||
|
{
|
||||||
|
return _adNetworks.Any(network => network.IsInterstitialAvailable());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 展示激励广告
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="callback"></param>
|
||||||
|
public void ShowInterstitialAd(string _adPos, IvType _IvType = IvType.IV1, Action _closeCallback = null)
|
||||||
|
{
|
||||||
|
if (!IsRewardAdReady())
|
||||||
|
{
|
||||||
|
_closeCallback?.Invoke();
|
||||||
|
_closeCallback = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlatformType result = GetBestPlatformType(true);
|
||||||
|
if (result == PlatformType.Max)
|
||||||
|
{
|
||||||
|
MaxAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
|
||||||
|
}
|
||||||
|
else if (result == PlatformType.Admob)
|
||||||
|
{
|
||||||
|
AdmobAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
|
||||||
|
}
|
||||||
|
else if (result == PlatformType.Bigo)
|
||||||
|
{
|
||||||
|
BigoAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
|
||||||
|
}
|
||||||
|
else if (result == PlatformType.Tpn)
|
||||||
|
{
|
||||||
|
TpnAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
|
||||||
|
}
|
||||||
|
else if (result == PlatformType.Kwai)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_closeCallback?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PlatformType GetBestPlatformType(bool isInterstitial)
|
||||||
|
{
|
||||||
|
if (isInterstitial)
|
||||||
|
{
|
||||||
|
AdPriceInfo priceInfo = new AdPriceInfo(
|
||||||
|
maxPrice: MaxAdsManager.Instance.GetInterstitialRevenue(),
|
||||||
|
admobPrice: AdmobAdsManager.Instance.GetInterstitialRevenue(),
|
||||||
|
bigoPrice: BigoAdsManager.Instance.GetInterstitialRevenue(),
|
||||||
|
toponAdUnitId: TpnAdsManager.Instance.topon_interstitial_units
|
||||||
|
);
|
||||||
|
return AdsBidResult.GetPlatformType(priceInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AdPriceInfo priceInfo = new AdPriceInfo(
|
||||||
|
maxPrice: MaxAdsManager.Instance.GetRewardedRevenue(),
|
||||||
|
admobPrice: AdmobAdsManager.Instance.GetRewardedRevenue(),
|
||||||
|
bigoPrice: BigoAdsManager.Instance.GetRewardedRevenue(),
|
||||||
|
toponAdUnitId: TpnAdsManager.Instance.topon_rewarded_units
|
||||||
|
);
|
||||||
|
return AdsBidResult.GetPlatformType(priceInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,12 @@ namespace Script.SDKManager.AdsSDKManager.BigoAdsManager
|
||||||
private List<string> _interstitialAdUnits;
|
private List<string> _interstitialAdUnits;
|
||||||
private List<string> _rewardedAdUnits;
|
private List<string> _rewardedAdUnits;
|
||||||
public string bigo_app_id;
|
public string bigo_app_id;
|
||||||
|
|
||||||
private bool _initialized;
|
private bool _initialized;
|
||||||
|
private string _rvPos;
|
||||||
|
private string _IvPos;
|
||||||
|
private Action<bool> _rvCloseCallback = null;
|
||||||
|
private Action _ivCloseCallback = null;
|
||||||
|
private Action _rvShowFailedCallback = null;
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
|
|
@ -88,13 +92,19 @@ namespace Script.SDKManager.AdsSDKManager.BigoAdsManager
|
||||||
}
|
}
|
||||||
private void OnRewardedAdDismissed(string adUnitId)
|
private void OnRewardedAdDismissed(string adUnitId)
|
||||||
{
|
{
|
||||||
|
_rvCloseCallback?.Invoke(true);
|
||||||
|
_rvCloseCallback = null;
|
||||||
_rewardedAdManager.Destroy();
|
_rewardedAdManager.Destroy();
|
||||||
LoadRewarded();
|
LoadRewarded();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRewardedAdError(string adUnitId, int code, string msg)
|
private void OnRewardedAdError(string adUnitId, int code, string msg)
|
||||||
{
|
{
|
||||||
|
_rvShowFailedCallback?.Invoke();
|
||||||
|
_rvShowFailedCallback = null;
|
||||||
|
_rewardedAdManager.Destroy();
|
||||||
|
LoadRewarded();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRewardedAdClicked()
|
private void OnRewardedAdClicked()
|
||||||
|
|
@ -117,8 +127,11 @@ namespace Script.SDKManager.AdsSDKManager.BigoAdsManager
|
||||||
return _rewardedAdManager.GetAvailableAdUnits().Count > 0;
|
return _rewardedAdManager.GetAvailableAdUnits().Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayRewarded()
|
public void DisplayRewarded(string adPos, Action<bool> rewardCallback = null, Action showFailedCallback = null)
|
||||||
{
|
{
|
||||||
|
_rvPos = adPos;
|
||||||
|
_rvCloseCallback = rewardCallback;
|
||||||
|
_rvShowFailedCallback = showFailedCallback;
|
||||||
_rewardedAdManager.ShowHighestPayingAd();
|
_rewardedAdManager.ShowHighestPayingAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,12 +157,18 @@ namespace Script.SDKManager.AdsSDKManager.BigoAdsManager
|
||||||
}
|
}
|
||||||
private void OnInterstitialAdDismissed(string adUnitId)
|
private void OnInterstitialAdDismissed(string adUnitId)
|
||||||
{
|
{
|
||||||
|
_ivCloseCallback?.Invoke();
|
||||||
|
_ivCloseCallback = null;
|
||||||
_interstitialAdManager.Destroy();
|
_interstitialAdManager.Destroy();
|
||||||
LoadInterstitial();
|
LoadInterstitial();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInterstitialAdError(string adUnitId, int code, string msg)
|
private void OnInterstitialAdError(string adUnitId, int code, string msg)
|
||||||
{
|
{
|
||||||
|
_ivCloseCallback?.Invoke();
|
||||||
|
_ivCloseCallback = null;
|
||||||
|
_interstitialAdManager.Destroy();
|
||||||
|
LoadInterstitial();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,8 +191,10 @@ namespace Script.SDKManager.AdsSDKManager.BigoAdsManager
|
||||||
return _interstitialAdManager.GetAvailableAdUnits().Count > 0;
|
return _interstitialAdManager.GetAvailableAdUnits().Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayInterstitial()
|
public void DisplayInterstitial(string ivPos, IvType _IvType = IvType.IV1, Action closeCallback = null)
|
||||||
{
|
{
|
||||||
|
_IvPos = ivPos;
|
||||||
|
_ivCloseCallback = closeCallback;
|
||||||
_interstitialAdManager.ShowHighestPayingAd();
|
_interstitialAdManager.ShowHighestPayingAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace SDKManager.AdsSDKManager.Constant
|
||||||
|
{
|
||||||
|
public enum IvType
|
||||||
|
{
|
||||||
|
NULL = -1,
|
||||||
|
IV1 = 0,
|
||||||
|
IV2 = 1,
|
||||||
|
IV3 = 2,
|
||||||
|
IV4 = 3,
|
||||||
|
IV5 = 4,
|
||||||
|
IV6 = 5,
|
||||||
|
IV7 = 6,
|
||||||
|
IV8 = 7,
|
||||||
|
IVAuto = 999,
|
||||||
|
MAX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d0e4c55fdbb5b436f944b08b198aca51
|
||||||
|
|
@ -10,7 +10,7 @@ namespace DKManager.AdsSDKManager.Constant
|
||||||
Tpn,
|
Tpn,
|
||||||
Admob,
|
Admob,
|
||||||
Bigo,
|
Bigo,
|
||||||
KWai,
|
Kwai,
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,11 @@ namespace Script.SDKManager.AdsSDKManager.MaxAdsManager
|
||||||
private int _interRetryAttempt;
|
private int _interRetryAttempt;
|
||||||
private float _rvStartLoadTime = 0;
|
private float _rvStartLoadTime = 0;
|
||||||
private float _ivStartLoadTime = 0;
|
private float _ivStartLoadTime = 0;
|
||||||
|
private string _rvPos;
|
||||||
|
private string _ivPos;
|
||||||
|
private Action<bool> _rvCloseCallback = null;
|
||||||
|
private Action _ivCloseCallback = null;
|
||||||
|
private Action _rvShowFailedCallback = null;
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
|
|
@ -64,8 +69,11 @@ namespace Script.SDKManager.AdsSDKManager.MaxAdsManager
|
||||||
{
|
{
|
||||||
MaxSdk.LoadRewardedAd(max_rewarded_units);
|
MaxSdk.LoadRewardedAd(max_rewarded_units);
|
||||||
}
|
}
|
||||||
public void DisplayRewarded()
|
public void DisplayRewarded(string adPos, Action<bool> rewardCallback = null, Action showFailedCallback = null)
|
||||||
{
|
{
|
||||||
|
_rvPos = adPos;
|
||||||
|
_rvCloseCallback = rewardCallback;
|
||||||
|
_rvShowFailedCallback = showFailedCallback;
|
||||||
MaxSdk.ShowRewardedAd(max_rewarded_units);
|
MaxSdk.ShowRewardedAd(max_rewarded_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,11 +127,15 @@ namespace Script.SDKManager.AdsSDKManager.MaxAdsManager
|
||||||
private void OnRewardedAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
private void OnRewardedAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug("[Max] OnRewardedAdFailedToDisplayEvent :" + errorInfo.Message + " " + errorInfo.Code + " " + errorInfo.MediatedNetworkErrorMessage + " " + errorInfo.MediatedNetworkErrorCode);
|
LoggerUtils.Debug("[Max] OnRewardedAdFailedToDisplayEvent :" + errorInfo.Message + " " + errorInfo.Code + " " + errorInfo.MediatedNetworkErrorMessage + " " + errorInfo.MediatedNetworkErrorCode);
|
||||||
|
_rvShowFailedCallback?.Invoke();
|
||||||
|
_rvShowFailedCallback = null;
|
||||||
LoadRewarded();
|
LoadRewarded();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRewardedAdHiddenEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
private void OnRewardedAdHiddenEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||||
{
|
{
|
||||||
|
_rvCloseCallback?.Invoke(true);
|
||||||
|
_rvCloseCallback = null;
|
||||||
LoadRewarded();
|
LoadRewarded();
|
||||||
LoggerUtils.Debug("[Max] OnRewardedAdHiddenEvent");
|
LoggerUtils.Debug("[Max] OnRewardedAdHiddenEvent");
|
||||||
}
|
}
|
||||||
|
|
@ -158,8 +170,10 @@ namespace Script.SDKManager.AdsSDKManager.MaxAdsManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayInterstitial()
|
public void DisplayInterstitial(string ivPos, IvType _IvType = IvType.IV1, Action closeCallback = null)
|
||||||
{
|
{
|
||||||
|
_ivPos = ivPos;
|
||||||
|
_ivCloseCallback = closeCallback;
|
||||||
MaxSdk.ShowInterstitial(max_interstitial_units);
|
MaxSdk.ShowInterstitial(max_interstitial_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,6 +201,8 @@ namespace Script.SDKManager.AdsSDKManager.MaxAdsManager
|
||||||
private void OnInterstitialAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo,MaxSdkBase.AdInfo arg3)
|
private void OnInterstitialAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo,MaxSdkBase.AdInfo arg3)
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug("[Max] OnInterstitialAdFailedToDisplayEvent :" + errorInfo.Message + " " + errorInfo.Code + " " + errorInfo.MediatedNetworkErrorMessage + " " + errorInfo.MediatedNetworkErrorCode);
|
LoggerUtils.Debug("[Max] OnInterstitialAdFailedToDisplayEvent :" + errorInfo.Message + " " + errorInfo.Code + " " + errorInfo.MediatedNetworkErrorMessage + " " + errorInfo.MediatedNetworkErrorCode);
|
||||||
|
_ivCloseCallback?.Invoke();
|
||||||
|
_ivCloseCallback = null;
|
||||||
LoadInterstitial();
|
LoadInterstitial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,6 +215,8 @@ namespace Script.SDKManager.AdsSDKManager.MaxAdsManager
|
||||||
private void OnInterstitialHiddenEvent(string adUnitId, MaxSdkBase.AdInfo info)
|
private void OnInterstitialHiddenEvent(string adUnitId, MaxSdkBase.AdInfo info)
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug($"[Max] OnInterstitialHiddenEvent");
|
LoggerUtils.Debug($"[Max] OnInterstitialHiddenEvent");
|
||||||
|
_ivCloseCallback?.Invoke();
|
||||||
|
_ivCloseCallback = null;
|
||||||
LoadInterstitial();
|
LoadInterstitial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
@ -20,6 +21,11 @@ namespace Script.SDKManager.AdsSDKManager.TpnAdsManager
|
||||||
public string topon_app_key;
|
public string topon_app_key;
|
||||||
public string topon_interstitial_units;
|
public string topon_interstitial_units;
|
||||||
public string topon_rewarded_units;
|
public string topon_rewarded_units;
|
||||||
|
private string _rvPos;
|
||||||
|
private string _ivPos;
|
||||||
|
private Action<bool> _rvCloseCallback = null;
|
||||||
|
private Action _ivCloseCallback = null;
|
||||||
|
private Action _rvShowFailedCallback = null;
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
|
|
@ -52,8 +58,11 @@ namespace Script.SDKManager.AdsSDKManager.TpnAdsManager
|
||||||
|
|
||||||
}
|
}
|
||||||
public void LoadRewarded() {}
|
public void LoadRewarded() {}
|
||||||
public void DisplayRewarded()
|
public void DisplayRewarded(string adPos, Action<bool> rewardCallback = null, Action showFailedCallback = null)
|
||||||
{
|
{
|
||||||
|
_rvPos = adPos;
|
||||||
|
_rvCloseCallback = rewardCallback;
|
||||||
|
_rvShowFailedCallback = showFailedCallback;
|
||||||
ATRewardedAutoVideo.Instance.showAutoAd(topon_rewarded_units);
|
ATRewardedAutoVideo.Instance.showAutoAd(topon_rewarded_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,8 +91,10 @@ namespace Script.SDKManager.AdsSDKManager.TpnAdsManager
|
||||||
public void LoadInterstitial(){}
|
public void LoadInterstitial(){}
|
||||||
public double GetInterstitialRevenue(){return 0;}
|
public double GetInterstitialRevenue(){return 0;}
|
||||||
|
|
||||||
public void DisplayInterstitial()
|
public void DisplayInterstitial(string ivPos, IvType _IvType = IvType.IV1, Action closeCallback = null)
|
||||||
{
|
{
|
||||||
|
_ivPos = ivPos;
|
||||||
|
_ivCloseCallback = closeCallback;
|
||||||
ATInterstitialAutoAd.Instance.showAutoAd(topon_interstitial_units);
|
ATInterstitialAutoAd.Instance.showAutoAd(topon_interstitial_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,11 +148,13 @@ namespace Script.SDKManager.AdsSDKManager.TpnAdsManager
|
||||||
|
|
||||||
if (erg.placementId.Equals(topon_rewarded_units))
|
if (erg.placementId.Equals(topon_rewarded_units))
|
||||||
{
|
{
|
||||||
|
_rvShowFailedCallback?.Invoke();
|
||||||
|
_rvShowFailedCallback = null;
|
||||||
}
|
}
|
||||||
else if (erg.placementId.Equals(topon_interstitial_units))
|
else if (erg.placementId.Equals(topon_interstitial_units))
|
||||||
{
|
{
|
||||||
|
_ivCloseCallback?.Invoke();
|
||||||
|
_ivCloseCallback = null;
|
||||||
}
|
}
|
||||||
}, "");
|
}, "");
|
||||||
}
|
}
|
||||||
|
|
@ -154,11 +167,13 @@ namespace Script.SDKManager.AdsSDKManager.TpnAdsManager
|
||||||
{
|
{
|
||||||
if (erg.placementId.Equals(topon_rewarded_units))
|
if (erg.placementId.Equals(topon_rewarded_units))
|
||||||
{
|
{
|
||||||
|
_rvCloseCallback?.Invoke(true);
|
||||||
|
_rvCloseCallback = null;
|
||||||
}
|
}
|
||||||
else if (erg.placementId.Equals(topon_interstitial_units))
|
else if (erg.placementId.Equals(topon_interstitial_units))
|
||||||
{
|
{
|
||||||
|
_ivCloseCallback?.Invoke();
|
||||||
|
_ivCloseCallback = null;
|
||||||
}
|
}
|
||||||
}, "");
|
}, "");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace Script.SDKManager.AdsSDKManager.Utils
|
||||||
private static object m_maxObj = "m_maxObj";
|
private static object m_maxObj = "m_maxObj";
|
||||||
private static object m_admobObj = "m_admobObj";
|
private static object m_admobObj = "m_admobObj";
|
||||||
private static object m_bigoObj = "m_bigoObj";
|
private static object m_bigoObj = "m_bigoObj";
|
||||||
public static PlatformType GetCustomContentInfo(AdPriceInfo priceInfo)
|
public static PlatformType GetPlatformType(AdPriceInfo priceInfo)
|
||||||
{
|
{
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
|
using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue