广告竞价逻辑
This commit is contained in:
parent
927ede23b4
commit
655f507c30
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f0206a38823ea41d3af8ac3dad0e3381
|
|
@ -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<AndroidJavaObject>("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<bool>("add", toponCustomContentInfo);
|
||||||
|
atCustomContentInfoList.Call<bool>("add", admobCustomContentInfo);
|
||||||
|
atCustomContentInfoList.Call<bool>("add", maxCustomContentInfo);
|
||||||
|
atCustomContentInfoList.Call<bool>("add", bigoCustomContentInfo);
|
||||||
|
|
||||||
|
AndroidJavaClass sdkGlobalSetting = new AndroidJavaClass("com.anythink.core.api.ATSDKGlobalSetting");
|
||||||
|
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);
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9f4bb1420fa8442e7961c82f0f49e483
|
Loading…
Reference in New Issue