Compare commits
No commits in common. "3d1b40102ef141352bf214984488bcba3c79f086" and "bca15e9e14bde646f07f40cb908bc3cdd7420315" have entirely different histories.
3d1b40102e
...
bca15e9e14
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using SDKManager.AdsSDKManager.Constant;
|
|
||||||
namespace Script.Common
|
namespace Script.Common
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -61,7 +60,7 @@ namespace Script.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示插页广告
|
/// 显示插页广告
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void DisplayInterstitial(string _adPos, IvType _IvType = IvType.IV1, Action _closeCallback = null);
|
void DisplayInterstitial();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取插页广告收益信息
|
/// 获取插页广告收益信息
|
||||||
|
|
@ -85,7 +84,7 @@ namespace Script.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示激励广告
|
/// 显示激励广告
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void DisplayRewarded(string _adPos, Action<bool> _rewardCallback = null, Action _showFailedCallback = null);
|
void DisplayRewarded();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取激励广告收益信息
|
/// 获取激励广告收益信息
|
||||||
|
|
@ -193,11 +192,4 @@ namespace Script.Common
|
||||||
public int Height;
|
public int Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
|
||||||
public struct HandCallbackInfo
|
|
||||||
{
|
|
||||||
public string msg;
|
|
||||||
public bool isReady;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GoogleMobileAds.Api;
|
using GoogleMobileAds.Api;
|
||||||
using Script.Common;
|
using Script.Common;
|
||||||
|
|
@ -6,7 +5,6 @@ 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
|
||||||
{
|
{
|
||||||
|
|
@ -24,12 +22,6 @@ 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;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -76,11 +68,8 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
||||||
OnRewardedAdClicked
|
OnRewardedAdClicked
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
public void DisplayRewarded(string adPos, Action<bool> rewardCallback = null, Action showFailedCallback = null)
|
public void DisplayRewarded()
|
||||||
{
|
{
|
||||||
_rvPos = adPos;
|
|
||||||
_rvCloseCallback = rewardCallback;
|
|
||||||
_rvShowFailedCallback = showFailedCallback;
|
|
||||||
_admobRewardedAdManager.ShowHighestPayingAd();
|
_admobRewardedAdManager.ShowHighestPayingAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,18 +102,12 @@ 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)
|
||||||
|
|
@ -160,10 +143,8 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
|
||||||
return _admobInterstitialAdManager.GetHighestPayingAdRevenue();
|
return _admobInterstitialAdManager.GetHighestPayingAdRevenue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayInterstitial(string ivPos, IvType _IvType = IvType.IV1, Action closeCallback = null)
|
public void DisplayInterstitial()
|
||||||
{
|
{
|
||||||
_ivPos = ivPos;
|
|
||||||
_ivCloseCallback = closeCallback;
|
|
||||||
_admobInterstitialAdManager.ShowHighestPayingAd();
|
_admobInterstitialAdManager.ShowHighestPayingAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,18 +180,12 @@ 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 -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清理资源
|
// 清理资源
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using SDK.Utils;
|
||||||
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 : MonoBehaviour
|
public class AdsSDKManager : NormalSingleton<AdsSDKManager>
|
||||||
{
|
{
|
||||||
public static AdsSDKManager instance;
|
public static AdsSDKManager instance;
|
||||||
private List<IAdService> _adNetworks = new List<IAdService>();
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 看完广告的回调
|
/// 看完广告的回调
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -35,128 +26,17 @@ public class AdsSDKManager : MonoBehaviour
|
||||||
|
|
||||||
private void InitSDK()
|
private void InitSDK()
|
||||||
{
|
{
|
||||||
KwaiAdsManager.Init();
|
KwaiAdsManager.Instance.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>
|
||||||
public void ShowRewardAd(string _adPos, Action<bool> _rewardCallback = null, Action _showFailedCallback = null)
|
private void ShowRewardAd(Action<double> callback)
|
||||||
{
|
{
|
||||||
if (!IsRewardAdReady())
|
AdRewardCallback = callback;
|
||||||
{
|
|
||||||
_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,12 +21,8 @@ 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()
|
||||||
{
|
{
|
||||||
|
|
@ -92,19 +88,13 @@ 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()
|
||||||
|
|
@ -127,11 +117,8 @@ namespace Script.SDKManager.AdsSDKManager.BigoAdsManager
|
||||||
return _rewardedAdManager.GetAvailableAdUnits().Count > 0;
|
return _rewardedAdManager.GetAvailableAdUnits().Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayRewarded(string adPos, Action<bool> rewardCallback = null, Action showFailedCallback = null)
|
public void DisplayRewarded()
|
||||||
{
|
{
|
||||||
_rvPos = adPos;
|
|
||||||
_rvCloseCallback = rewardCallback;
|
|
||||||
_rvShowFailedCallback = showFailedCallback;
|
|
||||||
_rewardedAdManager.ShowHighestPayingAd();
|
_rewardedAdManager.ShowHighestPayingAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,18 +144,12 @@ 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();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,10 +172,8 @@ namespace Script.SDKManager.AdsSDKManager.BigoAdsManager
|
||||||
return _interstitialAdManager.GetAvailableAdUnits().Count > 0;
|
return _interstitialAdManager.GetAvailableAdUnits().Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayInterstitial(string ivPos, IvType _IvType = IvType.IV1, Action closeCallback = null)
|
public void DisplayInterstitial()
|
||||||
{
|
{
|
||||||
_IvPos = ivPos;
|
|
||||||
_ivCloseCallback = closeCallback;
|
|
||||||
_interstitialAdManager.ShowHighestPayingAd();
|
_interstitialAdManager.ShowHighestPayingAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: d0e4c55fdbb5b436f944b08b198aca51
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace DKManager.AdsSDKManager.Constant
|
||||||
Tpn,
|
Tpn,
|
||||||
Admob,
|
Admob,
|
||||||
Bigo,
|
Bigo,
|
||||||
Kwai,
|
KWai,
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,6 @@ 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()
|
||||||
{
|
{
|
||||||
|
|
@ -69,11 +64,8 @@ namespace Script.SDKManager.AdsSDKManager.MaxAdsManager
|
||||||
{
|
{
|
||||||
MaxSdk.LoadRewardedAd(max_rewarded_units);
|
MaxSdk.LoadRewardedAd(max_rewarded_units);
|
||||||
}
|
}
|
||||||
public void DisplayRewarded(string adPos, Action<bool> rewardCallback = null, Action showFailedCallback = null)
|
public void DisplayRewarded()
|
||||||
{
|
{
|
||||||
_rvPos = adPos;
|
|
||||||
_rvCloseCallback = rewardCallback;
|
|
||||||
_rvShowFailedCallback = showFailedCallback;
|
|
||||||
MaxSdk.ShowRewardedAd(max_rewarded_units);
|
MaxSdk.ShowRewardedAd(max_rewarded_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,15 +119,11 @@ 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");
|
||||||
}
|
}
|
||||||
|
|
@ -170,10 +158,8 @@ namespace Script.SDKManager.AdsSDKManager.MaxAdsManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayInterstitial(string ivPos, IvType _IvType = IvType.IV1, Action closeCallback = null)
|
public void DisplayInterstitial()
|
||||||
{
|
{
|
||||||
_ivPos = ivPos;
|
|
||||||
_ivCloseCallback = closeCallback;
|
|
||||||
MaxSdk.ShowInterstitial(max_interstitial_units);
|
MaxSdk.ShowInterstitial(max_interstitial_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,8 +187,6 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -215,8 +199,6 @@ 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,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
@ -21,11 +20,6 @@ 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()
|
||||||
{
|
{
|
||||||
|
|
@ -33,7 +27,7 @@ namespace Script.SDKManager.AdsSDKManager.TpnAdsManager
|
||||||
topon_app_key = AdConfigParser.GetTopOnAppKey();
|
topon_app_key = AdConfigParser.GetTopOnAppKey();
|
||||||
topon_interstitial_units = AdConfigParser.GetTopOnAdUnits(AdsType.Interstitial).ToArray()[0];
|
topon_interstitial_units = AdConfigParser.GetTopOnAdUnits(AdsType.Interstitial).ToArray()[0];
|
||||||
topon_rewarded_units = AdConfigParser.GetTopOnAdUnits(AdsType.Rewarded).ToArray()[0];
|
topon_rewarded_units = AdConfigParser.GetTopOnAdUnits(AdsType.Rewarded).ToArray()[0];
|
||||||
LoggerUtils.Debug("[Tpn] 初始化 Tpn 广告 SDK appid:" + topon_app_id + " appkey:" + topon_app_key + " ivId:" + topon_interstitial_units + " rvId:" + topon_rewarded_units);
|
LoggerUtils.Debug("[Tpn] 初始化 Tpn 广告 SDK appid:"+topon_app_id+" appkey:"+topon_app_key+" ivId:"+topon_interstitial_units+" rvId:"+topon_rewarded_units );
|
||||||
if (!string.IsNullOrEmpty(topon_app_id) && !string.IsNullOrEmpty(topon_app_key))
|
if (!string.IsNullOrEmpty(topon_app_id) && !string.IsNullOrEmpty(topon_app_key))
|
||||||
{
|
{
|
||||||
ATSDKAPI.initSDK(topon_app_id, topon_app_key);
|
ATSDKAPI.initSDK(topon_app_id, topon_app_key);
|
||||||
|
|
@ -58,11 +52,8 @@ namespace Script.SDKManager.AdsSDKManager.TpnAdsManager
|
||||||
|
|
||||||
}
|
}
|
||||||
public void LoadRewarded() {}
|
public void LoadRewarded() {}
|
||||||
public void DisplayRewarded(string adPos, Action<bool> rewardCallback = null, Action showFailedCallback = null)
|
public void DisplayRewarded()
|
||||||
{
|
{
|
||||||
_rvPos = adPos;
|
|
||||||
_rvCloseCallback = rewardCallback;
|
|
||||||
_rvShowFailedCallback = showFailedCallback;
|
|
||||||
ATRewardedAutoVideo.Instance.showAutoAd(topon_rewarded_units);
|
ATRewardedAutoVideo.Instance.showAutoAd(topon_rewarded_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,10 +82,8 @@ namespace Script.SDKManager.AdsSDKManager.TpnAdsManager
|
||||||
public void LoadInterstitial(){}
|
public void LoadInterstitial(){}
|
||||||
public double GetInterstitialRevenue(){return 0;}
|
public double GetInterstitialRevenue(){return 0;}
|
||||||
|
|
||||||
public void DisplayInterstitial(string ivPos, IvType _IvType = IvType.IV1, Action closeCallback = null)
|
public void DisplayInterstitial()
|
||||||
{
|
{
|
||||||
_ivPos = ivPos;
|
|
||||||
_ivCloseCallback = closeCallback;
|
|
||||||
ATInterstitialAutoAd.Instance.showAutoAd(topon_interstitial_units);
|
ATInterstitialAutoAd.Instance.showAutoAd(topon_interstitial_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,13 +137,11 @@ 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;
|
|
||||||
}
|
}
|
||||||
}, "");
|
}, "");
|
||||||
}
|
}
|
||||||
|
|
@ -167,13 +154,11 @@ 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 GetPlatformType(AdPriceInfo priceInfo)
|
public static PlatformType GetCustomContentInfo(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