parent
c89fe09c1a
commit
426ef62b6d
|
@ -331,7 +331,7 @@ namespace WZ
|
|||
|
||||
#region IvRules
|
||||
|
||||
public bool IvRulesShow(IvType ivadType)
|
||||
public bool IvRulesShow(IvType ivadType, bool isShow = true)
|
||||
{
|
||||
//1.获取远程配置
|
||||
string json = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString("IV_RULES");
|
||||
|
@ -366,8 +366,11 @@ namespace WZ
|
|||
int currentSkipLevel = PlayerPrefsUtils.GetPlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", 0);
|
||||
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 前N次不展示插屏, 本地次数是{currentSkipLevel + 1}, 远程参数是{skipLevel}");
|
||||
if (currentSkipLevel < skipLevel)
|
||||
{
|
||||
if (isShow)
|
||||
{
|
||||
PlayerPrefsUtils.SavePlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", currentSkipLevel + 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//5.判断overLevel(每跳过几次触发) 第一次会展示 之后每展示一次间隔+1
|
||||
|
@ -375,6 +378,8 @@ namespace WZ
|
|||
int currentOverLevel = IvRulesConst.OverLevels.ContainsKey(ivadType.ToString()) ? IvRulesConst.OverLevels[ivadType.ToString()] : 0;
|
||||
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 当前间隔次数: 本地次数是{currentOverLevel + 1}, 远程参数是{overLevel}");
|
||||
if (currentOverLevel != 0)
|
||||
{
|
||||
if (isShow)
|
||||
{
|
||||
if (currentOverLevel >= overLevel)
|
||||
{
|
||||
|
@ -384,6 +389,8 @@ namespace WZ
|
|||
{
|
||||
IvRulesConst.OverLevels[ivadType.ToString()] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,11 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return AdsSDKManager.Instance.IsInterstitialReady();
|
||||
}
|
||||
|
||||
public bool CanShowInterstitialAd(IvType ivType)
|
||||
{
|
||||
return AdsSDKManager.Instance.IvRulesShow(ivType, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 展示插屏广告
|
||||
/// </summary>
|
||||
|
@ -250,7 +255,7 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
||||
}
|
||||
|
||||
public void ShowFullNative(RectTransform rectTransform, Camera pCom = null, string position = "")
|
||||
public void ShowFullNative(RectTransform rectTransform, Camera pCom = null, string position = "", NativeTemplateStyle nativeTemplateStyle = null)
|
||||
{
|
||||
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
||||
if (!IsNativeFullReady())
|
||||
|
@ -260,11 +265,17 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobFullNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
|
||||
if (nativeTemplateStyle == null)
|
||||
{
|
||||
nativeTemplateStyle = new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Medium,
|
||||
MainBackgroundColor = Color.white
|
||||
}, rectTransform, pCom);
|
||||
};
|
||||
}
|
||||
|
||||
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||
|
||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||
}
|
||||
|
@ -296,7 +307,7 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
||||
}
|
||||
|
||||
public void ShowNative(RectTransform rectTransform, Camera pCom = null, string position = "")
|
||||
public void ShowNative(RectTransform rectTransform, Camera pCom = null, string position = "", NativeTemplateStyle nativeTemplateStyle = null)
|
||||
{
|
||||
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
||||
if (!IsNativeReady())
|
||||
|
@ -305,12 +316,17 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return;
|
||||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
if (nativeTemplateStyle == null)
|
||||
{
|
||||
nativeTemplateStyle = new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
MainBackgroundColor = Color.white
|
||||
}, rectTransform, pCom);
|
||||
};
|
||||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||
|
||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||
}
|
||||
|
@ -327,7 +343,7 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
||||
}
|
||||
|
||||
public void ShowSmallNative(RectTransform rectTransform, Camera pCom = null, string position = "")
|
||||
public void ShowSmallNative(RectTransform rectTransform, Camera pCom = null, string position = "", NativeTemplateStyle nativeTemplateStyle = null)
|
||||
{
|
||||
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
||||
if (!IsSmallNativeReady())
|
||||
|
@ -336,12 +352,17 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return;
|
||||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobSmallNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
if (nativeTemplateStyle == null)
|
||||
{
|
||||
nativeTemplateStyle = new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
MainBackgroundColor = Color.white
|
||||
}, rectTransform, pCom);
|
||||
};
|
||||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobSmallNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||
|
||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||
}
|
||||
|
@ -358,7 +379,7 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
||||
}
|
||||
|
||||
public void ShowMinddleNative(RectTransform rectTransform, Camera pCom = null, string position = "")
|
||||
public void ShowMinddleNative(RectTransform rectTransform, Camera pCom = null, string position = "", NativeTemplateStyle nativeTemplateStyle = null)
|
||||
{
|
||||
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
||||
if (!IsMinddleNativeReady())
|
||||
|
@ -367,12 +388,17 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return;
|
||||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
if (nativeTemplateStyle == null)
|
||||
{
|
||||
nativeTemplateStyle = new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
MainBackgroundColor = Color.white
|
||||
}, rectTransform, pCom);
|
||||
};
|
||||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||
|
||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue