You've already forked Commercialization.topon
update 1.1.25
This commit is contained in:
218
AnyThinkPlugin/AnyThinkAds/Api/ATAdEventArgs.cs
Normal file
218
AnyThinkPlugin/AnyThinkAds/Api/ATAdEventArgs.cs
Normal file
@@ -0,0 +1,218 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using AnyThinkAds.Api;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
|
||||
public class ATAdEventArgs
|
||||
{
|
||||
public String placementId { get; }
|
||||
public ATCallbackInfo callbackInfo { get; }
|
||||
public bool isTimeout { get; }
|
||||
|
||||
public bool isDeeplinkSucceed { get; }
|
||||
|
||||
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
|
||||
{
|
||||
public String errorMessage { get; }
|
||||
public String errorCode { get; }
|
||||
|
||||
public ATAdErrorEventArgs(String placementId, String code, String message)
|
||||
: base(placementId)
|
||||
{
|
||||
errorMessage = message;
|
||||
errorCode = code;
|
||||
}
|
||||
|
||||
public ATAdErrorEventArgs(String placementId, String callbackJson, String code, String message)
|
||||
: base(placementId, callbackJson)
|
||||
{
|
||||
errorMessage = message;
|
||||
errorCode = code;
|
||||
}
|
||||
}
|
||||
|
||||
public class ATAdProgressEventArgs : ATAdEventArgs
|
||||
{
|
||||
public int adProgress { get; }
|
||||
|
||||
public ATAdProgressEventArgs(String placementId, String callbackJson, int progress)
|
||||
: base(placementId, callbackJson)
|
||||
{
|
||||
adProgress = progress;
|
||||
}
|
||||
}
|
||||
|
||||
public class ATAdRewardEventArgs : ATAdEventArgs
|
||||
{
|
||||
public bool isRewarded { get; }
|
||||
|
||||
public ATAdRewardEventArgs(String placementId, String callbackJson, bool doReward)
|
||||
: base(placementId, callbackJson)
|
||||
{
|
||||
isRewarded = doReward;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface IHCommonEvents
|
||||
{
|
||||
// triggers when the ad has been succesfully loaded
|
||||
event EventHandler<ATAdEventArgs> onAdLoadEvent;
|
||||
|
||||
// triggers when the ad has failed to load
|
||||
event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||
|
||||
// triggers when a the ad has started to load
|
||||
event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||
|
||||
// triggers when a the ad has finished to load
|
||||
event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||
|
||||
// triggers when a the ad has started to load
|
||||
event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||
|
||||
// triggers when a the ad has started to load
|
||||
event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||
|
||||
// triggers when a the ad has started to load
|
||||
event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||
|
||||
// triggers when a the ad has started to load
|
||||
event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||
}
|
||||
|
||||
|
||||
public interface IATBannerEvents: IHCommonEvents
|
||||
{
|
||||
// triggers when a banner ad generates an impression
|
||||
event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||
|
||||
// triggers when the user clicks a banner ad
|
||||
event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||
|
||||
// triggers when the ad refreshes
|
||||
event EventHandler<ATAdEventArgs> onAdAutoRefreshEvent;
|
||||
|
||||
// triggers when the ad fails to auto refresh
|
||||
event EventHandler<ATAdErrorEventArgs> onAdAutoRefreshFailureEvent;
|
||||
|
||||
// triggers when the banner ad is closed
|
||||
event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||
|
||||
// triggers when the users closes the ad via the button
|
||||
event EventHandler<ATAdEventArgs> onAdCloseButtonTappedEvent;
|
||||
}
|
||||
|
||||
public interface IATInterstitialAdEvents : 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;
|
||||
|
||||
// called when a video ad has started playing
|
||||
event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||
|
||||
// called if an ad video has failed to be displayed
|
||||
event EventHandler<ATAdErrorEventArgs> onAdVideoFailureEvent;
|
||||
|
||||
// called when ad video has finished
|
||||
event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||
}
|
||||
|
||||
public interface IATNativeAdEvents : IHCommonEvents
|
||||
{
|
||||
// triggers when the ad generates an impression
|
||||
event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||
|
||||
// triggers when the user clicks the ad
|
||||
event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||
|
||||
// triggers when the ad video starts
|
||||
event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||
|
||||
// triggers when the ad video ends
|
||||
event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||
|
||||
// triggers if the ad progresses
|
||||
event EventHandler<ATAdProgressEventArgs> onAdVideoProgressEvent;
|
||||
|
||||
// triggers when the ad is closed
|
||||
event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||
}
|
||||
|
||||
public interface IATRewardedVideoEvents : IHCommonEvents
|
||||
{
|
||||
// triggers on video start
|
||||
event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||
|
||||
// triggers on video end
|
||||
event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||
|
||||
// triggers if the video fails to play
|
||||
event EventHandler<ATAdErrorEventArgs> onAdVideoFailureEvent;
|
||||
|
||||
// triggers when the user has closed the ad
|
||||
event EventHandler<ATAdRewardEventArgs> onAdVideoCloseEvent;
|
||||
|
||||
// triggers when the user has clicked the ad
|
||||
event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||
|
||||
// triggers when the user has finsihed watching the ad and should be rewarded
|
||||
event EventHandler<ATAdEventArgs> onRewardEvent;
|
||||
|
||||
event EventHandler<ATAdEventArgs> onPlayAgainStart;
|
||||
|
||||
event EventHandler<ATAdEventArgs> onPlayAgainEnd;
|
||||
|
||||
event EventHandler<ATAdErrorEventArgs> onPlayAgainFailure;
|
||||
|
||||
event EventHandler<ATAdEventArgs> onPlayAgainClick;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATAdEventArgs.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATAdEventArgs.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b85e8925fa22644f1803fbdc727149ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
130
AnyThinkPlugin/AnyThinkAds/Api/ATBannerAd.cs
Normal file
130
AnyThinkPlugin/AnyThinkAds/Api/ATBannerAd.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
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 ATBannerAdLoadingExtra
|
||||
{
|
||||
public static readonly string kATBannerAdLoadingExtraBannerAdSize = "banner_ad_size";
|
||||
public static readonly string kATBannerAdLoadingExtraBannerAdSizeStruct = "banner_ad_size_struct";
|
||||
public static readonly string kATBannerAdSizeUsesPixelFlagKey = "uses_pixel";
|
||||
public static readonly string kATBannerAdShowingPisitionTop = "top";
|
||||
public static readonly string kATBannerAdShowingPisitionBottom = "bottom";
|
||||
|
||||
//Deprecated in v5.7.3
|
||||
public static readonly string kATBannerAdLoadingExtraInlineAdaptiveWidth = "inline_adaptive_width";
|
||||
public static readonly string kATBannerAdLoadingExtraInlineAdaptiveOrientation = "inline_adaptive_orientation";
|
||||
public static readonly int kATBannerAdLoadingExtraInlineAdaptiveOrientationCurrent = 0;
|
||||
public static readonly int kATBannerAdLoadingExtraInlineAdaptiveOrientationPortrait = 1;
|
||||
public static readonly int kATBannerAdLoadingExtraInlineAdaptiveOrientationLandscape = 2;
|
||||
//Deprecated in v5.7.3
|
||||
|
||||
public static readonly string kATBannerAdLoadingExtraAdaptiveWidth = "adaptive_width";
|
||||
public static readonly string kATBannerAdLoadingExtraAdaptiveOrientation = "adaptive_orientation";
|
||||
public static readonly int kATBannerAdLoadingExtraAdaptiveOrientationCurrent = 0;
|
||||
public static readonly int kATBannerAdLoadingExtraAdaptiveOrientationPortrait = 1;
|
||||
public static readonly int kATBannerAdLoadingExtraAdaptiveOrientationLandscape = 2;
|
||||
|
||||
}
|
||||
public class ATBannerAd
|
||||
{
|
||||
private static readonly ATBannerAd instance = new ATBannerAd();
|
||||
public IATBannerAdClient client;
|
||||
|
||||
private ATBannerAd()
|
||||
{
|
||||
client = GetATBannerAdClient();
|
||||
|
||||
}
|
||||
|
||||
public static ATBannerAd Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
API
|
||||
*/
|
||||
public void loadBannerAd(string placementId, Dictionary<string,object> pairs)
|
||||
{
|
||||
if (pairs != null && pairs.ContainsKey(ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSize))
|
||||
{
|
||||
client.loadBannerAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
else if (pairs != null && pairs.ContainsKey(ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSizeStruct))
|
||||
{
|
||||
ATSize size = (ATSize)(pairs[ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSizeStruct]);
|
||||
pairs.Add(ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSize, size.width + "x" + size.height);
|
||||
pairs.Add(ATBannerAdLoadingExtra.kATBannerAdSizeUsesPixelFlagKey, size.usesPixel);
|
||||
|
||||
//Dictionary<string, object> newPaires = new Dictionary<string, object> { { ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSize, size.width + "x" + size.height }, { ATBannerAdLoadingExtra.kATBannerAdSizeUsesPixelFlagKey, size.usesPixel } };
|
||||
client.loadBannerAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
else
|
||||
{
|
||||
client.loadBannerAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public string checkAdStatus(string placementId)
|
||||
{
|
||||
return client.checkAdStatus(placementId);
|
||||
}
|
||||
|
||||
public string getValidAdCaches(string placementId)
|
||||
{
|
||||
return client.getValidAdCaches(placementId);
|
||||
}
|
||||
|
||||
|
||||
public void showBannerAd(string placementId, ATRect rect)
|
||||
{
|
||||
client.showBannerAd(placementId, rect, "");
|
||||
}
|
||||
|
||||
public void showBannerAd(string placementId, ATRect rect, Dictionary<string,string> pairs)
|
||||
{
|
||||
client.showBannerAd(placementId, rect, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
public void showBannerAd(string placementId, string position)
|
||||
{
|
||||
client.showBannerAd(placementId, position, "");
|
||||
}
|
||||
|
||||
public void showBannerAd(string placementId, string position, Dictionary<string,string> pairs)
|
||||
{
|
||||
client.showBannerAd(placementId, position, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
public void showBannerAd(string placementId)
|
||||
{
|
||||
client.showBannerAd(placementId);
|
||||
}
|
||||
|
||||
public void hideBannerAd(string placementId)
|
||||
{
|
||||
client.hideBannerAd(placementId);
|
||||
}
|
||||
|
||||
public void cleanBannerAd(string placementId)
|
||||
{
|
||||
client.cleanBannerAd(placementId);
|
||||
}
|
||||
|
||||
public IATBannerAdClient GetATBannerAdClient()
|
||||
{
|
||||
return AnyThinkAds.ATAdsClientFactory.BuildBannerAdClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATBannerAd.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATBannerAd.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 303b96d7e38d241d895947db76a77868
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
57
AnyThinkPlugin/AnyThinkAds/Api/ATBannerAdListener.cs
Normal file
57
AnyThinkPlugin/AnyThinkAds/Api/ATBannerAdListener.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public interface ATBannerAdListener
|
||||
{
|
||||
/***
|
||||
* 广告请求成功(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdLoad(string placementId);
|
||||
/***
|
||||
* 广告请求失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdLoadFail(string placementId, string code, string message);
|
||||
/***
|
||||
* 广告展示(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdImpress(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
* 广告点击(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdClick(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
* 广告自动刷新(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdAutoRefresh(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
*广告自动刷新失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdAutoRefreshFail(string placementId, string code, string message);
|
||||
/**
|
||||
*广告关闭;某些厂商不支持(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdClose(string placementId);
|
||||
/**
|
||||
*广告关闭;某些厂商不支持(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdCloseButtonTapped(string placementId, 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
AnyThinkPlugin/AnyThinkAds/Api/ATBannerAdListener.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATBannerAdListener.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e25052682a99b4f11b9ccda0a98ec1ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
159
AnyThinkPlugin/AnyThinkAds/Api/ATCallbackInfo.cs
Normal file
159
AnyThinkPlugin/AnyThinkAds/Api/ATCallbackInfo.cs
Normal file
@@ -0,0 +1,159 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using AnyThinkAds.ThirdParty.LitJson;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public class ATCallbackInfo
|
||||
{
|
||||
|
||||
public readonly int network_firm_id;
|
||||
public readonly string adsource_id;
|
||||
public readonly int adsource_index;
|
||||
public readonly double adsource_price;
|
||||
public readonly int adsource_isheaderbidding;
|
||||
|
||||
public readonly string id;
|
||||
public readonly double publisher_revenue;
|
||||
public readonly string currency;
|
||||
public readonly string country;
|
||||
public readonly string adunit_id;
|
||||
|
||||
public readonly string adunit_format;
|
||||
public readonly string precision;
|
||||
public readonly string network_type;
|
||||
public readonly string network_placement_id;
|
||||
public readonly int ecpm_level;
|
||||
|
||||
public readonly int segment_id;
|
||||
public readonly string scenario_id;
|
||||
public readonly string scenario_reward_name;
|
||||
public readonly int scenario_reward_number;
|
||||
|
||||
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 Dictionary<string, object> user_load_extra_data;
|
||||
public readonly int abtest_id;
|
||||
|
||||
public readonly string reward_custom_data;
|
||||
|
||||
private string callbackJson;
|
||||
|
||||
public ATCallbackInfo(string callbackJson)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.callbackJson = callbackJson;
|
||||
|
||||
|
||||
JsonData jsonData = JsonMapper.ToObject(callbackJson);
|
||||
|
||||
network_firm_id = int.Parse(jsonData.ContainsKey("network_firm_id") ? jsonData["network_firm_id"].ToString() : "0");
|
||||
adsource_id = jsonData.ContainsKey("adsource_id") ? (string)jsonData["adsource_id"] : "";
|
||||
adsource_index = int.Parse(jsonData.ContainsKey("adsource_index") ? jsonData["adsource_index"].ToString() : "-1");
|
||||
adsource_price = double.Parse(jsonData.ContainsKey("adsource_price") ? jsonData["adsource_price"].ToString() : "0");
|
||||
|
||||
adsource_isheaderbidding = 0;
|
||||
if (jsonData.ContainsKey("adsource_isheaderbidding")) {
|
||||
adsource_isheaderbidding = int.Parse(jsonData.ContainsKey("adsource_isheaderbidding") ? jsonData["adsource_isheaderbidding"].ToString() : "0");
|
||||
}
|
||||
|
||||
id = jsonData.ContainsKey("id") ? (string)jsonData["id"] : "";
|
||||
publisher_revenue = double.Parse(jsonData.ContainsKey("publisher_revenue") ? jsonData["publisher_revenue"].ToString() : "0");
|
||||
currency = jsonData.ContainsKey("currency") ? (string)jsonData["currency"] : "";
|
||||
country = jsonData.ContainsKey("country") ? (string)jsonData["country"] : "";
|
||||
|
||||
adunit_format = jsonData.ContainsKey("adunit_format") ? (string)jsonData["adunit_format"] : "";
|
||||
adunit_id = jsonData.ContainsKey("adunit_id") ? (string)jsonData["adunit_id"] : "";
|
||||
|
||||
precision = jsonData.ContainsKey("precision") ? (string)jsonData["precision"] : "";
|
||||
|
||||
network_type = jsonData.ContainsKey("network_type") ? (string)jsonData["network_type"] : "";
|
||||
|
||||
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 = JsonMapper.ToObject<Dictionary<string, object>>(jsonData["user_load_extra_data"].ToJson());
|
||||
}
|
||||
|
||||
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"] : "";
|
||||
|
||||
}
|
||||
catch (System.Exception e) {
|
||||
System.Console.WriteLine("Exception caught: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
public string getOriginJSONString()
|
||||
{
|
||||
return callbackJson;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> toAdsourceDictionary()
|
||||
{
|
||||
Dictionary<string, object> dataDictionary = new Dictionary<string, object>();
|
||||
|
||||
dataDictionary.Add("adsource_id", adsource_id);
|
||||
dataDictionary.Add("adsource_price", adsource_price);
|
||||
dataDictionary.Add("adunit_id", adunit_id);
|
||||
dataDictionary.Add("currency", currency);
|
||||
dataDictionary.Add("network_firm_id",network_firm_id);
|
||||
dataDictionary.Add("network_placement_id",network_placement_id);
|
||||
return dataDictionary;
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<string, object> toDictionary()
|
||||
{
|
||||
Dictionary<string, object> dataDictionary = new Dictionary<string, object>();
|
||||
|
||||
dataDictionary.Add("network_firm_id",network_firm_id);
|
||||
dataDictionary.Add("adsource_id", adsource_id);
|
||||
dataDictionary.Add("adsource_index", adsource_index);
|
||||
dataDictionary.Add("adsource_price", adsource_price);
|
||||
dataDictionary.Add("adsource_isheaderbidding", adsource_isheaderbidding);
|
||||
dataDictionary.Add("id", id);
|
||||
dataDictionary.Add("publisher_revenue", publisher_revenue);
|
||||
dataDictionary.Add("currency", currency);
|
||||
dataDictionary.Add("country", country);
|
||||
dataDictionary.Add("adunit_id", adunit_id);
|
||||
dataDictionary.Add("adunit_format", adunit_format);
|
||||
dataDictionary.Add("precision", precision);
|
||||
dataDictionary.Add("network_type", network_type);
|
||||
dataDictionary.Add("network_placement_id",network_placement_id);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATCallbackInfo.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATCallbackInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebf4bf9c5f1a54007a31d4a19a30835c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
AnyThinkPlugin/AnyThinkAds/Api/ATConst.cs
Normal file
25
AnyThinkPlugin/AnyThinkAds/Api/ATConst.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public class ATConst {
|
||||
public const string ADAPTIVE_HEIGHT = "AdaptiveHeight";//value is string
|
||||
public const string ADAPTIVE_HEIGHT_YES = "1";
|
||||
public const string POSITION = "Position";//value is string
|
||||
public const string POSITION_TOP = "Top";
|
||||
public const string POSITION_BOTTOM = "Bottom";
|
||||
|
||||
|
||||
public const string SCENARIO = "Scenario";//value is string
|
||||
public const string USERID_KEY = "UserId";//value is string
|
||||
public const string USER_EXTRA_DATA = "UserExtraData"; //value is string
|
||||
public const string USE_REWARDED_VIDEO_AS_INTERSTITIAL = "UseRewardedVideoAsInterstitial";//value is string
|
||||
public const string USE_REWARDED_VIDEO_AS_INTERSTITIAL_YES = "1";
|
||||
public const string USE_REWARDED_VIDEO_AS_INTERSTITIAL_NO = "0";
|
||||
|
||||
public const string WIDTH = "Width";//value is string
|
||||
public const string HEIGHT = "Height";//value is string
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATConst.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATConst.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc541fdcbb9254973a14d8aa4f305201
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
21
AnyThinkPlugin/AnyThinkAds/Api/ATDownloadAdListener.cs
Normal file
21
AnyThinkPlugin/AnyThinkAds/Api/ATDownloadAdListener.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public interface ATDownloadAdListener
|
||||
{
|
||||
|
||||
void onDownloadStart(string placementId, ATCallbackInfo callbackInfo, long totalBytes, long currBytes, string fileName, string appName);
|
||||
|
||||
void onDownloadUpdate(string placementId, ATCallbackInfo callbackInfo, long totalBytes, long currBytes, string fileName, string appName);
|
||||
|
||||
void onDownloadPause(string placementId, ATCallbackInfo callbackInfo, long totalBytes, long currBytes, string fileName, string appName);
|
||||
|
||||
void onDownloadFinish(string placementId, ATCallbackInfo callbackInfo, long totalBytes, string fileName, string appName);
|
||||
|
||||
void onDownloadFail(string placementId, ATCallbackInfo callbackInfo, long totalBytes, long currBytes, string fileName, string appName);
|
||||
|
||||
void onInstalled(string placementId, ATCallbackInfo callbackInfo, string fileName, string appName);
|
||||
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATDownloadAdListener.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATDownloadAdListener.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e06efbc55c798478a941850f6726fdbb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
36
AnyThinkPlugin/AnyThinkAds/Api/ATDownloadManager.cs
Normal file
36
AnyThinkPlugin/AnyThinkAds/Api/ATDownloadManager.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
using AnyThinkAds.Common;
|
||||
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public class ATDownloadManager
|
||||
{
|
||||
private static readonly ATDownloadManager instance = new ATDownloadManager();
|
||||
private IATDownloadClient client;
|
||||
|
||||
private ATDownloadManager()
|
||||
{
|
||||
client = GetATDownloadClient();
|
||||
}
|
||||
|
||||
public static ATDownloadManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public void setListener(ATDownloadAdListener listener)
|
||||
{
|
||||
client.setListener(listener);
|
||||
}
|
||||
|
||||
public IATDownloadClient GetATDownloadClient()
|
||||
{
|
||||
return AnyThinkAds.ATAdsClientFactory.BuildDownloadClient();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATDownloadManager.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATDownloadManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b7e6ef35d34e47d79856f3e737b5a04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
89
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAd.cs
Normal file
89
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAd.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
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 ATInterstitialAdLoadingExtra
|
||||
{
|
||||
public static readonly string kATInterstitialAdLoadingExtraInterstitialAdSize = "interstitial_ad_size";
|
||||
public static readonly string kATInterstitialAdLoadingExtraInterstitialAdSizeStruct = "interstitial_ad_size_struct";
|
||||
public static readonly string kATInterstitialAdSizeUsesPixelFlagKey = "uses_pixel";
|
||||
}
|
||||
|
||||
public class ATInterstitialAd
|
||||
{
|
||||
private static readonly ATInterstitialAd instance = new ATInterstitialAd();
|
||||
public IATInterstitialAdClient client;
|
||||
|
||||
private ATInterstitialAd()
|
||||
{
|
||||
client = GetATInterstitialAdClient();
|
||||
}
|
||||
|
||||
public static ATInterstitialAd Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public void loadInterstitialAd(string placementId, Dictionary<string,object> pairs)
|
||||
{
|
||||
if (pairs != null && pairs.ContainsKey(ATInterstitialAdLoadingExtra.kATInterstitialAdLoadingExtraInterstitialAdSizeStruct))
|
||||
{
|
||||
ATSize size = (ATSize)(pairs[ATInterstitialAdLoadingExtra.kATInterstitialAdLoadingExtraInterstitialAdSizeStruct]);
|
||||
pairs.Add(ATInterstitialAdLoadingExtra.kATInterstitialAdLoadingExtraInterstitialAdSize, size.width + "x" + size.height);
|
||||
pairs.Add(ATInterstitialAdLoadingExtra.kATInterstitialAdSizeUsesPixelFlagKey, size.usesPixel);
|
||||
|
||||
client.loadInterstitialAd(placementId, JsonMapper.ToJson(pairs));
|
||||
} else
|
||||
{
|
||||
client.loadInterstitialAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool hasInterstitialAdReady(string placementId)
|
||||
{
|
||||
return client.hasInterstitialAdReady(placementId);
|
||||
}
|
||||
public void entryScenarioWithPlacementID(string placementId, string scenarioID)
|
||||
{
|
||||
client.entryScenarioWithPlacementID(placementId,scenarioID);
|
||||
}
|
||||
|
||||
|
||||
public string checkAdStatus(string placementId)
|
||||
{
|
||||
return client.checkAdStatus(placementId);
|
||||
}
|
||||
|
||||
public string getValidAdCaches(string placementId)
|
||||
{
|
||||
return client.getValidAdCaches(placementId);
|
||||
}
|
||||
|
||||
public void showInterstitialAd(string placementId)
|
||||
{
|
||||
client.showInterstitialAd(placementId, JsonMapper.ToJson(new Dictionary<string, string>()));
|
||||
}
|
||||
|
||||
public void showInterstitialAd(string placementId, Dictionary<string, string> pairs)
|
||||
{
|
||||
client.showInterstitialAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
public IATInterstitialAdClient GetATInterstitialAdClient()
|
||||
{
|
||||
return AnyThinkAds.ATAdsClientFactory.BuildInterstitialAdClient();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAd.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAd.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5417f30bdb0e84db696652694de24b55
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
74
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAdListener.cs
Normal file
74
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAdListener.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public interface ATInterstitialAdListener
|
||||
{
|
||||
/***
|
||||
* 加载广告成功(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
* @param placementId 广告位id
|
||||
*/
|
||||
void onInterstitialAdLoad(string placementId);
|
||||
/***
|
||||
* 加载广告失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
* @param placementId 广告位id
|
||||
* @param code 错误码
|
||||
* @param message 错误信息
|
||||
*/
|
||||
void onInterstitialAdLoadFail(string placementId, string code, string message);
|
||||
/***
|
||||
* 广告展示(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
* @param placementId 广告位id
|
||||
*/
|
||||
void onInterstitialAdShow(string placementId, ATCallbackInfo callbackInfo);
|
||||
/***
|
||||
* 广告展示失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
* @param placementId 广告位id
|
||||
*/
|
||||
void onInterstitialAdFailedToShow(string placementId);
|
||||
/***
|
||||
* 广告关闭(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
* @param placementId 广告位id
|
||||
*/
|
||||
void onInterstitialAdClose(string placementId, ATCallbackInfo callbackInfo);
|
||||
/***
|
||||
* 广告点击(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
* @param placementId 广告位id
|
||||
*/
|
||||
void onInterstitialAdClick(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
*广告开始播放视频(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
* @param placementId 广告位id
|
||||
*/
|
||||
void onInterstitialAdStartPlayingVideo(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
*广告视频播放结束(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
* @param placementId 广告位id
|
||||
*/
|
||||
void onInterstitialAdEndPlayingVideo(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
*广告播放视频失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
* @param placementId 广告位id
|
||||
* @param code 错误码
|
||||
* @param message 错误信息
|
||||
*/
|
||||
void onInterstitialAdFailedToPlayVideo(string placementId, string code, string message);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e59697f061674b95b6fc11bf3eb570a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
97
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAutoAd.cs
Normal file
97
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAutoAd.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
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 ATInterstitialAutoAd
|
||||
{
|
||||
private static readonly ATInterstitialAutoAd instance = new ATInterstitialAutoAd();
|
||||
public IATInterstitialAdClient client;
|
||||
|
||||
private ATInterstitialAutoAd()
|
||||
{
|
||||
client = GetATInterstitialAdClient();
|
||||
}
|
||||
|
||||
public static ATInterstitialAutoAd Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public IATInterstitialAdClient GetATInterstitialAdClient()
|
||||
{
|
||||
return AnyThinkAds.ATAdsClientFactory.BuildInterstitialAdClient();
|
||||
}
|
||||
|
||||
|
||||
// auto
|
||||
|
||||
public void addAutoLoadAdPlacementID(string[] placementIDList)
|
||||
{
|
||||
client.addAutoLoadAdPlacementID(placementIDList);
|
||||
}
|
||||
|
||||
public void removeAutoLoadAdPlacementID(string[] placementIDList)
|
||||
{
|
||||
if (placementIDList != null && placementIDList.Length > 0)
|
||||
{
|
||||
string placementIDListString = JsonMapper.ToJson(placementIDList);
|
||||
client.removeAutoLoadAdPlacementID(placementIDListString);
|
||||
Debug.Log("removeAutoLoadAdPlacementID, placementIDList === " + placementIDListString);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("removeAutoLoadAdPlacementID, placementIDList = null");
|
||||
}
|
||||
}
|
||||
|
||||
public string checkAutoAdStatus(string placementId)
|
||||
{
|
||||
return client.checkAutoAdStatus(placementId);
|
||||
}
|
||||
|
||||
public bool autoLoadInterstitialAdReadyForPlacementID(string placementId)
|
||||
{
|
||||
return client.autoLoadInterstitialAdReadyForPlacementID(placementId);
|
||||
}
|
||||
public string getAutoValidAdCaches(string placementId)
|
||||
{
|
||||
return client.getAutoValidAdCaches(placementId);
|
||||
}
|
||||
|
||||
public void setAutoLocalExtra(string placementId, Dictionary<string,string> pairs)
|
||||
{
|
||||
client.setAutoLocalExtra(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID)
|
||||
{
|
||||
client.entryAutoAdScenarioWithPlacementID(placementId, scenarioID);
|
||||
}
|
||||
|
||||
public void showAutoAd(string placementId)
|
||||
{
|
||||
client.showAutoAd(placementId, JsonMapper.ToJson(new Dictionary<string, string>()));
|
||||
}
|
||||
|
||||
public void showAutoAd(string placementId, Dictionary<string, string> pairs)
|
||||
{
|
||||
client.showAutoAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAutoAd.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATInterstitialAutoAd.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f74e005d6e184ccdbd0582232cfb896
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
101
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAd.cs
Normal file
101
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAd.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
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 ATNativeAdLoadingExtra
|
||||
{
|
||||
public static readonly string kATNativeAdLoadingExtraNativeAdSizeStruct = "native_ad_size_struct";
|
||||
public static readonly string kATNativeAdLoadingExtraNativeAdSize = "native_ad_size";
|
||||
public static readonly string kATNativeAdSizeUsesPixelFlagKey = "uses_pixel";
|
||||
}
|
||||
|
||||
public class ATNativeAd
|
||||
{
|
||||
|
||||
private static readonly ATNativeAd instance = new ATNativeAd();
|
||||
public IATNativeAdClient client;
|
||||
|
||||
public ATNativeAd(){
|
||||
client = GetATNativeAdClient();
|
||||
}
|
||||
|
||||
public static ATNativeAd Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void loadNativeAd(string placementId, Dictionary<String,object> pairs){
|
||||
if (pairs != null && pairs.ContainsKey(ATNativeAdLoadingExtra.kATNativeAdLoadingExtraNativeAdSizeStruct))
|
||||
{
|
||||
ATSize size = (ATSize)(pairs[ATNativeAdLoadingExtra.kATNativeAdLoadingExtraNativeAdSizeStruct]);
|
||||
pairs.Add(ATNativeAdLoadingExtra.kATNativeAdLoadingExtraNativeAdSize, size.width + "x" + size.height);
|
||||
pairs.Add(ATNativeAdLoadingExtra.kATNativeAdSizeUsesPixelFlagKey, size.usesPixel);
|
||||
}
|
||||
client.loadNativeAd(placementId,JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
public bool hasAdReady(string placementId){
|
||||
return client.hasAdReady(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);
|
||||
}
|
||||
|
||||
public void renderAdToScene(string placementId, ATNativeAdView anyThinkNativeAdView){
|
||||
client.renderAdToScene(placementId, anyThinkNativeAdView, "");
|
||||
}
|
||||
|
||||
public void renderAdToScene(string placementId, ATNativeAdView anyThinkNativeAdView, Dictionary<string,string> pairs){
|
||||
client.renderAdToScene(placementId, anyThinkNativeAdView, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
public void cleanAdView(string placementId, ATNativeAdView anyThinkNativeAdView){
|
||||
client.cleanAdView(placementId, anyThinkNativeAdView);
|
||||
}
|
||||
|
||||
public void onApplicationForces(string placementId, ATNativeAdView anyThinkNativeAdView){
|
||||
client.onApplicationForces(placementId, anyThinkNativeAdView);
|
||||
}
|
||||
|
||||
public void onApplicationPasue(string placementId, ATNativeAdView anyThinkNativeAdView){
|
||||
client.onApplicationPasue(placementId, anyThinkNativeAdView);
|
||||
}
|
||||
|
||||
public void cleanCache(string placementId){
|
||||
client.cleanCache(placementId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IATNativeAdClient GetATNativeAdClient()
|
||||
{
|
||||
return AnyThinkAds.ATAdsClientFactory.BuildNativeAdClient();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAd.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAd.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63ff9b48e554f481b84df35718d2082c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAdListener.cs
Normal file
60
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAdListener.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public interface ATNativeAdListener
|
||||
{
|
||||
/***
|
||||
* 广告请求成功(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdLoaded(string placementId);
|
||||
/***
|
||||
* 广告请求失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdLoadFail(string placementId, string code, string message);
|
||||
/***
|
||||
* 广告展示(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdImpressed(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
* 广告点击(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdClicked(string placementId, ATCallbackInfo callbackInfo);
|
||||
/***
|
||||
* 视屏播放开始 如果有(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdVideoStart(string placementId);
|
||||
/***
|
||||
* 视屏播放结束 如果有(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdVideoEnd(string placementId);
|
||||
/***
|
||||
* 视屏播放进度 如果有(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdVideoProgress(string placementId,int progress);
|
||||
/***
|
||||
* 广告关闭按钮点击 如果有(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdCloseButtonClicked(string placementId, 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
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAdListener.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAdListener.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea594e5e65c2b44d581e5bbf6e46d2df
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
112
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAdView.cs
Normal file
112
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAdView.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Text;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public class ATNativeAdView
|
||||
{
|
||||
public ATNativeConfig config;
|
||||
public ATNativeAdView(ATNativeConfig config)
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
|
||||
private string parentKey = "parent";
|
||||
private string appIconKey = "appIcon";
|
||||
private string mainImageKey = "mainImage";
|
||||
private string titleKey = "title";
|
||||
private string descKey = "desc";
|
||||
private string adLogoKey = "adLogo";
|
||||
private string ctaButtonKey = "cta";
|
||||
private string dislikeButtonKey = "dislike";
|
||||
private string elementsKey = "elements";
|
||||
|
||||
public string toJSON()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.Append("{");
|
||||
if(config.parentProperty != null)
|
||||
{
|
||||
builder.Append("\"").Append(parentKey).Append("\"");
|
||||
builder.Append(":");
|
||||
builder.Append(JsonUtility.ToJson(config.parentProperty));
|
||||
builder.Append(",");
|
||||
}
|
||||
if(config.appIconProperty != null){
|
||||
builder.Append("\"").Append(appIconKey).Append("\"");
|
||||
builder.Append(":");
|
||||
builder.Append(JsonUtility.ToJson(config.appIconProperty));
|
||||
builder.Append(",");
|
||||
}
|
||||
|
||||
if(config.mainImageProperty != null)
|
||||
{
|
||||
builder.Append("\"").Append(mainImageKey).Append("\"");
|
||||
builder.Append(":");
|
||||
builder.Append(JsonUtility.ToJson(config.mainImageProperty));
|
||||
builder.Append(",");
|
||||
}
|
||||
|
||||
if(config.titleProperty != null)
|
||||
{
|
||||
builder.Append("\"").Append(titleKey).Append("\"");
|
||||
builder.Append(":");
|
||||
builder.Append(JsonUtility.ToJson(config.titleProperty));
|
||||
builder.Append(",");
|
||||
}
|
||||
if(config.descProperty != null)
|
||||
{
|
||||
builder.Append("\"").Append(descKey).Append("\"");
|
||||
builder.Append(":");
|
||||
builder.Append(JsonUtility.ToJson(config.descProperty));
|
||||
builder.Append(",");
|
||||
}
|
||||
|
||||
if(config.adLogoProperty != null)
|
||||
{
|
||||
builder.Append("\"").Append(adLogoKey).Append("\"");
|
||||
builder.Append(":");
|
||||
builder.Append(JsonUtility.ToJson(config.adLogoProperty));
|
||||
builder.Append(",");
|
||||
}
|
||||
|
||||
if(config.ctaButtonProperty != null)
|
||||
{
|
||||
builder.Append("\"").Append(ctaButtonKey).Append("\"");
|
||||
builder.Append(":");
|
||||
builder.Append(JsonUtility.ToJson(config.ctaButtonProperty));
|
||||
builder.Append(",");
|
||||
}
|
||||
|
||||
if(config.dislikeButtonProperty != null)
|
||||
{
|
||||
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();
|
||||
|
||||
if (temp.EndsWith(","))
|
||||
{
|
||||
temp = temp.Substring(0, temp.Length - 1);
|
||||
}
|
||||
|
||||
temp = temp + "}";
|
||||
|
||||
return temp;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAdView.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeAdView.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7e39d0f92be94036b0c3361002bdb6d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
73
AnyThinkPlugin/AnyThinkAds/Api/ATNativeBannerAd.cs
Normal file
73
AnyThinkPlugin/AnyThinkAds/Api/ATNativeBannerAd.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 ATNativeBannerAdShowingExtra
|
||||
{
|
||||
public static readonly string kATNativeBannerAdShowingExtraBackgroundColor = "background_color";
|
||||
public static readonly string kATNativeBannerAdShowingExtraAutorefreshInterval = "autorefresh_interval";
|
||||
public static readonly string kATNativeBannerAdShowingExtraHideCloseButtonFlag = "hide_close_button_flag";
|
||||
public static readonly string kATNativeBannerAdShowingExtraCTAButtonBackgroundColor = "cta_button_background_color";
|
||||
public static readonly string kATNativeBannerAdShowingExtraCTATextColor = "cta_button_title_color";//of type string, example:#3e2f10
|
||||
public static readonly string kATNativeBannerAdShowingExtraCTATextFont = "cta_text_font";//of type double
|
||||
public static readonly string kATNativeBannerAdShowingExtraTitleColor = "title_color";
|
||||
public static readonly string kATNativeBannerAdShowingExtraTitleFont = "title_font";
|
||||
public static readonly string kATNativeBannerAdShowingExtraTextColor = "text_color";
|
||||
public static readonly string kATNativeBannerAdShowingExtraTextFont = "text_font";
|
||||
public static readonly string kATNativeBannerAdShowingExtraAdvertiserTextFont = "sponsor_text_font";
|
||||
public static readonly string kATNativeBannerAdShowingExtraAdvertiserTextColor = "spnosor_text_color";
|
||||
}
|
||||
|
||||
public class ATNativeBannerAd
|
||||
{
|
||||
private static readonly ATNativeBannerAd instance = new ATNativeBannerAd();
|
||||
public IATNativeBannerAdClient client;
|
||||
public ATNativeBannerAd() {
|
||||
client = GetATNativeBannerAdClient();
|
||||
}
|
||||
|
||||
public static ATNativeBannerAd Instance {
|
||||
get {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public void loadAd(string placementId, Dictionary<String, String> pairs) {
|
||||
Debug.Log("ATNativeBannerAd::loadAd(" + placementId + ")");
|
||||
client.loadAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
public bool adReady(string placementId) {
|
||||
Debug.Log("ATNativeBannerAd::adReady(" + placementId + ")");
|
||||
return client.adReady(placementId);
|
||||
}
|
||||
|
||||
public void setListener(ATNativeBannerAdListener listener) {
|
||||
Debug.Log("ATNativeBannerAd::setListener");
|
||||
client.setListener(listener);
|
||||
}
|
||||
|
||||
public void showAd(string placementId, ATRect rect, Dictionary<string, string> pairs) {
|
||||
Debug.Log("ATNativeBannerAd::showAd");
|
||||
client.showAd(placementId, rect, pairs);
|
||||
}
|
||||
|
||||
public void removeAd(string placementId) {
|
||||
Debug.Log("ATNativeBannerAd::removeAd");
|
||||
client.removeAd(placementId);
|
||||
}
|
||||
|
||||
public IATNativeBannerAdClient GetATNativeBannerAdClient()
|
||||
{
|
||||
return AnyThinkAds.ATAdsClientFactory.BuildNativeBannerAdClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeBannerAd.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeBannerAd.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e02adf55e190948ba8238cbbb8e649d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
38
AnyThinkPlugin/AnyThinkAds/Api/ATNativeBannerAdListener.cs
Normal file
38
AnyThinkPlugin/AnyThinkAds/Api/ATNativeBannerAdListener.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public interface ATNativeBannerAdListener
|
||||
{
|
||||
/***
|
||||
* 广告请求成功(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdLoaded(string placementId);
|
||||
/***
|
||||
* 广告请求失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdLoadFail(string placementId, string code, string message);
|
||||
/***
|
||||
* 广告展示(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdImpressed(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
* 广告点击(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdClicked(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
* 广告自动刷新(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdAutoRefresh(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
* 广告自动刷新失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdAutoRefreshFailure(string placementId, string code, string message);
|
||||
/**
|
||||
* 关闭按钮被点击(内部逻辑不会移除ad view)(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||
*/
|
||||
void onAdCloseButtonClicked(string placementId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e977ada5558a4440ab4096ec189d66c3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
AnyThinkPlugin/AnyThinkAds/Api/ATNativeConfig.cs
Normal file
19
AnyThinkPlugin/AnyThinkAds/Api/ATNativeConfig.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public class ATNativeConfig
|
||||
{
|
||||
public ATNativeItemProperty parentProperty;
|
||||
public ATNativeItemProperty appIconProperty;
|
||||
public ATNativeItemProperty mainImageProperty;
|
||||
public ATNativeItemProperty titleProperty;
|
||||
public ATNativeItemProperty descProperty;
|
||||
public ATNativeItemProperty adLogoProperty;
|
||||
public ATNativeItemProperty ctaButtonProperty;
|
||||
public ATNativeItemProperty dislikeButtonProperty;
|
||||
public ATNativeItemProperty elementsProperty;
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeConfig.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeConfig.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ff7b39d30d2f48c7886af12676d5dca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
55
AnyThinkPlugin/AnyThinkAds/Api/ATNativeItemProperty.cs
Normal file
55
AnyThinkPlugin/AnyThinkAds/Api/ATNativeItemProperty.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Api{
|
||||
public class ATNativeItemProperty {
|
||||
public int x;
|
||||
public int y;
|
||||
public int width;
|
||||
public int height;
|
||||
public bool usesPixel;
|
||||
|
||||
public string backgroundColor;
|
||||
public string textColor; //只是针对text的view有效
|
||||
public int textSize; //只是针对text的view有效
|
||||
public bool isCustomClick; //只针对Android
|
||||
|
||||
public ATNativeItemProperty(int x, int y, int width, int height, string backgroundColor, string textColor, int textSize, bool usesPixel, bool isCustomClick)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.usesPixel = usesPixel;
|
||||
this.backgroundColor = backgroundColor;
|
||||
this.textColor = textColor;
|
||||
this.textSize = textSize;
|
||||
this.isCustomClick = isCustomClick;
|
||||
}
|
||||
|
||||
|
||||
public ATNativeItemProperty(int x, int y, int width, int height, string backgroundColor, string textColor, int textSize, bool usesPixel)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.usesPixel = usesPixel;
|
||||
this.backgroundColor = backgroundColor;
|
||||
this.textColor = textColor;
|
||||
this.textSize = textSize;
|
||||
}
|
||||
|
||||
public ATNativeItemProperty(int x,int y,int width,int height,string backgroundColor,string textColor,int textSize){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.usesPixel = false;
|
||||
this.backgroundColor = backgroundColor;
|
||||
this.textColor = textColor;
|
||||
this.textSize = textSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeItemProperty.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATNativeItemProperty.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33288477361ec4906b2f2b90af9afe74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
55
AnyThinkPlugin/AnyThinkAds/Api/ATRect.cs
Normal file
55
AnyThinkPlugin/AnyThinkAds/Api/ATRect.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public class ATRect
|
||||
{
|
||||
public ATRect(int x, int y, int width, int height, bool usesPixel)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.usesPixel = usesPixel;
|
||||
}
|
||||
|
||||
public ATRect(int x, int y, int width, int height)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.usesPixel = false;
|
||||
}
|
||||
|
||||
public int x = 0;
|
||||
public int y = 0;
|
||||
public int width = 0;
|
||||
public int height = 0;
|
||||
public bool usesPixel = false;
|
||||
|
||||
}
|
||||
|
||||
public class ATSize
|
||||
{
|
||||
public ATSize(int width, int height, bool usesPixel)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.usesPixel = usesPixel;
|
||||
}
|
||||
|
||||
public ATSize(int width, int height)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.usesPixel = false;
|
||||
}
|
||||
|
||||
public int width = 0;
|
||||
public int height = 0;
|
||||
public bool usesPixel = false;
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATRect.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATRect.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f4d9eae1b90142ca8004116a3e4c869
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedAutoVideo.cs
Normal file
93
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedAutoVideo.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
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 ATRewardedAutoVideo
|
||||
{
|
||||
private static readonly ATRewardedAutoVideo instance = new ATRewardedAutoVideo();
|
||||
public IATRewardedVideoAdClient client;
|
||||
|
||||
private ATRewardedAutoVideo()
|
||||
{
|
||||
client = GetATRewardedClient();
|
||||
}
|
||||
|
||||
public static ATRewardedAutoVideo Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
// Auto
|
||||
public void addAutoLoadAdPlacementID(string[] placementIDList)
|
||||
{
|
||||
client.addAutoLoadAdPlacementID(placementIDList);
|
||||
}
|
||||
|
||||
public void removeAutoLoadAdPlacementID(string[] placementIDList)
|
||||
{
|
||||
if (placementIDList != null && placementIDList.Length > 0)
|
||||
{
|
||||
string placementIDListString = JsonMapper.ToJson(placementIDList);
|
||||
client.removeAutoLoadAdPlacementID(placementIDListString);
|
||||
Debug.Log("removeAutoLoadAdPlacementID, placementIDList === " + placementIDListString);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("removeAutoLoadAdPlacementID, placementIDList = null");
|
||||
}
|
||||
}
|
||||
|
||||
public bool autoLoadRewardedVideoReadyForPlacementID(string placementId)
|
||||
{
|
||||
return client.autoLoadRewardedVideoReadyForPlacementID(placementId);
|
||||
}
|
||||
public string getAutoValidAdCaches(string placementId)
|
||||
{
|
||||
return client.getAutoValidAdCaches(placementId);
|
||||
}
|
||||
|
||||
public string checkAutoAdStatus(string placementId)
|
||||
{
|
||||
return client.checkAutoAdStatus(placementId);
|
||||
}
|
||||
|
||||
|
||||
public void setAutoLocalExtra(string placementId, Dictionary<string,string> pairs)
|
||||
{
|
||||
client.setAutoLocalExtra(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID)
|
||||
{
|
||||
client.entryAutoAdScenarioWithPlacementID(placementId, scenarioID);
|
||||
}
|
||||
|
||||
public void showAutoAd(string placementId)
|
||||
{
|
||||
client.showAutoAd(placementId, JsonMapper.ToJson(new Dictionary<string, string>()));
|
||||
}
|
||||
|
||||
public void showAutoAd(string placementId, Dictionary<string, string> pairs)
|
||||
{
|
||||
client.showAutoAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
public IATRewardedVideoAdClient GetATRewardedClient()
|
||||
{
|
||||
return AnyThinkAds.ATAdsClientFactory.BuildRewardedVideoAdClient();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedAutoVideo.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedAutoVideo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d40b4678e713487ab21c87b284165e9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
79
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedVideo.cs
Normal file
79
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedVideo.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
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 ATRewardedVideo
|
||||
{
|
||||
private static readonly ATRewardedVideo instance = new ATRewardedVideo();
|
||||
public IATRewardedVideoAdClient client;
|
||||
|
||||
private ATRewardedVideo()
|
||||
{
|
||||
client = GetATRewardedClient();
|
||||
}
|
||||
|
||||
public static ATRewardedVideo Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
*/
|
||||
public void loadVideoAd(string placementId, Dictionary<string,string> pairs)
|
||||
{
|
||||
client.loadVideoAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
|
||||
public bool hasAdReady(string placementId)
|
||||
{
|
||||
return client.hasAdReady(placementId);
|
||||
}
|
||||
|
||||
public void entryScenarioWithPlacementID(string placementId, string scenarioID)
|
||||
{
|
||||
client.entryScenarioWithPlacementID(placementId,scenarioID);
|
||||
}
|
||||
|
||||
public string checkAdStatus(string placementId)
|
||||
{
|
||||
return client.checkAdStatus(placementId);
|
||||
}
|
||||
|
||||
public string getValidAdCaches(string placementId)
|
||||
{
|
||||
return client.getValidAdCaches(placementId);
|
||||
}
|
||||
|
||||
public void showAd(string placementId)
|
||||
{
|
||||
client.showAd(placementId, JsonMapper.ToJson(new Dictionary<string, string>()));
|
||||
}
|
||||
|
||||
public void showAd(string placementId, Dictionary<string, string> pairs)
|
||||
{
|
||||
client.showAd(placementId, JsonMapper.ToJson(pairs));
|
||||
}
|
||||
|
||||
public IATRewardedVideoAdClient GetATRewardedClient()
|
||||
{
|
||||
return AnyThinkAds.ATAdsClientFactory.BuildRewardedVideoAdClient();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedVideo.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedVideo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e666f918e4a54255ae6d45c5ed483c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
90
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedVideoListener.cs
Normal file
90
AnyThinkPlugin/AnyThinkAds/Api/ATRewardedVideoListener.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public interface ATRewardedVideoListener
|
||||
{
|
||||
/***
|
||||
* The Ad load successfully (note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onRewardedVideoAdLoaded(string placementId);
|
||||
/***
|
||||
* The Ad load fail (note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onRewardedVideoAdLoadFail(string placementId,string code, string message);
|
||||
/***
|
||||
* The Ad play (note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onRewardedVideoAdPlayStart(string placementId, ATCallbackInfo callbackInfo);
|
||||
/***
|
||||
* The Ad play end (note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onRewardedVideoAdPlayEnd(string placementId, ATCallbackInfo callbackInfo);
|
||||
/***
|
||||
* The Ad play fail(note: for Android, all callback methods are not in the main thread of Unity)
|
||||
* @param code error code
|
||||
* @param message error message
|
||||
*/
|
||||
void onRewardedVideoAdPlayFail(string placementId,string code, string message);
|
||||
/**
|
||||
* The Ad close(note: for Android, all callback methods are not in the main thread of Unity)
|
||||
* @param isReward
|
||||
*/
|
||||
void onRewardedVideoAdPlayClosed(string placementId,bool isReward, ATCallbackInfo callbackInfo);
|
||||
/***
|
||||
* The Ad click(note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onRewardedVideoAdPlayClicked(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
* The Ad reward(note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onReward(string placementId, 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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public interface ATRewardedVideoExListener : ATRewardedVideoListener {
|
||||
/***
|
||||
* The Ad play again (note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onRewardedVideoAdAgainPlayStart(string placementId, ATCallbackInfo callbackInfo);
|
||||
/***
|
||||
* The Ad play end again(note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onRewardedVideoAdAgainPlayEnd(string placementId, ATCallbackInfo callbackInfo);
|
||||
/***
|
||||
* The Ad play fail again(note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onRewardedVideoAdAgainPlayFail(string placementId, string code, string message);
|
||||
|
||||
/***
|
||||
* The Ad click again(note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onRewardedVideoAdAgainPlayClicked(string placementId, ATCallbackInfo callbackInfo);
|
||||
/**
|
||||
* The Ad reward again(note: for Android, all callback methods are not in the main thread of Unity)
|
||||
*/
|
||||
void onAgainReward(string placementId, ATCallbackInfo callbackInfo);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2a8b39939a6e4561b49ec08c9648efa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
229
AnyThinkPlugin/AnyThinkAds/Api/ATSDKAPI.cs
Normal file
229
AnyThinkPlugin/AnyThinkAds/Api/ATSDKAPI.cs
Normal file
@@ -0,0 +1,229 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
|
||||
using AnyThinkAds.Common;
|
||||
using AnyThinkAds.ThirdParty.LitJson;
|
||||
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public interface ATGetUserLocationListener
|
||||
{
|
||||
void didGetUserLocation(int location);
|
||||
}
|
||||
|
||||
public interface ATConsentDismissListener
|
||||
{
|
||||
void onConsentDismiss();
|
||||
}
|
||||
|
||||
|
||||
public interface ATGetAreaListener
|
||||
{
|
||||
void onArea(string area);
|
||||
void onError(string message);
|
||||
}
|
||||
|
||||
public class ATSDKAPI
|
||||
{
|
||||
public static readonly int kATUserLocationUnknown = 0;
|
||||
public static readonly int kATUserLocationInEU = 1;
|
||||
public static readonly int kATUserLocationOutOfEU = 2;
|
||||
|
||||
public static readonly int PERSONALIZED = 0;
|
||||
public static readonly int NONPERSONALIZED = 1;
|
||||
public static readonly int UNKNOWN = 2;
|
||||
|
||||
public static readonly int AREA_GLOBAL = 0;
|
||||
public static readonly int AREA_CHINESE_MAINLAND = 1;
|
||||
|
||||
|
||||
//for android and ios
|
||||
public static readonly string OS_VERSION_NAME = "os_vn";
|
||||
public static readonly string OS_VERSION_CODE = "os_vc";
|
||||
public static readonly string APP_PACKAGE_NAME = "package_name";
|
||||
public static readonly string APP_VERSION_NAME = "app_vn";
|
||||
public static readonly string APP_VERSION_CODE = "app_vc";
|
||||
|
||||
public static readonly string BRAND = "brand";
|
||||
public static readonly string MODEL = "model";
|
||||
public static readonly string DEVICE_SCREEN_SIZE = "screen";
|
||||
public static readonly string MNC = "mnc";
|
||||
public static readonly string MCC = "mcc";
|
||||
|
||||
public static readonly string LANGUAGE = "language";
|
||||
public static readonly string TIMEZONE = "timezone";
|
||||
public static readonly string USER_AGENT = "ua";
|
||||
public static readonly string ORIENTATION = "orient";
|
||||
public static readonly string NETWORK_TYPE = "network_type";
|
||||
|
||||
//for android
|
||||
public static readonly string INSTALLER = "it_src";
|
||||
public static readonly string ANDROID_ID = "android_id";
|
||||
public static readonly string GAID = "gaid";
|
||||
public static readonly string MAC = "mac";
|
||||
public static readonly string IMEI = "imei";
|
||||
public static readonly string OAID = "oaid";
|
||||
|
||||
//for ios
|
||||
public static readonly string IDFA = "idfa";
|
||||
public static readonly string IDFV = "idfv";
|
||||
|
||||
|
||||
|
||||
private static readonly IATSDKAPIClient client = GetATSDKAPIClient();
|
||||
|
||||
public static void initSDK(string appId, string appKey)
|
||||
{
|
||||
client.initSDK(appId, appKey);
|
||||
}
|
||||
|
||||
public static void initSDK(string appId, string appKey, ATSDKInitListener listener)
|
||||
{
|
||||
client.initSDK(appId, appKey, listener);
|
||||
}
|
||||
|
||||
public static void showDebuggerUI()
|
||||
{
|
||||
client.showDebuggerUI();
|
||||
}
|
||||
|
||||
public static void setGDPRLevel(int level)
|
||||
{
|
||||
client.setGDPRLevel(level);
|
||||
}
|
||||
|
||||
public static void getUserLocation(ATGetUserLocationListener listener)
|
||||
{
|
||||
client.getUserLocation(listener);
|
||||
}
|
||||
|
||||
public static int getGDPRLevel() {
|
||||
return client.getGDPRLevel();
|
||||
}
|
||||
|
||||
public static bool isEUTraffic() {
|
||||
return client.isEUTraffic();
|
||||
}
|
||||
|
||||
public static void setChannel(string channel)
|
||||
{
|
||||
client.setChannel(channel);
|
||||
}
|
||||
|
||||
public static void setSubChannel(string subChannel)
|
||||
{
|
||||
client.setSubChannel(subChannel);
|
||||
}
|
||||
|
||||
public static void initCustomMap(Dictionary<string, string> customMap)
|
||||
{
|
||||
client.initCustomMap(JsonMapper.ToJson(customMap));
|
||||
}
|
||||
|
||||
public static void setCustomDataForPlacementID(Dictionary<string, string> customData, string placementID)
|
||||
{
|
||||
client.setCustomDataForPlacementID(JsonMapper.ToJson(customData), placementID);
|
||||
}
|
||||
|
||||
public static void showGDPRAuth()
|
||||
{
|
||||
client.showGDPRAuth();
|
||||
}
|
||||
|
||||
public static void showGDPRConsentDialog(ATConsentDismissListener listener)
|
||||
{
|
||||
client.showGDPRConsentDialog(listener);
|
||||
}
|
||||
|
||||
public static void setLogDebug(bool isDebug)
|
||||
{
|
||||
client.setLogDebug(isDebug);
|
||||
ATLogger.IsDebug = isDebug;
|
||||
}
|
||||
|
||||
public static void addNetworkGDPRInfo(int networkType, Dictionary<string,object> dictionary)
|
||||
{
|
||||
client.addNetworkGDPRInfo(networkType, JsonMapper.ToJson(dictionary));
|
||||
}
|
||||
|
||||
public static void deniedUploadDeviceInfo(string[] deniedInfo)
|
||||
{
|
||||
if (deniedInfo != null && deniedInfo.Length > 0)
|
||||
{
|
||||
string deniedString = JsonMapper.ToJson(deniedInfo);
|
||||
client.deniedUploadDeviceInfo(deniedString);
|
||||
Debug.Log("deniedUploadDeviceInfo, deniedInfo === " + deniedString);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("deniedUploadDeviceInfo, deniedInfo = null");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static IATSDKAPIClient GetATSDKAPIClient(){
|
||||
Debug.Log("GetATSDKAPIClient");
|
||||
return AnyThinkAds.ATAdsClientFactory.BuildSDKAPIClient();
|
||||
}
|
||||
|
||||
public static void setExcludeBundleIdArray(string[] bundleIds)
|
||||
{
|
||||
if (bundleIds != null && bundleIds.Length > 0)
|
||||
{
|
||||
string bundleIdsString = JsonMapper.ToJson(bundleIds);
|
||||
Debug.Log("setExcludeBundleIdArray, bundleIdsString === " + bundleIdsString);
|
||||
|
||||
client.setExcludeBundleIdArray(bundleIdsString);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("setExcludeBundleIdArray, bundleIdsString = null");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void setExcludeAdSourceIdArrayForPlacementID(string placementID, string[] adSourceIds)
|
||||
{
|
||||
if (adSourceIds != null && adSourceIds.Length > 0)
|
||||
{
|
||||
string adSourceIdsString = JsonMapper.ToJson(adSourceIds);
|
||||
Debug.Log("setExcludeAdSourceIdArrayForPlacementID, adSourceIdsString === " + adSourceIdsString);
|
||||
|
||||
client.setExcludeAdSourceIdArrayForPlacementID(placementID, adSourceIdsString);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("setExcludeAdSourceIdArrayForPlacementID, adSourceIdsString = null");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void setSDKArea(int area)
|
||||
{
|
||||
client.setSDKArea(area);
|
||||
}
|
||||
|
||||
public static void getArea(ATGetAreaListener listener)
|
||||
{
|
||||
client.getArea(listener);
|
||||
}
|
||||
|
||||
public static void setWXStatus(bool install)
|
||||
{
|
||||
client.setWXStatus(install);
|
||||
}
|
||||
|
||||
public static void setLocation(double longitude, double latitude)
|
||||
{
|
||||
client.setLocation(longitude, latitude);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATSDKAPI.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATSDKAPI.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2668d385cd9ef4bc385b0c1487756d84
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13
AnyThinkPlugin/AnyThinkAds/Api/ATSDKInitListener.cs
Normal file
13
AnyThinkPlugin/AnyThinkAds/Api/ATSDKInitListener.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Api
|
||||
{
|
||||
public interface ATSDKInitListener
|
||||
{
|
||||
|
||||
void initSuccess();
|
||||
void initFail(string message);
|
||||
}
|
||||
}
|
||||
11
AnyThinkPlugin/AnyThinkAds/Api/ATSDKInitListener.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATSDKInitListener.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92bd41ae21ada4f13ba4f646fe8d8e87
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
73
AnyThinkPlugin/AnyThinkAds/Api/ATSplashAd.cs
Normal file
73
AnyThinkPlugin/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
AnyThinkPlugin/AnyThinkAds/Api/ATSplashAd.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATSplashAd.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6599afb4d52b14fa098f43f1d01be850
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
AnyThinkPlugin/AnyThinkAds/Api/ATSplashAdListener.cs
Normal file
40
AnyThinkPlugin/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
AnyThinkPlugin/AnyThinkAds/Api/ATSplashAdListener.cs.meta
Normal file
11
AnyThinkPlugin/AnyThinkAds/Api/ATSplashAdListener.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e99f46e9ff2ba49338673e9655a6b494
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user