From 655f507c30a96fc442a2ac6c95bbac4e90b527d3 Mon Sep 17 00:00:00 2001 From: juncong lee Date: Sun, 31 Aug 2025 10:52:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=BF=E5=91=8A=E7=AB=9E=E4=BB=B7=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdsSDKManager/Constant/PlatformType.cs | 16 ++++ .../Constant/PlatformType.cs.meta | 2 + .../AdsSDKManager/Utils/AdsBidResult.cs | 83 +++++++++++++++++++ .../AdsSDKManager/Utils/AdsBidResult.cs.meta | 2 + 4 files changed, 103 insertions(+) create mode 100644 Assets/Script/SDKManager/AdsSDKManager/Constant/PlatformType.cs create mode 100644 Assets/Script/SDKManager/AdsSDKManager/Constant/PlatformType.cs.meta create mode 100644 Assets/Script/SDKManager/AdsSDKManager/Utils/AdsBidResult.cs create mode 100644 Assets/Script/SDKManager/AdsSDKManager/Utils/AdsBidResult.cs.meta diff --git a/Assets/Script/SDKManager/AdsSDKManager/Constant/PlatformType.cs b/Assets/Script/SDKManager/AdsSDKManager/Constant/PlatformType.cs new file mode 100644 index 0000000..9026472 --- /dev/null +++ b/Assets/Script/SDKManager/AdsSDKManager/Constant/PlatformType.cs @@ -0,0 +1,16 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace DKManager.AdsSDKManager.Constant +{ + public enum PlatformType + { + Max, + Tpn, + Admob, + Bigo, + KWai, + NULL + } +} diff --git a/Assets/Script/SDKManager/AdsSDKManager/Constant/PlatformType.cs.meta b/Assets/Script/SDKManager/AdsSDKManager/Constant/PlatformType.cs.meta new file mode 100644 index 0000000..291a091 --- /dev/null +++ b/Assets/Script/SDKManager/AdsSDKManager/Constant/PlatformType.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f0206a38823ea41d3af8ac3dad0e3381 \ No newline at end of file diff --git a/Assets/Script/SDKManager/AdsSDKManager/Utils/AdsBidResult.cs b/Assets/Script/SDKManager/AdsSDKManager/Utils/AdsBidResult.cs new file mode 100644 index 0000000..a7a4318 --- /dev/null +++ b/Assets/Script/SDKManager/AdsSDKManager/Utils/AdsBidResult.cs @@ -0,0 +1,83 @@ +using System.Collections; +using System.Collections.Generic; +using DKManager.AdsSDKManager.Constant; +using Script.Utils; +using UnityEngine; + +namespace Script.SDKManager.AdsSDKManager.Utils +{ + public struct AdPriceInfo + { + public double MaxPrice; + public double AdmobPrice; + public double BigoPrice; + public string ToponAdUnitId; + + public AdPriceInfo(double maxPrice, double admobPrice, double bigoPrice, string toponAdUnitId) + { + MaxPrice = maxPrice; + AdmobPrice = admobPrice; + BigoPrice = bigoPrice; + 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"; + public static PlatformType GetCustomContentInfo(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.anythink.core.api.ATCustomContentInfo", priceInfo.ToponAdUnitId, m_toponObj); + AndroidJavaObject admobCustomContentInfo = new AndroidJavaObject("com.anythink.core.api.ATCustomContentInfo", priceInfo.AdmobPrice * 1000, m_admobObj); + AndroidJavaObject maxCustomContentInfo = new AndroidJavaObject("com.anythink.core.api.ATCustomContentInfo", priceInfo.MaxPrice * 1000, m_maxObj); + AndroidJavaObject bigoCustomContentInfo = new AndroidJavaObject("com.anythink.core.api.ATCustomContentInfo", priceInfo.BigoPrice * 1000, m_bigoObj); + + AndroidJavaObject atCustomContentInfoList = new AndroidJavaObject("java.util.ArrayList"); + atCustomContentInfoList.Call("add", toponCustomContentInfo); + atCustomContentInfoList.Call("add", admobCustomContentInfo); + atCustomContentInfoList.Call("add", maxCustomContentInfo); + atCustomContentInfoList.Call("add", bigoCustomContentInfo); + + AndroidJavaClass sdkGlobalSetting = new AndroidJavaClass("com.anythink.core.api.ATSDKGlobalSetting"); + 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); + LoggerUtils.Debug("[AdsBidResult] final maxPriceCustomContentInfo: " + customContentString + " double: " + customContentDouble + " object:" + customContentObjectString); + if (customContentObjectString.Equals(m_toponObj)) + { + return PlatformType.Tpn; + } + else if (customContentObjectString.Equals(m_maxObj)) + { + return PlatformType.Max; + } + else if (customContentObjectString.Equals(m_admobObj)) + { + return PlatformType.Admob; + } + else if (customContentObjectString.Equals(m_bigoObj)) + { + return PlatformType.Bigo; + } + else + { + return PlatformType.NULL; + } + } +#else + return PlatformType.NULL; +#endif + } + } +} \ No newline at end of file diff --git a/Assets/Script/SDKManager/AdsSDKManager/Utils/AdsBidResult.cs.meta b/Assets/Script/SDKManager/AdsSDKManager/Utils/AdsBidResult.cs.meta new file mode 100644 index 0000000..0ff9962 --- /dev/null +++ b/Assets/Script/SDKManager/AdsSDKManager/Utils/AdsBidResult.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9f4bb1420fa8442e7961c82f0f49e483 \ No newline at end of file