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
|
#region IvRules
|
||||||
|
|
||||||
public bool IvRulesShow(IvType ivadType)
|
public bool IvRulesShow(IvType ivadType, bool isShow = true)
|
||||||
{
|
{
|
||||||
//1.获取远程配置
|
//1.获取远程配置
|
||||||
string json = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString("IV_RULES");
|
string json = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString("IV_RULES");
|
||||||
|
@ -367,7 +367,10 @@ namespace WZ
|
||||||
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 前N次不展示插屏, 本地次数是{currentSkipLevel + 1}, 远程参数是{skipLevel}");
|
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 前N次不展示插屏, 本地次数是{currentSkipLevel + 1}, 远程参数是{skipLevel}");
|
||||||
if (currentSkipLevel < 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;
|
return false;
|
||||||
}
|
}
|
||||||
//5.判断overLevel(每跳过几次触发) 第一次会展示 之后每展示一次间隔+1
|
//5.判断overLevel(每跳过几次触发) 第一次会展示 之后每展示一次间隔+1
|
||||||
|
@ -376,14 +379,18 @@ namespace WZ
|
||||||
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 当前间隔次数: 本地次数是{currentOverLevel + 1}, 远程参数是{overLevel}");
|
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 当前间隔次数: 本地次数是{currentOverLevel + 1}, 远程参数是{overLevel}");
|
||||||
if (currentOverLevel != 0)
|
if (currentOverLevel != 0)
|
||||||
{
|
{
|
||||||
if (currentOverLevel >= overLevel)
|
if (isShow)
|
||||||
{
|
{
|
||||||
IvRulesConst.OverLevels[ivadType.ToString()] = 0;
|
if (currentOverLevel >= overLevel)
|
||||||
}
|
{
|
||||||
else
|
IvRulesConst.OverLevels[ivadType.ToString()] = 0;
|
||||||
{
|
}
|
||||||
IvRulesConst.OverLevels[ivadType.ToString()] += 1;
|
else
|
||||||
|
{
|
||||||
|
IvRulesConst.OverLevels[ivadType.ToString()] += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,9 +230,13 @@ namespace WZ
|
||||||
|
|
||||||
private Parameter GetParameter(string key, object value)
|
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))
|
if (type == typeof(string))
|
||||||
{
|
{
|
||||||
return new Parameter(key, value as string);
|
return new Parameter(key, value as string);
|
||||||
|
|
|
@ -159,6 +159,16 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
||||||
return AdsSDKManager.Instance.IsInterstitialReady();
|
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>
|
||||||
/// 展示插屏广告
|
/// 展示插屏广告
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -250,7 +260,14 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
||||||
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
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);
|
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
||||||
if (!IsNativeFullReady())
|
if (!IsNativeFullReady())
|
||||||
|
@ -260,11 +277,17 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
||||||
}
|
}
|
||||||
|
|
||||||
var adUnitId = StaticValue.AdmobFullNativeId;
|
var adUnitId = StaticValue.AdmobFullNativeId;
|
||||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
|
||||||
|
if (nativeTemplateStyle == null)
|
||||||
{
|
{
|
||||||
TemplateId = NativeTemplateId.Medium,
|
nativeTemplateStyle = new NativeTemplateStyle
|
||||||
MainBackgroundColor = Color.white
|
{
|
||||||
}, rectTransform, pCom);
|
TemplateId = NativeTemplateId.Medium,
|
||||||
|
MainBackgroundColor = Color.white
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||||
|
|
||||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||||
}
|
}
|
||||||
|
@ -296,7 +319,7 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
||||||
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
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);
|
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
||||||
if (!IsNativeReady())
|
if (!IsNativeReady())
|
||||||
|
@ -305,12 +328,19 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var adUnitId = StaticValue.AdmobNativeId;
|
if (nativeTemplateStyle == null)
|
||||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
|
||||||
{
|
{
|
||||||
TemplateId = NativeTemplateId.Small,
|
nativeTemplateStyle = new NativeTemplateStyle
|
||||||
MainBackgroundColor = Color.white
|
{
|
||||||
}, rectTransform, pCom);
|
//除了中型Native,其他的都是Small
|
||||||
|
TemplateId = NativeTemplateId.Small,
|
||||||
|
//背景颜色
|
||||||
|
MainBackgroundColor = Color.white
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var adUnitId = StaticValue.AdmobNativeId;
|
||||||
|
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||||
|
|
||||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||||
}
|
}
|
||||||
|
@ -327,7 +357,7 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
||||||
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
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);
|
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
||||||
if (!IsSmallNativeReady())
|
if (!IsSmallNativeReady())
|
||||||
|
@ -336,12 +366,17 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var adUnitId = StaticValue.AdmobSmallNativeId;
|
if (nativeTemplateStyle == null)
|
||||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
|
||||||
{
|
{
|
||||||
TemplateId = NativeTemplateId.Small,
|
nativeTemplateStyle = new NativeTemplateStyle
|
||||||
MainBackgroundColor = Color.white
|
{
|
||||||
}, rectTransform, pCom);
|
TemplateId = NativeTemplateId.Small,
|
||||||
|
MainBackgroundColor = Color.white
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var adUnitId = StaticValue.AdmobSmallNativeId;
|
||||||
|
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||||
|
|
||||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||||
}
|
}
|
||||||
|
@ -358,7 +393,7 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
||||||
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
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);
|
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
||||||
if (!IsMinddleNativeReady())
|
if (!IsMinddleNativeReady())
|
||||||
|
@ -367,12 +402,17 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
if (nativeTemplateStyle == null)
|
||||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
|
||||||
{
|
{
|
||||||
TemplateId = NativeTemplateId.Small,
|
nativeTemplateStyle = new NativeTemplateStyle
|
||||||
MainBackgroundColor = Color.white
|
{
|
||||||
}, rectTransform, pCom);
|
TemplateId = NativeTemplateId.Small,
|
||||||
|
MainBackgroundColor = Color.white
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
||||||
|
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
||||||
|
|
||||||
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue