Compare commits
No commits in common. "295b16d3cdb579652308fc2a7250869a79d638e2" and "017aa5de36a80d01843d907bfb4471cd2e768c87" have entirely different histories.
295b16d3cd
...
017aa5de36
|
|
@ -436,40 +436,6 @@ namespace WZ
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 判断当前广告id的配置是否包含这个id
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="adsType"></param>
|
|
||||||
/// <param name="adUnitId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool FindAdsID(AdsType adsType, string adUnitId)
|
|
||||||
{
|
|
||||||
if (adsType == AdsType.Rewarded)
|
|
||||||
{
|
|
||||||
return _rewardedAdUnits.Contains(adUnitId);
|
|
||||||
}
|
|
||||||
else if (adsType == AdsType.Interstitial)
|
|
||||||
{
|
|
||||||
return _interstitialAdUnits.Contains(adUnitId);
|
|
||||||
}
|
|
||||||
else if (adsType == AdsType.Native)
|
|
||||||
{
|
|
||||||
return _nativeAdUnits.Contains(adUnitId);
|
|
||||||
}
|
|
||||||
else if (adsType == AdsType.Splash)
|
|
||||||
{
|
|
||||||
return _splashAdUnits.Contains(adUnitId);
|
|
||||||
}
|
|
||||||
else if (adsType == AdsType.Banner)
|
|
||||||
{
|
|
||||||
return _bannerAdUnits.Contains(adUnitId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,10 +91,6 @@ namespace WZ
|
||||||
|
|
||||||
public void LoadAd(string adUnitId)
|
public void LoadAd(string adUnitId)
|
||||||
{
|
{
|
||||||
if (!AdmobAdsManager.Instance.FindAdsID(AdsType.Banner, adUnitId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_bannerAds.TryGetValue(adUnitId, out var ad))
|
if (_bannerAds.TryGetValue(adUnitId, out var ad))
|
||||||
{
|
{
|
||||||
ad.LoadAd(new AdRequest());
|
ad.LoadAd(new AdRequest());
|
||||||
|
|
@ -126,11 +122,6 @@ namespace WZ
|
||||||
// 显示特定广告位的广告
|
// 显示特定广告位的广告
|
||||||
private void ShowAd(string adUnitId)
|
private void ShowAd(string adUnitId)
|
||||||
{
|
{
|
||||||
if (!AdmobAdsManager.Instance.FindAdsID(AdsType.Banner, adUnitId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_bannerAds.TryGetValue(adUnitId, out var ad))
|
if (_bannerAds.TryGetValue(adUnitId, out var ad))
|
||||||
{
|
{
|
||||||
ad.Show();
|
ad.Show();
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,6 @@ namespace WZ
|
||||||
onAdLoadFailed?.Invoke(adUnitId, error.GetCode(), error.GetMessage());
|
onAdLoadFailed?.Invoke(adUnitId, error.GetCode(), error.GetMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AdmobAdsManager.Instance.FindAdsID(AdsType.Interstitial, adUnitId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoggerUtils.Debug("Admob Interstitial ad loaded with response : " + ad.GetResponseInfo().ToString());
|
LoggerUtils.Debug("Admob Interstitial ad loaded with response : " + ad.GetResponseInfo().ToString());
|
||||||
_interstitialAds[adUnitId] = ad;
|
_interstitialAds[adUnitId] = ad;
|
||||||
|
|
@ -133,10 +128,6 @@ namespace WZ
|
||||||
// 检查特定广告位是否可用
|
// 检查特定广告位是否可用
|
||||||
private bool IsAdAvailable(string adUnitId)
|
private bool IsAdAvailable(string adUnitId)
|
||||||
{
|
{
|
||||||
if (!AdmobAdsManager.Instance.FindAdsID(AdsType.Interstitial, adUnitId))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return _interstitialAds.TryGetValue(adUnitId, out var ad) && ad.CanShowAd();
|
return _interstitialAds.TryGetValue(adUnitId, out var ad) && ad.CanShowAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,6 @@ namespace WZ
|
||||||
public void LoadAd(string adUnitId)
|
public void LoadAd(string adUnitId)
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug($"[Admob] Native Ad unit {adUnitId} load start");
|
LoggerUtils.Debug($"[Admob] Native Ad unit {adUnitId} load start");
|
||||||
//判断在线参数是否包含这个id
|
|
||||||
if (!AdmobAdsManager.Instance.FindAdsID(AdsType.Native, adUnitId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NativeOverlayAd.Load(adUnitId, new AdRequest(), new NativeAdOptions(), (NativeOverlayAd ad, LoadAdError error) =>
|
NativeOverlayAd.Load(adUnitId, new AdRequest(), new NativeAdOptions(), (NativeOverlayAd ad, LoadAdError error) =>
|
||||||
{
|
{
|
||||||
|
|
@ -81,11 +76,6 @@ namespace WZ
|
||||||
LoggerUtils.Debug("[Admob] Native ad failed to load an ad with error : " + error + " \n retryDelay :" + retryDelay);
|
LoggerUtils.Debug("[Admob] Native ad failed to load an ad with error : " + error + " \n retryDelay :" + retryDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AdmobAdsManager.Instance.FindAdsID(AdsType.Native, adUnitId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AdsActionEvents.TrackAdLoaded(PlatformType.Admob,
|
AdsActionEvents.TrackAdLoaded(PlatformType.Admob,
|
||||||
ad.GetResponseInfo().GetLoadedAdapterResponseInfo().AdSourceName,
|
ad.GetResponseInfo().GetLoadedAdapterResponseInfo().AdSourceName,
|
||||||
|
|
@ -153,11 +143,6 @@ namespace WZ
|
||||||
// 显示特定广告位的广告
|
// 显示特定广告位的广告
|
||||||
public void ShowAd(NativeAdPosition position, string adUnitId)
|
public void ShowAd(NativeAdPosition position, string adUnitId)
|
||||||
{
|
{
|
||||||
if (!AdmobAdsManager.Instance.FindAdsID(AdsType.Native, adUnitId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoggerUtils.Debug($"[Admob] Native ad ShowAd start {adUnitId} , {position}");
|
LoggerUtils.Debug($"[Admob] Native ad ShowAd start {adUnitId} , {position}");
|
||||||
|
|
||||||
if (_nativeAds.TryGetValue(adUnitId, out var ad))
|
if (_nativeAds.TryGetValue(adUnitId, out var ad))
|
||||||
|
|
@ -307,7 +292,6 @@ namespace WZ
|
||||||
_adStartLoadTimes.Remove(key);
|
_adStartLoadTimes.Remove(key);
|
||||||
_adRevenueCache.Remove(key);
|
_adRevenueCache.Remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -53,11 +53,6 @@ namespace WZ
|
||||||
|
|
||||||
LoggerUtils.Debug("[Admob] rewarded ad loaded with response : " + ad.GetResponseInfo().ToString()+"revenue:"+AdmobUtils.GetRewardedAdEcpm(ad));
|
LoggerUtils.Debug("[Admob] rewarded ad loaded with response : " + ad.GetResponseInfo().ToString()+"revenue:"+AdmobUtils.GetRewardedAdEcpm(ad));
|
||||||
LoggerUtils.Debug("[Admob] rewarded ad revenue : " +AdmobUtils.GetRewardedAdEcpm(ad));
|
LoggerUtils.Debug("[Admob] rewarded ad revenue : " +AdmobUtils.GetRewardedAdEcpm(ad));
|
||||||
|
|
||||||
if (!AdmobAdsManager.Instance.FindAdsID(AdsType.Rewarded, adUnitId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_rewardedAds[adUnitId] = ad;
|
_rewardedAds[adUnitId] = ad;
|
||||||
_adRevenueCache[adUnitId] = AdmobUtils.GetRewardedAdEcpm(ad);
|
_adRevenueCache[adUnitId] = AdmobUtils.GetRewardedAdEcpm(ad);
|
||||||
|
|
@ -133,10 +128,6 @@ namespace WZ
|
||||||
// 检查特定广告位是否可用
|
// 检查特定广告位是否可用
|
||||||
private bool IsAdAvailable(string adUnitId)
|
private bool IsAdAvailable(string adUnitId)
|
||||||
{
|
{
|
||||||
if (!AdmobAdsManager.Instance.FindAdsID(AdsType.Rewarded, adUnitId))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return _rewardedAds.TryGetValue(adUnitId, out var ad) && ad.CanShowAd();
|
return _rewardedAds.TryGetValue(adUnitId, out var ad) && ad.CanShowAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue