激励、插屏、全屏Native竞价

This commit is contained in:
玉峰 2025-09-10 16:42:40 +08:00
parent ac14113c1f
commit f4a1f2e1e2
5 changed files with 99 additions and 7 deletions

View File

@ -117,14 +117,14 @@ namespace WZ
{
return BigoAdsManager.Instance.GetRewardedRevenue();
}
else if (result == PlatformType.Topon)
{
return TpnAdsManager.Instance.GetRewardedRevenue();
}
else if (result == PlatformType.Kwai)
{
return KwaiAdsManager.Instance.GetRewardedRevenue();
}
else if (result == PlatformType.Topon)
{
return TpnAdsManager.Instance.GetRewardedRevenue();
}
else
{
return -1;
@ -315,6 +315,19 @@ namespace WZ
}
}
/// <summary>
/// 广告比价类型
/// </summary>
/// <returns></returns>
public AdsType GetAdBidType()
{
var adsType = AdsBidResult.GetAdsType(TpnAdsManager.Instance._topon_rewarded_units, TpnAdsManager.Instance._topon_interstitial_units, GetRewardedAdRevenue(), GetInterstitialAdRevenue(), RushSDKManager.Instance.GetFullNativeRevenue());
LoggerUtils.Debug($"[SDK] AdBidType: {adsType} ");
return adsType;
}
#region IvRules
public bool IvRulesShow(IvType ivadType)

View File

@ -22,6 +22,7 @@ namespace WZ
ToponAdUnitId = toponAdUnitId;
}
}
public static class AdsBidResult
{
private static object m_toponObj = "m_toponObj";
@ -29,9 +30,16 @@ namespace WZ
private static object m_admobObj = "m_admobObj";
private static object m_bigoObj = "m_bigoObj";
private static object m_kwaiObj = "m_kwaiObj";
private static object m_toponRewardObj = "m_toponRewardObj";
private static object m_toponInterstitialObj = "m_toponInterstitialObj";
private static object m_rewardObj = "m_rewardObj";
private static object m_interstitialObj = "m_interstitialObj";
private static object m_fullNativeObj = "m_fullNativeObj";
public static PlatformType GetPlatformType(AdPriceInfo priceInfo)
{
#if UNITY_ANDROID && !UNITY_EDITOR
#if UNITY_ANDROID && !UNITY_EDITOR
using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
@ -86,5 +94,64 @@ namespace WZ
return PlatformType.NULL;
#endif
}
public static AdsType GetAdsType(string toponRewardAdUnitId, string topinInterstitialAdUnitId, double rewardPrice, double interstitialPrice, double fullNativePrice)
{
#if UNITY_ANDROID && !UNITY_EDITOR
using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject toponRewardCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", toponRewardAdUnitId, m_toponRewardObj);
AndroidJavaObject toponInterstitialCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", topinInterstitialAdUnitId, m_toponInterstitialObj);
AndroidJavaObject rewardCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", rewardPrice * 1000, m_rewardObj);
AndroidJavaObject interstitialCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", interstitialPrice * 1000, m_interstitialObj);
AndroidJavaObject fullNativeCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", fullNativePrice * 1000, m_fullNativeObj);
AndroidJavaObject atCustomContentInfoList = new AndroidJavaObject("java.util.ArrayList");
atCustomContentInfoList.Call<bool>("add", toponRewardCustomContentInfo);
atCustomContentInfoList.Call<bool>("add", toponInterstitialCustomContentInfo);
atCustomContentInfoList.Call<bool>("add", rewardCustomContentInfo);
atCustomContentInfoList.Call<bool>("add", interstitialCustomContentInfo);
atCustomContentInfoList.Call<bool>("add", fullNativeCustomContentInfo);
AndroidJavaClass sdkGlobalSetting = new AndroidJavaClass("com.thinkup.core.api.TUSDKGlobalSetting");
AndroidJavaObject maxPriceCustomContentInfo = sdkGlobalSetting.CallStatic<AndroidJavaObject>("customContentReviewResult", atCustomContentInfoList);
string customContentString = maxPriceCustomContentInfo.Get<string>("customContentString");
double customContentDouble = maxPriceCustomContentInfo.Get<double>("customContentDouble");
AndroidJavaObject customContentObject = maxPriceCustomContentInfo.Get<AndroidJavaObject>("customContentObject");
string customContentObjectString = customContentObject != null ? customContentObject.Call<string>("toString") : "null";
LoggerUtils.Debug("[AdsBidResult] rewardPrice: " + rewardPrice * 1000 + " interstitialPrice: " + interstitialPrice * 1000 + " fullNativePrice: " + fullNativePrice * 1000 + " toponRewardAdUnitId: " +toponRewardAdUnitId + " topinInterstitialAdUnitId: " + topinInterstitialAdUnitId);
LoggerUtils.Debug("[AdsBidResult] final maxPriceCustomContentInfo: " + customContentString + " double: " + customContentDouble + " object:" + customContentObjectString);
if (customContentObjectString.Equals(m_toponRewardObj))
{
return AdsType.Rewarded;
}
else if (customContentObjectString.Equals(m_toponInterstitialObj))
{
return AdsType.Interstitial;
}
else if (customContentObjectString.Equals(m_rewardObj))
{
return AdsType.Rewarded;
}
else if (customContentObjectString.Equals(m_interstitialObj))
{
return AdsType.Interstitial;
}
else if (customContentObjectString.Equals(m_fullNativeObj))
{
return AdsType.Native;
}
else
{
return AdsType.Rewarded;
}
}
#else
return AdsType.Rewarded;
#endif
}
}
}

View File

@ -31,6 +31,15 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
#region ad
/// <summary>
/// 多类型广告竞价激励、插屏、全屏Native
/// </summary>
/// <returns></returns>
public AdsType GetAdBidType()
{
return AdsSDKManager.Instance.GetAdBidType();
}
/// <summary>
/// 是否已缓存激励广告
/// </summary>
@ -86,6 +95,8 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
return AdsSDKManager.Instance.GetRewardedAdRevenue();
}
/// <summary>
/// 是否已缓存插屏
/// </summary>
@ -193,7 +204,7 @@ public class RushSDKManager : D_MonoSingleton<RushSDKManager>
/// <summary>
/// 获取激励广告价值
/// 获取全屏Native广告价值
/// </summary>
/// <returns></returns>
public double GetFullNativeRevenue()

View File

@ -17,6 +17,7 @@ public class Test : MonoBehaviour
{
small = gameObject.transform.Find("NativeAd-small").GetComponent<RectTransform>();
medium = gameObject.transform.Find("NativeAd-medium").GetComponent<RectTransform>();
RushSDKManager.Instance.InitializeSdk(null, true);
}
public void OnShowAd()

View File

@ -1 +1 @@
Build from HY-LSZNWIN10 at 2025/9/9 14:28:41
Build from HY-LSZNWIN10 at 2025/9/10 16:37:43