You've already forked Commercialization.topon
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 950569ee05 | |||
| 1da26e1d74 | |||
| caf057bb97 | |||
| 41f75ad3d0 | |||
| c07a7e5f4a | |||
| 120d3315fc | |||
| 5a24a3292c | |||
| 9a8096f347 | |||
| 0f760ca1a5 | |||
| 4ec2560f30 | |||
|
|
1d22a3dae0 | ||
|
|
75730fb783 | ||
|
|
38c9cabad2 | ||
| f8a4ac18c1 | |||
| c6bf3ec373 | |||
| 39014e1de3 | |||
| 97674a4b16 | |||
| a248437870 | |||
| c2c8dea87d | |||
| 1e04999628 | |||
| 2cabb0e4e8 | |||
| 874b5edf93 | |||
| 49a35b1b6c | |||
| 37f58dcd84 | |||
| d646659fcf | |||
| 91ef145ede | |||
| e93e33ca2a | |||
| c11f7e3306 | |||
| 079f155da9 |
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 687c8129e7770fe47aa2bdceaab14b6b
|
||||
guid: 0b1601c425ae3b24e9764462dbbe5359
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91a7a1e184c2641f79c95f363b8872d2
|
||||
guid: ae70ff20f73a04e91b4e6bb12d7adc69
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -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
|
||||
@@ -29,14 +34,14 @@ namespace AnyThinkAds.Api
|
||||
public String errorMessage { get; }
|
||||
public String errorCode { get; }
|
||||
|
||||
public ATAdErrorEventArgs(String placementId, String message, String code)
|
||||
public ATAdErrorEventArgs(String placementId, String code, String message)
|
||||
: base(placementId)
|
||||
{
|
||||
errorMessage = message;
|
||||
errorCode = code;
|
||||
}
|
||||
|
||||
public ATAdErrorEventArgs(String placementId, String callbackJson, String message, String code)
|
||||
public ATAdErrorEventArgs(String placementId, String callbackJson, String code, String message)
|
||||
: base(placementId, callbackJson)
|
||||
{
|
||||
errorMessage = message;
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 219a4269ecae84c4e9d5b84de8b992de
|
||||
guid: 9b60b708af5e340558538fb89bf1ad69
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8137f9ecda484f4f82280927f6cc6d3
|
||||
guid: 3b97598ecf1ac41ae8a6e0eee94608f4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82a2859cc834c4a2f92c6497ca4ffa5f
|
||||
guid: fae71ee84b92049808278fa6136d7df6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using AnyThinkAds.ThirdParty.LitJson;
|
||||
@@ -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 Dictionary<string, object> user_load_extra_data;
|
||||
public readonly int abtest_id;
|
||||
|
||||
public readonly string reward_custom_data;
|
||||
|
||||
@@ -72,15 +76,21 @@ 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 = 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"] : "";
|
||||
|
||||
@@ -130,12 +140,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;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d71af2c579e014d268a0dfa493b7b42a
|
||||
guid: 2c93c0c14cd404be996bcf059100b463
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96cb1512452b44892ab41a110737bc6f
|
||||
guid: 6b26a8704722c46babeea74f3987c69d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c23fcd22e05664d73ba39e69a58fdfdb
|
||||
guid: 56dcbba2145654405b16127bddded05a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88edb880a748a4df7be4481415e44907
|
||||
guid: 61212f78425314ddf82ce67401332cbc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b93dd6d343c0473193c776c1ba89ec8
|
||||
guid: 8eb2c48fff706415897ff05ee871d29b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2b539b7c0e104683ad9789e63c426c1
|
||||
guid: 5f82d7548575e4785813857cc3af2560
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ec858a9445e344c6ae02b731012d297
|
||||
guid: 1556c57dc2f9145beb17f8971ffc7d54
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 220e014333c6840fc89f951639f5deba
|
||||
guid: 36fdba1e893634f0e996c56f9aaf8af4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2c5ed4e8516545f0838dddae9200f2f
|
||||
guid: 985c207868dc84dd8a02d16d2d203bdd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 863e49baa0bfb4c899f6d1591f126aeb
|
||||
guid: 5dfea32a3220f4ff0b52af1e0c9f0f37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4cf0c99e1e574b3aa6d4a1a46daf9da
|
||||
guid: 449f93d5988674ac0bf3d01fce8b40af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f89a8b127b7346a7a27be7bf6cdc2a1
|
||||
guid: a3cfc0715bf4e418c8185e81824a3951
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -14,5 +14,6 @@ namespace AnyThinkAds.Api
|
||||
public ATNativeItemProperty adLogoProperty;
|
||||
public ATNativeItemProperty ctaButtonProperty;
|
||||
public ATNativeItemProperty dislikeButtonProperty;
|
||||
public ATNativeItemProperty elementsProperty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7472931a01bd34107842d9baa5edf262
|
||||
guid: 9452d40d6d58a443a9de0a893dcd23c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4ce4b4690b764fcd9a5bdba6c7a48b8
|
||||
guid: 907d2c40069d74e4497ac4259e61a0b4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ce958c2c0a294f85981fc0d7efd277e
|
||||
guid: 3785b3f4f63d441b9964d109ad0c0eb1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5feccd0a003ab4defba25cd4e3f9e870
|
||||
guid: 765e71648fb324c22af60e7d4269b7f5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1e0f021a24cc491eb4f054d576982f7
|
||||
guid: 11dc3169fecba4718a711508c79ff3ea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c71cf6d83ff4406db7ed141066a54d3
|
||||
guid: 899c4c12dc20d4847b2c902dbc6d083d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -82,6 +82,11 @@ namespace AnyThinkAds.Api
|
||||
client.initSDK(appId, appKey, listener);
|
||||
}
|
||||
|
||||
public static void showDebuggerUI()
|
||||
{
|
||||
client.showDebuggerUI();
|
||||
}
|
||||
|
||||
public static void setGDPRLevel(int level)
|
||||
{
|
||||
client.setGDPRLevel(level);
|
||||
@@ -128,6 +133,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)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17ae30f8263a149fc8eba30dad68d0f0
|
||||
guid: 5459d05d6e7d74bddbfdfd593624c02a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57b3ce41b10cf46cbb2e5a082691be6d
|
||||
guid: d638f5a77e3fb44589978034d550ae48
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
73
AnyThinkAds/Api/ATSplashAd.cs
Normal file
73
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4655aa99cf2c1475eb148561285c1d0e
|
||||
guid: 8a239d301e22f4ab9bb1fab7a8b7be3a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
40
AnyThinkAds/Api/ATSplashAdListener.cs
Normal file
40
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);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 653ebf512c3af46698bdf323cfb74f53
|
||||
guid: 303f9d84876fe468d8800abe78fc59c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e8456848ebbf4b988a66e831999e0b7
|
||||
guid: 9ded34532e9f04a199738e82a8f7ca89
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
95
AnyThinkAds/Common/ATLogger.cs
Normal file
95
AnyThinkAds/Common/ATLogger.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AnyThinkAds.Common
|
||||
{
|
||||
public class ATLogger
|
||||
{
|
||||
private static bool isDebug = false;
|
||||
public static bool IsDebug
|
||||
{
|
||||
get {
|
||||
return isDebug;
|
||||
}
|
||||
set {
|
||||
isDebug = value;
|
||||
}
|
||||
}
|
||||
|
||||
// public static void Log(string msg)
|
||||
// {
|
||||
// Log(msg, null);
|
||||
// }
|
||||
|
||||
// public static void Log(string format, object obj)
|
||||
// {
|
||||
// Log(format, obj, null);
|
||||
// }
|
||||
|
||||
public static void Log(string format, object obj1 = null, object obj2 = null)
|
||||
{
|
||||
if (!isDebug) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (obj1 == null && obj2 == null)
|
||||
{
|
||||
Debug.Log(format);
|
||||
}
|
||||
else if (obj1 != null && obj2 == null)
|
||||
{
|
||||
Debug.Log(String.Format(format, obj1));
|
||||
}
|
||||
else if (obj1 == null && obj2 != null)
|
||||
{
|
||||
Debug.Log(String.Format(format, obj2));
|
||||
}
|
||||
else {
|
||||
Debug.Log(String.Format(format, obj1, obj2));
|
||||
}
|
||||
} catch(Exception e)
|
||||
{
|
||||
Debug.LogError("Log error: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public static void LogError(string msg)
|
||||
// {
|
||||
// LogError(msg, null);
|
||||
// }
|
||||
|
||||
// public static void LogError(string format, object obj)
|
||||
// {
|
||||
// LogError(format, obj, null);
|
||||
// }
|
||||
|
||||
public static void LogError(string format, object obj1 = null, object obj2 = null)
|
||||
{
|
||||
if (!isDebug) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (obj1 == null && obj2 == null)
|
||||
{
|
||||
Debug.LogError(format);
|
||||
}
|
||||
else if (obj1 != null && obj2 == null)
|
||||
{
|
||||
Debug.LogError(String.Format(format, obj1));
|
||||
}
|
||||
else if (obj1 == null && obj2 != null)
|
||||
{
|
||||
Debug.LogError(String.Format(format, obj2));
|
||||
}
|
||||
else {
|
||||
Debug.LogError(String.Format(format, obj1, obj2));
|
||||
}
|
||||
} catch(Exception e)
|
||||
{
|
||||
Debug.LogError("Log error: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82226c0ac90874afc9d1b46b47c9dfb5
|
||||
guid: 481cb536df3414d5996de09dc3d93f27
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33f1ceabaff3f4892a39bf63a74352b7
|
||||
guid: ea61e5a90a3874a97bb25388556a634f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fd119e79e8154f6e885622336dd50f7
|
||||
guid: cb52de4904a0241deacbc13164605b9a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2d102c3a980f472fa20811ed609d085
|
||||
guid: 6ca423c96597e414a9696e534160eaa6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2275de4a621e46b2b6a157d2c35ed7e
|
||||
guid: ca2cc2e235e7f4c6b9d6df05890fee83
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 87ae11b5cac0f4dbbb559cfed9dc531b
|
||||
guid: a883f68b421b746b4b386d2323b8bd70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c8f90439b6de4b25b7fc5e8d62ec895
|
||||
guid: 9447b44b60e964f1fb25c2f09c31e178
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace AnyThinkAds.Common
|
||||
{
|
||||
void initSDK(string appId, string appKey);
|
||||
void initSDK(string appId, string appKey, ATSDKInitListener listener);
|
||||
void showDebuggerUI();
|
||||
void getUserLocation(ATGetUserLocationListener listener);
|
||||
void setGDPRLevel(int level);
|
||||
void showGDPRAuth();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 833dc348e2c4648f08a4791990328b24
|
||||
guid: 0c9f6614fa9d340f6aac85b26808f013
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
24
AnyThinkAds/Common/IATSplashAdClient.cs
Normal file
24
AnyThinkAds/Common/IATSplashAdClient.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using AnyThinkAds.Api;
|
||||
|
||||
namespace AnyThinkAds.Common
|
||||
{
|
||||
public interface IATSplashAdClient : IATSplashEvents
|
||||
{
|
||||
// void loadSplashAd(string placementId, string mapJson);
|
||||
void loadSplashAd(string placementId, int fetchAdTimeout, string defaultAdSourceConfig, string mapJson);
|
||||
void setListener(ATSplashAdListener listener);
|
||||
|
||||
bool hasSplashAdReady(string placementId);
|
||||
|
||||
string checkAdStatus(string placementId);
|
||||
|
||||
void showSplashAd(string placementId, string mapJson);
|
||||
|
||||
string getValidAdCaches(string placementId);
|
||||
|
||||
void entryScenarioWithPlacementID(string placementId, string scenarioID);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa8c0cec5bff04aeca5dc28fe21ffc89
|
||||
guid: 8a4b7cb850fe447f9980f860ad314b7a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8cf0d327cc346430caa11f4acd1f815e
|
||||
guid: bbfb513f68b154b0ebfa36897c6e4401
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -122,6 +122,21 @@ namespace AnyThinkAds
|
||||
return new UnityDownloadClient();
|
||||
}
|
||||
|
||||
public static IATSplashAdClient BuildSplashAdClient()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
// Testing UNITY_EDITOR first because the editor also responds to the currently
|
||||
// selected platform.
|
||||
#elif UNITY_ANDROID
|
||||
return new AnyThinkAds.Android.ATSplashAdClient();
|
||||
#elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
|
||||
//TODO iOS返回开屏client
|
||||
return new AnyThinkAds.iOS.ATSplashAdClient();
|
||||
#else
|
||||
#endif
|
||||
return new UnitySplashClient();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class UnitySDKAPIClient:IATSDKAPIClient
|
||||
@@ -146,7 +161,7 @@ namespace AnyThinkAds
|
||||
public void getArea(ATGetAreaListener listener) { }
|
||||
public void setWXStatus(bool install) { }
|
||||
public void setLocation(double longitude, double latitude) { }
|
||||
|
||||
public void showDebuggerUI() {}
|
||||
}
|
||||
|
||||
class UnityBannerClient:IATBannerAdClient
|
||||
@@ -425,4 +440,52 @@ namespace AnyThinkAds
|
||||
Debug.Log("Must run on Android platform");
|
||||
}
|
||||
}
|
||||
|
||||
class UnitySplashClient : IATSplashAdClient
|
||||
{
|
||||
public event EventHandler<ATAdEventArgs> onAdLoadTimeoutEvent;
|
||||
public event EventHandler<ATAdEventArgs> onDeeplinkEvent;
|
||||
public event EventHandler<ATAdEventArgs> onDownloadConfirmEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdShowEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||
// called if the ad has failed to be shown
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdShowFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdLoadEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||
public event EventHandler<ATAdEventArgs> onRewardEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onPlayAgainStart;
|
||||
public event EventHandler<ATAdEventArgs> onPlayAgainEnd;
|
||||
public event EventHandler<ATAdErrorEventArgs> onPlayAgainFailure;
|
||||
public event EventHandler<ATAdEventArgs> onPlayAgainClick;
|
||||
public event EventHandler<ATAdEventArgs> onPlayAgainReward;
|
||||
// public void loadSplashAd(string placementId, string mapJson) {}
|
||||
public void loadSplashAd(string placementId, int fetchAdTimeout, string defaultAdSourceConfig, string mapJson) {}
|
||||
public void setListener(ATSplashAdListener listener) {}
|
||||
|
||||
public bool hasSplashAdReady(string placementId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public string checkAdStatus(string placementId) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public void showSplashAd(string placementId, string mapJson) {}
|
||||
|
||||
/***
|
||||
* 获取所有可用缓存广告
|
||||
*/
|
||||
public string getValidAdCaches(string placementId) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public void entryScenarioWithPlacementID(string placementId, string scenarioID) {}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cfc618d1f344493aa2c430c0ff5e8c3
|
||||
guid: 981b262fb83e54eeabfd486e41f29be2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e06b6a7bea414435806d944b50c9238
|
||||
guid: b0a6ebc6626634f558dc5c05feb59058
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eadc3c4bb3f0f4260b1a97ff1d4c1cf7
|
||||
guid: 90dbd7456e6124557975885ffe10f3a9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace AnyThinkAds.Android
|
||||
public void onBannerFailed(string placementId,string code, string error)
|
||||
{
|
||||
Debug.Log("onBannerFailed...unity3d.");
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
//广告点击
|
||||
@@ -265,7 +265,7 @@ namespace AnyThinkAds.Android
|
||||
public void onBannerAutoRefreshFail(string placementId, string code, string msg)
|
||||
{
|
||||
Debug.Log("onBannerAutoRefreshFail...unity3d.");
|
||||
onAdAutoRefreshFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, msg, code));
|
||||
onAdAutoRefreshFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, msg));
|
||||
}
|
||||
|
||||
// Adsource Listener
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92e8455090a784b949bd67df1b3fc530
|
||||
guid: 7f3cedb25774f4e35812850b16bdc513
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10ff201c4f54b4fce8f22229037070c4
|
||||
guid: 29efa7f20db6a498dac09b319bda9933
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace AnyThinkAds.Android
|
||||
public void onInterstitialAdLoadFail(string placementId,string code, string error)
|
||||
{
|
||||
Debug.Log("onInterstitialAdFailed...unity3d.");
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
//开始播放
|
||||
@@ -234,13 +234,13 @@ namespace AnyThinkAds.Android
|
||||
public void onInterstitialAdVideoError(string placementId,string code, string error)
|
||||
{
|
||||
Debug.Log("onInterstitialAdPlayFailed...unity3d.");
|
||||
onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
//展示失败
|
||||
public void OnInterstitialAdFailedToShow(string placementID) {
|
||||
Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdFailedToShow()");
|
||||
onAdShowFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, "Failed to show video ad", "-1"));
|
||||
onAdShowFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, "-1", "Failed to show video ad"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a5faa4e142aa43dbba381b1cef1eb7b
|
||||
guid: 6c850120fc39e4e98a4eddd0401c9dd6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f9a8f81e02c94851a16c544a4f2bca9
|
||||
guid: bf17f096c3ea74e6c844e4853edaa7a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7739e5e9b404f44fc8d2079f8f8a5423
|
||||
guid: 1bd144bb8c54a4fbbaecdf49ee696391
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e7ad1dcac86142608df799cdeefe124
|
||||
guid: d2903f5baf1ad44538c552d99ef462b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc7832ca770c84f96ac1401368abb7dc
|
||||
guid: b62935f38b76841139a556d293fc6af1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace AnyThinkAds.Android
|
||||
public void onRewardedVideoAdFailed(string placementId,string code, string error)
|
||||
{
|
||||
Debug.Log("onRewardedVideoAdFailed...unity3d.");
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace AnyThinkAds.Android
|
||||
public void onRewardedVideoAdPlayFailed(string placementId,string code, string error)
|
||||
{
|
||||
Debug.Log("onRewardedVideoAdPlayFailed...unity3d.");
|
||||
onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
public void onRewardedVideoAdClosed(string placementId,bool isRewarded, string callbackJson)
|
||||
@@ -237,7 +237,7 @@ namespace AnyThinkAds.Android
|
||||
public void onRewardedVideoAdAgainPlayFailed(string placementId, string code, string error)
|
||||
{
|
||||
Debug.Log("onRewardedVideoAdAgainPlayFailed...unity3d.");
|
||||
onPlayAgainFailure?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onPlayAgainFailure?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace AnyThinkAds.Android
|
||||
public void onAdSourceBiddingFail(string placementId, string callbackJson, string code, string error)
|
||||
{
|
||||
Debug.Log("onAdSourceBiddingFail...unity3d." + placementId + "," + code + "," + error + "," + callbackJson);
|
||||
onAdSourceBiddingFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onAdSourceBiddingFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
public void onAdSourceAttempt(string placementId, string callbackJson)
|
||||
@@ -289,7 +289,7 @@ namespace AnyThinkAds.Android
|
||||
public void onAdSourceLoadFail(string placementId, string callbackJson, string code, string error)
|
||||
{
|
||||
Debug.Log("onAdSourceLoadFail...unity3d." + placementId + "," + code + "," + error + "," + callbackJson);
|
||||
onAdSourceLoadFailureEvent?.Invoke(this,new ATAdErrorEventArgs(placementId, error, code));
|
||||
onAdSourceLoadFailureEvent?.Invoke(this,new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8d0bdf7098d34eb28d38fba39a47b0c
|
||||
guid: 5fd0fd9d36b8346598b43cd3ee66060c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -357,5 +357,19 @@ namespace AnyThinkAds.Android
|
||||
}
|
||||
}
|
||||
|
||||
public void showDebuggerUI() {
|
||||
try
|
||||
{
|
||||
if (this.sdkInitHelper != null)
|
||||
{
|
||||
this.sdkInitHelper.Call("showDebuggerUI");
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
System.Console.WriteLine("Exception caught: {0}", e);
|
||||
Debug.Log("ATSDKAPIClient : error." + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 245e7a5e922934f43a6484d5f0189a91
|
||||
guid: 1171cfa63deb643d9a1c39bab8a00929
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
237
AnyThinkAds/Platform/Android/ATSplashAdClient.cs
Normal file
237
AnyThinkAds/Platform/Android/ATSplashAdClient.cs
Normal file
@@ -0,0 +1,237 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using AnyThinkAds.Common;
|
||||
using AnyThinkAds.Api;
|
||||
using AnyThinkAds.ThirdParty.LitJson;
|
||||
|
||||
namespace AnyThinkAds.Android
|
||||
{
|
||||
public class ATSplashAdClient : AndroidJavaProxy, IATSplashAdClient
|
||||
{
|
||||
public event EventHandler<ATAdEventArgs> onAdLoadTimeoutEvent;
|
||||
public event EventHandler<ATAdEventArgs> onDeeplinkEvent;
|
||||
public event EventHandler<ATAdEventArgs> onDownloadConfirmEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdLoadEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdShowEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdShowFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||
|
||||
private Dictionary<string, AndroidJavaObject> splashHelperMap = new Dictionary<string, AndroidJavaObject>();
|
||||
private ATSplashAdListener splashAdListener;
|
||||
|
||||
private int fetchAdTimeout = 0;
|
||||
private string defaultAdSourceConfig;
|
||||
|
||||
public ATSplashAdClient() : base("com.anythink.unitybridge.splash.SplashListener")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private AndroidJavaObject getSplashHelper(string placementId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!splashHelperMap.ContainsKey(placementId))
|
||||
{
|
||||
AndroidJavaObject splashHelper = new AndroidJavaObject(
|
||||
"com.anythink.unitybridge.splash.SplashHelper", this);
|
||||
splashHelper.Call("initSplash", placementId, fetchAdTimeout, defaultAdSourceConfig);
|
||||
splashHelperMap.Add(placementId, splashHelper);
|
||||
return splashHelper;
|
||||
} else {
|
||||
return splashHelperMap[placementId];
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
ATLogger.LogError("getSplashHelper() >>> error: {0}", e.Message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void loadSplashAd(string placementId, int fetchAdTimeout = 0, string defaultAdSourceConfig = "", string mapJson = "")
|
||||
{
|
||||
this.fetchAdTimeout = fetchAdTimeout;
|
||||
this.defaultAdSourceConfig = defaultAdSourceConfig;
|
||||
try
|
||||
{
|
||||
ATLogger.Log("loadSplashAd() >>> placementId: {0}", placementId);
|
||||
getSplashHelper(placementId).Call("loadAd", mapJson);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
ATLogger.LogError("loadSplashAd() >>> error: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void setListener(ATSplashAdListener listener)
|
||||
{
|
||||
this.splashAdListener = listener;
|
||||
}
|
||||
|
||||
public bool hasSplashAdReady(string placementId)
|
||||
{
|
||||
bool isAdReady = false;
|
||||
ATLogger.Log("hasSplashAdReady() >>> placementId: {0}", placementId);
|
||||
try
|
||||
{
|
||||
isAdReady = getSplashHelper(placementId).Call<bool>("isAdReady");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
ATLogger.LogError("hasSplashAdReady() >>> error: {0}", e.Message);
|
||||
}
|
||||
return isAdReady;
|
||||
}
|
||||
|
||||
public string checkAdStatus(string placementId)
|
||||
{
|
||||
string adStatusJsonString = "";
|
||||
ATLogger.Log("checkAdStatus() >>> placementId: {0}", placementId);
|
||||
try
|
||||
{
|
||||
adStatusJsonString = getSplashHelper(placementId).Call<string>("checkAdStatus");
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
ATLogger.LogError("checkAdStatus() >>> error: {0}", e.Message);
|
||||
}
|
||||
return adStatusJsonString;
|
||||
}
|
||||
|
||||
public void showSplashAd(string placementId, string mapJson)
|
||||
{
|
||||
ATLogger.Log("showSplashAd() >>> placementId: {0}, mapJson: {1}", placementId, mapJson);
|
||||
try
|
||||
{
|
||||
getSplashHelper(placementId).Call("showAd", mapJson);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
ATLogger.LogError("showSplashAd() >>> error: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public string getValidAdCaches(string placementId)
|
||||
{
|
||||
ATLogger.Log("getValidAdCaches() >>> placementId: {0}", placementId);
|
||||
string adString = "";
|
||||
try
|
||||
{
|
||||
adString = getSplashHelper(placementId).Call<string>("getValidAdCaches");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
ATLogger.LogError("getValidAdCaches() >>> error: {0}", e.Message);
|
||||
}
|
||||
return adString;
|
||||
}
|
||||
|
||||
public void entryScenarioWithPlacementID(string placementId, string scenarioID)
|
||||
{
|
||||
ATLogger.Log("entryScenarioWithPlacementID() >>> placementId: {0}, scenarioID: {1}", placementId, scenarioID);
|
||||
|
||||
try
|
||||
{
|
||||
getSplashHelper(placementId).Call<string>("entryAdScenario", scenarioID);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
ATLogger.LogError("entryScenarioWithPlacementID() >>> error: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSplashAdLoad(String unitId, bool isTimeout)
|
||||
{
|
||||
onAdLoadEvent?.Invoke(this, new ATAdEventArgs(unitId, "", isTimeout));
|
||||
}
|
||||
|
||||
public void onSplashAdLoadTimeOut(String unitId)
|
||||
{
|
||||
onAdLoadTimeoutEvent?.Invoke(this, new ATAdEventArgs(unitId, "", true));
|
||||
}
|
||||
|
||||
public void onSplashAdLoadFailed(String unitId, String code, String msg)
|
||||
{
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(unitId, code, msg));
|
||||
}
|
||||
|
||||
public void onSplashAdShow(String unitId, String callbackJson)
|
||||
{
|
||||
onAdShowEvent?.Invoke(this, new ATAdEventArgs(unitId, callbackJson));
|
||||
}
|
||||
|
||||
public void onSplashAdClick(String unitId, String callbackJson)
|
||||
{
|
||||
onAdClickEvent?.Invoke(this, new ATAdEventArgs(unitId, callbackJson));
|
||||
}
|
||||
|
||||
public void onSplashAdDismiss(String unitId, String callbackJson)
|
||||
{
|
||||
onAdClickEvent?.Invoke(this, new ATAdEventArgs(unitId, callbackJson));
|
||||
}
|
||||
|
||||
public void onSplashAdDeeplinkCallback(String unitId, String callbackJson, bool isSuccess)
|
||||
{
|
||||
onDeeplinkEvent?.Invoke(this, new ATAdEventArgs(unitId, callbackJson, false, isSuccess));
|
||||
}
|
||||
|
||||
public void onSplashAdDownloadConfirm(String unitId, String callbackJson)
|
||||
{
|
||||
onDownloadConfirmEvent?.Invoke(this, new ATAdEventArgs(unitId, callbackJson));
|
||||
}
|
||||
|
||||
// Adsource Listener
|
||||
public void onAdSourceBiddingAttempt(string placementId, string callbackJson)
|
||||
{
|
||||
ATLogger.Log("onAdSourceBiddingAttempt...unity3d." + placementId + "," + callbackJson);
|
||||
onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson));
|
||||
}
|
||||
|
||||
public void onAdSourceBiddingFilled(string placementId, string callbackJson)
|
||||
{
|
||||
ATLogger.Log("onAdSourceBiddingFilled...unity3d." + placementId + "," + callbackJson);
|
||||
|
||||
onAdSourceBiddingFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson));
|
||||
}
|
||||
|
||||
public void onAdSourceBiddingFail(string placementId, string callbackJson, string code, string error)
|
||||
{
|
||||
ATLogger.Log("onAdSourceBiddingFail...unity3d." + placementId + "," + code + "," + error + "," + callbackJson);
|
||||
|
||||
onAdSourceBiddingFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error));
|
||||
}
|
||||
|
||||
public void onAdSourceAttempt(string placementId, string callbackJson)
|
||||
{
|
||||
ATLogger.Log("onAdSourceAttempt...unity3d." + placementId + "," + callbackJson);
|
||||
|
||||
onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson));
|
||||
}
|
||||
|
||||
public void onAdSourceLoadFilled(string placementId, string callbackJson)
|
||||
{
|
||||
ATLogger.Log("onAdSourceLoadFilled...unity3d." + placementId + "," + callbackJson);
|
||||
|
||||
onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson));
|
||||
}
|
||||
|
||||
public void onAdSourceLoadFail(string placementId, string callbackJson, string code, string error)
|
||||
{
|
||||
ATLogger.Log("onAdSourceLoadFail...unity3d." + placementId + "," + code + "," + error + "," + callbackJson);
|
||||
|
||||
onAdSourceLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error));
|
||||
}
|
||||
}
|
||||
}
|
||||
11
AnyThinkAds/Platform/Android/ATSplashAdClient.cs.meta
Normal file
11
AnyThinkAds/Platform/Android/ATSplashAdClient.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5d900a3e2db7482a8f8ad05737decd3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24acb4405bd40449f82a6ea03b5824c7
|
||||
guid: da68e624ffa1041e889b8d3eb9187af2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace AnyThinkAds.iOS {
|
||||
|
||||
public void OnBannerAdLoadFail(string placementId, string code, string message) {
|
||||
Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdLoadFail()");
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, message, code));
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, message));
|
||||
}
|
||||
|
||||
public void OnBannerAdImpress(string placementId, string callbackJson) {
|
||||
@@ -123,7 +123,7 @@ namespace AnyThinkAds.iOS {
|
||||
|
||||
public void OnBannerAdAutoRefreshFail(string placementId, string code, string message) {
|
||||
Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdAutoRefreshFail()");
|
||||
onAdAutoRefreshFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, message, code));
|
||||
onAdAutoRefreshFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, message));
|
||||
}
|
||||
|
||||
public void OnBannerAdClose(string placementId) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc5aeee813f974653b6b9947425ec275
|
||||
guid: 30779b649671a471c83e73ac95e9ec79
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -82,12 +82,12 @@ namespace AnyThinkAds.iOS {
|
||||
|
||||
public void OnInterstitialAdLoadFailure(string placementID, string code, string error) {
|
||||
Debug.Log("onInterstitialAdFailed...unity3d.");
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, error, code));
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, code, error));
|
||||
}
|
||||
|
||||
public void OnInterstitialAdVideoPlayFailure(string placementID, string code, string error) {
|
||||
Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdVideoPlayFailure()");
|
||||
onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, error, code));
|
||||
onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, code, error));
|
||||
}
|
||||
|
||||
public void OnInterstitialAdVideoPlayStart(string placementID, string callbackJson) {
|
||||
@@ -107,7 +107,7 @@ namespace AnyThinkAds.iOS {
|
||||
|
||||
public void OnInterstitialAdFailedToShow(string placementID) {
|
||||
Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdFailedToShow()");
|
||||
onAdShowFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, "Failed to show video ad", "-1"));
|
||||
onAdShowFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, "-1", "Failed to show video ad"));
|
||||
}
|
||||
|
||||
public void OnInterstitialAdClick(string placementID, string callbackJson) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b16f7157dd7a84fbfa1a693d79e37e3e
|
||||
guid: 48f3ab04729004d958850a6c063f1980
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c3f95e41f96d41ff9911a95ecbbabbb
|
||||
guid: 2b8ba9d3acdab4b11a91b5d592e20160
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56333631c280443b98fed2a60d160ec6
|
||||
guid: 083e1df4f2bfe4088a98d20c9340df49
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace AnyThinkAds.iOS {
|
||||
|
||||
public void onRewardedVideoAdFailed(string placementId, string code, string error) {
|
||||
Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdFailed()");
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
public void onRewardedVideoAdPlayStart(string placementId, string callbackJson) {
|
||||
@@ -203,7 +203,7 @@ namespace AnyThinkAds.iOS {
|
||||
|
||||
public void onRewardedVideoAdPlayFailed(string placementId, string code, string error) {
|
||||
Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdPlayFailed()");
|
||||
onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
public void onRewardedVideoAdClosed(string placementId, bool isRewarded, string callbackJson) {
|
||||
@@ -238,7 +238,7 @@ namespace AnyThinkAds.iOS {
|
||||
public void onRewardedVideoAdAgainPlayFailed(string placementId, string code, string error)
|
||||
{
|
||||
Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdAgainPlayFailed()");
|
||||
onPlayAgainFailure?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code));
|
||||
onPlayAgainFailure?.Invoke(this, new ATAdErrorEventArgs(placementId, code, error));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7cd2abf09bb54cdca25de4b6f4e4375
|
||||
guid: cbe0fbc7b367d4e63b0017b9eec6cddd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -177,5 +177,12 @@ namespace AnyThinkAds.iOS {
|
||||
Debug.Log("Unity:ATSDKAPIClient::setLocation()");
|
||||
ATManager.setLocation(longitude, latitude);
|
||||
}
|
||||
|
||||
//iOS显示Debugger UI
|
||||
public void showDebuggerUI()
|
||||
{
|
||||
Debug.Log("Unity:ATSDKAPIClient::showDebuggerUI()");
|
||||
ATManager.showDebuggerUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91865ac680a7f418dbed624b52784e38
|
||||
guid: f9ec2cfb53d9b401f82480607a59e8e9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
233
AnyThinkAds/Platform/iOS/ATSplashAdClient.cs
Normal file
233
AnyThinkAds/Platform/iOS/ATSplashAdClient.cs
Normal file
@@ -0,0 +1,233 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using AnyThinkAds.Common;
|
||||
using AnyThinkAds.Api;
|
||||
using AnyThinkAds.ThirdParty.LitJson;
|
||||
|
||||
|
||||
namespace AnyThinkAds.iOS {
|
||||
|
||||
public class ATSplashAdClient : IATSplashAdClient {
|
||||
private ATSplashAdListener anyThinkListener;
|
||||
public event EventHandler<ATAdEventArgs> onAdLoadEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdShowEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdShowFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdVideoFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||
public event EventHandler<ATAdEventArgs> onAdLoadTimeoutEvent;
|
||||
public event EventHandler<ATAdEventArgs> onDeeplinkEvent;
|
||||
public event EventHandler<ATAdEventArgs> onDownloadConfirmEvent;
|
||||
|
||||
public void addsetting(string placementId,string json){
|
||||
//todo...
|
||||
}
|
||||
|
||||
public void setListener(ATSplashAdListener listener) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::setListener()");
|
||||
anyThinkListener = listener;
|
||||
}
|
||||
|
||||
public void loadSplashAd(string placementId, int fetchAdTimeout, string defaultAdSourceConfig, string mapJson) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::loadSplashAd()");
|
||||
ATSplashAdWrapper.setClientForPlacementID(placementId, this);
|
||||
ATSplashAdWrapper.loadSplashAd(placementId, mapJson);
|
||||
}
|
||||
|
||||
public bool hasSplashAdReady(string placementId) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::hasSplashAdReady()");
|
||||
return ATSplashAdWrapper.hasSplashAdReady(placementId);
|
||||
}
|
||||
|
||||
public void showSplashAd(string placementId, string mapJson) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::showSplashAd()");
|
||||
ATSplashAdWrapper.showSplashAd(placementId, mapJson);
|
||||
}
|
||||
|
||||
public void cleanCache(string placementId) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::cleanCache()");
|
||||
ATSplashAdWrapper.clearCache(placementId);
|
||||
}
|
||||
|
||||
public string checkAdStatus(string placementId) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::checkAdStatus()");
|
||||
return ATSplashAdWrapper.checkAdStatus(placementId);
|
||||
}
|
||||
|
||||
public string getValidAdCaches(string placementId)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient::getValidAdCaches()");
|
||||
return ATSplashAdWrapper.getValidAdCaches(placementId);
|
||||
}
|
||||
|
||||
public void entryScenarioWithPlacementID(string placementId, string scenarioID){
|
||||
Debug.Log("Unity: ATSplashAdAdClient::entryScenarioWithPlacementID()");
|
||||
ATSplashAdWrapper.entryScenarioWithPlacementID(placementId,scenarioID);
|
||||
}
|
||||
|
||||
|
||||
//Callbacks
|
||||
public void OnSplashAdDeeplink(string placementID, String callbackJson, bool isSuccess) {
|
||||
onDeeplinkEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson, false, isSuccess));
|
||||
}
|
||||
|
||||
public void OnSplashAdLoadTimeout(string placementID) {
|
||||
Debug.Log("OnSplashAdLoadTimeout...unity3d.");
|
||||
onAdLoadTimeoutEvent?.Invoke(this, new ATAdEventArgs(placementID, "", true));
|
||||
}
|
||||
|
||||
public void OnSplashAdLoaded(string placementID) {
|
||||
Debug.Log("onSplashAdLoaded...unity3d.");
|
||||
onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementID));
|
||||
}
|
||||
|
||||
public void OnSplashAdLoadFailure(string placementID, string code, string error) {
|
||||
Debug.Log("onSplashAdFailed...unity3d.");
|
||||
onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, code, error));
|
||||
}
|
||||
|
||||
public void OnSplashAdVideoPlayFailure(string placementID, string code, string error) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::OnSplashAdVideoPlayFailure()");
|
||||
onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, code, error));
|
||||
}
|
||||
|
||||
public void OnSplashAdVideoPlayStart(string placementID, string callbackJson) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::OnSplashAdPlayStart()");
|
||||
onAdVideoStartEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson));
|
||||
}
|
||||
|
||||
public void OnSplashAdVideoPlayEnd(string placementID, string callbackJson) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::OnSplashAdVideoPlayEnd()");
|
||||
onAdVideoEndEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson));
|
||||
}
|
||||
|
||||
public void OnSplashAdShow(string placementID, string callbackJson) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::OnSplashAdShow()");
|
||||
onAdShowEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson));
|
||||
}
|
||||
|
||||
public void OnSplashAdFailedToShow(string placementID) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::OnSplashAdFailedToShow()");
|
||||
onAdShowFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, "-1", "Failed to show video ad"));
|
||||
}
|
||||
|
||||
public void OnSplashAdClick(string placementID, string callbackJson) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::OnSplashAdClick()");
|
||||
onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson));
|
||||
}
|
||||
|
||||
public void OnSplashAdClose(string placementID, string callbackJson) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::OnSplashAdClose()");
|
||||
onAdCloseEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson));
|
||||
}
|
||||
|
||||
//auto callbacks
|
||||
public void startLoadingADSource(string placementId, string callbackJson)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient::startLoadingADSource()");
|
||||
onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson));
|
||||
}
|
||||
public void finishLoadingADSource(string placementId, string callbackJson)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient::finishLoadingADSource()");
|
||||
onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson));
|
||||
}
|
||||
public void failToLoadADSource(string placementId, string callbackJson,string code, string error)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient::failToLoadADSource()");
|
||||
onAdSourceLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error));
|
||||
}
|
||||
public void startBiddingADSource(string placementId, string callbackJson)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient::startBiddingADSource()");
|
||||
onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson));
|
||||
}
|
||||
public void finishBiddingADSource(string placementId, string callbackJson)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient::finishBiddingADSource()");
|
||||
onAdSourceBiddingFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson));
|
||||
}
|
||||
public void failBiddingADSource(string placementId,string callbackJson, string code, string error)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient::failBiddingADSource()");
|
||||
onAdSourceBiddingFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error));
|
||||
}
|
||||
|
||||
// Auto
|
||||
public void addAutoLoadAdPlacementID(string[] placementIDList)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient:addAutoLoadAdPlacementID()");
|
||||
|
||||
|
||||
|
||||
if (placementIDList != null && placementIDList.Length > 0)
|
||||
{
|
||||
foreach (string placementID in placementIDList)
|
||||
{
|
||||
ATSplashAdWrapper.setClientForPlacementID(placementID, this);
|
||||
}
|
||||
|
||||
string placementIDListString = JsonMapper.ToJson(placementIDList);
|
||||
ATSplashAdWrapper.addAutoLoadAdPlacementID(placementIDListString);
|
||||
Debug.Log("addAutoLoadAdPlacementID, placementIDList === " + placementIDListString);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("addAutoLoadAdPlacementID, placementIDList = null");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeAutoLoadAdPlacementID(string placementId)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient:removeAutoLoadAdPlacementID()");
|
||||
ATSplashAdWrapper.removeAutoLoadAdPlacementID(placementId);
|
||||
}
|
||||
|
||||
public bool autoLoadSplashAdReadyForPlacementID(string placementId)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient:autoLoadSplashAdReadyForPlacementID()");
|
||||
return ATSplashAdWrapper.autoLoadSplashAdReadyForPlacementID(placementId);
|
||||
}
|
||||
public string getAutoValidAdCaches(string placementId)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient:getAutoValidAdCaches()");
|
||||
return ATSplashAdWrapper.getAutoValidAdCaches(placementId);
|
||||
}
|
||||
|
||||
public string checkAutoAdStatus(string placementId) {
|
||||
Debug.Log("Unity: ATSplashAdAdClient::checkAutoAdStatus()");
|
||||
return ATSplashAdWrapper.checkAutoAdStatus(placementId);
|
||||
}
|
||||
|
||||
|
||||
public void setAutoLocalExtra(string placementId, string mapJson)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient:setAutoLocalExtra()");
|
||||
ATSplashAdWrapper.setAutoLocalExtra(placementId, mapJson);
|
||||
}
|
||||
public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient:entryAutoAdScenarioWithPlacementID()");
|
||||
ATSplashAdWrapper.entryAutoAdScenarioWithPlacementID(placementId, scenarioID);
|
||||
}
|
||||
public void showAutoAd(string placementId, string mapJson)
|
||||
{
|
||||
Debug.Log("Unity: ATSplashAdAdClient::showAutoAd()");
|
||||
ATSplashAdWrapper.showAutoSplashAd(placementId, mapJson);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
AnyThinkAds/Platform/iOS/ATSplashAdClient.cs.meta
Normal file
11
AnyThinkAds/Platform/iOS/ATSplashAdClient.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a33306df39ab941a197485f5c3e6fcb3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4787b4f73b23449fa906f342dfca1d00
|
||||
guid: 71c4a563eff03483d8d19430791ee6f8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd4b39134d1e64f1c9672717d4878e58
|
||||
guid: 304162e40b68148bb94a0c8806efce99
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 006a9c4ef70b04aef9da361757c85f85
|
||||
guid: 58082d61418354016aed95f4b3e46582
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2fe4e1278a9f407e9bf696affcfc594
|
||||
guid: 6a2df6de5e3a24cf28ac16ead6649bd1
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11af4b916b2164725bf8a13dd2fbdb37
|
||||
guid: 37ba9b7ff061d4ddd87073240d8a3962
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -123,13 +123,13 @@ static NSString *kATBannerAdLoadingExtraInlineAdaptiveOrientationKey = @"inline_
|
||||
statusDict[@"isReady"] = @(checkLoadModel.isReady);
|
||||
statusDict[@"adInfo"] = checkLoadModel.adOfferInfo;
|
||||
NSLog(@"ATBannerAdWrapper::statusDict = %@", statusDict);
|
||||
return statusDict.jsonString;
|
||||
return statusDict.jsonFilterString;
|
||||
}
|
||||
|
||||
-(NSString*) getValidAdCaches:(NSString *)placementID {
|
||||
NSArray *array = [[ATAdManager sharedManager] getBannerValidAdsForPlacementID:placementID];
|
||||
NSLog(@"ATNativeAdWrapper::array = %@", array);
|
||||
return array.jsonString;
|
||||
return array.jsonFilterString;
|
||||
}
|
||||
|
||||
UIEdgeInsets SafeAreaInsets_ATUnityBanner() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac1a4622946d34f26bfcafd57efac5c3
|
||||
guid: d135ed70f7ae64ca3974325b813941a3
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2eb6428e9bec4bee97e52b2151768c4
|
||||
guid: 4a670c7a6d0134ee2bd8c721fb1c0799
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -70,6 +70,25 @@
|
||||
NSMutableDictionary *msgDict = [NSMutableDictionary dictionary];
|
||||
|
||||
if (![ATUnityUtilities isEmpty:extra]) {
|
||||
|
||||
// 过滤SDK返回参数的 user_load_extra_data 中不支持的类型
|
||||
if (extra[kATUnityUserExtraDataKey] != nil) {
|
||||
NSMutableDictionary *extraDictM = [NSMutableDictionary dictionaryWithDictionary:extra];
|
||||
NSMutableDictionary *extraDataTemp = [NSMutableDictionary dictionary];
|
||||
NSMutableDictionary *extraDataDictM = [NSMutableDictionary dictionaryWithDictionary:extra[kATUnityUserExtraDataKey]];
|
||||
for (NSString *key in extraDataDictM.allKeys) {
|
||||
if ([extraDataDictM[key] isKindOfClass:[NSString class]] || [extraDataDictM[key] isKindOfClass:[NSNumber class]]) {
|
||||
[extraDataTemp setValue:extraDataDictM[key] forKey:key];
|
||||
}
|
||||
}
|
||||
if ([extraDataTemp count]) {
|
||||
[extraDictM setValue:extraDataTemp forKey:kATUnityUserExtraDataKey];
|
||||
} else {
|
||||
[extraDictM removeObjectForKey:kATUnityUserExtraDataKey];
|
||||
}
|
||||
extra = extraDictM;
|
||||
}
|
||||
|
||||
if (extra[@"extra"] != nil) {
|
||||
msgDict[@"extra"] = extra[@"extra"];
|
||||
msgDict[@"rewarded"] = extra[@"rewarded"];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa9e3a5ce2adc4eb9b9cd4d2bc9abe47
|
||||
guid: d77cd4de7860c492c8209b566af75147
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cdfdc46112824f91b18635724af738b
|
||||
guid: a0084a9d6950b45d2a3c68228ad71ea6
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -108,7 +108,7 @@ static NSString *kATInterstitialSizeUsesPixelFlagKey = @"uses_pixel";
|
||||
-(NSString*) getValidAdCaches:(NSString *)placementID {
|
||||
NSArray *array = [[ATAdManager sharedManager] getInterstitialValidAdsForPlacementID:placementID];
|
||||
NSLog(@"ATNativeAdWrapper::array = %@", array);
|
||||
return array.jsonString;
|
||||
return array.jsonFilterString;
|
||||
}
|
||||
|
||||
-(void) showInterstitialAdWithPlacementID:(NSString*)placementID extraJsonString:(NSString*)extraJsonString {
|
||||
@@ -123,7 +123,7 @@ static NSString *kATInterstitialSizeUsesPixelFlagKey = @"uses_pixel";
|
||||
statusDict[@"isReady"] = @(checkLoadModel.isReady);
|
||||
statusDict[@"adInfo"] = checkLoadModel.adOfferInfo;
|
||||
NSLog(@"ATInterstitialAdWrapper::statusDict = %@", statusDict);
|
||||
return statusDict.jsonString;
|
||||
return statusDict.jsonFilterString;
|
||||
}
|
||||
- (void)entryScenarioWithPlacementID:(NSString *)placementID scenarioID:(NSString *)scenarioID{
|
||||
|
||||
@@ -177,7 +177,7 @@ static NSString *kATInterstitialSizeUsesPixelFlagKey = @"uses_pixel";
|
||||
|
||||
NSLog(@"Unity: getAutoValidAdCaches::array = %@", array);
|
||||
|
||||
return array.jsonString;
|
||||
return array.jsonFilterString;
|
||||
}
|
||||
|
||||
-(NSString*) checkAutoAdStatus:(NSString *)placementID {
|
||||
@@ -190,7 +190,7 @@ static NSString *kATInterstitialSizeUsesPixelFlagKey = @"uses_pixel";
|
||||
statusDict[@"adInfo"] = checkLoadModel.adOfferInfo;
|
||||
|
||||
NSLog(@":checkAutoAdStatus statusDict = %@", statusDict);
|
||||
return statusDict.jsonString;
|
||||
return statusDict.jsonFilterString;
|
||||
}
|
||||
|
||||
-(void) setAutoLocalExtra:(NSString*)placementID customDataJSONString:(NSString*)customDataJSONString{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e534e371fd98645f0857baf8dec95667
|
||||
guid: bb4f4c173602a49be90b8790c297b6d8
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 896e8a703a8574fb48be91021abe3031
|
||||
guid: e68d78dfe048e44ad90beb377bfcafcd
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -150,7 +150,7 @@ UIEdgeInsets SafeAreaInsets_ATUnityNative() {
|
||||
statusDict[@"isReady"] = @(checkLoadModel.isReady);
|
||||
statusDict[@"adInfo"] = checkLoadModel.adOfferInfo;
|
||||
NSLog(@"ATNativeAdWrapper::statusDict = %@", statusDict);
|
||||
return statusDict.jsonString;
|
||||
return statusDict.jsonFilterString;
|
||||
}
|
||||
- (void)entryScenarioWithPlacementID:(NSString *)placementID scenarioID:(NSString *)scenarioID{
|
||||
|
||||
@@ -160,7 +160,7 @@ UIEdgeInsets SafeAreaInsets_ATUnityNative() {
|
||||
-(NSString*) getValidAdCaches:(NSString *)placementID {
|
||||
NSArray *array = [[ATAdManager sharedManager] getNativeValidAdsForPlacementID:placementID];
|
||||
NSLog(@"ATNativeAdWrapper::array = %@", array);
|
||||
return array.jsonString;
|
||||
return array.jsonFilterString;
|
||||
}
|
||||
|
||||
-(void) showNativeAdWithPlacementID:(NSString*)placementID metricsJSONString:(NSString*)metricsJSONString extraJsonString:(NSString*)extraJsonString {
|
||||
@@ -286,15 +286,17 @@ UIEdgeInsets SafeAreaInsets_ATUnityNative() {
|
||||
|
||||
NSMutableArray *array = [@[selfRenderView.iconImageView,selfRenderView.titleLabel,selfRenderView.textLabel,selfRenderView.ctaLabel,selfRenderView.mainImageView] mutableCopy];
|
||||
|
||||
if (mediaView) {
|
||||
if (mediaView && offer.nativeAd.isVideoContents) {
|
||||
[array addObject:mediaView];
|
||||
|
||||
selfRenderView.mediaView = mediaView;
|
||||
[selfRenderView addSubview:mediaView];
|
||||
//避免被遮挡
|
||||
[selfRenderView bringSubviewToFront:selfRenderView.logoImageView];
|
||||
}
|
||||
|
||||
[nativeADView registerClickableViewArray:array];
|
||||
|
||||
selfRenderView.mediaView = mediaView;
|
||||
|
||||
[selfRenderView addSubview:mediaView];
|
||||
|
||||
|
||||
self.adView = nativeADView;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d00f3756b49d4f5cbc15a35d7282721
|
||||
guid: db52f669f3e0044b9a7430805e25d86a
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea80a2164caa74a8bb294b02bae5e928
|
||||
guid: 13941195b5cc54944b0997be835d3592
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
self.textLabel.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
-(void) configureMetrics:(NSDictionary *)metrics {
|
||||
NSDictionary<NSString*, UIView*> *views = @{kNativeAssetTitle:_titleLabel, kNativeAssetText:_textLabel, kNativeAssetCta:_ctaLabel, kNativeAssetRating:_ratingLabel, kNativeAssetAdvertiser:_advertiserLabel, kNativeAssetIcon:_iconImageView, kNativeAssetMainImage:_mainImageView, kNativeAssetDislike:_dislikeButton};
|
||||
NSDictionary<NSString*, UIView*> *views = @{kNativeAssetTitle:_titleLabel, kNativeAssetText:_textLabel, kNativeAssetCta:_ctaLabel, kNativeAssetRating:_ratingLabel, kNativeAssetAdvertiser:_advertiserLabel, kNativeAssetIcon:_iconImageView, kNativeAssetMainImage:_mainImageView, kNativeAssetSponsorImage:_logoImageView, kNativeAssetDislike:_dislikeButton};
|
||||
[views enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
|
||||
CGRect frame = CGRectFromString(metrics[key][kParsedPropertiesFrameKey]);
|
||||
[self addConstraintsWithVisualFormat:[NSString stringWithFormat:@"|-x-[%@(w)]", key] options:0 metrics:@{@"x":@(frame.origin.x), @"w":@(frame.size.width)} views:views];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8952ba4c07a0b4860b6142e05374013c
|
||||
guid: f561b3d93a743426faa85303f6b4a878
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e19c1c56c316a4ce297fdfcce8318378
|
||||
guid: 401f817ea7ca545d59ec5e9224b8618f
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user