2023-12-26 03:47:44 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace AmazonAds {
|
|
|
|
|
|
public class APSMediationUtils
|
|
|
|
|
|
{
|
|
|
|
|
|
public static string APS_IRON_SOURCE_NETWORK_KEY = "APS";
|
2024-06-24 01:28:57 +00:00
|
|
|
|
private static string APS_REWARDED_VIDEO_KEY = "rewardedvideo";
|
|
|
|
|
|
private static string APS_INTERSTITIAL_KEY = "interstitial";
|
2023-12-26 03:47:44 +00:00
|
|
|
|
|
2024-06-24 01:28:57 +00:00
|
|
|
|
public static string GetInterstitialNetworkData(string amazonSlotId, AmazonAds.AdResponse adResponse)
|
2023-12-26 03:47:44 +00:00
|
|
|
|
{
|
2024-06-24 01:28:57 +00:00
|
|
|
|
return GetNetworkData(amazonSlotId, adResponse, APS_INTERSTITIAL_KEY);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static string GetRewardedNetworkData(string amazonSlotId, AmazonAds.AdResponse adResponse)
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetNetworkData(amazonSlotId, adResponse, APS_REWARDED_VIDEO_KEY);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static string GetNetworkData(string amazonSlotId, AmazonAds.AdResponse adResponse , string adInventoryType)
|
|
|
|
|
|
{
|
|
|
|
|
|
APSIronSourceNetworkInputData ironSourceInputData = new APSIronSourceNetworkInputData();
|
|
|
|
|
|
#if UNITY_ANDROID
|
|
|
|
|
|
ironSourceInputData.bidInfo = adResponse.GetBidInfo();
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
ironSourceInputData.pricePointEncoded = adResponse.GetPricePoint();
|
2023-12-26 03:47:44 +00:00
|
|
|
|
ironSourceInputData.uuid = amazonSlotId;
|
2024-06-24 01:28:57 +00:00
|
|
|
|
APSIronSourceNetworkData networkData = new APSIronSourceNetworkData();
|
|
|
|
|
|
networkData.networkInputData = ironSourceInputData;
|
|
|
|
|
|
|
|
|
|
|
|
#if UNITY_IOS
|
|
|
|
|
|
string mediationHints = "\"mediationHints\" :" + adResponse.GetMediationHints();
|
|
|
|
|
|
string jsonData = "{\""+adInventoryType+"\" :" + JsonUtility.ToJson(ironSourceInputData);
|
|
|
|
|
|
jsonData = jsonData.Remove(jsonData.Length - 1);
|
|
|
|
|
|
jsonData = jsonData + ", " + mediationHints + "}}";
|
|
|
|
|
|
#else
|
|
|
|
|
|
string jsonData = "{\""+adInventoryType+"\" :" + JsonUtility.ToJson(ironSourceInputData) + "}";
|
|
|
|
|
|
#endif
|
|
|
|
|
|
return jsonData;
|
|
|
|
|
|
}
|
2023-12-26 03:47:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-24 01:28:57 +00:00
|
|
|
|
public static string GetBannerNetworkData(string amazonSlotId, AmazonAds.AdResponse adResponse)
|
|
|
|
|
|
{
|
|
|
|
|
|
APSIronSourceNetworkBannerInputData ironSourceInputData = new APSIronSourceNetworkBannerInputData();
|
|
|
|
|
|
#if UNITY_ANDROID
|
|
|
|
|
|
ironSourceInputData.bidInfo = adResponse.GetBidInfo();
|
|
|
|
|
|
#endif
|
|
|
|
|
|
ironSourceInputData.pricePointEncoded = adResponse.GetPricePoint();
|
|
|
|
|
|
ironSourceInputData.uuid = amazonSlotId;
|
|
|
|
|
|
ironSourceInputData.width = adResponse.GetWidth();
|
|
|
|
|
|
ironSourceInputData.height = adResponse.GetHeight();
|
|
|
|
|
|
|
|
|
|
|
|
APSIronSourceBannerNetworkData networkData = new APSIronSourceBannerNetworkData();
|
|
|
|
|
|
networkData.banner = ironSourceInputData;
|
|
|
|
|
|
|
|
|
|
|
|
#if UNITY_IOS
|
|
|
|
|
|
string mediationHints = "\"mediationHints\" :" + adResponse.GetMediationHints();
|
|
|
|
|
|
string jsonData = "{ \"banner\" :" + JsonUtility.ToJson(ironSourceInputData);
|
|
|
|
|
|
jsonData = jsonData.Remove(jsonData.Length - 1);
|
|
|
|
|
|
jsonData = jsonData + ", " + mediationHints + "}}";
|
|
|
|
|
|
#else
|
|
|
|
|
|
string jsonData = "{ \"banner\" :" + JsonUtility.ToJson(ironSourceInputData) + "}";
|
|
|
|
|
|
#endif
|
2023-12-26 03:47:44 +00:00
|
|
|
|
return jsonData;
|
2024-06-24 01:28:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class APSIronSourceNetworkInputData
|
|
|
|
|
|
{
|
|
|
|
|
|
public string uuid;
|
|
|
|
|
|
public string pricePointEncoded;
|
|
|
|
|
|
#if UNITY_ANDROID
|
|
|
|
|
|
public string bidInfo;
|
2023-12-26 03:47:44 +00:00
|
|
|
|
|
2024-06-24 01:28:57 +00:00
|
|
|
|
#endif
|
2023-12-26 03:47:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-24 01:28:57 +00:00
|
|
|
|
public class APSIronSourceNetworkBannerInputData
|
2023-12-26 03:47:44 +00:00
|
|
|
|
{
|
2024-06-24 01:28:57 +00:00
|
|
|
|
#if UNITY_ANDROID
|
2023-12-26 03:47:44 +00:00
|
|
|
|
public string bidInfo;
|
2024-06-24 01:28:57 +00:00
|
|
|
|
|
|
|
|
|
|
#endif
|
2023-12-26 03:47:44 +00:00
|
|
|
|
public string pricePointEncoded;
|
|
|
|
|
|
public string uuid;
|
2024-06-24 01:28:57 +00:00
|
|
|
|
public int width;
|
|
|
|
|
|
public int height;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class APSIronSourceBannerNetworkData
|
|
|
|
|
|
{
|
|
|
|
|
|
public APSIronSourceNetworkBannerInputData banner;
|
2023-12-26 03:47:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-24 01:28:57 +00:00
|
|
|
|
public class APSIronSourceNetworkData
|
2023-12-26 03:47:44 +00:00
|
|
|
|
{
|
2024-06-24 01:28:57 +00:00
|
|
|
|
public APSIronSourceNetworkInputData networkInputData;
|
2023-12-26 03:47:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private APSMediationUtils()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|