You've already forked Commercialization.topon
update core
This commit is contained in:
@@ -10,18 +10,23 @@ namespace AnyThinkAds.Api
|
||||
{
|
||||
public String placementId { get; }
|
||||
public ATCallbackInfo callbackInfo { get; }
|
||||
public bool isTimeout { get; }
|
||||
|
||||
public ATAdEventArgs(String id)
|
||||
{
|
||||
placementId = id;
|
||||
callbackInfo = new ATCallbackInfo("");
|
||||
}
|
||||
public bool isDeeplinkSucceed { get; }
|
||||
|
||||
public ATAdEventArgs(String id, String callbackJson)
|
||||
public ATAdEventArgs(string id, string callbackJson = "", bool timeout = false, bool isDeeplinkSucceess = false)
|
||||
{
|
||||
placementId = id;
|
||||
callbackInfo = new ATCallbackInfo(callbackJson);
|
||||
isTimeout = timeout;
|
||||
isDeeplinkSucceed = isDeeplinkSucceess;
|
||||
}
|
||||
|
||||
// public ATAdEventArgs(String id, String callbackJson)
|
||||
// {
|
||||
// placementId = id;
|
||||
// callbackInfo = new ATCallbackInfo(callbackJson);
|
||||
// }
|
||||
}
|
||||
|
||||
public class ATAdErrorEventArgs : ATAdEventArgs
|
||||
@@ -191,4 +196,23 @@ namespace AnyThinkAds.Api
|
||||
|
||||
event EventHandler<ATAdEventArgs> onPlayAgainReward;
|
||||
}
|
||||
|
||||
public interface IATSplashEvents : IHCommonEvents
|
||||
{
|
||||
// called when the ad is shown
|
||||
event EventHandler<ATAdEventArgs> onAdShowEvent;
|
||||
|
||||
// called if the ad has failed to be shown
|
||||
event EventHandler<ATAdErrorEventArgs> onAdShowFailureEvent;
|
||||
|
||||
// called when the ad is closed
|
||||
event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||
|
||||
// called when an user has clicked an ad
|
||||
event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||
|
||||
event EventHandler<ATAdEventArgs> onAdLoadTimeoutEvent;
|
||||
event EventHandler<ATAdEventArgs> onDeeplinkEvent;
|
||||
event EventHandler<ATAdEventArgs> onDownloadConfirmEvent;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,10 @@ namespace AnyThinkAds.Api
|
||||
public readonly string sub_channel;
|
||||
public readonly string channel;
|
||||
public readonly Dictionary<string, object> custom_rule;
|
||||
|
||||
public readonly Dictionary<string, object> ext_info;
|
||||
public readonly string user_load_extra_data;
|
||||
public readonly int abtest_id;
|
||||
|
||||
public readonly string reward_custom_data;
|
||||
|
||||
@@ -72,15 +76,20 @@ namespace AnyThinkAds.Api
|
||||
|
||||
network_placement_id = jsonData.ContainsKey("network_placement_id") ? (string)jsonData["network_placement_id"] : "";
|
||||
ecpm_level = int.Parse(jsonData.ContainsKey("ecpm_level") ? jsonData["ecpm_level"].ToString() : "0");
|
||||
abtest_id = int.Parse(jsonData.ContainsKey("abtest_id") ? jsonData["abtest_id"].ToString() : "0");
|
||||
segment_id = int.Parse(jsonData.ContainsKey("segment_id") ? jsonData["segment_id"].ToString() : "0");
|
||||
scenario_id = jsonData.ContainsKey("scenario_id") ? (string)jsonData["scenario_id"] : "";// RewardVideo & Interstitial
|
||||
|
||||
if (jsonData.ContainsKey("user_load_extra_data")) {
|
||||
user_load_extra_data = jsonData.ContainsKey("user_load_extra_data") ? (string)jsonData["user_load_extra_data"] : "";
|
||||
}
|
||||
|
||||
scenario_reward_name = jsonData.ContainsKey("scenario_reward_name") ? (string)jsonData["scenario_reward_name"] : "";
|
||||
scenario_reward_number = int.Parse(jsonData.ContainsKey("scenario_reward_number") ? jsonData["scenario_reward_number"].ToString() : "0");
|
||||
|
||||
channel = jsonData.ContainsKey("channel") ? (string)jsonData["channel"] : "";
|
||||
sub_channel = jsonData.ContainsKey("sub_channel") ? (string)jsonData["sub_channel"] : "";
|
||||
custom_rule = jsonData.ContainsKey("custom_rule") ? JsonMapper.ToObject<Dictionary<string, object>>(jsonData["custom_rule"].ToJson()) : null;
|
||||
ext_info = jsonData.ContainsKey("ext_info") ? JsonMapper.ToObject<Dictionary<string, object>>(jsonData["ext_info"].ToJson()) : null;
|
||||
|
||||
reward_custom_data = jsonData.ContainsKey("reward_custom_data") ? (string)jsonData["reward_custom_data"] : "";
|
||||
|
||||
@@ -130,12 +139,15 @@ namespace AnyThinkAds.Api
|
||||
dataDictionary.Add("ecpm_level", ecpm_level);
|
||||
dataDictionary.Add("segment_id", segment_id);
|
||||
dataDictionary.Add("scenario_id", scenario_id);
|
||||
dataDictionary.Add("user_load_extra_data", user_load_extra_data);
|
||||
dataDictionary.Add("scenario_reward_name", scenario_reward_name);
|
||||
dataDictionary.Add("scenario_reward_number", scenario_reward_number);
|
||||
dataDictionary.Add("abtest_id", abtest_id);
|
||||
|
||||
dataDictionary.Add("sub_channel", sub_channel);
|
||||
dataDictionary.Add("channel", channel);
|
||||
dataDictionary.Add("custom_rule", custom_rule);
|
||||
dataDictionary.Add("ext_info", ext_info);
|
||||
dataDictionary.Add("reward_custom_data", reward_custom_data);
|
||||
|
||||
return dataDictionary;
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace AnyThinkAds.Api
|
||||
private string adLogoKey = "adLogo";
|
||||
private string ctaButtonKey = "cta";
|
||||
private string dislikeButtonKey = "dislike";
|
||||
private string elementsKey = "elements";
|
||||
|
||||
public string toJSON()
|
||||
{
|
||||
@@ -85,6 +86,14 @@ namespace AnyThinkAds.Api
|
||||
builder.Append("\"").Append(dislikeButtonKey).Append("\"");
|
||||
builder.Append(":");
|
||||
builder.Append(JsonUtility.ToJson(config.dislikeButtonProperty));
|
||||
builder.Append(",");
|
||||
}
|
||||
|
||||
if (config.elementsProperty != null)
|
||||
{
|
||||
builder.Append("\"").Append(elementsKey).Append("\"");
|
||||
builder.Append(":");
|
||||
builder.Append(JsonUtility.ToJson(config.elementsProperty));
|
||||
}
|
||||
|
||||
string temp = builder.ToString();
|
||||
|
||||
@@ -14,5 +14,6 @@ namespace AnyThinkAds.Api
|
||||
public ATNativeItemProperty adLogoProperty;
|
||||
public ATNativeItemProperty ctaButtonProperty;
|
||||
public ATNativeItemProperty dislikeButtonProperty;
|
||||
public ATNativeItemProperty elementsProperty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ namespace AnyThinkAds.Api
|
||||
public static void setLogDebug(bool isDebug)
|
||||
{
|
||||
client.setLogDebug(isDebug);
|
||||
ATLogger.IsDebug = isDebug;
|
||||
}
|
||||
|
||||
public static void addNetworkGDPRInfo(int networkType, Dictionary<string,object> dictionary)
|
||||
|
||||
73
Assets/AnyThinkAds/Api/ATSplashAd.cs
Normal file
73
Assets/AnyThinkAds/Api/ATSplashAd.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
|
||||
using AnyThinkAds.Common;
|
||||
using AnyThinkAds.ThirdParty.LitJson;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public class ATSplashAdLocalExtra
|
||||
{
|
||||
//Only for GDT (true: open download dialog, false: download directly)
|
||||
public static readonly string kATSplashAdClickConfirmStatus = "ad_click_confirm_status";
|
||||
}
|
||||
public class ATSplashAd
|
||||
{
|
||||
private static readonly ATSplashAd instance = new ATSplashAd();
|
||||
public IATSplashAdClient client;
|
||||
|
||||
private ATSplashAd()
|
||||
{
|
||||
client = AnyThinkAds.ATAdsClientFactory.BuildSplashAdClient();
|
||||
}
|
||||
|
||||
public static ATSplashAd Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public void loadSplashAd(string placementId, Dictionary<string, object> pairs, int fetchAdTimeout = 5000, string defaultAdSourceConfig = "")
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
client.loadSplashAd(placementId, fetchAdTimeout, defaultAdSourceConfig, JsonMapper.ToJson(pairs));
|
||||
#elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
|
||||
//TODO iOS的开屏加载
|
||||
pairs.Add("tolerate_timeout", fetchAdTimeout);
|
||||
pairs.Add("default_adSource_config", defaultAdSourceConfig);
|
||||
|
||||
client.loadSplashAd(placementId, fetchAdTimeout, defaultAdSourceConfig, JsonMapper.ToJson(pairs));
|
||||
#endif
|
||||
}
|
||||
|
||||
public void showSplashAd(string placementId, Dictionary<string, object> pairs)
|
||||
{
|
||||
client.showSplashAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
public bool hasSplashAdReady(string placementId)
|
||||
{
|
||||
return client.hasSplashAdReady(placementId);
|
||||
}
|
||||
|
||||
public string checkAdStatus(string placementId)
|
||||
{
|
||||
return client.checkAdStatus(placementId);
|
||||
}
|
||||
|
||||
public string getValidAdCaches(string placementId)
|
||||
{
|
||||
return client.getValidAdCaches(placementId);
|
||||
}
|
||||
|
||||
public void entryScenarioWithPlacementID(string placementId, string scenarioID)
|
||||
{
|
||||
client.entryScenarioWithPlacementID(placementId, scenarioID);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/AnyThinkAds/Api/ATSplashAd.cs.meta
Normal file
11
Assets/AnyThinkAds/Api/ATSplashAd.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5989e268b2acc4d0dafdbe2ddbf0dd4b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Assets/AnyThinkAds/Api/ATSplashAdListener.cs
Normal file
40
Assets/AnyThinkAds/Api/ATSplashAdListener.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
///summary
|
||||
///(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
///sumary
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public interface ATSplashAdListener
|
||||
{
|
||||
void onSplashAdLoad(string unitId, bool isTimeout);
|
||||
|
||||
void onSplashAdLoadTimeOut(string unitId);
|
||||
|
||||
void onSplashAdLoadFailed(string unitId, string code, string msg);
|
||||
|
||||
void onSplashAdShow(string unitId, ATCallbackInfo callbackInfo);
|
||||
|
||||
void onSplashAdClick(string unitId, ATCallbackInfo callbackInfo);
|
||||
|
||||
void onSplashAdDismiss(string unitId, ATCallbackInfo callbackInfo);
|
||||
|
||||
void onSplashAdDeeplinkCallback(string unitId, ATCallbackInfo callbackInfo, bool isSuccess);
|
||||
|
||||
void onSplashAdDownloadConfirm(string unitId, ATCallbackInfo callbackInfo);
|
||||
|
||||
void startLoadingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||
|
||||
|
||||
void finishLoadingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||
|
||||
void failToLoadADSource(string placementId,ATCallbackInfo callbackInfo,string code, string message);
|
||||
|
||||
void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||
|
||||
void finishBiddingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||
|
||||
void failBiddingADSource(string placementId,ATCallbackInfo callbackInfo,string code, string message);
|
||||
}
|
||||
}
|
||||
11
Assets/AnyThinkAds/Api/ATSplashAdListener.cs.meta
Normal file
11
Assets/AnyThinkAds/Api/ATSplashAdListener.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10be2707423e74e678bcee7dff04f3d7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user