SDK_UnityMoney/Assets/Script/SDKManager/AdsSDKManager/Utils/AdsBidResult.cs

90 lines
4.7 KiB
C#
Raw Normal View History

2025-08-31 02:52:49 +00:00
using System.Collections;
using System.Collections.Generic;
2025-09-01 10:32:50 +00:00
2025-08-31 02:52:49 +00:00
using UnityEngine;
2025-09-01 10:32:50 +00:00
namespace WZ
2025-08-31 02:52:49 +00:00
{
public struct AdPriceInfo
{
public double MaxPrice;
public double AdmobPrice;
public double BigoPrice;
public double KwaiPrice;
2025-08-31 02:52:49 +00:00
public string ToponAdUnitId;
public AdPriceInfo(double maxPrice, double admobPrice, double bigoPrice, double kwaiPrice,string toponAdUnitId)
2025-08-31 02:52:49 +00:00
{
MaxPrice = maxPrice;
AdmobPrice = admobPrice;
BigoPrice = bigoPrice;
KwaiPrice = kwaiPrice;
2025-08-31 02:52:49 +00:00
ToponAdUnitId = toponAdUnitId;
}
}
public static class AdsBidResult
{
private static object m_toponObj = "m_toponObj";
private static object m_maxObj = "m_maxObj";
private static object m_admobObj = "m_admobObj";
private static object m_bigoObj = "m_bigoObj";
private static object m_kwaiObj = "m_kwaiObj";
2025-08-31 05:15:14 +00:00
public static PlatformType GetPlatformType(AdPriceInfo priceInfo)
2025-08-31 02:52:49 +00:00
{
#if UNITY_ANDROID && !UNITY_EDITOR
2025-08-31 02:52:49 +00:00
using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
2025-09-02 09:14:49 +00:00
AndroidJavaObject toponCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", priceInfo.ToponAdUnitId, m_toponObj);
AndroidJavaObject admobCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", priceInfo.AdmobPrice * 1000, m_admobObj);
AndroidJavaObject maxCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", priceInfo.MaxPrice * 1000, m_maxObj);
AndroidJavaObject bigoCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", priceInfo.BigoPrice * 1000, m_bigoObj);
AndroidJavaObject kwaiCustomContentInfo = new AndroidJavaObject("com.thinkup.core.api.TUCustomContentInfo", priceInfo.KwaiPrice * 1000, m_kwaiObj);
2025-08-31 02:52:49 +00:00
AndroidJavaObject atCustomContentInfoList = new AndroidJavaObject("java.util.ArrayList");
atCustomContentInfoList.Call<bool>("add", toponCustomContentInfo);
atCustomContentInfoList.Call<bool>("add", admobCustomContentInfo);
atCustomContentInfoList.Call<bool>("add", maxCustomContentInfo);
atCustomContentInfoList.Call<bool>("add", bigoCustomContentInfo);
atCustomContentInfoList.Call<bool>("add", kwaiCustomContentInfo);
2025-09-02 09:14:49 +00:00
AndroidJavaClass sdkGlobalSetting = new AndroidJavaClass("com.thinkup.core.api.TUSDKGlobalSetting");
2025-08-31 02:52:49 +00:00
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] maxPrice: " + priceInfo.MaxPrice * 1000 + " bigoPrice: " + priceInfo.BigoPrice * 1000 + " admobPrice: " + priceInfo.AdmobPrice * 1000 + " kwaiPrice: " + priceInfo.KwaiPrice * 1000 + " toponAdUnitId: " + priceInfo.ToponAdUnitId);
2025-08-31 02:52:49 +00:00
LoggerUtils.Debug("[AdsBidResult] final maxPriceCustomContentInfo: " + customContentString + " double: " + customContentDouble + " object:" + customContentObjectString);
if (customContentObjectString.Equals(m_toponObj))
{
2025-09-01 08:14:50 +00:00
return PlatformType.Topon;
2025-08-31 02:52:49 +00:00
}
else if (customContentObjectString.Equals(m_maxObj))
{
2025-09-01 08:14:50 +00:00
return PlatformType.AppLovin;
2025-08-31 02:52:49 +00:00
}
else if (customContentObjectString.Equals(m_admobObj))
{
return PlatformType.Admob;
}
else if (customContentObjectString.Equals(m_bigoObj))
{
return PlatformType.Bigo;
}
else if (customContentObjectString.Equals(m_kwaiObj))
{
return PlatformType.Kwai;
}
2025-08-31 02:52:49 +00:00
else
{
return PlatformType.NULL;
}
}
#else
return PlatformType.NULL;
#endif
}
}
}