Merge branch 'main' of http://v4.9ms.co:7777/yufeng/SDK_UnityMoney
This commit is contained in:
commit
7e7f3a0234
|
@ -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");
|
||||
|
@ -367,7 +367,10 @@ namespace WZ
|
|||
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 前N次不展示插屏, 本地次数是{currentSkipLevel + 1}, 远程参数是{skipLevel}");
|
||||
if (currentSkipLevel < skipLevel)
|
||||
{
|
||||
PlayerPrefsUtils.SavePlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", currentSkipLevel + 1);
|
||||
if (isShow)
|
||||
{
|
||||
PlayerPrefsUtils.SavePlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", currentSkipLevel + 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//5.判断overLevel(每跳过几次触发) 第一次会展示 之后每展示一次间隔+1
|
||||
|
@ -376,14 +379,18 @@ namespace WZ
|
|||
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 当前间隔次数: 本地次数是{currentOverLevel + 1}, 远程参数是{overLevel}");
|
||||
if (currentOverLevel != 0)
|
||||
{
|
||||
if (currentOverLevel >= overLevel)
|
||||
if (isShow)
|
||||
{
|
||||
IvRulesConst.OverLevels[ivadType.ToString()] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
IvRulesConst.OverLevels[ivadType.ToString()] += 1;
|
||||
if (currentOverLevel >= overLevel)
|
||||
{
|
||||
IvRulesConst.OverLevels[ivadType.ToString()] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
IvRulesConst.OverLevels[ivadType.ToString()] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -230,9 +230,13 @@ namespace WZ
|
|||
|
||||
private Parameter GetParameter(string key, object value)
|
||||
{
|
||||
Type type = value.GetType();
|
||||
|
||||
// 根据类型进行转换
|
||||
if (value == null)
|
||||
{
|
||||
return new Parameter(key, "");
|
||||
}
|
||||
|
||||
Type type = value.GetType();
|
||||
if (type == typeof(string))
|
||||
{
|
||||
return new Parameter(key, value as string);
|
||||
|
|
|
@ -159,6 +159,16 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return AdsSDKManager.Instance.IsInterstitialReady();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否能展示插屏
|
||||
/// </summary>
|
||||
/// <param name="ivType"></param>
|
||||
/// <returns></returns>
|
||||
public bool CanShowInterstitialAd(IvType ivType)
|
||||
{
|
||||
return AdsSDKManager.Instance.IvRulesShow(ivType, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 展示插屏广告
|
||||
/// </summary>
|
||||
|
@ -250,7 +260,14 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
||||
}
|
||||
|
||||
public void ShowFullNative(RectTransform rectTransform, Camera pCom = null, string position = "")
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="rectTransform"></param>
|
||||
/// <param name="pCom"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="nativeTemplateStyle"></param>
|
||||
public void ShowFullNative(RectTransform rectTransform, Camera pCom = null, string position = "", NativeTemplateStyle nativeTemplateStyle = null)
|
||||
{
|
||||
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
||||
if (!IsNativeFullReady())
|
||||
|
@ -260,11 +277,17 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobFullNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
|
||||
if (nativeTemplateStyle == null)
|
||||
{
|
||||
TemplateId = NativeTemplateId.Medium,
|
||||
MainBackgroundColor = Color.white
|
||||
}, rectTransform, pCom);
|
||||
nativeTemplateStyle = new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Medium,
|
||||
MainBackgroundColor = Color.white
|
||||
};
|
||||
}
|
||||
|
||||
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||
|
||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||
}
|
||||
|
@ -296,7 +319,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())
|
||||
|
@ -304,13 +327,20 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
AdsActionEvents.TrackAdFailToShow(AdsType.Native, position, AdsShowFailType.NoFill);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nativeTemplateStyle == null)
|
||||
{
|
||||
nativeTemplateStyle = new NativeTemplateStyle
|
||||
{
|
||||
//除了中型Native,其他的都是Small
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
//背景颜色
|
||||
MainBackgroundColor = Color.white
|
||||
};
|
||||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
MainBackgroundColor = Color.white
|
||||
}, rectTransform, pCom);
|
||||
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||
|
||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||
}
|
||||
|
@ -327,7 +357,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())
|
||||
|
@ -335,13 +365,18 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
AdsActionEvents.TrackAdFailToShow(AdsType.Native, position, AdsShowFailType.NoFill);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nativeTemplateStyle == null)
|
||||
{
|
||||
nativeTemplateStyle = new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
MainBackgroundColor = Color.white
|
||||
};
|
||||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobSmallNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
MainBackgroundColor = Color.white
|
||||
}, rectTransform, pCom);
|
||||
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||
|
||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||
}
|
||||
|
@ -358,7 +393,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())
|
||||
|
@ -366,13 +401,18 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
|||
AdsActionEvents.TrackAdFailToShow(AdsType.Native, position, AdsShowFailType.NoFill);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nativeTemplateStyle == null)
|
||||
{
|
||||
nativeTemplateStyle = new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
MainBackgroundColor = Color.white
|
||||
};
|
||||
}
|
||||
|
||||
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
MainBackgroundColor = Color.white
|
||||
}, rectTransform, pCom);
|
||||
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||
|
||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue