using System.Collections; using System.Collections.Generic; using UnityEngine; namespace WZ { public struct AdPriceInfo { public double MaxPrice; public double AdmobPrice; public double BigoPrice; public double KwaiPrice; public string ToponAdUnitId; public AdPriceInfo(double maxPrice, double admobPrice, double bigoPrice, double kwaiPrice,string toponAdUnitId) { MaxPrice = maxPrice; AdmobPrice = admobPrice; BigoPrice = bigoPrice; KwaiPrice = kwaiPrice; 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"; public static PlatformType GetPlatformType(AdPriceInfo priceInfo) { #if UNITY_ANDROID && !UNITY_EDITOR using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { AndroidJavaObject activity = unityPlayer.GetStatic("currentActivity"); 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); AndroidJavaObject atCustomContentInfoList = new AndroidJavaObject("java.util.ArrayList"); atCustomContentInfoList.Call("add", toponCustomContentInfo); atCustomContentInfoList.Call("add", admobCustomContentInfo); atCustomContentInfoList.Call("add", maxCustomContentInfo); atCustomContentInfoList.Call("add", bigoCustomContentInfo); atCustomContentInfoList.Call("add", kwaiCustomContentInfo); AndroidJavaClass sdkGlobalSetting = new AndroidJavaClass("com.thinkup.core.api.TUSDKGlobalSetting"); AndroidJavaObject maxPriceCustomContentInfo = sdkGlobalSetting.CallStatic("customContentReviewResult", atCustomContentInfoList); string customContentString = maxPriceCustomContentInfo.Get("customContentString"); double customContentDouble = maxPriceCustomContentInfo.Get("customContentDouble"); AndroidJavaObject customContentObject = maxPriceCustomContentInfo.Get("customContentObject"); string customContentObjectString = customContentObject != null ? customContentObject.Call("toString") : "null"; LoggerUtils.Debug("[AdsBidResult] maxPrice: " + priceInfo.MaxPrice * 1000 + " bigoPrice: " + priceInfo.BigoPrice * 1000 + " admobPrice: " + priceInfo.AdmobPrice * 1000 + " kwaiPrice: " + priceInfo.KwaiPrice * 1000 + " toponAdUnitId: " + priceInfo.ToponAdUnitId); LoggerUtils.Debug("[AdsBidResult] final maxPriceCustomContentInfo: " + customContentString + " double: " + customContentDouble + " object:" + customContentObjectString); if (customContentObjectString.Equals(m_toponObj)) { return PlatformType.Topon; } else if (customContentObjectString.Equals(m_maxObj)) { return PlatformType.AppLovin; } 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; } else { return PlatformType.NULL; } } #else return PlatformType.NULL; #endif } } }