commit b0c40a046f9976fdfc10bc32e38fff9477d70053 Author: Foldcc_b1 Date: Sun Jan 29 12:44:57 2023 +0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e4b4e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,57 @@ +[Ll]ibrary/ +[Tt]emp/ +[Oo]bj/ +[Bb]uild/ +[Bb]uilds/ +[Ll]ogs/ +DLC/ +Build/ +AssetBundle/ +UserSettings/ + +# Uncomment this line if you wish to ignore the asset store tools plugin +# [Aa]ssets/AssetStoreTools* + +# Visual Studio cache directory +.vs/ + +# Gradle cache directory +.gradle/ + +.svn/ + +.idea/ + +# Autogenerated VS/MD/Consulo solution and project files +ExportedObj/ +.consulo/ +*.csproj +*.unityproj +*.sln +*.suo +*.tmp +*.user +*.userprefs +*.pidb +*.booproj +*.svd +*.pdb +*.mdb +*.opendb +*.VC.db + +# Unity3D generated meta files +*.pidb.meta +*.pdb.meta +*.mdb.meta + +# Unity3D generated file on crash reports +sysinfo.txt + +# Builds +*.apk +*.unitypackage + +# Crashlytics generated file +crashlytics-build.properties +.DS_Store \ No newline at end of file diff --git a/Assets/AnyThinkAds.meta b/Assets/AnyThinkAds.meta new file mode 100644 index 0000000..02474c4 --- /dev/null +++ b/Assets/AnyThinkAds.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 687c8129e7770fe47aa2bdceaab14b6b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api.meta b/Assets/AnyThinkAds/Api.meta new file mode 100644 index 0000000..7b2fa3d --- /dev/null +++ b/Assets/AnyThinkAds/Api.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91a7a1e184c2641f79c95f363b8872d2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATAdEventArgs.cs b/Assets/AnyThinkAds/Api/ATAdEventArgs.cs new file mode 100644 index 0000000..b7b787b --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATAdEventArgs.cs @@ -0,0 +1,194 @@ + +using System; +using System.Collections; +using AnyThinkAds.Api; + +namespace AnyThinkAds.Api +{ + + public class ATAdEventArgs + { + public String placementId { get; } + public ATCallbackInfo callbackInfo { get; } + + public ATAdEventArgs(String id) + { + placementId = id; + callbackInfo = new ATCallbackInfo(""); + } + + 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 message, String code) + : base(placementId) + { + errorMessage = message; + errorCode = code; + } + + public ATAdErrorEventArgs(String placementId, String callbackJson, String message, String code) + : 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 onAdLoadEvent; + + // triggers when the ad has failed to load + event EventHandler onAdLoadFailureEvent; + + // triggers when a the ad has started to load + event EventHandler onAdSourceAttemptEvent; + + // triggers when a the ad has finished to load + event EventHandler onAdSourceFilledEvent; + + // triggers when a the ad has started to load + event EventHandler onAdSourceLoadFailureEvent; + + // triggers when a the ad has started to load + event EventHandler onAdSourceBiddingAttemptEvent; + + // triggers when a the ad has started to load + event EventHandler onAdSourceBiddingFilledEvent; + + // triggers when a the ad has started to load + event EventHandler onAdSourceBiddingFailureEvent; + } + + + public interface IATBannerEvents: IHCommonEvents + { + // triggers when a banner ad generates an impression + event EventHandler onAdImpressEvent; + + // triggers when the user clicks a banner ad + event EventHandler onAdClickEvent; + + // triggers when the ad refreshes + event EventHandler onAdAutoRefreshEvent; + + // triggers when the ad fails to auto refresh + event EventHandler onAdAutoRefreshFailureEvent; + + // triggers when the banner ad is closed + event EventHandler onAdCloseEvent; + + // triggers when the users closes the ad via the button + event EventHandler onAdCloseButtonTappedEvent; + } + + public interface IATInterstitialAdEvents : IHCommonEvents + { + // called when the ad is shown + event EventHandler onAdShowEvent; + + // called if the ad has failed to be shown + event EventHandler onAdShowFailureEvent; + + // called when the ad is closed + event EventHandler onAdCloseEvent; + + // called when an user has clicked an ad + event EventHandler onAdClickEvent; + + // called when a video ad has started playing + event EventHandler onAdVideoStartEvent; + + // called if an ad video has failed to be displayed + event EventHandler onAdVideoFailureEvent; + + // called when ad video has finished + event EventHandler onAdVideoEndEvent; + } + + public interface IATNativeAdEvents : IHCommonEvents + { + // triggers when the ad generates an impression + event EventHandler onAdImpressEvent; + + // triggers when the user clicks the ad + event EventHandler onAdClickEvent; + + // triggers when the ad video starts + event EventHandler onAdVideoStartEvent; + + // triggers when the ad video ends + event EventHandler onAdVideoEndEvent; + + // triggers if the ad progresses + event EventHandler onAdVideoProgressEvent; + + // triggers when the ad is closed + event EventHandler onAdCloseEvent; + } + + public interface IATRewardedVideoEvents : IHCommonEvents + { + // triggers on video start + event EventHandler onAdVideoStartEvent; + + // triggers on video end + event EventHandler onAdVideoEndEvent; + + // triggers if the video fails to play + event EventHandler onAdVideoFailureEvent; + + // triggers when the user has closed the ad + event EventHandler onAdVideoCloseEvent; + + // triggers when the user has clicked the ad + event EventHandler onAdClickEvent; + + // triggers when the user has finsihed watching the ad and should be rewarded + event EventHandler onRewardEvent; + + event EventHandler onPlayAgainStart; + + event EventHandler onPlayAgainEnd; + + event EventHandler onPlayAgainFailure; + + event EventHandler onPlayAgainClick; + + event EventHandler onPlayAgainReward; + } +} \ No newline at end of file diff --git a/Assets/AnyThinkAds/Api/ATAdEventArgs.cs.meta b/Assets/AnyThinkAds/Api/ATAdEventArgs.cs.meta new file mode 100644 index 0000000..1332f86 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATAdEventArgs.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 219a4269ecae84c4e9d5b84de8b992de +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATBannerAd.cs b/Assets/AnyThinkAds/Api/ATBannerAd.cs new file mode 100644 index 0000000..d5509ec --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATBannerAd.cs @@ -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 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 newPaires = new Dictionary { { 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 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 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(); + } + } +} diff --git a/Assets/AnyThinkAds/Api/ATBannerAd.cs.meta b/Assets/AnyThinkAds/Api/ATBannerAd.cs.meta new file mode 100644 index 0000000..7b1e9ca --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATBannerAd.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c8137f9ecda484f4f82280927f6cc6d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATBannerAdListener.cs b/Assets/AnyThinkAds/Api/ATBannerAdListener.cs new file mode 100644 index 0000000..80692ef --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATBannerAdListener.cs @@ -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); + + + } +} diff --git a/Assets/AnyThinkAds/Api/ATBannerAdListener.cs.meta b/Assets/AnyThinkAds/Api/ATBannerAdListener.cs.meta new file mode 100644 index 0000000..234d92e --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATBannerAdListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82a2859cc834c4a2f92c6497ca4ffa5f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATCallbackInfo.cs b/Assets/AnyThinkAds/Api/ATCallbackInfo.cs new file mode 100644 index 0000000..d1aa6c3 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATCallbackInfo.cs @@ -0,0 +1,146 @@ +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 custom_rule; + + 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"); + 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 + + 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>(jsonData["custom_rule"].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 toAdsourceDictionary() + { + Dictionary dataDictionary = new Dictionary(); + + 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 toDictionary() + { + Dictionary dataDictionary = new Dictionary(); + + 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("scenario_reward_name", scenario_reward_name); + dataDictionary.Add("scenario_reward_number", scenario_reward_number); + + dataDictionary.Add("sub_channel", sub_channel); + dataDictionary.Add("channel", channel); + dataDictionary.Add("custom_rule", custom_rule); + dataDictionary.Add("reward_custom_data", reward_custom_data); + + return dataDictionary; + } + + + } +} diff --git a/Assets/AnyThinkAds/Api/ATCallbackInfo.cs.meta b/Assets/AnyThinkAds/Api/ATCallbackInfo.cs.meta new file mode 100644 index 0000000..ef48aad --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATCallbackInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d71af2c579e014d268a0dfa493b7b42a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATConst.cs b/Assets/AnyThinkAds/Api/ATConst.cs new file mode 100644 index 0000000..4b52e58 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATConst.cs @@ -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 + } +} diff --git a/Assets/AnyThinkAds/Api/ATConst.cs.meta b/Assets/AnyThinkAds/Api/ATConst.cs.meta new file mode 100644 index 0000000..055c153 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATConst.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 96cb1512452b44892ab41a110737bc6f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATDownloadAdListener.cs b/Assets/AnyThinkAds/Api/ATDownloadAdListener.cs new file mode 100644 index 0000000..9f8602f --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATDownloadAdListener.cs @@ -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); + + } +} diff --git a/Assets/AnyThinkAds/Api/ATDownloadAdListener.cs.meta b/Assets/AnyThinkAds/Api/ATDownloadAdListener.cs.meta new file mode 100644 index 0000000..f001f17 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATDownloadAdListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c23fcd22e05664d73ba39e69a58fdfdb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATDownloadManager.cs b/Assets/AnyThinkAds/Api/ATDownloadManager.cs new file mode 100644 index 0000000..0c6c51b --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATDownloadManager.cs @@ -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(); + } + + } +} \ No newline at end of file diff --git a/Assets/AnyThinkAds/Api/ATDownloadManager.cs.meta b/Assets/AnyThinkAds/Api/ATDownloadManager.cs.meta new file mode 100644 index 0000000..10b982f --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATDownloadManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 88edb880a748a4df7be4481415e44907 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATInterstitialAd.cs b/Assets/AnyThinkAds/Api/ATInterstitialAd.cs new file mode 100644 index 0000000..97d8d70 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATInterstitialAd.cs @@ -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 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())); + } + + public void showInterstitialAd(string placementId, Dictionary pairs) + { + client.showInterstitialAd(placementId, JsonMapper.ToJson(pairs)); + } + + public IATInterstitialAdClient GetATInterstitialAdClient() + { + return AnyThinkAds.ATAdsClientFactory.BuildInterstitialAdClient(); + } + + } +} diff --git a/Assets/AnyThinkAds/Api/ATInterstitialAd.cs.meta b/Assets/AnyThinkAds/Api/ATInterstitialAd.cs.meta new file mode 100644 index 0000000..7b6ebd0 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATInterstitialAd.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9b93dd6d343c0473193c776c1ba89ec8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATInterstitialAdListener.cs b/Assets/AnyThinkAds/Api/ATInterstitialAdListener.cs new file mode 100644 index 0000000..ee49d24 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATInterstitialAdListener.cs @@ -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); + + + } +} diff --git a/Assets/AnyThinkAds/Api/ATInterstitialAdListener.cs.meta b/Assets/AnyThinkAds/Api/ATInterstitialAdListener.cs.meta new file mode 100644 index 0000000..d00c4cd --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATInterstitialAdListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2b539b7c0e104683ad9789e63c426c1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATInterstitialAutoAd.cs b/Assets/AnyThinkAds/Api/ATInterstitialAutoAd.cs new file mode 100644 index 0000000..272336a --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATInterstitialAutoAd.cs @@ -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 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())); + } + + public void showAutoAd(string placementId, Dictionary pairs) + { + client.showAutoAd(placementId, JsonMapper.ToJson(pairs)); + } + + + + + + + } +} diff --git a/Assets/AnyThinkAds/Api/ATInterstitialAutoAd.cs.meta b/Assets/AnyThinkAds/Api/ATInterstitialAutoAd.cs.meta new file mode 100644 index 0000000..733be35 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATInterstitialAutoAd.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5ec858a9445e344c6ae02b731012d297 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATNativeAd.cs b/Assets/AnyThinkAds/Api/ATNativeAd.cs new file mode 100644 index 0000000..7bd4ae6 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeAd.cs @@ -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 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 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(); + } + + } +} \ No newline at end of file diff --git a/Assets/AnyThinkAds/Api/ATNativeAd.cs.meta b/Assets/AnyThinkAds/Api/ATNativeAd.cs.meta new file mode 100644 index 0000000..eb691f7 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeAd.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 220e014333c6840fc89f951639f5deba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATNativeAdListener.cs b/Assets/AnyThinkAds/Api/ATNativeAdListener.cs new file mode 100644 index 0000000..cb9a052 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeAdListener.cs @@ -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); + + + + } +} diff --git a/Assets/AnyThinkAds/Api/ATNativeAdListener.cs.meta b/Assets/AnyThinkAds/Api/ATNativeAdListener.cs.meta new file mode 100644 index 0000000..ba03605 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeAdListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a2c5ed4e8516545f0838dddae9200f2f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATNativeAdView.cs b/Assets/AnyThinkAds/Api/ATNativeAdView.cs new file mode 100644 index 0000000..3fb4709 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeAdView.cs @@ -0,0 +1,103 @@ +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"; + + 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)); + } + + string temp = builder.ToString(); + + if (temp.EndsWith(",")) + { + temp = temp.Substring(0, temp.Length - 1); + } + + temp = temp + "}"; + + return temp; + + } + } +} diff --git a/Assets/AnyThinkAds/Api/ATNativeAdView.cs.meta b/Assets/AnyThinkAds/Api/ATNativeAdView.cs.meta new file mode 100644 index 0000000..8011b7b --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeAdView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 863e49baa0bfb4c899f6d1591f126aeb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATNativeBannerAd.cs b/Assets/AnyThinkAds/Api/ATNativeBannerAd.cs new file mode 100644 index 0000000..1ab46d9 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeBannerAd.cs @@ -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 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 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(); + } + } +} diff --git a/Assets/AnyThinkAds/Api/ATNativeBannerAd.cs.meta b/Assets/AnyThinkAds/Api/ATNativeBannerAd.cs.meta new file mode 100644 index 0000000..d6c04dc --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeBannerAd.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c4cf0c99e1e574b3aa6d4a1a46daf9da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATNativeBannerAdListener.cs b/Assets/AnyThinkAds/Api/ATNativeBannerAdListener.cs new file mode 100644 index 0000000..a2fcadb --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeBannerAdListener.cs @@ -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); + } +} diff --git a/Assets/AnyThinkAds/Api/ATNativeBannerAdListener.cs.meta b/Assets/AnyThinkAds/Api/ATNativeBannerAdListener.cs.meta new file mode 100644 index 0000000..ecda093 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeBannerAdListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f89a8b127b7346a7a27be7bf6cdc2a1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATNativeConfig.cs b/Assets/AnyThinkAds/Api/ATNativeConfig.cs new file mode 100644 index 0000000..1ec06de --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeConfig.cs @@ -0,0 +1,18 @@ +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; + } +} diff --git a/Assets/AnyThinkAds/Api/ATNativeConfig.cs.meta b/Assets/AnyThinkAds/Api/ATNativeConfig.cs.meta new file mode 100644 index 0000000..9d01196 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7472931a01bd34107842d9baa5edf262 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATNativeItemProperty.cs b/Assets/AnyThinkAds/Api/ATNativeItemProperty.cs new file mode 100644 index 0000000..8264978 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeItemProperty.cs @@ -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; + } + } +} diff --git a/Assets/AnyThinkAds/Api/ATNativeItemProperty.cs.meta b/Assets/AnyThinkAds/Api/ATNativeItemProperty.cs.meta new file mode 100644 index 0000000..6d87e72 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATNativeItemProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e4ce4b4690b764fcd9a5bdba6c7a48b8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATRect.cs b/Assets/AnyThinkAds/Api/ATRect.cs new file mode 100644 index 0000000..7a40130 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATRect.cs @@ -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; + } +} diff --git a/Assets/AnyThinkAds/Api/ATRect.cs.meta b/Assets/AnyThinkAds/Api/ATRect.cs.meta new file mode 100644 index 0000000..78a4da7 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATRect.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ce958c2c0a294f85981fc0d7efd277e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATRewardedAutoVideo.cs b/Assets/AnyThinkAds/Api/ATRewardedAutoVideo.cs new file mode 100644 index 0000000..087fb50 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATRewardedAutoVideo.cs @@ -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 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())); + } + + public void showAutoAd(string placementId, Dictionary pairs) + { + client.showAutoAd(placementId, JsonMapper.ToJson(pairs)); + } + + public IATRewardedVideoAdClient GetATRewardedClient() + { + return AnyThinkAds.ATAdsClientFactory.BuildRewardedVideoAdClient(); + } + + + + } +} \ No newline at end of file diff --git a/Assets/AnyThinkAds/Api/ATRewardedAutoVideo.cs.meta b/Assets/AnyThinkAds/Api/ATRewardedAutoVideo.cs.meta new file mode 100644 index 0000000..fb97a85 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATRewardedAutoVideo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5feccd0a003ab4defba25cd4e3f9e870 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATRewardedVideo.cs b/Assets/AnyThinkAds/Api/ATRewardedVideo.cs new file mode 100644 index 0000000..c02ceee --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATRewardedVideo.cs @@ -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 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())); + } + + public void showAd(string placementId, Dictionary pairs) + { + client.showAd(placementId, JsonMapper.ToJson(pairs)); + } + + public IATRewardedVideoAdClient GetATRewardedClient() + { + return AnyThinkAds.ATAdsClientFactory.BuildRewardedVideoAdClient(); + } + + + + } +} \ No newline at end of file diff --git a/Assets/AnyThinkAds/Api/ATRewardedVideo.cs.meta b/Assets/AnyThinkAds/Api/ATRewardedVideo.cs.meta new file mode 100644 index 0000000..8168b35 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATRewardedVideo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a1e0f021a24cc491eb4f054d576982f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATRewardedVideoListener.cs b/Assets/AnyThinkAds/Api/ATRewardedVideoListener.cs new file mode 100644 index 0000000..acf838d --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATRewardedVideoListener.cs @@ -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); + + } +} diff --git a/Assets/AnyThinkAds/Api/ATRewardedVideoListener.cs.meta b/Assets/AnyThinkAds/Api/ATRewardedVideoListener.cs.meta new file mode 100644 index 0000000..5034bc1 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATRewardedVideoListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c71cf6d83ff4406db7ed141066a54d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATSDKAPI.cs b/Assets/AnyThinkAds/Api/ATSDKAPI.cs new file mode 100644 index 0000000..062e117 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATSDKAPI.cs @@ -0,0 +1,212 @@ +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 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 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 customMap) + { + client.initCustomMap(JsonMapper.ToJson(customMap)); + } + + public static void setCustomDataForPlacementID(Dictionary customData, string placementID) + { + client.setCustomDataForPlacementID(JsonMapper.ToJson(customData), placementID); + } + + public static void showGDPRAuth() + { + client.showGDPRAuth(); + } + + public static void setLogDebug(bool isDebug) + { + client.setLogDebug(isDebug); + } + + public static void addNetworkGDPRInfo(int networkType, Dictionary 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); + } + + } +} + diff --git a/Assets/AnyThinkAds/Api/ATSDKAPI.cs.meta b/Assets/AnyThinkAds/Api/ATSDKAPI.cs.meta new file mode 100644 index 0000000..a50b36c --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATSDKAPI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 17ae30f8263a149fc8eba30dad68d0f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Api/ATSDKInitListener.cs b/Assets/AnyThinkAds/Api/ATSDKInitListener.cs new file mode 100644 index 0000000..20bafd8 --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATSDKInitListener.cs @@ -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); + } +} diff --git a/Assets/AnyThinkAds/Api/ATSDKInitListener.cs.meta b/Assets/AnyThinkAds/Api/ATSDKInitListener.cs.meta new file mode 100644 index 0000000..5c5432a --- /dev/null +++ b/Assets/AnyThinkAds/Api/ATSDKInitListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 57b3ce41b10cf46cbb2e5a082691be6d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Common.meta b/Assets/AnyThinkAds/Common.meta new file mode 100644 index 0000000..1c8d203 --- /dev/null +++ b/Assets/AnyThinkAds/Common.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e8456848ebbf4b988a66e831999e0b7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Common/IATBannerAdClient.cs b/Assets/AnyThinkAds/Common/IATBannerAdClient.cs new file mode 100644 index 0000000..d6e21c1 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATBannerAdClient.cs @@ -0,0 +1,75 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Api; + +namespace AnyThinkAds.Common +{ + public interface IATBannerAdClient : IATBannerEvents + { + /*** + * 请求广告 + * @param placementId 广告位id + * @parm mapJson 各平台的私有属性 一般可以不调用 + */ + void loadBannerAd(string placementId, string mapJson); + /** + * 获取广告状态信息(是否正在加载、是否存在可以展示广告、广告缓存详细信息) + * @param unityid + * + */ + string checkAdStatus(string placementId); + /*** + * + * 设置监听回调接口 + * + * @param listener + */ + void setListener(ATBannerAdListener listener); + /*** + * + * 展示广告, + * @param placementId + * @param pass bottom or top for position + * @parm mapJson + */ + void showBannerAd(string placementId, string position, string mapJson); + /*** + * + * 展示广告, + * @param placementId + * @param rect the region used to show banner ad; currently only x&y fields in rect are used(as the origin, or top left corner of the banner). + * @parm mapJson + */ + void showBannerAd(string placementId, ATRect rect, string mapJson); + /*** + * + * 清理广告 + * @param placementId + * @param anyThinkNativeAdView 这里的属性是显示区域坐标等配置,需要自行设置 + */ + void cleanBannerAd(string placementId); + /*** + * + * 隐藏广告 + * @param placementId + * @param rect the region used to show banner ad. + */ + void hideBannerAd(string placementId); + /*** + * + * (重新)展示之前隐藏的广告 + * @param placementId + */ + void showBannerAd(string placementId); + /*** + * 清理缓存 + */ + void cleanCache(string placementId); + + /*** + * 获取所有可用缓存广告 + */ + string getValidAdCaches(string placementId); + } +} diff --git a/Assets/AnyThinkAds/Common/IATBannerAdClient.cs.meta b/Assets/AnyThinkAds/Common/IATBannerAdClient.cs.meta new file mode 100644 index 0000000..5bf9700 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATBannerAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 33f1ceabaff3f4892a39bf63a74352b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Common/IATDownloadClient.cs b/Assets/AnyThinkAds/Common/IATDownloadClient.cs new file mode 100644 index 0000000..b9b0429 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATDownloadClient.cs @@ -0,0 +1,14 @@ + +using AnyThinkAds.Api; + +namespace AnyThinkAds.Common +{ + public interface IATDownloadClient + { + + /** + * @param listener + */ + void setListener(ATDownloadAdListener listener); + } +} diff --git a/Assets/AnyThinkAds/Common/IATDownloadClient.cs.meta b/Assets/AnyThinkAds/Common/IATDownloadClient.cs.meta new file mode 100644 index 0000000..6d89964 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATDownloadClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9fd119e79e8154f6e885622336dd50f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Common/IATInterstitialAdClient.cs b/Assets/AnyThinkAds/Common/IATInterstitialAdClient.cs new file mode 100644 index 0000000..17d23de --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATInterstitialAdClient.cs @@ -0,0 +1,64 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Api; + +namespace AnyThinkAds.Common +{ + public interface IATInterstitialAdClient : IATInterstitialAdEvents + { + /*** + * 请求广告 + * @param placementId 广告位id + * @parm mapJson 各平台的私有属性 一般可以不调用 + */ + void loadInterstitialAd(string placementId, string mapJson); + /*** + * + * 设置监听回调接口 + * + * @param listener + */ + void setListener(ATInterstitialAdListener listener); + /** + * 是否存在可以展示的广告 + * @param unityid + */ + bool hasInterstitialAdReady(string placementId); + /** + * 获取广告状态信息(是否正在加载、是否存在可以展示广告、广告缓存详细信息) + * @param unityid + * + */ + string checkAdStatus(string placementId); + /*** + * 显示广告 + */ + void showInterstitialAd(string placementId, string mapJson); + + + /*** + * 获取所有可用缓存广告 + */ + string getValidAdCaches(string placementId); + + void entryScenarioWithPlacementID(string placementId, string scenarioID); + + + string checkAutoAdStatus(string placementId); + + void addAutoLoadAdPlacementID(string[] placementIDList); + + void removeAutoLoadAdPlacementID(string placementId); + + bool autoLoadInterstitialAdReadyForPlacementID(string placementId); + + string getAutoValidAdCaches(string placementId); + + void setAutoLocalExtra(string placementId, string mapJson); + + void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID); + + void showAutoAd(string placementId, string mapJson); + } +} diff --git a/Assets/AnyThinkAds/Common/IATInterstitialAdClient.cs.meta b/Assets/AnyThinkAds/Common/IATInterstitialAdClient.cs.meta new file mode 100644 index 0000000..88cef0e --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATInterstitialAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2d102c3a980f472fa20811ed609d085 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Common/IATNativeAdClient.cs b/Assets/AnyThinkAds/Common/IATNativeAdClient.cs new file mode 100644 index 0000000..1e0cb53 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATNativeAdClient.cs @@ -0,0 +1,73 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using AnyThinkAds.Api; + +namespace AnyThinkAds.Common +{ + public interface IATNativeAdClient : IATNativeAdEvents + { + /*** + * 请求广告 + * @param placementId 广告位id + * @parm mapJson 各平台的私有属性 一般可以不调用 + */ + void loadNativeAd(string placementId, string mapJson); + /*** + * 判断是否有广告存在 + * 可以在显示广告之前调用 + * @param placementId 广告位id + */ + bool hasAdReady(string placementId); + /** + * 获取广告状态信息(是否正在加载、是否存在可以展示广告、广告缓存详细信息) + * @param unityid + * + */ + string checkAdStatus(string placementId); + /*** + * + * 设置监听回调接口 + * + * @param listener + */ + void setListener(ATNativeAdListener listener); + /*** + * + * 展示广告, + * @param placementId + * @param anyThinkNativeAdView 这里的属性是显示区域坐标等配置,需要自行设置 + * @parm mapJson + */ + void renderAdToScene(string placementId, ATNativeAdView anyThinkNativeAdView, string mapJson); + + /*** + * + * 清理广告 + * @param placementId + * @param anyThinkNativeAdView 这里的属性是显示区域坐标等配置,需要自行设置 + */ + void cleanAdView(string placementId, ATNativeAdView anyThinkNativeAdView); + /*** + * 页面显示 + */ + void onApplicationForces(string placementId, ATNativeAdView anyThinkNativeAdView); + /*** + * 页面隐藏 + */ + void onApplicationPasue(string placementId, ATNativeAdView anyThinkNativeAdView); + /*** + * 清理缓存 + */ + void cleanCache(string placementId); + + /*** + * 获取所有可用缓存广告 + */ + string getValidAdCaches(string placementId); + + void entryScenarioWithPlacementID(string placementId, string scenarioID); + + } +} diff --git a/Assets/AnyThinkAds/Common/IATNativeAdClient.cs.meta b/Assets/AnyThinkAds/Common/IATNativeAdClient.cs.meta new file mode 100644 index 0000000..4e77b32 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATNativeAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f2275de4a621e46b2b6a157d2c35ed7e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Common/IATNativeBannerAdClient.cs b/Assets/AnyThinkAds/Common/IATNativeBannerAdClient.cs new file mode 100644 index 0000000..710f1a8 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATNativeBannerAdClient.cs @@ -0,0 +1,45 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using AnyThinkAds.Api; + +namespace AnyThinkAds.Common +{ + public interface IATNativeBannerAdClient : IATNativeAdEvents + { + /*** + * 请求广告 + * @param placementId 广告位id + * @parm mapJson 各平台的私有属性 一般可以不调用 + */ + void loadAd(string placementId, string mapJson); + + /*** + * 判断是否有广告存在 + * 可以在显示广告之前调用 + * @param placementId 广告位id + */ + bool adReady(string placementId); + /*** + * + * 设置监听回调接口 + * + * @param listener + */ + void setListener(ATNativeBannerAdListener listener); + /*** + * + * 展示广告, + * @param placementId + * @param rect + */ + void showAd(string placementId, ATRect rect, Dictionary pairs); + /*** + * + * 移除广告 + * @param placementId + */ + void removeAd(string placementId); + } +} diff --git a/Assets/AnyThinkAds/Common/IATNativeBannerAdClient.cs.meta b/Assets/AnyThinkAds/Common/IATNativeBannerAdClient.cs.meta new file mode 100644 index 0000000..01b3f69 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATNativeBannerAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 87ae11b5cac0f4dbbb559cfed9dc531b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Common/IATRewardedVideoAdClient.cs b/Assets/AnyThinkAds/Common/IATRewardedVideoAdClient.cs new file mode 100644 index 0000000..b209271 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATRewardedVideoAdClient.cs @@ -0,0 +1,63 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using AnyThinkAds.Api; + +namespace AnyThinkAds.Common +{ + public interface IATRewardedVideoAdClient : IATRewardedVideoEvents + { + /** + * 请求视屏广告 + * @param placementId 广告位id + * @parm mapJson 平台私有参数 一般不些 + */ + void loadVideoAd(string placementId, string mapJson); + /** + * @param listener 监听回调 + */ + void setListener(ATRewardedVideoListener listener); + /** + * 是否存在可以展示的广告 + * @param unityid + * + */ + bool hasAdReady(string placementId); + /** + * 获取广告状态信息(是否正在加载、是否存在可以展示广告、广告缓存详细信息) + * @param unityid + * + */ + string checkAdStatus(string placementId); + /*** + * 显示广告 + */ + void showAd(string placementId, string mapJson); + + /*** + * 获取所有可用缓存广告 + */ + string getValidAdCaches(string placementId); + + void entryScenarioWithPlacementID(string placementId, string scenarioID); + + + string checkAutoAdStatus(string placementId); + + void addAutoLoadAdPlacementID(string[] placementIDList); + + void removeAutoLoadAdPlacementID(string placementId); + + bool autoLoadRewardedVideoReadyForPlacementID(string placementId); + + string getAutoValidAdCaches(string placementId); + + void setAutoLocalExtra(string placementId, string mapJson); + + void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID); + + void showAutoAd(string placementId, string mapJson); + + } +} diff --git a/Assets/AnyThinkAds/Common/IATRewardedVideoAdClient.cs.meta b/Assets/AnyThinkAds/Common/IATRewardedVideoAdClient.cs.meta new file mode 100644 index 0000000..83d9e33 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATRewardedVideoAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1c8f90439b6de4b25b7fc5e8d62ec895 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Common/IATSDKAPIClient.cs b/Assets/AnyThinkAds/Common/IATSDKAPIClient.cs new file mode 100644 index 0000000..de6b241 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATSDKAPIClient.cs @@ -0,0 +1,32 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Api; + +namespace AnyThinkAds.Common +{ + public interface IATSDKAPIClient + { + void initSDK(string appId, string appKey); + void initSDK(string appId, string appKey, ATSDKInitListener listener); + void getUserLocation(ATGetUserLocationListener listener); + void setGDPRLevel(int level); + void showGDPRAuth(); + void addNetworkGDPRInfo(int networkType, string mapJson); + void setChannel(string channel); + void setSubChannel(string subchannel); + void initCustomMap(string cutomMap); + void setCustomDataForPlacementID(string customData, string placementID); + void setLogDebug(bool isDebug); + int getGDPRLevel(); + bool isEUTraffic(); + void deniedUploadDeviceInfo(string deniedInfo); + + void setExcludeBundleIdArray(string bundleIds); + void setExcludeAdSourceIdArrayForPlacementID(string placementID, string adsourceIds); + void setSDKArea(int area); + void getArea(ATGetAreaListener listener); + void setWXStatus(bool install); + void setLocation(double longitude, double latitude); + } +} diff --git a/Assets/AnyThinkAds/Common/IATSDKAPIClient.cs.meta b/Assets/AnyThinkAds/Common/IATSDKAPIClient.cs.meta new file mode 100644 index 0000000..23f1c32 --- /dev/null +++ b/Assets/AnyThinkAds/Common/IATSDKAPIClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 833dc348e2c4648f08a4791990328b24 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Dependencies.meta b/Assets/AnyThinkAds/Dependencies.meta new file mode 100644 index 0000000..5b5eac3 --- /dev/null +++ b/Assets/AnyThinkAds/Dependencies.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a94c7b266b79787429106afa2514e1bd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Dependencies/AnyThinkCore.unitypackage.meta b/Assets/AnyThinkAds/Dependencies/AnyThinkCore.unitypackage.meta new file mode 100644 index 0000000..27fdbb4 --- /dev/null +++ b/Assets/AnyThinkAds/Dependencies/AnyThinkCore.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 204b06fd9e3f8604f8bc52ca1580d565 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Dependencies/AnyThinkGDT.unitypackage.meta b/Assets/AnyThinkAds/Dependencies/AnyThinkGDT.unitypackage.meta new file mode 100644 index 0000000..476c153 --- /dev/null +++ b/Assets/AnyThinkAds/Dependencies/AnyThinkGDT.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 957bd8bc9cbce83459807a818f4bbc43 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Dependencies/AnyThinkKuaiShou.unitypackage.meta b/Assets/AnyThinkAds/Dependencies/AnyThinkKuaiShou.unitypackage.meta new file mode 100644 index 0000000..f25bac5 --- /dev/null +++ b/Assets/AnyThinkAds/Dependencies/AnyThinkKuaiShou.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 69c6ecb25ea2fc94bbae9adeba79f8ff +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Dependencies/AnyThinkPangle.unitypackage.meta b/Assets/AnyThinkAds/Dependencies/AnyThinkPangle.unitypackage.meta new file mode 100644 index 0000000..400fb10 --- /dev/null +++ b/Assets/AnyThinkAds/Dependencies/AnyThinkPangle.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2b40414c5bb92cc4591777b77d3d888e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform.meta b/Assets/AnyThinkAds/Platform.meta new file mode 100644 index 0000000..327ddbf --- /dev/null +++ b/Assets/AnyThinkAds/Platform.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8cf0d327cc346430caa11f4acd1f815e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/ATAdsClientFactory.cs b/Assets/AnyThinkAds/Platform/ATAdsClientFactory.cs new file mode 100644 index 0000000..16864dd --- /dev/null +++ b/Assets/AnyThinkAds/Platform/ATAdsClientFactory.cs @@ -0,0 +1,428 @@ +using System; +using UnityEngine; +using AnyThinkAds.Api; +using AnyThinkAds.Common; + +using System.Collections; +using System.Collections.Generic; +#pragma warning disable 0067 +namespace AnyThinkAds +{ + public class ATAdsClientFactory + { + public static IATBannerAdClient BuildBannerAdClient() + { + #if UNITY_EDITOR + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + #elif UNITY_ANDROID + return new AnyThinkAds.Android.ATBannerAdClient(); + #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE + return new AnyThinkAds.iOS.ATBannerAdClient(); + #else + + #endif + return new UnityBannerClient(); + } + + public static IATInterstitialAdClient BuildInterstitialAdClient() + { + #if UNITY_EDITOR + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + #elif UNITY_ANDROID + return new AnyThinkAds.Android.ATInterstitialAdClient(); + #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE + return new AnyThinkAds.iOS.ATInterstitialAdClient(); + #else + + #endif + return new UnityInterstitialClient(); + } + + public static IATNativeAdClient BuildNativeAdClient() + { + #if UNITY_EDITOR + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + #elif UNITY_ANDROID + return new AnyThinkAds.Android.ATNativeAdClient(); + #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE + return new AnyThinkAds.iOS.ATNativeAdClient(); + #else + + #endif + return new UnityNativeAdClient(); + } + + public static IATNativeBannerAdClient BuildNativeBannerAdClient() + { + #if UNITY_EDITOR + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + #elif UNITY_ANDROID + return new AnyThinkAds.Android.ATNativeBannerAdClient(); + #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE + return new AnyThinkAds.iOS.ATNativeBannerAdClient(); + #else + + #endif + return new UnityNativeBannerAdClient(); + } + + public static IATRewardedVideoAdClient BuildRewardedVideoAdClient() + { + #if UNITY_EDITOR + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + + #elif UNITY_ANDROID + return new AnyThinkAds.Android.ATRewardedVideoAdClient(); + #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE + return new AnyThinkAds.iOS.ATRewardedVideoAdClient(); + #else + + #endif + return new UnityRewardedVideoAdClient(); + } + + public static IATSDKAPIClient BuildSDKAPIClient() + { + Debug.Log("BuildSDKAPIClient"); + #if UNITY_EDITOR + Debug.Log("Unity Editor"); + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + + #elif UNITY_ANDROID + return new AnyThinkAds.Android.ATSDKAPIClient(); + #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE + Debug.Log("Unity:ATAdsClientFactory::Build iOS Client"); + return new AnyThinkAds.iOS.ATSDKAPIClient(); + #else + + #endif + return new UnitySDKAPIClient(); + } + + public static IATDownloadClient BuildDownloadClient() + { + Debug.Log("BuildDownloadClient"); + #if UNITY_EDITOR + Debug.Log("Unity Editor"); + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + + #elif UNITY_ANDROID + return new AnyThinkAds.Android.ATDownloadClient(); + + #else + + #endif + return new UnityDownloadClient(); + } + + } + + class UnitySDKAPIClient:IATSDKAPIClient + { + public void initSDK(string appId, string appkey){} + public void initSDK(string appId, string appkey, ATSDKInitListener listener){ } + public void getUserLocation(ATGetUserLocationListener listener){ } + public void setGDPRLevel(int level){ } + public void showGDPRAuth(){ } + public void addNetworkGDPRInfo(int networkType, string mapJson){ } + public void setChannel(string channel){ } + public void setSubChannel(string subchannel){ } + public void initCustomMap(string cutomMap){ } + public void setCustomDataForPlacementID(string customData, string placementID){ } + public void setLogDebug(bool isDebug){ } + public int getGDPRLevel(){ return ATSDKAPI.PERSONALIZED; } + public bool isEUTraffic() { return false; } + public void deniedUploadDeviceInfo(string deniedInfo) { } + public void setExcludeBundleIdArray(string bundleIds) { } + public void setExcludeAdSourceIdArrayForPlacementID(string placementID, string adsourceIds) { } + public void setSDKArea(int area) { } + public void getArea(ATGetAreaListener listener) { } + public void setWXStatus(bool install) { } + public void setLocation(double longitude, double latitude) { } + + } + + class UnityBannerClient:IATBannerAdClient + { + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdImpressEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdAutoRefreshEvent; + public event EventHandler onAdAutoRefreshFailureEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdCloseButtonTappedEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + ATBannerAdListener listener; + public void loadBannerAd(string unitId, string mapJson){ + if(listener != null) + { + listener.onAdLoadFail(unitId, "-1", "Must run on Android or IOS platform!"); + } + } + + public void setListener(ATBannerAdListener listener) + { + this.listener = listener; + } + + public string checkAdStatus(string unitId) { return ""; } + + public void showBannerAd(string unitId, string position){ } + + public void showBannerAd(string unitId, string position, string mapJson){ } + + public void showBannerAd(string unitId, ATRect rect){ } + + public void showBannerAd(string unitId, ATRect rect, string mapJson){ } + + public void cleanBannerAd(string unitId){ } + + public void hideBannerAd(string unitId){ } + + public void showBannerAd(string unitId){ } + + public void cleanCache(string unitId){} + + public string getValidAdCaches(string unitId) { return ""; } + } + + class UnityInterstitialClient : IATInterstitialAdClient + { + ATInterstitialAdListener listener; + #pragma warning disable 220 + + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdShowEvent; + public event EventHandler onAdShowFailureEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoFailureEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + + public void loadInterstitialAd(string unitId, string mapJson){ + if (listener != null) + { + listener.onInterstitialAdLoadFail(unitId, "-1", "Must run on Android or IOS platform!"); + } + } + + public void setListener(ATInterstitialAdListener listener){ + this.listener = listener; + } + + public bool hasInterstitialAdReady(string unitId) { return false; } + + public string checkAdStatus(string unitId) { return ""; } + + public void showInterstitialAd(string unitId, string mapJson){} + + public void cleanCache(string unitId){} + + public string getValidAdCaches(string unitId) { return ""; } + + public void entryScenarioWithPlacementID(string placementId, string scenarioID){} + + + public void addAutoLoadAdPlacementID(string[] placementIDList) {} + + public void removeAutoLoadAdPlacementID(string placementId){} + + public bool autoLoadInterstitialAdReadyForPlacementID(string placementId){return false;} + + public string getAutoValidAdCaches(string placementId){return "";} + public string checkAutoAdStatus(string unitId) { return ""; } + + + public void setAutoLocalExtra(string placementId, string mapJson){} + + public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID){} + + public void showAutoAd(string placementId, string mapJson){} + + } + + class UnityNativeAdClient : IATNativeAdClient + { + + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdImpressEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdVideoProgressEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + + ATNativeAdListener listener; + public void loadNativeAd(string unitId, string mapJson){ + if(listener != null) + { + listener.onAdLoadFail(unitId, "-1", "Must run on Android or IOS platform!"); + } + } + + public bool hasAdReady(string unitId) { return false; } + + public string checkAdStatus(string unitId) { return ""; } + + public string getValidAdCaches(string unitId) { return ""; } + + public void entryScenarioWithPlacementID(string placementId, string scenarioID){} + + + public void setListener(ATNativeAdListener listener){ + this.listener = listener; + } + + public void renderAdToScene(string unitId, ATNativeAdView anyThinkNativeAdView){} + + public void renderAdToScene(string unitId, ATNativeAdView anyThinkNativeAdView, string mapJson){} + + public void cleanAdView(string unitId, ATNativeAdView anyThinkNativeAdView){} + + public void onApplicationForces(string unitId, ATNativeAdView anyThinkNativeAdView){} + + public void onApplicationPasue(string unitId, ATNativeAdView anyThinkNativeAdView){} + + public void cleanCache(string unitId){} + + public void setLocalExtra(string unitid, string mapJson){} + } + + class UnityNativeBannerAdClient : IATNativeBannerAdClient + { + + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdImpressEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdVideoProgressEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + ATNativeBannerAdListener listener; + public void loadAd(string unitId, string mapJson){ + if(listener != null) + { + listener.onAdLoadFail(unitId, "-1", "Must run on Android or IOS platform!"); + } + } + + public bool adReady(string unitId) { return false; } + + public void setListener(ATNativeBannerAdListener listener){ + this.listener = listener; + } + + public void showAd(string unitId, ATRect rect, Dictionary pairs){} + + public void removeAd(string unitId){} + } + + class UnityRewardedVideoAdClient : IATRewardedVideoAdClient + { + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdVideoFailureEvent; + public event EventHandler onAdVideoCloseEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onRewardEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + public event EventHandler onPlayAgainStart; + public event EventHandler onPlayAgainEnd; + public event EventHandler onPlayAgainFailure; + public event EventHandler onPlayAgainClick; + public event EventHandler onPlayAgainReward; + + ATRewardedVideoListener listener; + public void loadVideoAd(string unitId, string mapJson){ + if (listener != null) + { + listener.onRewardedVideoAdLoadFail(unitId, "-1", "Must run on Android or IOS platform!"); + } + } + + public void setListener(ATRewardedVideoListener listener){ + this.listener = listener; + } + + public bool hasAdReady(string unitId) { return false; } + + public string checkAdStatus(string unitId) { return ""; } + + public string getValidAdCaches(string unitId) { return ""; } + + public void entryScenarioWithPlacementID(string placementId, string scenarioID){} + + public void showAd(string unitId, string mapJson){} + + public void addAutoLoadAdPlacementID(string[] placementIDList) {} + + public void removeAutoLoadAdPlacementID(string placementId){} + + public bool autoLoadRewardedVideoReadyForPlacementID(string placementId){return false;} + + public string getAutoValidAdCaches(string placementId){return "";} + + public string checkAutoAdStatus(string unitId) { return ""; } + + public void setAutoLocalExtra(string placementId, string mapJson){} + + public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID){} + + public void showAutoAd(string placementId, string mapJson){} + + + + + } + + + class UnityDownloadClient : IATDownloadClient + { + public void setListener(ATDownloadAdListener listener) + { + Debug.Log("Must run on Android platform"); + } + } +} \ No newline at end of file diff --git a/Assets/AnyThinkAds/Platform/ATAdsClientFactory.cs.meta b/Assets/AnyThinkAds/Platform/ATAdsClientFactory.cs.meta new file mode 100644 index 0000000..4637aa6 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/ATAdsClientFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7cfc618d1f344493aa2c430c0ff5e8c3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android.meta b/Assets/AnyThinkAds/Platform/Android.meta new file mode 100644 index 0000000..2937f23 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e06b6a7bea414435806d944b50c9238 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATAreaListener.cs b/Assets/AnyThinkAds/Platform/Android/ATAreaListener.cs new file mode 100644 index 0000000..d8d95cd --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATAreaListener.cs @@ -0,0 +1,33 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Api; + +namespace AnyThinkAds.Android +{ + public class ATAreaListener : AndroidJavaProxy + { + ATGetAreaListener mListener; + public ATAreaListener(ATGetAreaListener listener): base("com.anythink.unitybridge.sdkinit.AreaCallbackListener") + { + mListener = listener; + } + + + public void onResultCallback(string area) + { + if (mListener != null) + { + mListener.onArea(area); + } + } + + public void onErrorCallback(string s) + { + if (mListener != null) + { + mListener.onError(s); + } + } + } +} diff --git a/Assets/AnyThinkAds/Platform/Android/ATAreaListener.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATAreaListener.cs.meta new file mode 100644 index 0000000..5370510 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATAreaListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eadc3c4bb3f0f4260b1a97ff1d4c1cf7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATBannerAdClient.cs b/Assets/AnyThinkAds/Platform/Android/ATBannerAdClient.cs new file mode 100644 index 0000000..ea27314 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATBannerAdClient.cs @@ -0,0 +1,314 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using AnyThinkAds.Common; +using AnyThinkAds.Api; +#pragma warning disable 0067 +namespace AnyThinkAds.Android +{ + public class ATBannerAdClient : AndroidJavaProxy, IATBannerAdClient + { + + private Dictionary bannerHelperMap = new Dictionary(); + + + private ATBannerAdListener anyThinkListener; + + public event EventHandler onAdLoadEvent; + + // triggers when a banner ad has failed to load + public event EventHandler onAdLoadFailureEvent; + + // triggers when a banner ad generates an impression + public event EventHandler onAdImpressEvent; + + // triggers when the user clicks a banner ad + public event EventHandler onAdClickEvent; + + // triggers when the ad refreshes + public event EventHandler onAdAutoRefreshEvent; + + // triggers when the ad fails to auto refresh + public event EventHandler onAdAutoRefreshFailureEvent; + + // triggers when the banner ad is closed + public event EventHandler onAdCloseEvent; + + // triggers when the users closes the ad via the button + public event EventHandler onAdCloseButtonTappedEvent; + + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + + public ATBannerAdClient() : base("com.anythink.unitybridge.banner.BannerListener") + { + + } + + + public void loadBannerAd(string placementId, string mapJson) + { + + //如果不存在则直接创建对应广告位的helper + if(!bannerHelperMap.ContainsKey(placementId)) + { + AndroidJavaObject bannerHelper = new AndroidJavaObject( + "com.anythink.unitybridge.banner.BannerHelper", this); + bannerHelper.Call("initBanner", placementId); + bannerHelperMap.Add(placementId, bannerHelper); + Debug.Log("ATBannerAdClient : no exit helper ,create helper "); + } + + try + { + Debug.Log("ATBannerAdClient : loadBannerAd "); + bannerHelperMap[placementId].Call("loadBannerAd", mapJson); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATBannerAdClient : error."+e.Message); + } + + + } + + public string checkAdStatus(string placementId) + { + string adStatusJsonString = ""; + Debug.Log("ATBannerAdClient : checkAdStatus...."); + try + { + if (bannerHelperMap.ContainsKey(placementId)) + { + adStatusJsonString = bannerHelperMap[placementId].Call("checkAdStatus"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATBannerAdClient : error." + e.Message); + } + + return adStatusJsonString; + } + + public string getValidAdCaches(string placementId) + { + string validAdCachesString = ""; + Debug.Log("ATBannerAdClient : getValidAdCaches...."); + try + { + if (bannerHelperMap.ContainsKey(placementId)) + { + validAdCachesString = bannerHelperMap[placementId].Call("getValidAdCaches"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATBannerAdClient : error." + e.Message); + } + + return validAdCachesString; + } + + + public void setListener(ATBannerAdListener listener) + { + anyThinkListener = listener; + } + + + public void showBannerAd(string placementId, string position, string mapJson) + { + Debug.Log("ATBannerAdClient : showBannerAd by position" ); + //todo + try + { + if (bannerHelperMap.ContainsKey(placementId)) + { + this.bannerHelperMap[placementId].Call("showBannerAd", position, mapJson); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATBannerAdClient : error." + e.Message); + } + + } + + + + public void showBannerAd(string placementId, ATRect rect, string mapJson) + { + Debug.Log("ATBannerAdClient : showBannerAd " ); + + try{ + if (bannerHelperMap.ContainsKey(placementId)) { + this.bannerHelperMap[placementId].Call ("showBannerAd", rect.x, rect.y, rect.width, rect.height, mapJson); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATBannerAdClient : error."+e.Message); + + } + } + + public void cleanBannerAd(string placementId) + { + + Debug.Log("ATBannerAdClient : cleanBannerAd" ); + + try{ + if (bannerHelperMap.ContainsKey(placementId)) { + this.bannerHelperMap[placementId].Call ("cleanBannerAd"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATBannerAdClient : error."+e.Message); + } + } + + public void hideBannerAd(string placementId) + { + Debug.Log("ATBannerAdClient : hideBannerAd"); + + try + { + if (bannerHelperMap.ContainsKey(placementId)) + { + this.bannerHelperMap[placementId].Call("hideBannerAd"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATBannerAdClient : error." + e.Message); + } + } + + //针对已有的进行展示,没有就调用该方法无效 + public void showBannerAd(string placementId) + { + Debug.Log("ATBannerAdClient : showBannerAd "); + + try + { + if (bannerHelperMap.ContainsKey(placementId)) + { + this.bannerHelperMap[placementId].Call("showBannerAd"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATBannerAdClient : error." + e.Message); + + } + } + + public void cleanCache(string placementId) + { + + } + + + //广告加载成功 + public void onBannerLoaded(string placementId) + { + Debug.Log("onBannerLoaded...unity3d."); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementId)); + } + + //广告加载失败 + public void onBannerFailed(string placementId,string code, string error) + { + Debug.Log("onBannerFailed...unity3d."); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code)); + } + + //广告点击 + public void onBannerClicked(string placementId, string callbackJson) + { + Debug.Log("onBannerClicked...unity3d."); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + //广告展示 + public void onBannerShow(string placementId, string callbackJson) + { + Debug.Log("onBannerShow...unity3d."); + onAdImpressEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + //广告关闭 + public void onBannerClose(string placementId, string callbackJson) + { + Debug.Log("onBannerClose...unity3d."); + onAdCloseEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + //广告关闭 + public void onBannerAutoRefreshed(string placementId, string callbackJson) + { + Debug.Log("onBannerAutoRefreshed...unity3d."); + onAdAutoRefreshEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + //广告自动刷新失败 + public void onBannerAutoRefreshFail(string placementId, string code, string msg) + { + Debug.Log("onBannerAutoRefreshFail...unity3d."); + onAdAutoRefreshFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, msg, code)); + } + + // Adsource Listener + public void onAdSourceBiddingAttempt(string placementId, string callbackJson) + { + Debug.Log("onAdSourceBiddingAttempt...unity3d." + placementId + "," + callbackJson); + + onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onAdSourceBiddingFilled(string placementId, string callbackJson) + { + Debug.Log("onAdSourceBiddingFilled...unity3d." + placementId + "," + callbackJson); + + onAdSourceBiddingFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + 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, callbackJson, code, error)); + } + + public void onAdSourceAttempt(string placementId, string callbackJson) + { + Debug.Log("onAdSourceAttempt...unity3d." + placementId + "," + callbackJson); + + onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onAdSourceLoadFilled(string placementId, string callbackJson) + { + Debug.Log("onAdSourceLoadFilled...unity3d." + placementId + "," + callbackJson); + + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + 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, callbackJson, code, error)); + } + + } +} diff --git a/Assets/AnyThinkAds/Platform/Android/ATBannerAdClient.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATBannerAdClient.cs.meta new file mode 100644 index 0000000..1887bc1 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATBannerAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 92e8455090a784b949bd67df1b3fc530 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATDownloadClient.cs b/Assets/AnyThinkAds/Platform/Android/ATDownloadClient.cs new file mode 100644 index 0000000..b459d37 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATDownloadClient.cs @@ -0,0 +1,93 @@ +using UnityEngine; + +using AnyThinkAds.Common; +using AnyThinkAds.Api; +namespace AnyThinkAds.Android +{ + public class ATDownloadClient : AndroidJavaProxy,IATDownloadClient + { + + private AndroidJavaObject downloadHelper; + + + private ATDownloadAdListener anyThinkListener; + + public ATDownloadClient() : base("com.anythink.unitybridge.download.DownloadListener") + { + + } + + public void setListener(ATDownloadAdListener listener) + { + Debug.Log("ATDownloadClient : setListener"); + anyThinkListener = listener; + + if (downloadHelper == null) + { + downloadHelper = new AndroidJavaObject( + "com.anythink.unitybridge.download.DownloadHelper", this); + } + + } + + + public void onDownloadStart(string placementId, string callbackJson, long totalBytes, long currBytes, string fileName, string appName) + { + Debug.Log("onDownloadStart...unity3d."); + if(anyThinkListener != null){ + anyThinkListener.onDownloadStart(placementId, new ATCallbackInfo(callbackJson), totalBytes, currBytes, fileName, appName); + } + } + + + public void onDownloadUpdate(string placementId, string callbackJson, long totalBytes, long currBytes, string fileName, string appName) + { + Debug.Log("onDownloadUpdate...unity3d."); + if (anyThinkListener != null) + { + anyThinkListener.onDownloadUpdate(placementId, new ATCallbackInfo(callbackJson), totalBytes, currBytes, fileName, appName); + } + } + + + public void onDownloadPause(string placementId, string callbackJson, long totalBytes, long currBytes, string fileName, string appName) + { + Debug.Log("onDownloadPause...unity3d."); + if (anyThinkListener != null) + { + anyThinkListener.onDownloadPause(placementId, new ATCallbackInfo(callbackJson), totalBytes, currBytes, fileName, appName); + } + } + + + public void onDownloadFinish(string placementId, string callbackJson, long totalBytes, string fileName, string appName) + { + Debug.Log("onDownloadFinish...unity3d."); + if (anyThinkListener != null) + { + anyThinkListener.onDownloadFinish(placementId, new ATCallbackInfo(callbackJson), totalBytes, fileName, appName); + } + } + + + public void onDownloadFail(string placementId, string callbackJson, long totalBytes, long currBytes, string fileName, string appName) + { + Debug.Log("onDownloadFail...unity3d."); + if (anyThinkListener != null) + { + anyThinkListener.onDownloadFail(placementId, new ATCallbackInfo(callbackJson), totalBytes, currBytes, fileName, appName); + } + } + + + public void onInstalled(string placementId, string callbackJson, string fileName, string appName) + { + Debug.Log("onInstalled...unity3d."); + if (anyThinkListener != null) + { + anyThinkListener.onInstalled(placementId, new ATCallbackInfo(callbackJson), fileName, appName); + } + } + + } +} diff --git a/Assets/AnyThinkAds/Platform/Android/ATDownloadClient.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATDownloadClient.cs.meta new file mode 100644 index 0000000..7d139a8 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATDownloadClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 10ff201c4f54b4fce8f22229037070c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATInterstitialAdClient.cs b/Assets/AnyThinkAds/Platform/Android/ATInterstitialAdClient.cs new file mode 100644 index 0000000..b98de99 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATInterstitialAdClient.cs @@ -0,0 +1,427 @@ +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 ATInterstitialAdClient : AndroidJavaProxy,IATInterstitialAdClient + { + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdShowEvent; + public event EventHandler onAdShowFailureEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoFailureEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + + private Dictionary interstitialHelperMap = new Dictionary(); + + //private AndroidJavaObject videoHelper; + private ATInterstitialAdListener anyThinkListener; + + private AndroidJavaObject interstitialAutoAdHelper; + + public ATInterstitialAdClient() : base("com.anythink.unitybridge.interstitial.InterstitialListener") + { + interstitialAutoAdHelper = new AndroidJavaObject("com.anythink.unitybridge.interstitial.InterstitialAutoAdHelper", this); + } + + + public void loadInterstitialAd(string placementId, string mapJson) + { + + //如果不存在则直接创建对应广告位的helper + if(!interstitialHelperMap.ContainsKey(placementId)) + { + AndroidJavaObject videoHelper = new AndroidJavaObject( + "com.anythink.unitybridge.interstitial.InterstitialHelper", this); + videoHelper.Call("initInterstitial", placementId); + interstitialHelperMap.Add(placementId, videoHelper); + Debug.Log("ATInterstitialAdClient : no exit helper ,create helper "); + } + + try + { + Debug.Log("ATInterstitialAdClient : loadInterstitialAd "); + interstitialHelperMap[placementId].Call("loadInterstitialAd", mapJson); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATInterstitialAdClient : error."+e.Message); + } + + + } + + public void setListener(ATInterstitialAdListener listener) + { + anyThinkListener = listener; + } + + public bool hasInterstitialAdReady(string placementId) + { + bool isready = false; + Debug.Log ("ATInterstitialAdClient : hasAdReady...."); + try{ + if (interstitialHelperMap.ContainsKey(placementId)) { + isready = interstitialHelperMap[placementId].Call ("isAdReady"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATInterstitialAdClient : error."+e.Message); + } + return isready; + } + + public string checkAdStatus(string placementId) + { + string adStatusJsonString = ""; + Debug.Log("ATInterstitialAdClient : checkAdStatus...."); + try + { + if (interstitialHelperMap.ContainsKey(placementId)) + { + adStatusJsonString = interstitialHelperMap[placementId].Call("checkAdStatus"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATInterstitialAdClient : error." + e.Message); + } + + return adStatusJsonString; + } + + public void entryScenarioWithPlacementID(string placementId, string scenarioID){ + Debug.Log("ATInterstitialAdClient : entryScenarioWithPlacementID...."); + try + { + if (interstitialHelperMap.ContainsKey(placementId)) + { + interstitialHelperMap[placementId].Call("entryAdScenario", scenarioID); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATInterstitialAdClient entryScenarioWithPlacementID: error." + e.Message); + } + + + } + + + public string getValidAdCaches(string placementId) + { + string validAdCachesString = ""; + Debug.Log("ATNativeAdClient : getValidAdCaches...."); + try + { + if (interstitialHelperMap.ContainsKey(placementId)) + { + validAdCachesString = interstitialHelperMap[placementId].Call("getValidAdCaches"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATNativeAdClient : error." + e.Message); + } + + return validAdCachesString; + } + + public void showInterstitialAd(string placementId, string jsonmap) + { + Debug.Log("ATInterstitialAdClient : showAd " ); + + try{ + if (interstitialHelperMap.ContainsKey(placementId)) { + this.interstitialHelperMap[placementId].Call ("showInterstitialAd", jsonmap); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATInterstitialAdClient : error."+e.Message); + + } + } + + + public void cleanCache(string placementId) + { + + Debug.Log("ATInterstitialAdClient : clean" ); + + try{ + if (interstitialHelperMap.ContainsKey(placementId)) { + this.interstitialHelperMap[placementId].Call ("clean"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATInterstitialAdClient : error."+e.Message); + } + } + + public void onApplicationForces(string placementId) + { + Debug.Log ("onApplicationForces.... "); + try{ + if (interstitialHelperMap.ContainsKey(placementId)) { + this.interstitialHelperMap[placementId].Call ("onResume"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATInterstitialAdClient : error."+e.Message); + } + } + + public void onApplicationPasue(string placementId) + { + Debug.Log ("onApplicationPasue.... "); + try{ + if (interstitialHelperMap.ContainsKey(placementId)) { + this.interstitialHelperMap[placementId].Call ("onPause"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATInterstitialAdClient : error."+e.Message); + } + } + + //广告加载成功 + public void onInterstitialAdLoaded(string placementId) + { + Debug.Log("onInterstitialAdLoaded...unity3d."); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementId)); + } + + //广告加载失败 + public void onInterstitialAdLoadFail(string placementId,string code, string error) + { + Debug.Log("onInterstitialAdFailed...unity3d."); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code)); + } + + //开始播放 + public void onInterstitialAdVideoStart(string placementId, string callbackJson) + { + Debug.Log("onInterstitialAdPlayStart...unity3d."); + onAdVideoStartEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + //结束播放 + public void onInterstitialAdVideoEnd(string placementId, string callbackJson) + { + Debug.Log("onInterstitialAdPlayEnd...unity3d."); + onAdVideoEndEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + //播放失败 + public void onInterstitialAdVideoError(string placementId,string code, string error) + { + Debug.Log("onInterstitialAdPlayFailed...unity3d."); + onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code)); + } + + //展示失败 + public void OnInterstitialAdFailedToShow(string placementID) { + Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdFailedToShow()"); + onAdShowFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, "Failed to show video ad", "-1")); + } + + + //广告关闭 + public void onInterstitialAdClose(string placementId, string callbackJson) + { + Debug.Log("onInterstitialAdClosed...unity3d."); + onAdCloseEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + //广告点击 + public void onInterstitialAdClicked(string placementId, string callbackJson) + { + Debug.Log("onInterstitialAdClicked...unity3d."); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onInterstitialAdShow(string placementId, string callbackJson){ + Debug.Log("onInterstitialAdShow...unity3d."); + onAdShowEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + // Adsource Listener + public void onAdSourceBiddingAttempt(string placementId, string callbackJson) + { + Debug.Log("onAdSourceBiddingAttempt...unity3d." + placementId + "," + callbackJson); + onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onAdSourceBiddingFilled(string placementId, string callbackJson) + { + Debug.Log("onAdSourceBiddingFilled...unity3d." + placementId + "," + callbackJson); + + onAdSourceBiddingFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + 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, callbackJson, code, error)); + } + + public void onAdSourceAttempt(string placementId, string callbackJson) + { + Debug.Log("onAdSourceAttempt...unity3d." + placementId + "," + callbackJson); + + onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onAdSourceLoadFilled(string placementId, string callbackJson) + { + Debug.Log("onAdSourceLoadFilled...unity3d." + placementId + "," + callbackJson); + + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + 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, callbackJson, code, error)); + } + + // Auto + public void addAutoLoadAdPlacementID(string[] placementIDList){ + Debug.Log("Unity: ATInterstitialAdClient:addAutoLoadAdPlacementID()" + JsonMapper.ToJson(placementIDList)); + try + { + interstitialAutoAdHelper.Call("addPlacementIds", JsonMapper.ToJson(placementIDList)); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("Unity: ATInterstitialAdClient addAutoLoadAdPlacementID: error." + e.Message); + } + } + + public void removeAutoLoadAdPlacementID(string placementId) + { + Debug.Log("Unity: ATInterstitialAdClient:removeAutoLoadAdPlacementID()"); + try + { + interstitialAutoAdHelper.Call("removePlacementIds", placementId); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("Unity: ATInterstitialAdClient removeAutoLoadAdPlacementID: error." + e.Message); + } + } + + public bool autoLoadInterstitialAdReadyForPlacementID(string placementId) + { + Debug.Log("Unity: ATInterstitialAdClient:autoLoadInterstitialAdReadyForPlacementID()"); + bool isready = false; + try + { + isready = interstitialAutoAdHelper.Call("isAdReady", placementId); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATInterstitialAdClient:autoLoadInterstitialAdReadyForPlacementID( : error." + e.Message); + } + return isready; + } + public string getAutoValidAdCaches(string placementId) + { + Debug.Log("Unity: ATInterstitialAdClient:getAutoValidAdCaches()"); + string adStatusJsonString = ""; + try + { + adStatusJsonString = interstitialAutoAdHelper.Call("getValidAdCaches", placementId); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATInterstitialAdClient:getAutoValidAdCaches() : error." + e.Message); + } + + return adStatusJsonString; + } + + public void setAutoLocalExtra(string placementId, string mapJson) + { + Debug.Log("Unity: ATInterstitialAdClient:setAutoLocalExtra()"); + try + { + interstitialAutoAdHelper.Call("setAdExtraData", placementId, mapJson); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATInterstitialAdClient:setAutoLocalExtra() : error." + e.Message); + } + } + + public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID) + { + Debug.Log("Unity: ATInterstitialAdClient:entryAutoAdScenarioWithPlacementID()"); + try + { + interstitialAutoAdHelper.Call("entryAdScenario", placementId, scenarioID); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATInterstitialAdClient:entryAutoAdScenarioWithPlacementID() : error." + e.Message); + } + } + + public void showAutoAd(string placementId, string mapJson) + { + Debug.Log("Unity: ATInterstitialAdClient::showAutoAd()"); + try + { + interstitialAutoAdHelper.Call("show", placementId, mapJson); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("Unity: ATInterstitialAdClient:showAutoAd() : error." + e.Message); + } + } + + public string checkAutoAdStatus(string placementId) + { + Debug.Log("Unity: ATInterstitialAdClient:checkAutoAdStatus() : checkAutoAdStatus...."); + string adStatusJsonString = ""; + try + { + adStatusJsonString = interstitialAutoAdHelper.Call("checkAdStatus", placementId); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("Unity: ATInterstitialAdClient:checkAutoAdStatus() : error." + e.Message); + } + + return adStatusJsonString; + } + + } +} diff --git a/Assets/AnyThinkAds/Platform/Android/ATInterstitialAdClient.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATInterstitialAdClient.cs.meta new file mode 100644 index 0000000..32dac17 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATInterstitialAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a5faa4e142aa43dbba381b1cef1eb7b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATMsgTools.cs b/Assets/AnyThinkAds/Platform/Android/ATMsgTools.cs new file mode 100644 index 0000000..035f034 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATMsgTools.cs @@ -0,0 +1,54 @@ +using UnityEngine; +using System.Collections; + + +#if UNITY_ANDROID + +public class ATMsgTools +{ + private AndroidJavaObject _Plugin; + + public ATMsgTools () + { + try{ + if (Application.platform != RuntimePlatform.Android) + return; + + _Plugin = new AndroidJavaObject ("com.anythink.unitybridge.MsgTools"); + + }catch(System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + } + } + + + public void printLogI (string msg) + { + try{ + + _Plugin.Call ("printLogI",msg); + }catch(System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + } + } + + + public void printMsg (string msg) + { + try{ + _Plugin.Call ("pirntMsg",msg); + }catch(System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + } + } + + +} + +#endif + + + diff --git a/Assets/AnyThinkAds/Platform/Android/ATMsgTools.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATMsgTools.cs.meta new file mode 100644 index 0000000..5ef8c0c --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATMsgTools.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f9a8f81e02c94851a16c544a4f2bca9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATNativeAdClient.cs b/Assets/AnyThinkAds/Platform/Android/ATNativeAdClient.cs new file mode 100644 index 0000000..64f680e --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATNativeAdClient.cs @@ -0,0 +1,342 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Common; +using AnyThinkAds.Api; + +namespace AnyThinkAds.Android +{ + public class ATNativeAdClient : AndroidJavaProxy, IATNativeAdClient + { + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdImpressEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdVideoProgressEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + + private Dictionary nativeAdHelperMap = new Dictionary(); + private ATNativeAdListener mlistener; + + public ATNativeAdClient(): base("com.anythink.unitybridge.nativead.NativeListener") + { + + } + + public void loadNativeAd(string placementId, string mapJson) + { + Debug.Log ("loadNativeAd....jsonmap:"+mapJson); + if(!nativeAdHelperMap.ContainsKey(placementId)){ + AndroidJavaObject nativeHelper = new AndroidJavaObject( + "com.anythink.unitybridge.nativead.NativeHelper", this); + nativeHelper.Call("initNative", placementId); + nativeAdHelperMap.Add(placementId, nativeHelper); + } + try{ + if (nativeAdHelperMap.ContainsKey(placementId)) { + nativeAdHelperMap[placementId].Call ("loadNative",mapJson); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATNativeAdClient : error."+e.Message); + } + } + + + public bool hasAdReady(string placementId) + { + bool isready = false; + Debug.Log ("hasAdReady...."); + try{ + if (nativeAdHelperMap.ContainsKey(placementId)) { + isready = nativeAdHelperMap[placementId].Call ("isAdReady"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATNativeAdClient : error."+e.Message); + } + return isready; + } + + public void entryScenarioWithPlacementID(string placementId, string scenarioID){ + Debug.Log("ATNativeAdClient : entryScenarioWithPlacementID...."); + try + { + if (nativeAdHelperMap.ContainsKey(placementId)) + { + nativeAdHelperMap[placementId].Call("entryAdScenario", scenarioID); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATNativeAdClient entryScenarioWithPlacementID: error." + e.Message); + } + + + } + + public string checkAdStatus(string placementId) + { + string adStatusJsonString = ""; + Debug.Log("ATNativeAdClient : checkAdStatus...."); + try + { + if (nativeAdHelperMap.ContainsKey(placementId)) + { + adStatusJsonString = nativeAdHelperMap[placementId].Call("checkAdStatus"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATNativeAdClient : error." + e.Message); + } + + return adStatusJsonString; + } + + public string getValidAdCaches(string placementId) + { + string validAdCachesString = ""; + Debug.Log("ATNativeAdClient : getValidAdCaches...."); + try + { + if (nativeAdHelperMap.ContainsKey(placementId)) + { + validAdCachesString = nativeAdHelperMap[placementId].Call("getValidAdCaches"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATNativeAdClient : error." + e.Message); + } + + return validAdCachesString; + } + + public void setListener(ATNativeAdListener listener) + { + mlistener = listener; + } + + public void renderAdToScene(string placementId, ATNativeAdView anyThinkNativeAdView, string mapJson) + { + string showconfig = anyThinkNativeAdView.toJSON (); + //暂未实现 show + Debug.Log ("renderAdToScene....showconfig >>>:"+showconfig); + try{ + if (nativeAdHelperMap.ContainsKey(placementId)) { + nativeAdHelperMap[placementId].Call ("show",showconfig, mapJson); + } + }catch(System.Exception e){ + Debug.Log ("ATNativeAdClient : error."+e.Message); + System.Console.WriteLine("Exception caught: {0}", e); + } + } + + public void cleanAdView(string placementId, ATNativeAdView anyThinkNativeAdView) + { + // + Debug.Log ("cleanAdView.... "); + try{ + + if (nativeAdHelperMap.ContainsKey(placementId)) { + nativeAdHelperMap[placementId].Call ("cleanView"); + } + + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATNativeAdClient : error."+e.Message); + } + } + + public void onApplicationForces(string placementId, ATNativeAdView anyThinkNativeAdView) + { + + + Debug.Log ("onApplicationForces.... "); + try{ + + if (nativeAdHelperMap.ContainsKey(placementId)) { + nativeAdHelperMap[placementId].Call ("onResume"); + } + + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATNativeAdClient : error."+e.Message); + } + } + + + public void onApplicationPasue(string placementId, ATNativeAdView anyThinkNativeAdView) + { + + Debug.Log ("onApplicationPasue.... "); + try{ + + + if (nativeAdHelperMap.ContainsKey(placementId)) { + nativeAdHelperMap[placementId].Call ("onPause"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATNativeAdClient : error."+e.Message); + } + } + + public void cleanCache(string placementId) + { + Debug.Log ("cleanCache...."); + try{ + if (nativeAdHelperMap.ContainsKey(placementId)) { + nativeAdHelperMap[placementId].Call ("clean"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATNativeAdClient : error."+e.Message); + } + } + + /** + * 广告展示回调 + * + * @param view + */ + public void onAdImpressed(string placementId, string callbackJson) + { + Debug.Log("onAdImpressed...unity3d."); + onAdImpressEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + } + + /** + * 广告点击回调 + * + * @param view + */ + public void onAdClicked(string placementId, string callbackJson) + { + Debug.Log("onAdClicked...unity3d."); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + + /** + * 广告视频开始回调 + * + * @param view + */ + public void onAdVideoStart(string placementId) + { + Debug.Log("onAdVideoStart...unity3d."); + onAdVideoStartEvent?.Invoke(this, new ATAdEventArgs(placementId)); + } + + /** + * 广告视频结束回调 + * + * @param view + */ + public void onAdVideoEnd(string placementId) + { + Debug.Log("onAdVideoEnd...unity3d."); + onAdVideoEndEvent?.Invoke(this, new ATAdEventArgs(placementId,"")); + } + + /** + * 广告视频进度回调 + * + * @param view + */ + public void onAdVideoProgress(string placementId,int progress) + { + Debug.Log("onAdVideoProgress...progress[" + progress + "]"); + onAdVideoProgressEvent?.Invoke(this, new ATAdProgressEventArgs(placementId,"",progress)); + } + + /** + * 广告视频进度回调 + * + * @param view + */ + public void onAdCloseButtonClicked(string placementId, string callbackJson) + { + Debug.Log("onAdCloseButtonClicked...unity3d"); + onAdCloseEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + } + + + /** + * 广告加载成功 + */ + public void onNativeAdLoaded(string placementId) + { + Debug.Log("onNativeAdLoaded...unity3d."); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementId,"")); + + } + + /** + * 广告加载失败 + */ + public void onNativeAdLoadFail(string placementId,string code, string msg) + { + Debug.Log("onNativeAdLoadFail...unity3d. code:" + code + " msg:" + msg); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId,code,msg)); + } + + // Adsource Listener + public void onAdSourceBiddingAttempt(string placementId, string callbackJson) + { + Debug.Log("onAdSourceBiddingAttempt...unity3d." + placementId + "," + callbackJson); + + onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + } + + public void onAdSourceBiddingFilled(string placementId, string callbackJson) + { + Debug.Log("onAdSourceBiddingFilled...unity3d." + placementId + "," + callbackJson); + + onAdSourceBiddingFilledEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + } + + 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,callbackJson,code,error)); + } + + public void onAdSourceAttempt(string placementId, string callbackJson) + { + Debug.Log("onAdSourceAttempt...unity3d." + placementId + "," + callbackJson); + + onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + } + + public void onAdSourceLoadFilled(string placementId, string callbackJson) + { + Debug.Log("onAdSourceLoadFilled...unity3d." + placementId + "," + callbackJson); + + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + } + + 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,callbackJson,code,error)); + } + + + } +} diff --git a/Assets/AnyThinkAds/Platform/Android/ATNativeAdClient.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATNativeAdClient.cs.meta new file mode 100644 index 0000000..4ef24e5 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATNativeAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7739e5e9b404f44fc8d2079f8f8a5423 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATNativeBannerAdClient.cs b/Assets/AnyThinkAds/Platform/Android/ATNativeBannerAdClient.cs new file mode 100644 index 0000000..885776b --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATNativeBannerAdClient.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using AnyThinkAds.Common; +using AnyThinkAds.Api; +#pragma warning disable 0067 +namespace AnyThinkAds.Android +{ + public class ATNativeBannerAdClient :IATNativeBannerAdClient + { + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdImpressEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdVideoProgressEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + public ATNativeBannerAdClient() { + + } + + public void loadAd(string placementId, string mapJson) { + + } + + public bool adReady(string placementId) { + return false; + } + + public void setListener(ATNativeBannerAdListener listener) { + + } + + public void showAd(string placementId, ATRect rect, Dictionary pairs) { + + } + + public void removeAd(string placementId) { + + } + + public void onAdLoaded(string placementId) { + Debug.Log("ATNativeBannerAdClient::onAdLoaded()"); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementId)); + } + + public void onAdLoadFail(string placementId, string code, string message) { + Debug.Log("ATNativeBannerAdClient::onAdLoadFail()"); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, "", code, message)); + + } + + public void onAdImpressed(string placementId, string callbackJson) { + Debug.Log("ATNativeBannerAdClient::onAdImpressed()"); + onAdImpressEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + + public void onAdClicked(string placementId, string callbackJson) { + Debug.Log("ATNativeBannerAdClient::onAdClicked()"); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + } + + public void onAdAutoRefresh(string placementId, string callbackJson) { + Debug.Log("ATNativeBannerAdClient::onAdAutoRefresh()"); + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + + public void onAdAutoRefreshFailure(string placementId, string code, string message) { + Debug.Log("ATNativeBannerAdClient::onAdAutoRefreshFailure()"); + onAdSourceLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, "", code, message)); + + } + + public void onAdCloseButtonClicked(string placementId) { + Debug.Log("ATNativeBannerAdClient::onAdCloseButtonClicked()"); + onAdCloseEvent?.Invoke(this, new ATAdEventArgs(placementId)); + + } + } +} diff --git a/Assets/AnyThinkAds/Platform/Android/ATNativeBannerAdClient.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATNativeBannerAdClient.cs.meta new file mode 100644 index 0000000..37948dd --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATNativeBannerAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3e7ad1dcac86142608df799cdeefe124 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATNetTrafficListener.cs b/Assets/AnyThinkAds/Platform/Android/ATNetTrafficListener.cs new file mode 100644 index 0000000..19f578f --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATNetTrafficListener.cs @@ -0,0 +1,40 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Api; + +namespace AnyThinkAds.Android +{ + public class ATNetTrafficListener : AndroidJavaProxy + { + ATGetUserLocationListener mListener; + public ATNetTrafficListener(ATGetUserLocationListener listener): base("com.anythink.unitybridge.sdkinit.SDKEUCallbackListener") + { + mListener = listener; + } + + + public void onResultCallback(bool isEu) + { + if (mListener != null) + { + if (isEu) + { + mListener.didGetUserLocation(ATSDKAPI.kATUserLocationInEU); + } + else + { + mListener.didGetUserLocation(ATSDKAPI.kATUserLocationOutOfEU); + } + } + } + + public void onErrorCallback(string s) + { + if (mListener != null) + { + mListener.didGetUserLocation(ATSDKAPI.kATUserLocationUnknown); + } + } + } +} diff --git a/Assets/AnyThinkAds/Platform/Android/ATNetTrafficListener.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATNetTrafficListener.cs.meta new file mode 100644 index 0000000..5043b02 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATNetTrafficListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bc7832ca770c84f96ac1401368abb7dc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATRewardedVideoAdClient.cs b/Assets/AnyThinkAds/Platform/Android/ATRewardedVideoAdClient.cs new file mode 100644 index 0000000..0970bd8 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATRewardedVideoAdClient.cs @@ -0,0 +1,416 @@ +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 ATRewardedVideoAdClient : AndroidJavaProxy,IATRewardedVideoAdClient + { + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdVideoFailureEvent; + public event EventHandler onAdVideoCloseEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onRewardEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + public event EventHandler onPlayAgainStart; + public event EventHandler onPlayAgainEnd; + public event EventHandler onPlayAgainFailure; + public event EventHandler onPlayAgainClick; + public event EventHandler onPlayAgainReward; + + + private Dictionary videoHelperMap = new Dictionary(); + + private AndroidJavaObject videoAutoAdHelper; + + //private AndroidJavaObject videoHelper; + private ATRewardedVideoListener anyThinkListener; + + public ATRewardedVideoAdClient() : base("com.anythink.unitybridge.videoad.VideoListener") + { + videoAutoAdHelper = new AndroidJavaObject("com.anythink.unitybridge.videoad.VideoAutoAdHelper", this); + } + + + public void loadVideoAd(string placementId, string mapJson) + { + + if(!videoHelperMap.ContainsKey(placementId)) + { + AndroidJavaObject videoHelper = new AndroidJavaObject( + "com.anythink.unitybridge.videoad.VideoHelper", this); + videoHelper.Call("initVideo", placementId); + videoHelperMap.Add(placementId, videoHelper); + Debug.Log("ATRewardedVideoAdClient : no exit helper ,create helper "); + } + + try + { + Debug.Log("ATRewardedVideoAdClient : loadVideoAd "); + videoHelperMap[placementId].Call("fillVideo", mapJson); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATRewardedVideoAdClient : error."+e.Message); + } + + + } + + public void setListener(ATRewardedVideoListener listener) + { + anyThinkListener = listener; + } + + public bool hasAdReady(string placementId) + { + bool isready = false; + Debug.Log ("ATRewardedVideoAdClient : hasAdReady...."); + try{ + if (videoHelperMap.ContainsKey(placementId)) { + isready = videoHelperMap[placementId].Call ("isAdReady"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATRewardedVideoAdClient : error."+e.Message); + } + return isready; + } + + public string checkAdStatus(string placementId) + { + string adStatusJsonString = ""; + Debug.Log("ATRewardedVideoAdClient : checkAdStatus...."); + try + { + if (videoHelperMap.ContainsKey(placementId)) + { + adStatusJsonString = videoHelperMap[placementId].Call("checkAdStatus"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATRewardedVideoAdClient : error." + e.Message); + } + + return adStatusJsonString; + } + + public void entryScenarioWithPlacementID(string placementId, string scenarioID){ + Debug.Log("ATRewardedVideoAdClient : entryScenarioWithPlacementID...."); + try + { + if (videoHelperMap.ContainsKey(placementId)) + { + videoHelperMap[placementId].Call("entryAdScenario", scenarioID); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATRewardedVideoAdClient entryScenarioWithPlacementID: error." + e.Message); + } + + } + + + + public string getValidAdCaches(string placementId) + { + string validAdCachesString = ""; + Debug.Log("ATNativeAdClient : getValidAdCaches...."); + try + { + if (videoHelperMap.ContainsKey(placementId)) + { + validAdCachesString = videoHelperMap[placementId].Call("getValidAdCaches"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATNativeAdClient : error." + e.Message); + } + + return validAdCachesString; + } + + public void showAd(string placementId, string scenario) + { + Debug.Log("ATRewardedVideoAdClient : showAd " ); + + try{ + if (videoHelperMap.ContainsKey(placementId)) { + this.videoHelperMap[placementId].Call ("showVideo", scenario); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATRewardedVideoAdClient : error."+e.Message); + + } + } + + + + public void onRewardedVideoAdLoaded(string placementId) + { + Debug.Log("onRewardedVideoAdLoaded...unity3d."); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementId)); + } + + + public void onRewardedVideoAdFailed(string placementId,string code, string error) + { + Debug.Log("onRewardedVideoAdFailed...unity3d."); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code)); + } + + + public void onRewardedVideoAdPlayStart(string placementId, string callbackJson) + { + Debug.Log("onRewardedVideoAdPlayStart...unity3d."); + onAdVideoStartEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + + public void onRewardedVideoAdPlayEnd(string placementId, string callbackJson) + { + Debug.Log("onRewardedVideoAdPlayEnd...unity3d."); + onAdVideoEndEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + + public void onRewardedVideoAdPlayFailed(string placementId,string code, string error) + { + Debug.Log("onRewardedVideoAdPlayFailed...unity3d."); + onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code)); + } + + public void onRewardedVideoAdClosed(string placementId,bool isRewarded, string callbackJson) + { + Debug.Log("onRewardedVideoAdClosed...unity3d."); + onAdVideoCloseEvent?.Invoke(this, new ATAdRewardEventArgs(placementId, callbackJson, isRewarded)); + } + + public void onRewardedVideoAdPlayClicked(string placementId, string callbackJson) + { + Debug.Log("onRewardedVideoAdPlayClicked...unity3d."); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + + } + + + public void onReward(string placementId, string callbackJson) + { + Debug.Log("onReward...unity3d."); + onRewardEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + + public void onRewardedVideoAdAgainPlayStart(string placementId, string callbackJson) + { + Debug.Log("onRewardedVideoAdAgainPlayStart...unity3d."); + onPlayAgainStart?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onRewardedVideoAdAgainPlayEnd(string placementId, string callbackJson) + { + Debug.Log("onRewardedVideoAdAgainPlayEnd...unity3d."); + onPlayAgainEnd?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + + public void onRewardedVideoAdAgainPlayFailed(string placementId, string code, string error) + { + Debug.Log("onRewardedVideoAdAgainPlayFailed...unity3d."); + onPlayAgainFailure?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code)); + } + + + public void onRewardedVideoAdAgainPlayClicked(string placementId, string callbackJson) + { + Debug.Log("onRewardedVideoAdAgainPlayClicked...unity3d."); + onPlayAgainClick?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + + } + + + public void onAgainReward(string placementId, string callbackJson) + { + Debug.Log("onAgainReward...unity3d."); + onPlayAgainReward?.Invoke(this, new ATAdRewardEventArgs(placementId, callbackJson, true)); + } + + // Adsource Listener + public void onAdSourceBiddingAttempt(string placementId, string callbackJson) + { + Debug.Log("onAdSourceBiddingAttempt...unity3d."+ placementId + "," + callbackJson); + onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onAdSourceBiddingFilled(string placementId, string callbackJson) + { + Debug.Log("onAdSourceBiddingFilled...unity3d." + placementId + "," + callbackJson); + onAdSourceBiddingFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + 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)); + } + + public void onAdSourceAttempt(string placementId, string callbackJson) + { + Debug.Log("onAdSourceAttempt...unity3d." + placementId + "," + callbackJson); + onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onAdSourceLoadFilled(string placementId, string callbackJson) + { + Debug.Log("onAdSourceLoadFilled...unity3d." + placementId + "," + callbackJson); + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + 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)); + } + + + // Auto + public void addAutoLoadAdPlacementID(string[] placementIDList){ + Debug.Log("Unity: ATRewardedVideoAdClient:addAutoLoadAdPlacementID()" + JsonMapper.ToJson(placementIDList)); + try + { + videoAutoAdHelper.Call("addPlacementIds", JsonMapper.ToJson(placementIDList)); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("Unity: ATRewardedVideoAdClient addAutoLoadAdPlacementID: error." + e.Message); + } + } + + public void removeAutoLoadAdPlacementID(string placementId) { + Debug.Log("Unity: ATRewardedVideoAdClient:removeAutoLoadAdPlacementID()"); + try + { + videoAutoAdHelper.Call("removePlacementIds", placementId); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("Unity: ATRewardedVideoAdClient removeAutoLoadAdPlacementID: error." + e.Message); + } + } + + public bool autoLoadRewardedVideoReadyForPlacementID(string placementId) + { + Debug.Log("Unity: ATRewardedVideoAdClient:autoLoadRewardedVideoReadyForPlacementID()"); + bool isready = false; + try + { + isready = videoAutoAdHelper.Call("isAdReady", placementId); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATRewardedVideoAdClient:autoLoadRewardedVideoReadyForPlacementID( : error." + e.Message); + } + return isready; + } + + public string getAutoValidAdCaches(string placementId) + { + Debug.Log("Unity: ATRewardedVideoAdClient:getAutoValidAdCaches()"); + string adStatusJsonString = ""; + try + { + adStatusJsonString = videoAutoAdHelper.Call("getValidAdCaches", placementId); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATRewardedVideoAdClient:getAutoValidAdCaches() : error." + e.Message); + } + + return adStatusJsonString; + } + + public void setAutoLocalExtra(string placementId, string mapJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient:setAutoLocalExtra()"); + try + { + videoAutoAdHelper.Call("setAdExtraData", placementId, mapJson); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATRewardedVideoAdClient:setAutoLocalExtra() : error." + e.Message); + } + } + + public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID) + { + Debug.Log("Unity: ATRewardedVideoAdClient:entryAutoAdScenarioWithPlacementID()"); + try + { + videoAutoAdHelper.Call("entryAdScenario", placementId, scenarioID); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATRewardedVideoAdClient:entryAutoAdScenarioWithPlacementID() : error." + e.Message); + } + } + public void showAutoAd(string placementId, string mapJson) { + Debug.Log("Unity: ATRewardedVideoAdClient:showAutoAd()"); + try + { + videoAutoAdHelper.Call("show", placementId, mapJson); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("Unity: ATRewardedVideoAdClient:showAutoAd() : error." + e.Message); + } + } + + public string checkAutoAdStatus(string placementId) + { + Debug.Log("Unity: ATRewardedVideoAdClient:checkAutoAdStatus() : checkAutoAdStatus...."); + string adStatusJsonString = ""; + try + { + adStatusJsonString = videoAutoAdHelper.Call("checkAdStatus", placementId); + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("Unity: ATRewardedVideoAdClient:checkAutoAdStatus() : error." + e.Message); + } + + return adStatusJsonString; + } + + + + } +} diff --git a/Assets/AnyThinkAds/Platform/Android/ATRewardedVideoAdClient.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATRewardedVideoAdClient.cs.meta new file mode 100644 index 0000000..c3afb6b --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATRewardedVideoAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f8d0bdf7098d34eb28d38fba39a47b0c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/Android/ATSDKAPIClient.cs b/Assets/AnyThinkAds/Platform/Android/ATSDKAPIClient.cs new file mode 100644 index 0000000..de2e8d4 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATSDKAPIClient.cs @@ -0,0 +1,361 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Common; +using AnyThinkAds.Api; + +namespace AnyThinkAds.Android +{ + public class ATSDKAPIClient : AndroidJavaProxy, IATSDKAPIClient + { + private AndroidJavaObject sdkInitHelper; + private ATSDKInitListener sdkInitListener; + public ATSDKAPIClient () : base("com.anythink.unitybridge.sdkinit.SDKInitListener") + { + this.sdkInitHelper = new AndroidJavaObject( + "com.anythink.unitybridge.sdkinit.SDKInitHelper", this); + } + + public void initSDK(string appId, string appKey) + { + this.initSDK(appId, appKey, null); + } + + public void initSDK(string appId, string appKey, ATSDKInitListener listener) + { + Debug.Log("initSDK...."); + sdkInitListener = listener; + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("initAppliction", appId, appKey); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATSDKAPIClient : error."+e.Message); + } + } + + public void getUserLocation(ATGetUserLocationListener listener) + { + ATNetTrafficListener netTrafficListener = new ATNetTrafficListener(listener); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("checkIsEuTraffic", netTrafficListener); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + //implement getting location here + } + + public void setGDPRLevel(int level) + { + Debug.Log ("setGDPRLevel...."); + try{ + if (this.sdkInitHelper != null) { + this.sdkInitHelper.Call ("setGDPRLevel",level); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATSDKAPIClient : error."+e.Message); + } + + } + + public void showGDPRAuth() + { + Debug.Log ("showGDPRAuth...."); + try{ + if (this.sdkInitHelper != null) { + this.sdkInitHelper.Call ("showGDPRAuth"); + } + }catch(System.Exception e){ + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log ("ATSDKAPIClient : error."+e.Message); + + } + } + + public void setChannel(string channel) + { + Debug.Log("setChannel...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("setChannel", channel); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void setSubChannel(string subchannel) + { + Debug.Log("setSubChannel...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("setSubChannel", subchannel); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void initCustomMap(string jsonMap) + { + Debug.Log("initCustomMap...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("initCustomMap", jsonMap); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void setCustomDataForPlacementID(string customData, string placementID) + { + Debug.Log("setCustomDataForPlacementID...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("initPlacementCustomMap", placementID, customData); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void setLogDebug(bool isDebug) + { + Debug.Log("setLogDebug...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("setDebugLogOpen", isDebug); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void addNetworkGDPRInfo(int networkType, string mapJson) + { +// Debug.Log ("addNetworkGDPRInfo...." + networkType + "mapjson:"+mapJson); +// try{ +// if (this.sdkInitHelper != null) { +// this.sdkInitHelper.Call ("addNetworkGDPRInfo",networkType,mapJson); +// } +// }catch(System.Exception e){ +// System.Console.WriteLine("Exception caught: {0}", e); +// Debug.Log ("ATSDKAPIClient : error."+e.Message); +// } + + } + + public void initSDKSuccess(string appid) + { + Debug.Log("initSDKSuccess...unity3d."); + if(sdkInitListener != null){ + sdkInitListener.initSuccess(); + } + } + + public void initSDKError(string appid, string message) + { + Debug.Log("initSDKError..unity3d.."); + if (sdkInitListener != null) + { + sdkInitListener.initFail(message); + } + } + + public int getGDPRLevel() + { + Debug.Log("getGDPRLevel...."); + try + { + if (this.sdkInitHelper != null) + { + return this.sdkInitHelper.Call("getGDPRLevel"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + return 2; //UNKNOW + } + + public bool isEUTraffic() + { + Debug.Log("isEUTraffic...."); + try + { + if (this.sdkInitHelper != null) + { + return this.sdkInitHelper.Call("isEUTraffic"); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + return false; + } + + public void deniedUploadDeviceInfo(string deniedInfoString) + { + Debug.Log("deniedUploadDeviceInfo...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("deniedUploadDeviceInfo", deniedInfoString); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void setExcludeBundleIdArray(string bundleIds) + { + Debug.Log("setExcludeBundleIdArray...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("setExcludeBundleIdArray", bundleIds); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void setExcludeAdSourceIdArrayForPlacementID(string placementID, string adsourceIds) + { + Debug.Log("setExcludeAdSourceIdArrayForPlacementID...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("setExcludeAdSourceIdArrayForPlacementID", placementID, adsourceIds); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void setSDKArea(int area) + { + Debug.Log("setSDKArea...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("setSDKArea", area); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void getArea(ATGetAreaListener listener) + { + Debug.Log("getArea...."); + ATAreaListener areaListener = new ATAreaListener(listener); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("getArea", areaListener); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void setWXStatus(bool install) + { + Debug.Log("setWXStatus...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("setWXStatus", install); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + public void setLocation(double longitude, double latitude) + { + Debug.Log("setLocation...."); + try + { + if (this.sdkInitHelper != null) + { + this.sdkInitHelper.Call("setLocation", longitude, latitude); + } + } + catch (System.Exception e) + { + System.Console.WriteLine("Exception caught: {0}", e); + Debug.Log("ATSDKAPIClient : error." + e.Message); + } + } + + } +} diff --git a/Assets/AnyThinkAds/Platform/Android/ATSDKAPIClient.cs.meta b/Assets/AnyThinkAds/Platform/Android/ATSDKAPIClient.cs.meta new file mode 100644 index 0000000..b6c47dc --- /dev/null +++ b/Assets/AnyThinkAds/Platform/Android/ATSDKAPIClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 245e7a5e922934f43a6484d5f0189a91 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS.meta b/Assets/AnyThinkAds/Platform/iOS.meta new file mode 100644 index 0000000..6529c9c --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 24acb4405bd40449f82a6ea03b5824c7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/ATBannerAdClient.cs b/Assets/AnyThinkAds/Platform/iOS/ATBannerAdClient.cs new file mode 100644 index 0000000..2d3e4db --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATBannerAdClient.cs @@ -0,0 +1,171 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Common; +using AnyThinkAds.Api; +using System; + +namespace AnyThinkAds.iOS { + public class ATBannerAdClient : IATBannerAdClient { + + + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdImpressEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdAutoRefreshEvent; + public event EventHandler onAdAutoRefreshFailureEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdCloseButtonTappedEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + + private ATBannerAdListener anyThinkListener; + + + public void addsetting(string placementId,string json){ + //todo... + } + + public void setListener(ATBannerAdListener listener) { + Debug.Log("Unity: ATBannerAdClient::setListener()"); + anyThinkListener = listener; + } + + public void loadBannerAd(string placementId, string mapJson) { + Debug.Log("Unity: ATBannerAdClient::loadBannerAd()"); + ATBannerAdWrapper.setClientForPlacementID(placementId, this); + ATBannerAdWrapper.loadBannerAd(placementId, mapJson); + } + + public string checkAdStatus(string placementId) { + Debug.Log("Unity: ATBannerAdClient::checkAdStatus()"); + return ATBannerAdWrapper.checkAdStatus(placementId); + } + + public string getValidAdCaches(string placementId) + { + Debug.Log("Unity: ATBannerAdClient::getValidAdCaches()"); + return ATBannerAdWrapper.getValidAdCaches(placementId); + } + + public void showBannerAd(string placementId, ATRect rect) { + Debug.Log("Unity: ATBannerAdClient::showBannerAd()"); + ATBannerAdWrapper.showBannerAd(placementId, rect); + } + + public void showBannerAd(string placementId, ATRect rect, string mapJson) { + Debug.Log("Unity: ATBannerAdClient::showBannerAd()"); + ATBannerAdWrapper.showBannerAd(placementId, rect, mapJson); + } + + public void showBannerAd(string placementId, string position) + { + Debug.Log("Unity: ATBannerAdClient::showBannerAd()"); + ATBannerAdWrapper.showBannerAd(placementId, position); + } + + public void showBannerAd(string placementId, string position, string mapJson) + { + Debug.Log("Unity: ATBannerAdClient::showBannerAd()"); + ATBannerAdWrapper.showBannerAd(placementId, position, mapJson); + } + + public void cleanBannerAd(string placementId) { + Debug.Log("Unity: ATBannerAdClient::cleanBannerAd()"); + ATBannerAdWrapper.cleanBannerAd(placementId); + } + + public void hideBannerAd(string placementId) { + Debug.Log("Unity: ATBannerAdClient::hideBannerAd()"); + ATBannerAdWrapper.hideBannerAd(placementId); + } + + public void showBannerAd(string placementId) { + Debug.Log("Unity: ATBannerAdClient::showBannerAd()"); + ATBannerAdWrapper.showBannerAd(placementId); + } + + public void cleanCache(string placementId) { + Debug.Log("Unity: ATBannerAdClient::cleanCache()"); + ATBannerAdWrapper.clearCache(); + } + + + public void OnBannerAdLoad(string placementId) { + Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdLoad()"); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementId)); + } + + public void OnBannerAdLoadFail(string placementId, string code, string message) { + Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdLoadFail()"); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, message, code)); + } + + public void OnBannerAdImpress(string placementId, string callbackJson) { + Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdImpress()"); + onAdImpressEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void OnBannerAdClick(string placementId, string callbackJson) { + Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdClick()"); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void OnBannerAdAutoRefresh(string placementId, string callbackJson) { + Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdAutoRefresh()"); + onAdAutoRefreshEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void OnBannerAdAutoRefreshFail(string placementId, string code, string message) { + Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdAutoRefreshFail()"); + onAdAutoRefreshFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, message, code)); + } + + public void OnBannerAdClose(string placementId) { + Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdClose()"); + onAdCloseEvent?.Invoke(this, new ATAdEventArgs(placementId)); + } + + public void OnBannerAdCloseButtonTapped(string placementId, string callbackJson) { + Debug.Log("Unity: HBBannerAdWrapper::OnBannerAdCloseButton()"); + onAdCloseButtonTappedEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + //auto callbacks + public void startLoadingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: HBBannerAdWrapper::startLoadingADSource()"); + onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void finishLoadingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: HBBannerAdWrapper::finishLoadingADSource()"); + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void failToLoadADSource(string placementId,string callbackJson, string code, string error) + { + Debug.Log("Unity: HBBannerAdWrapper::failToLoadADSource()"); + onAdSourceLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error)); + } + public void startBiddingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: HBBannerAdWrapper::startBiddingADSource()"); + onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void finishBiddingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: HBBannerAdWrapper::finishBiddingADSource()"); + onAdSourceBiddingFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void failBiddingADSource(string placementId, string callbackJson,string code, string error) + { + Debug.Log("Unity: HBBannerAdWrapper::failBiddingADSource()"); + onAdSourceBiddingFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error)); + } + + } +} \ No newline at end of file diff --git a/Assets/AnyThinkAds/Platform/iOS/ATBannerAdClient.cs.meta b/Assets/AnyThinkAds/Platform/iOS/ATBannerAdClient.cs.meta new file mode 100644 index 0000000..4db131f --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATBannerAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fc5aeee813f974653b6b9947425ec275 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/ATInterstitialAdClient.cs b/Assets/AnyThinkAds/Platform/iOS/ATInterstitialAdClient.cs new file mode 100644 index 0000000..a83aaa1 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATInterstitialAdClient.cs @@ -0,0 +1,221 @@ +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 ATInterstitialAdClient : IATInterstitialAdClient { + private ATInterstitialAdListener anyThinkListener; + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdShowEvent; + public event EventHandler onAdShowFailureEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoFailureEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + + public void addsetting(string placementId,string json){ + //todo... + } + + public void setListener(ATInterstitialAdListener listener) { + Debug.Log("Unity: ATInterstitialAdClient::setListener()"); + anyThinkListener = listener; + } + + public void loadInterstitialAd(string placementId, string mapJson) { + Debug.Log("Unity: ATInterstitialAdClient::loadInterstitialAd()"); + ATInterstitialAdWrapper.setClientForPlacementID(placementId, this); + ATInterstitialAdWrapper.loadInterstitialAd(placementId, mapJson); + } + + public bool hasInterstitialAdReady(string placementId) { + Debug.Log("Unity: ATInterstitialAdClient::hasInterstitialAdReady()"); + return ATInterstitialAdWrapper.hasInterstitialAdReady(placementId); + } + + public void showInterstitialAd(string placementId, string mapJson) { + Debug.Log("Unity: ATInterstitialAdClient::showInterstitialAd()"); + ATInterstitialAdWrapper.showInterstitialAd(placementId, mapJson); + } + + public void cleanCache(string placementId) { + Debug.Log("Unity: ATInterstitialAdClient::cleanCache()"); + ATInterstitialAdWrapper.clearCache(placementId); + } + + public string checkAdStatus(string placementId) { + Debug.Log("Unity: ATInterstitialAdClient::checkAdStatus()"); + return ATInterstitialAdWrapper.checkAdStatus(placementId); + } + + public string getValidAdCaches(string placementId) + { + Debug.Log("Unity: ATInterstitialAdClient::getValidAdCaches()"); + return ATInterstitialAdWrapper.getValidAdCaches(placementId); + } + + public void entryScenarioWithPlacementID(string placementId, string scenarioID){ + Debug.Log("Unity: ATInterstitialAdClient::entryScenarioWithPlacementID()"); + ATInterstitialAdWrapper.entryScenarioWithPlacementID(placementId,scenarioID); + } + + + //Callbacks + public void OnInterstitialAdLoaded(string placementID) { + Debug.Log("onInterstitialAdLoaded...unity3d."); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementID)); + } + + public void OnInterstitialAdLoadFailure(string placementID, string code, string error) { + Debug.Log("onInterstitialAdFailed...unity3d."); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, error, code)); + } + + public void OnInterstitialAdVideoPlayFailure(string placementID, string code, string error) { + Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdVideoPlayFailure()"); + onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, error, code)); + } + + public void OnInterstitialAdVideoPlayStart(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdPlayStart()"); + onAdVideoStartEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson)); + } + + public void OnInterstitialAdVideoPlayEnd(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdVideoPlayEnd()"); + onAdVideoEndEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson)); + } + + public void OnInterstitialAdShow(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdShow()"); + onAdShowEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson)); + } + + public void OnInterstitialAdFailedToShow(string placementID) { + Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdFailedToShow()"); + onAdShowFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, "Failed to show video ad", "-1")); + } + + public void OnInterstitialAdClick(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdClick()"); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson)); + } + + public void OnInterstitialAdClose(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdClose()"); + onAdCloseEvent?.Invoke(this, new ATAdEventArgs(placementID, callbackJson)); + } + + //auto callbacks + public void startLoadingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATInterstitialAdClient::startLoadingADSource()"); + onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void finishLoadingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATInterstitialAdClient::finishLoadingADSource()"); + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void failToLoadADSource(string placementId, string callbackJson,string code, string error) + { + Debug.Log("Unity: ATInterstitialAdClient::failToLoadADSource()"); + onAdSourceLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error)); + } + public void startBiddingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATInterstitialAdClient::startBiddingADSource()"); + onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void finishBiddingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATInterstitialAdClient::finishBiddingADSource()"); + onAdSourceBiddingFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void failBiddingADSource(string placementId,string callbackJson, string code, string error) + { + Debug.Log("Unity: ATInterstitialAdClient::failBiddingADSource()"); + onAdSourceBiddingFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error)); + } + + // Auto + public void addAutoLoadAdPlacementID(string[] placementIDList) + { + Debug.Log("Unity: ATInterstitialAdClient:addAutoLoadAdPlacementID()"); + + + + if (placementIDList != null && placementIDList.Length > 0) + { + foreach (string placementID in placementIDList) + { + ATInterstitialAdWrapper.setClientForPlacementID(placementID, this); + } + + string placementIDListString = JsonMapper.ToJson(placementIDList); + ATInterstitialAdWrapper.addAutoLoadAdPlacementID(placementIDListString); + Debug.Log("addAutoLoadAdPlacementID, placementIDList === " + placementIDListString); + } + else + { + Debug.Log("addAutoLoadAdPlacementID, placementIDList = null"); + } + + } + + public void removeAutoLoadAdPlacementID(string placementId) + { + Debug.Log("Unity: ATInterstitialAdClient:removeAutoLoadAdPlacementID()"); + ATInterstitialAdWrapper.removeAutoLoadAdPlacementID(placementId); + } + + public bool autoLoadInterstitialAdReadyForPlacementID(string placementId) + { + Debug.Log("Unity: ATInterstitialAdClient:autoLoadInterstitialAdReadyForPlacementID()"); + return ATInterstitialAdWrapper.autoLoadInterstitialAdReadyForPlacementID(placementId); + } + public string getAutoValidAdCaches(string placementId) + { + Debug.Log("Unity: ATInterstitialAdClient:getAutoValidAdCaches()"); + return ATInterstitialAdWrapper.getAutoValidAdCaches(placementId); + } + + public string checkAutoAdStatus(string placementId) { + Debug.Log("Unity: ATInterstitialAdClient::checkAutoAdStatus()"); + return ATInterstitialAdWrapper.checkAutoAdStatus(placementId); + } + + + public void setAutoLocalExtra(string placementId, string mapJson) + { + Debug.Log("Unity: ATInterstitialAdClient:setAutoLocalExtra()"); + ATInterstitialAdWrapper.setAutoLocalExtra(placementId, mapJson); + } + public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID) + { + Debug.Log("Unity: ATInterstitialAdClient:entryAutoAdScenarioWithPlacementID()"); + ATInterstitialAdWrapper.entryAutoAdScenarioWithPlacementID(placementId, scenarioID); + } + public void showAutoAd(string placementId, string mapJson) + { + Debug.Log("Unity: ATInterstitialAdClient::showAutoAd()"); + ATInterstitialAdWrapper.showAutoInterstitialAd(placementId, mapJson); + } + + + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/ATInterstitialAdClient.cs.meta b/Assets/AnyThinkAds/Platform/iOS/ATInterstitialAdClient.cs.meta new file mode 100644 index 0000000..3bd80f7 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATInterstitialAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b16f7157dd7a84fbfa1a693d79e37e3e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/ATNativeAdClient.cs b/Assets/AnyThinkAds/Platform/iOS/ATNativeAdClient.cs new file mode 100644 index 0000000..435e94c --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATNativeAdClient.cs @@ -0,0 +1,182 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Common; +using AnyThinkAds.Api; +using AnyThinkAds.iOS; +using AnyThinkAds.ThirdParty.LitJson; +#pragma warning disable 0067 +namespace AnyThinkAds.iOS { + public class ATNativeAdClient : IATNativeAdClient { + + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdImpressEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdVideoProgressEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + + private ATNativeAdListener mlistener; + public void loadNativeAd(string placementId, string mapJson) { + Debug.Log("Unity:ATNativeAdClient::loadNativeAd()"); + ATNativeAdWrapper.setClientForPlacementID(placementId, this); + ATNativeAdWrapper.loadNativeAd(placementId, mapJson); + } + + public void setLocalExtra (string placementId,string localExtra){ + + } + + public bool hasAdReady(string placementId) { + Debug.Log("Unity:ATNativeAdClient::hasAdReady()"); + return ATNativeAdWrapper.isNativeAdReady(placementId); + } + + public string checkAdStatus(string placementId) { + Debug.Log("Unity: ATNativeAdClient::checkAdStatus()"); + return ATNativeAdWrapper.checkAdStatus(placementId); + } + + public void entryScenarioWithPlacementID(string placementId, string scenarioID){ + + Debug.Log("Unity: ATNativeAdClient::entryScenarioWithPlacementID()"); + ATNativeAdWrapper.entryScenarioWithPlacementID(placementId,scenarioID); + } + + + public string getValidAdCaches(string placementId) + { + Debug.Log("Unity: ATNativeAdClient::getValidAdCaches()"); + return ATNativeAdWrapper.getValidAdCaches(placementId); + } + + public void setListener(ATNativeAdListener listener) { + Debug.Log("Unity:ATNativeAdClient::setListener()"); + mlistener = listener; + } + + public void renderAdToScene(string placementId, ATNativeAdView anyThinkNativeAdView) { + Debug.Log("Unity:ATNativeAdClient::renderAdToScene()"); + ATNativeAdWrapper.showNativeAd(placementId, anyThinkNativeAdView.toJSON()); + } + + public void renderAdToScene(string placementId, ATNativeAdView anyThinkNativeAdView, string mapJson) { + Debug.Log("Unity:ATNativeAdClient::renderAdToScene()"); + ATNativeAdWrapper.showNativeAd(placementId, anyThinkNativeAdView.toJSON(), mapJson); + } + + public void cleanAdView(string placementId, ATNativeAdView anyThinkNativeAdView) { + Debug.Log("Unity:ATNativeAdClient::cleanAdView()"); + ATNativeAdWrapper.removeNativeAdView(placementId); + } + + public void onApplicationForces(string placementId, ATNativeAdView anyThinkNativeAdView) { + Debug.Log("Unity:ATNativeAdClient::onApplicationForces()"); + } + + public void onApplicationPasue(string placementId, ATNativeAdView anyThinkNativeAdView) { + Debug.Log("Unity:ATNativeAdClient::onApplicationPasue()"); + } + + public void cleanCache(string placementId) { + Debug.Log("Unity:ATNativeAdClient::cleanCache()"); + ATNativeAdWrapper.clearCache(); + } + + //Callbacks + public void onAdImpressed(string placementId, string callbackJson) { + Debug.Log("Unity:ATNativeAdClient::onAdImpressed...unity3d."); + + onAdImpressEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + + public void onAdClicked(string placementId, string callbackJson) { + Debug.Log("Unity:ATNativeAdClient::onAdClicked...unity3d."); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + + public void onAdCloseButtonClicked(string placementId, string callbackJson) + { + Debug.Log("Unity:ATNativeAdClient::onAdCloseButtonClicked...unity3d."); + onAdCloseEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + + public void onAdVideoStart(string placementId) { + Debug.Log("Unity:ATNativeAdClient::onAdVideoStart...unity3d."); + onAdVideoStartEvent?.Invoke(this, new ATAdEventArgs(placementId)); + + } + + public void onAdVideoEnd(string placementId) { + Debug.Log("Unity:ATNativeAdClient::onAdVideoEnd...unity3d."); + onAdVideoEndEvent?.Invoke(this, new ATAdEventArgs(placementId,"")); + } + + public void onAdVideoProgress(string placementId,int progress) { + Debug.Log("Unity:ATNativeAdClient::onAdVideoProgress...progress[" + progress + "]"); + onAdVideoProgressEvent?.Invoke(this, new ATAdProgressEventArgs(placementId,"",progress)); + } + + public void onNativeAdLoaded(string placementId) { + Debug.Log("Unity:ATNativeAdClient::onNativeAdLoaded...unity3d."); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementId,"")); + + } + + public void onNativeAdLoadFail(string placementId,string code, string msg) { + Debug.Log("Unity:ATNativeAdClient::onNativeAdLoadFail...unity3d. code:" + code + " msg:" + msg); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId,code,msg)); + } + + //auto callbacks + public void startLoadingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATNativeAdClient::startLoadingADSource()"); + onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + } + public void finishLoadingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATNativeAdClient::finishLoadingADSource()"); + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + public void failToLoadADSource(string placementId,string callbackJson, string code, string error) + { + Debug.Log("Unity: ATNativeAdClient::failToLoadADSource()"); + onAdSourceLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId,code,error)); + + } + public void startBiddingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATNativeAdClient::startBiddingADSource()"); + onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + public void finishBiddingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATNativeAdClient::finishBiddingADSource()"); + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + + public void failBiddingADSource(string placementId,string callbackJson, string code, string error) + { + Debug.Log("Unity: ATNativeAdClient::failBiddingADSource()"); + onAdSourceBiddingFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId,callbackJson,code,error)); + + } + + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/ATNativeAdClient.cs.meta b/Assets/AnyThinkAds/Platform/iOS/ATNativeAdClient.cs.meta new file mode 100644 index 0000000..2af069d --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATNativeAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c3f95e41f96d41ff9911a95ecbbabbb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/ATNativeBannerAdClient.cs b/Assets/AnyThinkAds/Platform/iOS/ATNativeBannerAdClient.cs new file mode 100644 index 0000000..db1c297 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATNativeBannerAdClient.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using AnyThinkAds.Common; +using AnyThinkAds.Api; +#pragma warning disable 0067 +namespace AnyThinkAds.iOS +{ + public class ATNativeBannerAdClient : IATNativeBannerAdClient + { + + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdImpressEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdVideoProgressEvent; + public event EventHandler onAdCloseEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + private ATNativeBannerAdListener listener; + public void loadAd(string placementId, string mapJson) { + Debug.Log("ATNativeBannerAdClient::loadAd()"); + ATNativeBannerAdWrapper.setClientForPlacementID(placementId, this); + Debug.Log("ATNativeBannerAdClient::loadAd(), after set client"); + ATNativeBannerAdWrapper.loadAd(placementId, mapJson); + Debug.Log("ATNativeBannerAdClient::loadAd(), after invoke load ad"); + } + + public bool adReady(string placementId) { + Debug.Log("ATNativeBannerAdClient::adReady()"); + return ATNativeBannerAdWrapper.adReady(placementId); + } + + public void setListener(ATNativeBannerAdListener listener) { + Debug.Log("ATNativeBannerAdClient::setListener()"); + this.listener = listener; + } + + public void showAd(string placementId, ATRect rect, Dictionary pairs) { + Debug.Log("ATNativeBannerAdClient::showAd()"); + ATNativeBannerAdWrapper.showAd(placementId, rect, pairs); + } + + public void removeAd(string placementId) { + Debug.Log("ATNativeBannerAdClient::removeAd()"); + ATNativeBannerAdWrapper.removeAd(placementId); + } + + //Listener method(s) + public void onAdLoaded(string placementId) { + Debug.Log("ATNativeBannerAdClient::onAdLoaded()"); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementId)); + } + + public void onAdLoadFail(string placementId, string code, string message) { + Debug.Log("ATNativeBannerAdClient::onAdLoadFail()"); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, "", code, message)); + + } + + public void onAdImpressed(string placementId, string callbackJson) { + Debug.Log("ATNativeBannerAdClient::onAdImpressed()"); + onAdImpressEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + + public void onAdClicked(string placementId, string callbackJson) { + Debug.Log("ATNativeBannerAdClient::onAdClicked()"); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + } + + public void onAdAutoRefresh(string placementId, string callbackJson) { + Debug.Log("ATNativeBannerAdClient::onAdAutoRefresh()"); + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId,callbackJson)); + + } + + public void onAdAutoRefreshFailure(string placementId, string code, string message) { + Debug.Log("ATNativeBannerAdClient::onAdAutoRefreshFailure()"); + onAdSourceLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, "", code, message)); + + } + + public void onAdCloseButtonClicked(string placementId) { + Debug.Log("ATNativeBannerAdClient::onAdCloseButtonClicked()"); + onAdCloseEvent?.Invoke(this, new ATAdEventArgs(placementId)); + + } + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/ATNativeBannerAdClient.cs.meta b/Assets/AnyThinkAds/Platform/iOS/ATNativeBannerAdClient.cs.meta new file mode 100644 index 0000000..c2f6668 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATNativeBannerAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56333631c280443b98fed2a60d160ec6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/ATRewardedVideoAdClient.cs b/Assets/AnyThinkAds/Platform/iOS/ATRewardedVideoAdClient.cs new file mode 100644 index 0000000..cede10b --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATRewardedVideoAdClient.cs @@ -0,0 +1,259 @@ +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 ATRewardedVideoAdClient : IATRewardedVideoAdClient { + + public event EventHandler onAdLoadEvent; + public event EventHandler onAdLoadFailureEvent; + public event EventHandler onAdVideoStartEvent; + public event EventHandler onAdVideoEndEvent; + public event EventHandler onAdVideoFailureEvent; + public event EventHandler onAdVideoCloseEvent; + public event EventHandler onAdClickEvent; + public event EventHandler onRewardEvent; + public event EventHandler onAdSourceAttemptEvent; + public event EventHandler onAdSourceFilledEvent; + public event EventHandler onAdSourceLoadFailureEvent; + public event EventHandler onAdSourceBiddingAttemptEvent; + public event EventHandler onAdSourceBiddingFilledEvent; + public event EventHandler onAdSourceBiddingFailureEvent; + public event EventHandler onPlayAgainStart; + public event EventHandler onPlayAgainEnd; + public event EventHandler onPlayAgainFailure; + public event EventHandler onPlayAgainClick; + public event EventHandler onPlayAgainReward; + + private ATRewardedVideoListener anyThinkListener; + + public void addsetting (string placementId,string json){ + //todo... + } + public void setListener(ATRewardedVideoListener listener) { + Debug.Log("Unity: ATRewardedVideoAdClient::setListener()"); + anyThinkListener = listener; + } + + public void loadVideoAd(string placementId, string mapJson) { + Debug.Log("Unity: ATRewardedVideoAdClient::loadVideoAd()"); + ATRewardedVideoWrapper.setClientForPlacementID(placementId, this); + ATRewardedVideoWrapper.loadRewardedVideo(placementId, mapJson); + } + + public bool hasAdReady(string placementId) { + Debug.Log("Unity: ATRewardedVideoAdClient::hasAdReady()"); + return ATRewardedVideoWrapper.isRewardedVideoReady(placementId); + } + + //To be implemented + public void setUserData(string placementId, string userId, string customData) { + Debug.Log("Unity: ATRewardedVideoAdClient::setUserData()"); + } + + public void showAd(string placementId, string mapJson) { + Debug.Log("Unity: ATRewardedVideoAdClient::showAd()"); + ATRewardedVideoWrapper.showRewardedVideo(placementId, mapJson); + } + + public void cleanAd(string placementId) { + Debug.Log("Unity: ATRewardedVideoAdClient::cleanAd()"); + ATRewardedVideoWrapper.clearCache(); + } + + public void onApplicationForces(string placementId) { + Debug.Log("Unity: ATRewardedVideoAdClient::onApplicationForces()"); + } + + public void onApplicationPasue(string placementId) { + Debug.Log("Unity: ATRewardedVideoAdClient::onApplicationPasue()"); + } + + public string checkAdStatus(string placementId) { + Debug.Log("Unity: ATRewardedVideoAdClient::checkAdStatus()"); + return ATRewardedVideoWrapper.checkAdStatus(placementId); + } + + public void entryScenarioWithPlacementID(string placementId, string scenarioID){ + Debug.Log("Unity: ATRewardedVideoAdClient::entryScenarioWithPlacementID()"); + ATRewardedVideoWrapper.entryScenarioWithPlacementID(placementId,scenarioID); + } + + public string getValidAdCaches(string placementId) + { + Debug.Log("Unity: ATRewardedVideoAdClient::getValidAdCaches()"); + return ATRewardedVideoWrapper.getValidAdCaches(placementId); + } + + // Auto + public void addAutoLoadAdPlacementID(string[] placementIDList) + { + Debug.Log("Unity: ATRewardedVideoAdClient:addAutoLoadAdPlacementID()"); + + if (placementIDList != null && placementIDList.Length > 0) + { + foreach (string placementID in placementIDList) + { + ATRewardedVideoWrapper.setClientForPlacementID(placementID, this); + } + + string placementIDListString = JsonMapper.ToJson(placementIDList); + ATRewardedVideoWrapper.addAutoLoadAdPlacementID(placementIDListString); + Debug.Log("addAutoLoadAdPlacementID, placementIDList === " + placementIDListString); + } + else + { + Debug.Log("addAutoLoadAdPlacementID, placementIDList = null"); + } + } + + public void removeAutoLoadAdPlacementID(string placementId) + { + Debug.Log("Unity: ATRewardedVideoAdClient:removeAutoLoadAdPlacementID()"); + ATRewardedVideoWrapper.removeAutoLoadAdPlacementID(placementId); + } + + public bool autoLoadRewardedVideoReadyForPlacementID(string placementId) + { + Debug.Log("Unity: ATRewardedVideoAdClient:autoLoadRewardedVideoReadyForPlacementID()"); + return ATRewardedVideoWrapper.autoLoadRewardedVideoReadyForPlacementID(placementId); + } + public string getAutoValidAdCaches(string placementId) + { + Debug.Log("Unity: ATRewardedVideoAdClient:getAutoValidAdCaches()"); + return ATRewardedVideoWrapper.getAutoValidAdCaches(placementId); + } + public string checkAutoAdStatus(string placementId) { + Debug.Log("Unity: ATRewardedVideoAdClient::checkAutoAdStatus()"); + return ATRewardedVideoWrapper.checkAutoAdStatus(placementId); + } + + public void setAutoLocalExtra(string placementId, string mapJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient:setAutoLocalExtra()"); + ATRewardedVideoWrapper.setAutoLocalExtra(placementId, mapJson); + } + public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID) + { + Debug.Log("Unity: ATRewardedVideoAdClient:entryAutoAdScenarioWithPlacementID()"); + ATRewardedVideoWrapper.entryAutoAdScenarioWithPlacementID(placementId, scenarioID); + } + public void showAutoAd(string placementId, string mapJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient::showAutoAd()"); + ATRewardedVideoWrapper.showAutoRewardedVideo(placementId, mapJson); + } + + //auto callbacks + public void startLoadingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient::startLoadingADSource()"); + onAdSourceAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void finishLoadingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient::finishLoadingADSource()"); + onAdSourceFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void failToLoadADSource(string placementId, string callbackJson,string code, string error) + { + Debug.Log("Unity: ATRewardedVideoAdClient::failToLoadADSource()"); + onAdSourceLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error)); + } + public void startBiddingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient::startBiddingADSource()"); + onAdSourceBiddingAttemptEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void finishBiddingADSource(string placementId, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient::finishBiddingADSource()"); + onAdSourceBiddingFilledEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + public void failBiddingADSource(string placementId, string callbackJson,string code, string error) + { + Debug.Log("Unity: ATRewardedVideoAdClient::failBiddingADSource()"); + onAdSourceBiddingFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, callbackJson, code, error)); + } + + //Callbacks + public void onRewardedVideoAdLoaded(string placementId) { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdLoaded()"); + onAdLoadEvent?.Invoke(this, new ATAdEventArgs(placementId)); + } + + public void onRewardedVideoAdFailed(string placementId, string code, string error) { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdFailed()"); + onAdLoadFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code)); + } + + public void onRewardedVideoAdPlayStart(string placementId, string callbackJson) { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdPlayStart()"); + onAdVideoStartEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onRewardedVideoAdPlayEnd(string placementId, string callbackJson) { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdPlayEnd()"); + onAdVideoEndEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onRewardedVideoAdPlayFailed(string placementId, string code, string error) { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdPlayFailed()"); + onAdVideoFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code)); + } + + public void onRewardedVideoAdClosed(string placementId, bool isRewarded, string callbackJson) { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdClosed()"); + onAdVideoCloseEvent?.Invoke(this, new ATAdRewardEventArgs(placementId, callbackJson, isRewarded)); + } + + public void onRewardedVideoAdPlayClicked(string placementId, string callbackJson) { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdPlayClicked()"); + onAdClickEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onRewardedVideoReward(string placementId, string callbackJson) { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoReward()"); + onRewardEvent?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + //--------again callback------- + public void onRewardedVideoAdAgainPlayStart(string placementId, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdAgainPlayStart()"); + onPlayAgainStart?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + public void onRewardedVideoAdAgainPlayEnd(string placementId, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdAgainPlayEnd()"); + onPlayAgainEnd?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + + public void onRewardedVideoAdAgainPlayFailed(string placementId, string code, string error) + { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdAgainPlayFailed()"); + onPlayAgainFailure?.Invoke(this, new ATAdErrorEventArgs(placementId, error, code)); + } + + + public void onRewardedVideoAdAgainPlayClicked(string placementId, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient::onRewardedVideoAdAgainPlayClicked()"); + onPlayAgainClick?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + + public void onAgainReward(string placementId, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoAdClient::onAgainReward()"); + onPlayAgainReward?.Invoke(this, new ATAdEventArgs(placementId, callbackJson)); + } + + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/ATRewardedVideoAdClient.cs.meta b/Assets/AnyThinkAds/Platform/iOS/ATRewardedVideoAdClient.cs.meta new file mode 100644 index 0000000..71bc8fe --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATRewardedVideoAdClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d7cd2abf09bb54cdca25de4b6f4e4375 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/ATSDKAPIClient.cs b/Assets/AnyThinkAds/Platform/iOS/ATSDKAPIClient.cs new file mode 100644 index 0000000..d7a544e --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATSDKAPIClient.cs @@ -0,0 +1,181 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AnyThinkAds.Common; +using AnyThinkAds.Api; +using AOT; +using System; +using AnyThinkAds.ThirdParty.LitJson; + +namespace AnyThinkAds.iOS { + public class ATSDKAPIClient : IATSDKAPIClient { + static private ATGetUserLocationListener locationListener; + static private ATGetAreaListener areaListener; + + public ATSDKAPIClient () { + Debug.Log("Unity:ATSDKAPIClient::ATSDKAPIClient()"); + } + public void initSDK(string appId, string appKey) { + Debug.Log("Unity:ATSDKAPIClient::initSDK(string, string)"); + initSDK(appId, appKey, null); + } + + public void initSDK(string appId, string appKey, ATSDKInitListener listener) { + Debug.Log("Unity:ATSDKAPIClient::initSDK(string, string, ATSDKInitListener)"); + bool started = ATManager.StartSDK(appId, appKey); + if (listener != null) + { + if (started) + { + listener.initSuccess(); + } + else + { + listener.initFail("Failed to init."); + } + } + } + + [MonoPInvokeCallback(typeof(Func))] + static public int DidGetUserLocation(string location) + { + if (locationListener != null) { locationListener.didGetUserLocation(Int32.Parse(location)); } + return 0; + } + + [MonoPInvokeCallback(typeof(Func))] + static public int GetAreaInfo(string msg) + { + Debug.Log("Unity:ATSDKAPIClient::GetAreaInfo(" + msg + ")"); + if (areaListener != null) + { + JsonData msgJsonData = JsonMapper.ToObject(msg); + IDictionary idic = (System.Collections.IDictionary)msgJsonData; + + if (idic.Contains("areaCode")) { + string areaCode = (string)msgJsonData["areaCode"]; + Debug.Log("Unity:ATSDKAPIClient::GetAreaInfo::areaCode(" + areaCode + ")"); + areaListener.onArea(areaCode); + } + + if (idic.Contains("errorMsg")) { + string errorMsg = (string)msgJsonData["errorMsg"]; + Debug.Log("Unity:ATSDKAPIClient::GetAreaInfo::errorMsg(" + errorMsg + ")"); + areaListener.onError(errorMsg); + } + } + return 0; + } + + public void getUserLocation(ATGetUserLocationListener listener) + { + Debug.Log("Unity:ATSDKAPIClient::getUserLocation()"); + ATSDKAPIClient.locationListener = listener; + ATManager.getUserLocation(DidGetUserLocation); + } + + public void setGDPRLevel(int level) { + Debug.Log("Unity:ATSDKAPIClient::setGDPRLevel()"); + ATManager.SetDataConsent(level); + } + + public void showGDPRAuth() { + Debug.Log("Unity:ATSDKAPIClient::showGDPRAuth()"); + ATManager.ShowGDPRAuthDialog(); + } + + public void setPurchaseFlag() { + ATManager.setPurchaseFlag(); + } + + public void clearPurchaseFlag() { + ATManager.clearPurchaseFlag(); + } + + public bool purchaseFlag() { + return ATManager.purchaseFlag(); + } + + public void addNetworkGDPRInfo(int networkType, string mapJson) { + Debug.Log("Unity:ATSDKAPIClient::addNetworkGDPRInfo()"); + ATManager.SetNetworkGDPRInfo(networkType, mapJson); + } + + public void setChannel(string channel) + { + ATManager.setChannel(channel); + } + + public void setSubChannel(string subchannel) + { + ATManager.setSubChannel(subchannel); + } + + public void initCustomMap(string jsonMap) + { + ATManager.setCustomMap(jsonMap); + } + + public void setCustomDataForPlacementID(string customData, string placementID) + { + ATManager.setCustomDataForPlacementID(customData, placementID); + } + + public void setLogDebug(bool isDebug) + { + ATManager.setLogDebug(isDebug); + } + + public int getGDPRLevel() + { + return ATManager.GetDataConsent(); + } + + public bool isEUTraffic() + { + return ATManager.isEUTraffic(); + } + + public void deniedUploadDeviceInfo(string deniedInfo) + { + ATManager.deniedUploadDeviceInfo(deniedInfo); + } + + public void setExcludeBundleIdArray(string bundleIds) + { + Debug.Log("Unity:ATSDKAPIClient::setExcludeBundleIdArray()"); + ATManager.setExcludeBundleIdArray(bundleIds); + } + + public void setExcludeAdSourceIdArrayForPlacementID(string placementID, string adSourceIds) + { + Debug.Log("Unity:ATSDKAPIClient::setExcludeAdSourceIdArrayForPlacementID()"); + ATManager.setExcludeAdSourceIdArrayForPlacementID(placementID, adSourceIds); + } + + public void setSDKArea(int area) + { + Debug.Log("Unity:ATSDKAPIClient::setSDKArea()"); + ATManager.setSDKArea(area); + } + + public void getArea(ATGetAreaListener listener) + { + Debug.Log("Unity:ATSDKAPIClient::getArea()"); + ATSDKAPIClient.areaListener = listener; + ATManager.getArea(GetAreaInfo); + } + + public void setWXStatus(bool install) + { + Debug.Log("Unity:ATSDKAPIClient::setWXStatus()"); + ATManager.setWXStatus(install); + } + + public void setLocation(double longitude, double latitude) + { + Debug.Log("Unity:ATSDKAPIClient::setLocation()"); + ATManager.setLocation(longitude, latitude); + } + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/ATSDKAPIClient.cs.meta b/Assets/AnyThinkAds/Platform/iOS/ATSDKAPIClient.cs.meta new file mode 100644 index 0000000..f6f488f --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/ATSDKAPIClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91865ac680a7f418dbed624b52784e38 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal.meta b/Assets/AnyThinkAds/Platform/iOS/Internal.meta new file mode 100644 index 0000000..4079da8 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4787b4f73b23449fa906f342dfca1d00 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C.meta new file mode 100644 index 0000000..b80f479 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bd4b39134d1e64f1c9672717d4878e58 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.h new file mode 100644 index 0000000..17ab2a9 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.h @@ -0,0 +1,27 @@ +// +// ATAutolayoutCategories.h +// ATSDKDemo +// +// Created by Martin Lau on 24/04/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import + +@interface UIView(Autolayout) ++(instancetype) autolayoutView; +- (NSArray<__kindof NSLayoutConstraint *> *)addConstraintsWithVisualFormat:(NSString *)format options:(NSLayoutFormatOptions)opts metrics:(NSDictionary *)metrics views:(NSDictionary *)views; +-(NSLayoutConstraint*)addConstraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1 relatedBy:(NSLayoutRelation)relation toItem:(id)view2 attribute:(NSLayoutAttribute)attr2 multiplier:(CGFloat)multiplier constant:(CGFloat)c; +@end + +@interface UILabel(Autolayout) ++(instancetype) autolayoutLabelFont:(UIFont*)font textColor:(UIColor*)textColor textAlignment:(NSTextAlignment)textAlignment; +/** + * textAlignment defaults to NSTextAlignmentLeft + */ ++(instancetype) autolayoutLabelFont:(UIFont*)font textColor:(UIColor*)textColor; +@end + +@interface UIButton(Autolayout) ++(instancetype) autolayoutButtonWithType:(UIButtonType)type; +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.h.meta new file mode 100644 index 0000000..eb603a9 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 006a9c4ef70b04aef9da361757c85f85 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.m b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.m new file mode 100644 index 0000000..28f3856 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.m @@ -0,0 +1,52 @@ +// +// ATAutolayoutCategories.m +// ATSDKDemo +// +// Created by Martin Lau on 24/04/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import "ATAutolayoutCategories.h" + +@implementation UIView(Autolayout) ++(instancetype) autolayoutView { + UIView *view = [[self alloc] init]; + view.translatesAutoresizingMaskIntoConstraints = NO; + return view; +} + +- (NSArray<__kindof NSLayoutConstraint *> *)addConstraintsWithVisualFormat:(NSString *)format options:(NSLayoutFormatOptions)opts metrics:(NSDictionary *)metrics views:(NSDictionary *)views { + NSArray<__kindof NSLayoutConstraint*>* constraints = [NSLayoutConstraint constraintsWithVisualFormat:format options:opts metrics:metrics views:views]; + [self addConstraints:constraints]; + return constraints; +} + +-(NSLayoutConstraint*)addConstraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1 relatedBy:(NSLayoutRelation)relation toItem:(id)view2 attribute:(NSLayoutAttribute)attr2 multiplier:(CGFloat)multiplier constant:(CGFloat)c { + NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view1 attribute:attr1 relatedBy:relation toItem:view2 attribute:attr2 multiplier:multiplier constant:c]; + [self addConstraint:constraint]; + return constraint; +} +@end + +@implementation UILabel(Autolayout) ++(instancetype) autolayoutLabelFont:(UIFont*)font textColor:(UIColor*)textColor textAlignment:(NSTextAlignment)textAlignment { + UILabel *label = [UILabel autolayoutView]; + label.translatesAutoresizingMaskIntoConstraints = NO; + label.font = font; + label.textColor = textColor; + label.textAlignment = textAlignment; + return label; +} + ++(instancetype) autolayoutLabelFont:(UIFont*)font textColor:(UIColor*)textColor { + return [self autolayoutLabelFont:font textColor:textColor textAlignment:NSTextAlignmentLeft]; +} +@end + +@implementation UIButton(Autolayout) ++(instancetype) autolayoutButtonWithType:(UIButtonType)type { + UIButton *button = [UIButton buttonWithType:type]; + button.translatesAutoresizingMaskIntoConstraints = NO; + return button; +} +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.m.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.m.meta new file mode 100644 index 0000000..f583df9 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATAutolayoutCategories.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: e2fe4e1278a9f407e9bf696affcfc594 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.h new file mode 100644 index 0000000..7029c19 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.h @@ -0,0 +1,13 @@ +// +// ATBannerAdWrapper.h +// UnityContainer +// +// Created by Martin Lau on 2019/1/8. +// Copyright © 2019 Martin Lau. All rights reserved. +// + +#import "ATBaseUnityWrapper.h" + +@interface ATBannerAdWrapper : ATBaseUnityWrapper + +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.h.meta new file mode 100644 index 0000000..e14f995 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 11af4b916b2164725bf8a13dd2fbdb37 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.m b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.m new file mode 100644 index 0000000..bae3914 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.m @@ -0,0 +1,263 @@ +// +// ATBannerAdWrapper.m +// UnityContainer +// +// Created by Martin Lau on 2019/1/8. +// Copyright © 2019 Martin Lau. All rights reserved. +// + +#import "ATBannerAdWrapper.h" +#import +#import "ATUnityUtilities.h" +//5.6.6版本以上支持 admob 自适应banner (用到时再import该头文件) +//#import + +@interface ATBannerAdWrapper() +@property(nonatomic, readonly) NSMutableDictionary *bannerViewStorage; +@property(nonatomic, readonly) BOOL interstitialOrRVBeingShown; +@end + +static NSString *kATBannerSizeUsesPixelFlagKey = @"uses_pixel"; +static NSString *kATBannerAdLoadingExtraInlineAdaptiveWidthKey = @"inline_adaptive_width"; +static NSString *kATBannerAdLoadingExtraInlineAdaptiveOrientationKey = @"inline_adaptive_orientation"; + +@implementation ATBannerAdWrapper ++(instancetype)sharedInstance { + static ATBannerAdWrapper *sharedInstance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedInstance = [[ATBannerAdWrapper alloc] init]; + }); + return sharedInstance; +} + +-(instancetype) init { + self = [super init]; + if (self != nil) { + _bannerViewStorage = [NSMutableDictionary dictionary]; + } + return self; +} + +-(NSString*) scriptWrapperClass { + return @"ATBannerAdWrapper"; +} + +- (id)selWrapperClassWithDict:(NSDictionary *)dict callback:(void(*)(const char*, const char*))callback { + NSString *selector = dict[@"selector"]; + NSArray* arguments = dict[@"arguments"]; + NSString *firstObject = @""; + NSString *secondObject = @""; + NSString *lastObject = @""; + if (![ATUnityUtilities isEmpty:arguments]) { + for (int i = 0; i < arguments.count; i++) { + if (i == 0) { firstObject = arguments[i]; } + else if (i == 1) { secondObject = arguments[i]; } + else { lastObject = arguments[i]; } + } + } + + if ([selector isEqualToString:@"loadBannerAdWithPlacementID:customDataJSONString:callback:"]) { + [self loadBannerAdWithPlacementID:firstObject customDataJSONString:secondObject callback:callback]; + } else if ([selector isEqualToString:@"showBannerAdWithPlacementID:rect:extraJsonString:"]) { + [self showBannerAdWithPlacementID:firstObject rect:secondObject extraJsonString:lastObject]; + } else if ([selector isEqualToString:@"removeBannerAdWithPlacementID:"]) { + [self removeBannerAdWithPlacementID:firstObject]; + } else if ([selector isEqualToString:@"showBannerAdWithPlacementID:"]) { + [self showBannerAdWithPlacementID:firstObject]; + } else if ([selector isEqualToString:@"hideBannerAdWithPlacementID:"]) { + [self hideBannerAdWithPlacementID:firstObject]; + } else if ([selector isEqualToString:@"checkAdStatus:"]) { + return [self checkAdStatus:firstObject]; + } else if ([selector isEqualToString:@"clearCache"]) { + [self clearCache]; + } else if ([selector isEqualToString:@"getValidAdCaches:"]) { + return [self getValidAdCaches:firstObject]; + } + return nil; +} + +-(void) loadBannerAdWithPlacementID:(NSString*)placementID customDataJSONString:(NSString*)customDataJSONString callback:(void(*)(const char*, const char*))callback { + [self setCallBack:callback forKey:placementID]; + NSMutableDictionary *extra = [NSMutableDictionary dictionary]; + if ([customDataJSONString isKindOfClass:[NSString class]] && [customDataJSONString length] > 0) { + NSDictionary *extraDict = [NSJSONSerialization JSONObjectWithData:[customDataJSONString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + NSLog(@"extraDict = %@", extraDict); + CGFloat scale = [extraDict[kATBannerSizeUsesPixelFlagKey] boolValue] ? [UIScreen mainScreen].nativeScale : 1.0f; + if ([extraDict[kATAdLoadingExtraBannerAdSizeKey] isKindOfClass:[NSString class]] && [[extraDict[kATAdLoadingExtraBannerAdSizeKey] componentsSeparatedByString:@"x"] count] == 2) { + NSArray* com = [extraDict[kATAdLoadingExtraBannerAdSizeKey] componentsSeparatedByString:@"x"]; + + extra[kATAdLoadingExtraBannerAdSizeKey] = [NSValue valueWithCGSize:CGSizeMake([com[0] doubleValue] / scale, [com[1] doubleValue] / scale)]; + } + +// // admob 自适应banner,5.6.6版本以上支持 +// if (extraDict[kATBannerAdLoadingExtraInlineAdaptiveWidthKey] != nil && extraDict[kATBannerAdLoadingExtraInlineAdaptiveOrientationKey] != nil) { +// //GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth 自适应 +// //GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth 竖屏 +// //GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth 横屏 +// CGFloat admobBannerWidth = [extraDict[kATBannerAdLoadingExtraInlineAdaptiveWidthKey] doubleValue]; +// GADAdSize admobSize; +// if ([extraDict[kATBannerAdLoadingExtraInlineAdaptiveOrientationKey] integerValue] == 1) { +// admobSize = GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(admobBannerWidth); +// } else if ([extraDict[kATBannerAdLoadingExtraInlineAdaptiveOrientationKey] integerValue] == 2) { +// admobSize = GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(admobBannerWidth); +// } else { +// admobSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(admobBannerWidth); +// } +// +// extra[kATAdLoadingExtraAdmobBannerSizeKey] = [NSValue valueWithCGSize:admobSize.size]; +// extra[kATAdLoadingExtraAdmobAdSizeFlagsKey] = @(admobSize.flags); +// } + } + if (extra[kATAdLoadingExtraBannerAdSizeKey] == nil) { + extra[kATAdLoadingExtraBannerAdSizeKey] = [NSValue valueWithCGSize:CGSizeMake(320.0f, 50.0f)]; + } + NSLog(@"extra = %@", extra); + [[ATAdManager sharedManager] loadADWithPlacementID:placementID extra:extra delegate:self]; +} + +-(NSString*) checkAdStatus:(NSString *)placementID { + ATCheckLoadModel *checkLoadModel = [[ATAdManager sharedManager] checkBannerLoadStatusForPlacementID:placementID]; + NSMutableDictionary *statusDict = [NSMutableDictionary dictionary]; + statusDict[@"isLoading"] = @(checkLoadModel.isLoading); + statusDict[@"isReady"] = @(checkLoadModel.isReady); + statusDict[@"adInfo"] = checkLoadModel.adOfferInfo; + NSLog(@"ATBannerAdWrapper::statusDict = %@", statusDict); + return statusDict.jsonString; +} + +-(NSString*) getValidAdCaches:(NSString *)placementID { + NSArray *array = [[ATAdManager sharedManager] getBannerValidAdsForPlacementID:placementID]; + NSLog(@"ATNativeAdWrapper::array = %@", array); + return array.jsonString; +} + +UIEdgeInsets SafeAreaInsets_ATUnityBanner() { + return ([[UIApplication sharedApplication].keyWindow respondsToSelector:@selector(safeAreaInsets)] ? [UIApplication sharedApplication].keyWindow.safeAreaInsets : UIEdgeInsetsZero); +} + +-(void) showBannerAdWithPlacementID:(NSString*)placementID rect:(NSString*)rect extraJsonString:(NSString*)extraJsonString { + dispatch_async(dispatch_get_main_queue(), ^{ + if ([rect isKindOfClass:[NSString class]] && [rect dataUsingEncoding:NSUTF8StringEncoding] != nil) { + NSDictionary *extraDict = ([extraJsonString isKindOfClass:[NSString class]] && [extraJsonString dataUsingEncoding:NSUTF8StringEncoding] != nil) ? [NSJSONSerialization JSONObjectWithData:[extraJsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil] : nil; + + NSDictionary *rectDict = [NSJSONSerialization JSONObjectWithData:[rect dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + NSLog(@"rectDict = %@", rectDict); + CGFloat scale = [rectDict[kATBannerSizeUsesPixelFlagKey] boolValue] ? [UIScreen mainScreen].nativeScale : 1.0f; + ATBannerView *bannerView = [[ATAdManager sharedManager] retrieveBannerViewForPlacementID:placementID scene:extraDict[kATUnityUtilitiesAdShowingExtraScenarioKey]]; + bannerView.delegate = self; + UIButton *bannerCointainer = [UIButton buttonWithType:UIButtonTypeCustom]; + [bannerCointainer addTarget:self action:@selector(noop) forControlEvents:UIControlEventTouchUpInside]; + + NSString *position = rectDict[@"position"]; + CGSize totalSize = [UIApplication sharedApplication].keyWindow.rootViewController.view.bounds.size; + UIEdgeInsets safeAreaInsets = SafeAreaInsets_ATUnityBanner(); + if ([@"top" isEqualToString:position]) { + bannerCointainer.frame = CGRectMake((totalSize.width - CGRectGetWidth(bannerView.bounds)) / 2.0f, safeAreaInsets.top , CGRectGetWidth(bannerView.bounds), CGRectGetHeight(bannerView.bounds)); + } else if ([@"bottom" isEqualToString:position]) { + bannerCointainer.frame = CGRectMake((totalSize.width - CGRectGetWidth(bannerView.bounds)) / 2.0f, totalSize.height - safeAreaInsets.bottom - CGRectGetHeight(bannerView.bounds) , CGRectGetWidth(bannerView.bounds), CGRectGetHeight(bannerView.bounds)); + } else { + bannerCointainer.frame = CGRectMake([rectDict[@"x"] doubleValue] / scale, [rectDict[@"y"] doubleValue] / scale, [rectDict[@"width"] doubleValue] / scale, [rectDict[@"height"] doubleValue] / scale); + } + + bannerView.frame = bannerCointainer.bounds; + [bannerCointainer addSubview:bannerView]; + +// bannerCointainer.layer.borderColor = [UIColor redColor].CGColor; +// bannerCointainer.layer.borderWidth = .5f; + [[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:bannerCointainer]; + self->_bannerViewStorage[placementID] = bannerCointainer; + } + }); +} + +-(void) noop { + +} + +-(void) removeBannerAdWithPlacementID:(NSString*)placementID { + dispatch_async(dispatch_get_main_queue(), ^{ + [self->_bannerViewStorage[placementID] removeFromSuperview]; + [self->_bannerViewStorage removeObjectForKey:placementID]; + }); +} + +-(void) showBannerAdWithPlacementID:(NSString*)placementID { + dispatch_async(dispatch_get_main_queue(), ^{ + ATBannerView *bannerView = self->_bannerViewStorage[placementID]; + if (bannerView.superview != nil && !_interstitialOrRVBeingShown) { bannerView.hidden = NO; } + }); +} + +-(void) hideBannerAdWithPlacementID:(NSString*)placementID { + dispatch_async(dispatch_get_main_queue(), ^{ + ATBannerView *bannerView = self->_bannerViewStorage[placementID]; + if (bannerView.superview != nil) { bannerView.hidden = YES; } + }); +} + +-(void) clearCache { + +} + +#pragma mark - banner delegate method(s) +-(void) didFinishLoadingADWithPlacementID:(NSString *)placementID { + [self invokeCallback:@"OnBannerAdLoad" placementID:placementID error:nil extra:nil]; +} + +-(void) didFailToLoadADWithPlacementID:(NSString*)placementID error:(NSError*)error { + error = error != nil ? error : [NSError errorWithDomain:@"com.anythink.Unity3DPackage" code:100001 userInfo:@{NSLocalizedDescriptionKey:@"AT has failed to load ad", NSLocalizedFailureReasonErrorKey:@"AT has failed to load ad"}]; + [self invokeCallback:@"OnBannerAdLoadFail" placementID:placementID error:error extra:nil]; +} +// ad +- (void)didStartLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"startLoadingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFinishLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"finishLoadingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFailToLoadADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error{ + [self invokeCallback:@"failToLoadADSource" placementID:placementID error:error extra:extra]; +} + +// bidding +- (void)didStartBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"startBiddingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFinishBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"finishBiddingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFailBiddingADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error{ + [self invokeCallback:@"failBiddingADSource" placementID:placementID error:error extra:extra]; +} + +-(void) bannerView:(ATBannerView *)bannerView didShowAdWithPlacementID:(NSString *)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnBannerAdImpress" placementID:placementID error:nil extra:extra]; +} + +-(void) bannerView:(ATBannerView*)bannerView didClickWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnBannerAdClick" placementID:placementID error:nil extra:extra]; +} + +-(void) bannerView:(ATBannerView *)bannerView didTapCloseButtonWithPlacementID:(NSString *)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnBannerAdCloseButtonTapped" placementID:placementID error:nil extra:extra]; +} + +-(void) bannerView:(ATBannerView*)bannerView didCloseWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnBannerAdClose" placementID:placementID error:nil extra:extra]; +} + +-(void) bannerView:(ATBannerView *)bannerView didAutoRefreshWithPlacement:(NSString *)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnBannerAdAutoRefresh" placementID:placementID error:nil extra:extra]; +} + +-(void) bannerView:(ATBannerView *)bannerView failedToAutoRefreshWithPlacementID:(NSString *)placementID error:(NSError *)error { + error = error != nil ? error : [NSError errorWithDomain:@"com.anythink.Unity3DPackage" code:100001 userInfo:@{NSLocalizedDescriptionKey:@"AT has failed to refresh ad", NSLocalizedFailureReasonErrorKey:@"AT has failed to refresh ad"}]; + [self invokeCallback:@"OnBannerAdAutoRefreshFail" placementID:placementID error:error extra:nil]; +} + +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.m.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.m.meta new file mode 100644 index 0000000..d102b80 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBannerAdWrapper.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: ac1a4622946d34f26bfcafd57efac5c3 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.h new file mode 100644 index 0000000..641e16c --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.h @@ -0,0 +1,16 @@ +// +// ATBaseUnityWrapper.h +// UnityContainer +// +// Created by Martin Lau on 08/08/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import +#import "ATUnityWrapper.h" +@interface ATBaseUnityWrapper : NSObject +-(NSString*)scriptWrapperClass; +-(id)selWrapperClassWithDict:(NSDictionary *)dict callback:(void(*)(const char*, const char*))callback; +-(void) invokeCallback:(NSString*)callback placementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary*)extra; +- (NSArray *)jsonStrToArray:(NSString *)jsonString; +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.h.meta new file mode 100644 index 0000000..87cae41 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: e2eb6428e9bec4bee97e52b2151768c4 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.m b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.m new file mode 100644 index 0000000..a6d6544 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.m @@ -0,0 +1,131 @@ +// +// ATBaseUnityWrapper.m +// UnityContainer +// +// Created by Martin Lau on 08/08/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import "ATBaseUnityWrapper.h" +#import "ATUnityUtilities.h" +@interface ATBaseUnityWrapper() +@property(nonatomic, readonly) NSMutableDictionary *callbacks; +@property(nonatomic, readonly) dispatch_queue_t callbackAccessQueue; +@end +@implementation ATBaseUnityWrapper ++(instancetype) sharedInstance { + return nil; +} + +-(instancetype) init { + self = [super init]; + if (self != nil) { + _callbacks = [NSMutableDictionary dictionary]; + _callbackAccessQueue = dispatch_queue_create("com.anythink.UnityPackage", DISPATCH_QUEUE_CONCURRENT); + } + return self; +} + +-(void) setCallBack:(void (*)(const char *, const char *))callback forKey:(NSString *)key { + __weak ATBaseUnityWrapper* weakSelf = self; + if (callback != NULL && [key length] > 0) + dispatch_barrier_async(_callbackAccessQueue, ^{ + weakSelf.callbacks[key] = [NSValue valueWithPointer:(void*)callback]; + }); +} + +-(void) removeCallbackForKey:(NSString *)key { + __weak ATBaseUnityWrapper* weakSelf = self; + if ([key length] > 0) + dispatch_barrier_async(_callbackAccessQueue, ^{ + [weakSelf.callbacks removeObjectForKey:key]; + }); +} + +-(void(*)(const char*, const char *)) callbackForKey:(NSString*)key { + __block void(*callback)(const char*, const char *) = NULL; + if ([key length] > 0) { + __weak ATBaseUnityWrapper* weakSelf = self; + dispatch_barrier_sync(_callbackAccessQueue, ^{ + callback = (void(*)(const char*, const char *))[weakSelf.callbacks[key] pointerValue]; + }); + } + return callback; +} + +-(NSString*)scriptWrapperClass { + return @""; +} + +- (id)selWrapperClassWithDict:(NSDictionary *)dict callback:(void(*)(const char*, const char*))callback { + return nil; +} + +-(void) invokeCallback:(NSString*)callback placementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary*)extra { + if ([self callbackForKey:placementID] != NULL) { + if ([callback isKindOfClass:[NSString class]] && [callback length] > 0) { + + NSMutableDictionary *paraDict = [NSMutableDictionary dictionaryWithObject:callback forKey:@"callback"]; + + NSMutableDictionary *msgDict = [NSMutableDictionary dictionary]; + + if (![ATUnityUtilities isEmpty:extra]) { + if (extra[@"extra"] != nil) { + msgDict[@"extra"] = extra[@"extra"]; + msgDict[@"rewarded"] = extra[@"rewarded"]; + } else { + msgDict[@"extra"] = extra; + } + } + + paraDict[@"msg"] = msgDict; + + if ([placementID isKindOfClass:[NSString class]] && ![ATUnityUtilities isEmpty:placementID]) { + msgDict[@"placement_id"] = placementID; + }; + + if ([error isKindOfClass:[NSError class]]) { + + NSMutableDictionary *errorDict = [NSMutableDictionary dictionaryWithObject:[NSString stringWithFormat:@"%ld", error.code] forKey:@"code"]; + + if (![ATUnityUtilities isEmpty:error.userInfo[NSLocalizedDescriptionKey]]) { + errorDict[@"desc"] = [NSString stringWithFormat:@"%@",error.userInfo[NSLocalizedDescriptionKey]]; + } else { + errorDict[@"desc"] = @""; + } + if (![ATUnityUtilities isEmpty:error.userInfo[NSLocalizedFailureReasonErrorKey]]) { + errorDict[@"reason"] = [NSString stringWithFormat:@"%@",error.userInfo[NSLocalizedFailureReasonErrorKey]]; + } else { + errorDict[@"reason"] = @""; + } + msgDict[@"error"] = errorDict; + } + + [self callbackForKey:placementID]([self scriptWrapperClass].UTF8String, paraDict.jsonString.UTF8String); + } + } +} + +- (NSArray *)jsonStrToArray:(NSString *)jsonString{ + + + NSError *error; + NSArray *array = [NSArray array]; + + @try { + NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; + + array = [NSJSONSerialization JSONObjectWithData:jsonData + options:NSJSONReadingMutableContainers + error:&error]; + if(error){ + return [NSArray array]; + } + } @catch (NSException *exception) { + NSLog(@"jsonStrToArray --- exception:%@",exception); + } @finally {} + + return array; +} + +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.m.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.m.meta new file mode 100644 index 0000000..b0bef79 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATBaseUnityWrapper.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: aa9e3a5ce2adc4eb9b9cd4d2bc9abe47 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.h new file mode 100644 index 0000000..3d6ac58 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.h @@ -0,0 +1,12 @@ +// +// ATInterstitialAdWrapper.h +// UnityContainer +// +// Created by Martin Lau on 2019/1/8. +// Copyright © 2019 Martin Lau. All rights reserved. +// + +#import "ATBaseUnityWrapper.h" +@interface ATInterstitialAdWrapper : ATBaseUnityWrapper + +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.h.meta new file mode 100644 index 0000000..25972ed --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 7cdfdc46112824f91b18635724af738b +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.m b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.m new file mode 100644 index 0000000..7698806 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.m @@ -0,0 +1,309 @@ +// +// ATInterstitialAdWrapper.m +// UnityContainer +// +// Created by Martin Lau on 2019/1/8. +// Copyright © 2019 Martin Lau. All rights reserved. +// + +#import "ATInterstitialAdWrapper.h" +#import "ATUnityUtilities.h" +#import + +NSString *const kLoadUseRVAsInterstitialKey = @"UseRewardedVideoAsInterstitial"; +NSString *const kInterstitialExtraAdSizeKey = @"interstitial_ad_size"; +static NSString *kATInterstitialSizeUsesPixelFlagKey = @"uses_pixel"; + +@interface ATInterstitialAdWrapper() +@end +@implementation ATInterstitialAdWrapper ++(instancetype)sharedInstance { + static ATInterstitialAdWrapper *sharedInstance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedInstance = [[ATInterstitialAdWrapper alloc] init]; + }); + return sharedInstance; +} + +-(NSString*) scriptWrapperClass { + return @"ATInterstitialAdWrapper"; +} + +- (id)selWrapperClassWithDict:(NSDictionary *)dict callback:(void(*)(const char*, const char*))callback { + NSString *selector = dict[@"selector"]; + NSArray* arguments = dict[@"arguments"]; + NSString *firstObject = @""; + NSString *lastObject = @""; + if (![ATUnityUtilities isEmpty:arguments]) { + for (int i = 0; i < arguments.count; i++) { + if (i == 0) { firstObject = arguments[i]; } + else { lastObject = arguments[i]; } + } + } + + if ([selector isEqualToString:@"loadInterstitialAdWithPlacementID:customDataJSONString:callback:"]) { + [self loadInterstitialAdWithPlacementID:firstObject customDataJSONString:lastObject callback:callback]; + } else if ([selector isEqualToString:@"interstitialAdReadyForPlacementID:"]) { + return [NSNumber numberWithBool:[self interstitialAdReadyForPlacementID:firstObject]]; + } else if ([selector isEqualToString:@"showInterstitialAdWithPlacementID:extraJsonString:"]) { + [self showInterstitialAdWithPlacementID:firstObject extraJsonString:lastObject]; + } else if ([selector isEqualToString:@"checkAdStatus:"]) { + return [self checkAdStatus:firstObject]; + } else if ([selector isEqualToString:@"clearCache"]) { + [self clearCache]; + } else if ([selector isEqualToString:@"getValidAdCaches:"]) { + return [self getValidAdCaches:firstObject]; + }else if ([selector isEqualToString:@"entryScenarioWithPlacementID:scenarioID:"]) { + [self entryScenarioWithPlacementID:firstObject scenarioID:lastObject]; + } + // auto + else if ([selector isEqualToString:@"addAutoLoadAdPlacementID:callback:"]){ + [self addAutoLoadAdPlacementID:firstObject callback:callback]; + }else if ([selector isEqualToString:@"removeAutoLoadAdPlacementID:"]){ + [self removeAutoLoadAdPlacementID:firstObject]; + }else if ([selector isEqualToString:@"autoLoadInterstitialAdReadyForPlacementID:"]){ + return [NSNumber numberWithBool:[self autoLoadInterstitialAdReadyForPlacementID:firstObject]]; + }else if ([selector isEqualToString:@"getAutoValidAdCaches:"]){ + return [self getAutoValidAdCaches:firstObject]; + }else if ([selector isEqualToString:@"setAutoLocalExtra:customDataJSONString:"]){ + [self setAutoLocalExtra:firstObject customDataJSONString:lastObject]; + }else if ([selector isEqualToString:@"entryAutoAdScenarioWithPlacementID:scenarioID:"]){ + [self entryAutoAdScenarioWithPlacementID:firstObject scenarioID:lastObject]; + }else if ([selector isEqualToString:@"showAutoInterstitialAd:extraJsonString:"]){ + [self showAutoInterstitialAd:firstObject extraJsonString:lastObject]; + }else if ([selector isEqualToString:@"checkAutoAdStatus:"]) { + return [self checkAutoAdStatus:firstObject]; + } + + return nil; +} + +-(void) loadInterstitialAdWithPlacementID:(NSString*)placementID customDataJSONString:(NSString*)customDataJSONString callback:(void(*)(const char*, const char*))callback { + + [self setCallBack:callback forKey:placementID]; + NSMutableDictionary *extra = [NSMutableDictionary dictionary]; + if ([customDataJSONString isKindOfClass:[NSString class]] && [customDataJSONString length] > 0) { + NSDictionary *extraDict = [NSJSONSerialization JSONObjectWithData:[customDataJSONString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + NSLog(@"extraDict = %@", extraDict); + if (extraDict[kLoadUseRVAsInterstitialKey] != nil) { + extra[kATInterstitialExtraUsesRewardedVideo] = @([extraDict[kLoadUseRVAsInterstitialKey] boolValue]); + } + + CGFloat scale = [extraDict[kATInterstitialSizeUsesPixelFlagKey] boolValue] ? [UIScreen mainScreen].nativeScale : 1.0f; + if ([extraDict[kInterstitialExtraAdSizeKey] isKindOfClass:[NSString class]] && [[extraDict[kInterstitialExtraAdSizeKey] componentsSeparatedByString:@"x"] count] == 2) { + NSArray* com = [extraDict[kInterstitialExtraAdSizeKey] componentsSeparatedByString:@"x"]; + extra[kATInterstitialExtraAdSizeKey] = [NSValue valueWithCGSize:CGSizeMake([com[0] doubleValue] / scale, [com[1] doubleValue] / scale)]; + } + } + + NSLog(@"ATInterstitialAdWrapper::extra = %@", extra); + [[ATAdManager sharedManager] loadADWithPlacementID:placementID extra:extra != nil ? extra : nil delegate:self]; +} + +-(BOOL) interstitialAdReadyForPlacementID:(NSString*)placementID { + return [[ATAdManager sharedManager] interstitialReadyForPlacementID:placementID]; +} + +-(NSString*) getValidAdCaches:(NSString *)placementID { + NSArray *array = [[ATAdManager sharedManager] getInterstitialValidAdsForPlacementID:placementID]; + NSLog(@"ATNativeAdWrapper::array = %@", array); + return array.jsonString; +} + +-(void) showInterstitialAdWithPlacementID:(NSString*)placementID extraJsonString:(NSString*)extraJsonString { + NSDictionary *extraDict = ([extraJsonString isKindOfClass:[NSString class]] && [extraJsonString dataUsingEncoding:NSUTF8StringEncoding] != nil) ? [NSJSONSerialization JSONObjectWithData:[extraJsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil] : nil; + [[ATAdManager sharedManager] showInterstitialWithPlacementID:placementID scene:extraDict[kATUnityUtilitiesAdShowingExtraScenarioKey] inViewController:[UIApplication sharedApplication].delegate.window.rootViewController delegate:self]; +} + +-(NSString*) checkAdStatus:(NSString *)placementID { + ATCheckLoadModel *checkLoadModel = [[ATAdManager sharedManager] checkInterstitialLoadStatusForPlacementID:placementID]; + NSMutableDictionary *statusDict = [NSMutableDictionary dictionary]; + statusDict[@"isLoading"] = @(checkLoadModel.isLoading); + statusDict[@"isReady"] = @(checkLoadModel.isReady); + statusDict[@"adInfo"] = checkLoadModel.adOfferInfo; + NSLog(@"ATInterstitialAdWrapper::statusDict = %@", statusDict); + return statusDict.jsonString; +} +- (void)entryScenarioWithPlacementID:(NSString *)placementID scenarioID:(NSString *)scenarioID{ + + [[ATAdManager sharedManager] entryInterstitialScenarioWithPlacementID:placementID scene:scenarioID]; +} +-(void) clearCache { + +} + +#pragma mark - auto +-(void) addAutoLoadAdPlacementID:(NSString*)placementID callback:(void(*)(const char*, const char*))callback { + + if (placementID == nil) { + return; + } + + [ATInterstitialAutoAdManager sharedInstance].delegate = self; + + NSArray *placementIDArray = [self jsonStrToArray:placementID]; + + [placementIDArray enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [self setCallBack:callback forKey:obj]; + NSLog(@" addAutoLoadAdPlacementID--%@",placementID); + }]; + + + [[ATInterstitialAutoAdManager sharedInstance] addAutoLoadAdPlacementIDArray:placementIDArray]; +} + +-(void) removeAutoLoadAdPlacementID:(NSString*)placementID{ + NSLog(@" removeAutoLoadAdPlacementID--%@",placementID); + + if (placementID == nil) { + return; + } + + NSArray *placementIDArray = [self jsonStrToArray:placementID]; + + [[ATInterstitialAutoAdManager sharedInstance] removeAutoLoadAdPlacementIDArray:placementIDArray]; +} + +-(BOOL) autoLoadInterstitialAdReadyForPlacementID:(NSString*)placementID { + + NSLog(@"Unity: autoLoadInterstitialAdReadyForPlacementID--%@---%d",placementID,[[ATInterstitialAutoAdManager sharedInstance] autoLoadInterstitialReadyForPlacementID:placementID]); + return [[ATInterstitialAutoAdManager sharedInstance] autoLoadInterstitialReadyForPlacementID:placementID]; +} + +-(NSString*) getAutoValidAdCaches:(NSString *)placementID{ + + NSArray *array = [[ATInterstitialAutoAdManager sharedInstance] checkValidAdCachesWithPlacementID:placementID]; + + NSLog(@"Unity: getAutoValidAdCaches::array = %@", array); + + return array.jsonString; +} + +-(NSString*) checkAutoAdStatus:(NSString *)placementID { + + ATCheckLoadModel *checkLoadModel = [[ATInterstitialAutoAdManager sharedInstance] checkInterstitialLoadStatusForPlacementID:placementID]; + + NSMutableDictionary *statusDict = [NSMutableDictionary dictionary]; + statusDict[@"isLoading"] = @(checkLoadModel.isLoading); + statusDict[@"isReady"] = @(checkLoadModel.isReady); + statusDict[@"adInfo"] = checkLoadModel.adOfferInfo; + + NSLog(@":checkAutoAdStatus statusDict = %@", statusDict); + return statusDict.jsonString; +} + +-(void) setAutoLocalExtra:(NSString*)placementID customDataJSONString:(NSString*)customDataJSONString{ + + if ([customDataJSONString isKindOfClass:[NSString class]]) { + + NSDictionary *extraDict = [NSJSONSerialization JSONObjectWithData:[customDataJSONString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + + NSMutableDictionary *extra = [NSMutableDictionary dictionary]; + + if ([extraDict isKindOfClass:[NSDictionary class]]) { + + if (extraDict[kLoadUseRVAsInterstitialKey] != nil) { + extra[kATInterstitialExtraUsesRewardedVideo] = @([extraDict[kLoadUseRVAsInterstitialKey] boolValue]); + } + + CGFloat scale = [extraDict[kATInterstitialSizeUsesPixelFlagKey] boolValue] ? [UIScreen mainScreen].nativeScale : 1.0f; + if ([extraDict[kInterstitialExtraAdSizeKey] isKindOfClass:[NSString class]] && [[extraDict[kInterstitialExtraAdSizeKey] componentsSeparatedByString:@"x"] count] == 2) { + NSArray* com = [extraDict[kInterstitialExtraAdSizeKey] componentsSeparatedByString:@"x"]; + extra[kATInterstitialExtraAdSizeKey] = [NSValue valueWithCGSize:CGSizeMake([com[0] doubleValue] / scale, [com[1] doubleValue] / scale)]; + } + } + + NSLog(@"ATInterstitialAdWrapper::setAutoLocalExtra statusDict = %@", extraDict); + [[ATInterstitialAutoAdManager sharedInstance] setLocalExtra:extra placementID:placementID]; + + + } +} + +-(void) entryAutoAdScenarioWithPlacementID:(NSString*)placementID scenarioID:(NSString*)scenarioID{ + NSLog(@"ATInterstitialAdWrapper::entryAutoAdScenarioWithPlacementID = %@ scenarioID = %@", placementID,scenarioID); + + [[ATInterstitialAutoAdManager sharedInstance] entryAdScenarioWithPlacementID:placementID scenarioID:scenarioID]; +} + +-(void) showAutoInterstitialAd:(NSString*)placementID extraJsonString:(NSString*)extraJsonString { + + NSDictionary *extraDict = ([extraJsonString isKindOfClass:[NSString class]] && [extraJsonString dataUsingEncoding:NSUTF8StringEncoding] != nil) ? [NSJSONSerialization JSONObjectWithData:[extraJsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil] : nil; + + NSLog(@"ATInterstitialAdWrapper::showAutoInterstitialAd = %@ extraJsonString = %@", placementID,extraJsonString); + + NSLog(@"ATInterstitialAdWrapper::extraDict = %@", extraDict); + + [[ATInterstitialAutoAdManager sharedInstance] showAutoLoadInterstitialWithPlacementID:placementID scene:extraDict[kATUnityUtilitiesAdShowingExtraScenarioKey] inViewController:[UIApplication sharedApplication].delegate.window.rootViewController delegate:self]; +} + +#pragma mark - delegate method(s) +// ad +- (void)didStartLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"startLoadingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFinishLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"finishLoadingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFailToLoadADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error{ + [self invokeCallback:@"failToLoadADSource" placementID:placementID error:error extra:extra]; +} + +// bidding +- (void)didStartBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"startBiddingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFinishBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"finishBiddingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFailBiddingADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error{ + [self invokeCallback:@"failBiddingADSource" placementID:placementID error:error extra:extra]; +} + + + +-(void) didFinishLoadingADWithPlacementID:(NSString *)placementID { + [self invokeCallback:@"OnInterstitialAdLoaded" placementID:placementID error:nil extra:nil]; +} + +-(void) didFailToLoadADWithPlacementID:(NSString*)placementID error:(NSError*)error { + error = error != nil ? error : [NSError errorWithDomain:@"com.anythink.Unity3DPackage" code:100001 userInfo:@{NSLocalizedDescriptionKey:@"AT has failed to load ad", NSLocalizedFailureReasonErrorKey:@"AT has failed to load ad"}]; + [self invokeCallback:@"OnInterstitialAdLoadFailure" placementID:placementID error:error extra:nil]; +} + +-(void) interstitialDidShowForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnInterstitialAdShow" placementID:placementID error:nil extra:extra]; + [[NSNotificationCenter defaultCenter] postNotificationName:kATUnityUtilitiesInterstitialImpressionNotification object:nil]; +} + +-(void) interstitialFailedToShowForPlacementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary *)extra { + error = error != nil ? error : [NSError errorWithDomain:@"com.anythink.Unity3DPackage" code:100001 userInfo:@{NSLocalizedDescriptionKey:@"AT has failed to show ad", NSLocalizedFailureReasonErrorKey:@"AT has failed to show ad"}]; + [self invokeCallback:@"OnInterstitialAdFailedToShow" placementID:placementID error:error extra:nil]; +} + +-(void) interstitialDidStartPlayingVideoForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnInterstitialAdVideoPlayStart" placementID:placementID error:nil extra:extra]; +} + +-(void) interstitialDidEndPlayingVideoForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnInterstitialAdVideoPlayEnd" placementID:placementID error:nil extra:extra]; +} + +-(void) interstitialDidFailToPlayVideoForPlacementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary *)extra { + [self invokeCallback:@"OnInterstitialAdVideoPlayFailure" placementID:placementID error:error extra:extra]; +} + +-(void) interstitialDidCloseForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnInterstitialAdClose" placementID:placementID error:nil extra:extra]; + [[NSNotificationCenter defaultCenter] postNotificationName:kATUnityUtilitiesInterstitialCloseNotification object:nil]; +} + +-(void) interstitialDidClickForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnInterstitialAdClick" placementID:placementID error:nil extra:extra]; +} +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.m.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.m.meta new file mode 100644 index 0000000..e108ec9 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATInterstitialAdWrapper.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: e534e371fd98645f0857baf8dec95667 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.h new file mode 100644 index 0000000..ea8416a --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.h @@ -0,0 +1,34 @@ +// +// ATNativeAdWrapper.h +// UnityContainer +// +// Created by Martin Lau on 27/07/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import +#import "ATBaseUnityWrapper.h" +#import + +extern NSString *const kParsedPropertiesFrameKey; +extern NSString *const kParsedPropertiesBackgroundColorKey; +extern NSString *const kParsedPropertiesTextColorKey; +extern NSString *const kParsedPropertiesTextSizeKey; + +extern NSString *const kNativeAssetAdvertiser; +extern NSString *const kNativeAssetText; +extern NSString *const kNativeAssetTitle; +extern NSString *const kNativeAssetCta; +extern NSString *const kNativeAssetRating; +extern NSString *const kNativeAssetIcon; +extern NSString *const kNativeAssetMainImage; +extern NSString *const kNativeAssetSponsorImage; +extern NSString *const kNativeAssetDislike; +extern NSString *const kNativeAssetMedia; + +extern NSString *kATAdLoadingExtraNativeAdSizeKey; +extern NSString *kATNativeAdSizeUsesPixelFlagKey; + +@interface ATNativeAdWrapper : ATBaseUnityWrapper + +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.h.meta new file mode 100644 index 0000000..9a5faa6 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 896e8a703a8574fb48be91021abe3031 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.m b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.m new file mode 100644 index 0000000..231c3dd --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.m @@ -0,0 +1,404 @@ +// +// ATNativeAdWrapper.m +// UnityContainer +// +// Created by Martin Lau on 27/07/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import "ATNativeAdWrapper.h" +#import "ATUnityUtilities.h" +#import +#import +#import +#import +#import +#import "ATAutolayoutCategories.h" +#import "ATUnityManager.h" +#import "ATNativeSelfRenderView.h" +#define kNavigationBarHeight ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown ? ([[UIApplication sharedApplication]statusBarFrame].size.height + 44) : ([[UIApplication sharedApplication]statusBarFrame].size.height - 4)) + +#define kScreenW ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown ? UIScreen.mainScreen.bounds.size.width : UIScreen.mainScreen.bounds.size.height) + + NSString *const kParsedPropertiesFrameKey = @"frame"; + NSString *const kParsedPropertiesBackgroundColorKey = @"background_color"; + NSString *const kParsedPropertiesTextColorKey = @"text_color"; + NSString *const kParsedPropertiesTextSizeKey = @"text_size"; + + NSString *const kNativeAssetAdvertiser = @"advertiser_label"; + NSString *const kNativeAssetText = @"text"; + NSString *const kNativeAssetTitle = @"title"; + NSString *const kNativeAssetCta = @"cta"; + NSString *const kNativeAssetRating = @"rating"; + NSString *const kNativeAssetIcon = @"icon"; + NSString *const kNativeAssetMainImage = @"main_image"; + NSString *const kNativeAssetSponsorImage = @"sponsor_image"; + NSString *const kNativeAssetDislike = @"dislike_button"; + NSString *const kNativeAssetMedia = @"media"; + + NSString *kATAdLoadingExtraNativeAdSizeKey = @"native_ad_size"; + NSString *kATNativeAdSizeUsesPixelFlagKey = @"uses_pixel"; + +NSDictionary* at_parseUnityProperties(NSDictionary *properties) { + NSMutableDictionary *result = NSMutableDictionary.dictionary; + CGFloat scale = [properties[@"usesPixel"] boolValue] ? [UIScreen mainScreen].nativeScale : 1.0f; + result[kParsedPropertiesFrameKey] = [NSString stringWithFormat:@"{{%@, %@}, {%@, %@}}", @([properties[@"x"] doubleValue] / scale), @([properties[@"y"] doubleValue] / scale), @([properties[@"width"] doubleValue] / scale), @([properties[@"height"] doubleValue] / scale)]; + result[kParsedPropertiesBackgroundColorKey] = properties[@"backgroundColor"]; + result[kParsedPropertiesTextColorKey] = properties[@"textColor"]; + result[kParsedPropertiesTextSizeKey] = properties[@"textSize"]; + + return result; +} + +NSDictionary* at_parseUnityMetrics(NSDictionary* metrics) { + NSMutableDictionary *result = NSMutableDictionary.dictionary; + NSDictionary *keysMap = @{@"appIcon":kNativeAssetIcon, @"mainImage":kNativeAssetMainImage, @"title":kNativeAssetTitle, @"desc":kNativeAssetText, @"adLogo":kNativeAssetSponsorImage, @"cta":kNativeAssetCta, @"dislike":kNativeAssetDislike}; + [keysMap enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { result[keysMap[key]] = at_parseUnityProperties(metrics[key]); }]; + return result; +} + +#define CS_ATNativeAdWrapper "ATNativeAdWrapper" + +NSString *const kATNativeAdAdaptiveHeightKey = @"AdaptiveHeight"; + +@interface ATNativeAdWrapper() +@property(nonatomic, strong) ATNativeSelfRenderView *nativeSelfRenderView; +@property(nonatomic, strong) ATNativeADView *adView; +@property(nonatomic, readonly) NSMutableDictionary *viewsStorage; +@end +@implementation ATNativeAdWrapper ++(instancetype)sharedInstance { + static ATNativeAdWrapper *sharedInstance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedInstance = [[ATNativeAdWrapper alloc] init]; + }); + return sharedInstance; +} + +-(instancetype) init { + self = [super init]; + if (self != nil) { + _viewsStorage = [NSMutableDictionary dictionary]; + } + return self; +} + +UIEdgeInsets SafeAreaInsets_ATUnityNative() { + return ([[UIApplication sharedApplication].keyWindow respondsToSelector:@selector(safeAreaInsets)] ? [UIApplication sharedApplication].keyWindow.safeAreaInsets : UIEdgeInsetsZero); +} + +- (id)selWrapperClassWithDict:(NSDictionary *)dict callback:(void(*)(const char*, const char*))callback { + NSString *selector = dict[@"selector"]; + NSArray* arguments = dict[@"arguments"]; + NSString *firstObject = @""; + NSString *secondObject = @""; + NSString *lastObject = @""; + if (![ATUnityUtilities isEmpty:arguments]) { + for (int i = 0; i < arguments.count; i++) { + if (i == 0) { firstObject = arguments[i]; } + else if (i == 1) { secondObject = arguments[i]; } + else { lastObject = arguments[i]; } + } + } + + if ([selector isEqualToString:@"loadNativeAdWithPlacementID:customDataJSONString:callback:"]) { + [self loadNativeAdWithPlacementID:firstObject customDataJSONString:secondObject callback:callback]; + } else if ([selector isEqualToString:@"isNativeAdReadyForPlacementID:"]) { + return [NSNumber numberWithBool:[self isNativeAdReadyForPlacementID:firstObject]]; + } else if ([selector isEqualToString:@"showNativeAdWithPlacementID:metricsJSONString:extraJsonString:"]) { + [self showNativeAdWithPlacementID:firstObject metricsJSONString:secondObject extraJsonString:lastObject]; + } else if ([selector isEqualToString:@"removeNativeAdViewWithPlacementID:"]) { + [self removeNativeAdViewWithPlacementID:firstObject]; + } else if ([selector isEqualToString:@"checkAdStatus:"]) { + return [self checkAdStatus:firstObject]; + } else if ([selector isEqualToString:@"clearCache"]) { + [self clearCache]; + } else if ([selector isEqualToString:@"getValidAdCaches:"]) { + return [self getValidAdCaches:firstObject]; + }else if ([selector isEqualToString:@"entryScenarioWithPlacementID:scenarioID:"]) { + [self entryScenarioWithPlacementID:firstObject scenarioID:secondObject]; + + } + return nil; +} + +-(void) loadNativeAdWithPlacementID:(NSString*)placementID customDataJSONString:(NSString*)customDataJSONString callback:(void(*)(const char*, const char *))callback { + [self setCallBack:callback forKey:placementID]; + NSMutableDictionary *extra = [NSMutableDictionary dictionaryWithDictionary:@{kATExtraInfoNativeAdTypeKey:@(ATGDTNativeAdTypeSelfRendering), kATExtraNativeImageSizeKey:kATExtraNativeImageSize690_388}]; + if ([customDataJSONString isKindOfClass:[NSString class]] && [customDataJSONString length] > 0) { + NSDictionary *extraDict = [NSJSONSerialization JSONObjectWithData:[customDataJSONString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + NSLog(@"extraDict = %@", extraDict); + CGFloat scale = [extraDict[kATNativeAdSizeUsesPixelFlagKey] boolValue] ? [UIScreen mainScreen].nativeScale : 1.0f; + if ([extraDict[kATAdLoadingExtraNativeAdSizeKey] isKindOfClass:[NSString class]] && [[extraDict[kATAdLoadingExtraNativeAdSizeKey] componentsSeparatedByString:@"x"] count] == 2) { + NSArray* com = [extraDict[kATAdLoadingExtraNativeAdSizeKey] componentsSeparatedByString:@"x"]; + extra[kATExtraInfoNativeAdSizeKey] = [NSValue valueWithCGSize:CGSizeMake([com[0] doubleValue] / scale, [com[1] doubleValue] / scale)]; + } + } + NSLog(@"extra = %@", extra); + [[ATAdManager sharedManager] loadADWithPlacementID:placementID extra:extra delegate:self]; +} + +-(BOOL) isNativeAdReadyForPlacementID:(NSString*)placementID { + return [[ATAdManager sharedManager] nativeAdReadyForPlacementID:placementID]; +} + +-(NSString*) checkAdStatus:(NSString *)placementID { + ATCheckLoadModel *checkLoadModel = [[ATAdManager sharedManager] checkNativeLoadStatusForPlacementID:placementID]; + NSMutableDictionary *statusDict = [NSMutableDictionary dictionary]; + statusDict[@"isLoading"] = @(checkLoadModel.isLoading); + statusDict[@"isReady"] = @(checkLoadModel.isReady); + statusDict[@"adInfo"] = checkLoadModel.adOfferInfo; + NSLog(@"ATNativeAdWrapper::statusDict = %@", statusDict); + return statusDict.jsonString; +} +- (void)entryScenarioWithPlacementID:(NSString *)placementID scenarioID:(NSString *)scenarioID{ + + [[ATAdManager sharedManager] entryNativeScenarioWithPlacementID:placementID scene:scenarioID]; +} + +-(NSString*) getValidAdCaches:(NSString *)placementID { + NSArray *array = [[ATAdManager sharedManager] getNativeValidAdsForPlacementID:placementID]; + NSLog(@"ATNativeAdWrapper::array = %@", array); + return array.jsonString; +} + +-(void) showNativeAdWithPlacementID:(NSString*)placementID metricsJSONString:(NSString*)metricsJSONString extraJsonString:(NSString*)extraJsonString { + + if (self.adView) { + [self.adView removeFromSuperview]; + self.adView = nil; + } + + + + if ([self isNativeAdReadyForPlacementID:placementID]) { + NSDictionary *metrics = [NSJSONSerialization JSONObjectWithData:[metricsJSONString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + NSDictionary *extraDict = ([extraJsonString isKindOfClass:[NSString class]] && [extraJsonString dataUsingEncoding:NSUTF8StringEncoding] != nil) ? [NSJSONSerialization JSONObjectWithData:[extraJsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil] : nil; + + NSDictionary *parsedMetrics = at_parseUnityMetrics(metrics); + NSLog(@"metrics = %@, parsedMetrics = %@", metrics, parsedMetrics); + NSLog(@"ATNativeAdWrapper::extraDict:%@",extraDict); + + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + [button addTarget:self action:@selector(noop) forControlEvents:UIControlEventTouchUpInside]; + button.frame = CGRectFromString(at_parseUnityProperties(metrics[@"parent"])[kParsedPropertiesFrameKey]); + + CGRect adViewFrame = CGRectFromString(at_parseUnityProperties(metrics[@"parent"])[kParsedPropertiesFrameKey]); + CGRect mediaViewFrame = CGRectFromString(parsedMetrics[kNativeAssetMainImage][kParsedPropertiesFrameKey]); + ATNativeADConfiguration *configuration = [ATNativeADConfiguration new]; + configuration.ADFrame = CGRectMake(0, 0, CGRectGetWidth(adViewFrame), CGRectGetHeight(adViewFrame)); + configuration.mediaViewFrame = mediaViewFrame; + configuration.delegate = self; + if (extraDict[kATNativeAdAdaptiveHeightKey] != nil) { + configuration.sizeToFit = [extraDict[kATNativeAdAdaptiveHeightKey] boolValue]; + } + configuration.rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController; + configuration.context = @{ + kATNativeAdConfigurationContextAdOptionsViewFrameKey:[NSValue valueWithCGRect:CGRectMake(CGRectGetWidth([UIScreen mainScreen].bounds) - 43.0f, .0f, 43.0f, 18.0f)], + kATNativeAdConfigurationContextAdLogoViewFrameKey:[NSValue valueWithCGRect:CGRectMake(.0f, .0f, 54.0f, 18.0f)], + kATNativeAdConfigurationContextNetworkLogoViewFrameKey:[NSValue valueWithCGRect:CGRectMake(CGRectGetWidth(configuration.ADFrame) - 54.0f, CGRectGetHeight(configuration.ADFrame) - 18.0f, 54.0f, 18.0f)] + }; + + + ATNativeAdOffer *offer = [[ATAdManager sharedManager] getNativeAdOfferWithPlacementID:placementID]; + + ATNativeSelfRenderView *selfRenderView = [self getSelfRenderViewOffer:offer withMetrics:parsedMetrics]; + + selfRenderView.backgroundColor = [UIColor colorWithHexString:parsedMetrics[kNativeAssetMainImage][@"background_color"]]; + + NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"AnyThinkSDK" ofType:@"bundle"]]; + + UIImage * img = [UIImage imageNamed:@"icon_webview_close" inBundle:bundle compatibleWithTraitCollection:nil]; + [selfRenderView.dislikeButton setImage:img forState:0]; + + ATNativeADView *adview = [self getNativeADView:configuration offer:offer selfRenderView:selfRenderView withPlacementId:placementID]; + [self prepareWithNativePrepareInfo:selfRenderView nativeADView:adview]; + adview.ctaLabel.hidden = [adview.nativeAd.ctaText length] == 0; + if (adview != nil) { + [self removeNativeAdViewWithPlacementID:placementID]; + + _viewsStorage[placementID] = button; + + [button addSubview:adview]; + + [[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:button]; + + NSString *position = extraDict[@"Position"]; + CGSize totalSize = [UIApplication sharedApplication].keyWindow.rootViewController.view.bounds.size; + UIEdgeInsets safeAreaInsets = SafeAreaInsets_ATUnityNative(); + + if ([@"Top" isEqualToString:position]) { + button.frame = CGRectMake((totalSize.width - CGRectGetWidth(adview.bounds)) / 2.0f, safeAreaInsets.top , CGRectGetWidth(adview.bounds), CGRectGetHeight(adview.bounds)); + } else if ([@"Bottom" isEqualToString:position]) { + button.frame = CGRectMake((totalSize.width - CGRectGetWidth(adview.bounds)) / 2.0f, totalSize.height - safeAreaInsets.bottom - CGRectGetHeight(adview.bounds) , CGRectGetWidth(adview.bounds), CGRectGetHeight(adview.bounds)); + } else { + button.frame = CGRectFromString(at_parseUnityProperties(metrics[@"parent"])[kParsedPropertiesFrameKey]); + } + + NSMutableDictionary *contextStorage = [NSMutableDictionary dictionary]; + [contextStorage setValue:button forKey:@"button"]; + [contextStorage setValue:position forKey:@"position"]; + [adview addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:(void*)CFBridgingRetain(contextStorage)]; + } + } +} +- (void)prepareWithNativePrepareInfo:(ATNativeSelfRenderView *)selfRenderView nativeADView:(ATNativeADView *)nativeADView{ + + ATNativePrepareInfo *info = [ATNativePrepareInfo loadPrepareInfo:^(ATNativePrepareInfo * _Nonnull prepareInfo) { + prepareInfo.textLabel = selfRenderView.textLabel; + prepareInfo.advertiserLabel = selfRenderView.advertiserLabel; + prepareInfo.titleLabel = selfRenderView.titleLabel; + prepareInfo.ratingLabel = selfRenderView.ratingLabel; + prepareInfo.iconImageView = selfRenderView.iconImageView; + prepareInfo.mainImageView = selfRenderView.mainImageView; + prepareInfo.logoImageView = selfRenderView.logoImageView; + prepareInfo.dislikeButton = selfRenderView.dislikeButton; + prepareInfo.ctaLabel = selfRenderView.ctaLabel; + prepareInfo.mediaView = selfRenderView.mediaView; + }]; + [nativeADView prepareWithNativePrepareInfo:info]; + [nativeADView addSubview:selfRenderView]; + selfRenderView.frame = CGRectMake(0, 0, CGRectGetWidth(nativeADView.frame), CGRectGetHeight(nativeADView.frame)); +} + + +- (ATNativeSelfRenderView *)getSelfRenderViewOffer:(ATNativeAdOffer *)offer withMetrics:(NSDictionary*)metrics{ + + ATNativeSelfRenderView *selfRenderView = [[ATNativeSelfRenderView alloc]initWithOffer:offer]; + + self.nativeSelfRenderView = selfRenderView; + + [selfRenderView configureMetrics:metrics]; + + + return selfRenderView; +} + + +- (ATNativeADView *)getNativeADView:(ATNativeADConfiguration *)config offer:(ATNativeAdOffer *)offer selfRenderView:(ATNativeSelfRenderView *)selfRenderView withPlacementId:(NSString*)placementID{ + + ATNativeADView *nativeADView = [[ATNativeADView alloc]initWithConfiguration:config currentOffer:offer placementID:placementID]; + + + + UIView *mediaView = [nativeADView getMediaView]; + + NSMutableArray *array = [@[selfRenderView.iconImageView,selfRenderView.titleLabel,selfRenderView.textLabel,selfRenderView.ctaLabel,selfRenderView.mainImageView] mutableCopy]; + + if (mediaView) { + [array addObject:mediaView]; + } + + [nativeADView registerClickableViewArray:array]; + + selfRenderView.mediaView = mediaView; + + [selfRenderView addSubview:mediaView]; + + + self.adView = nativeADView; + + return nativeADView; +} + + + +-(void) noop { + +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + if ([keyPath isEqualToString:@"frame"]) { + CGRect frame = [change[@"new"] CGRectValue]; + NSDictionary *contextDict = (__bridge NSDictionary*)context; + + CGSize totalSize = [UIApplication sharedApplication].keyWindow.rootViewController.view.bounds.size; + UIEdgeInsets safeAreaInsets = SafeAreaInsets_ATUnityNative(); + NSString *position = contextDict[@"position"]; + UIButton *button = contextDict[@"button"]; + CGRect buttonFrame = button.frame; + buttonFrame.size.height = frame.size.height; + + if ([position isEqualToString:@"Bottom"]) { + buttonFrame.origin.y = totalSize.height - safeAreaInsets.bottom - frame.size.height; + } + button.frame = buttonFrame; + [object removeObserver:self forKeyPath:@"frame"]; + CFBridgingRelease(context); + } +} + + +-(void) removeNativeAdViewWithPlacementID:(NSString*)placementID { + if ([_viewsStorage.allKeys containsObject:placementID]) { + [_viewsStorage[placementID] removeFromSuperview]; + } +} + +-(void) clearCache { + +} + +-(NSString*) scriptWrapperClass { + return @"ATNativeAdWrapper"; +} +#pragma mark - delegate +-(void) didFinishLoadingADWithPlacementID:(NSString *)placementID { + [self invokeCallback:@"OnNativeAdLoaded" placementID:placementID error:nil extra:nil]; +} + +-(void) didFailToLoadADWithPlacementID:(NSString*)placementID error:(NSError*)error { + [self invokeCallback:@"OnNativeAdLoadingFailure" placementID:placementID error:error extra:nil]; +} +// ad +- (void)didStartLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"startLoadingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFinishLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"finishLoadingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFailToLoadADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error{ + [self invokeCallback:@"failToLoadADSource" placementID:placementID error:error extra:extra]; +} + +// bidding +- (void)didStartBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"startBiddingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFinishBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"finishBiddingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFailBiddingADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error{ + [self invokeCallback:@"failBiddingADSource" placementID:placementID error:error extra:extra]; +} + + +-(void) didShowNativeAdInAdView:(ATNativeADView*)adView placementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnNaitveAdShow" placementID:placementID error:nil extra:extra]; +} + +-(void) didClickNativeAdInAdView:(ATNativeADView*)adView placementID:(NSString*)placementID extra:(NSDictionary *)extra { + //Drop ad view + [self invokeCallback:@"OnNativeAdClick" placementID:placementID error:nil extra:extra]; +} + +-(void) didTapCloseButtonInAdView:(ATNativeADView*)adView placementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnNativeAdCloseButtonClick" placementID:placementID error:nil extra:extra]; + [self.adView removeFromSuperview]; +} + +-(void) didStartPlayingVideoInAdView:(ATNativeADView*)adView placementID:(NSString*)placementID extra:(NSDictionary *)extra { + //Drop ad view + [self invokeCallback:@"OnNativeAdVideoStart" placementID:placementID error:nil extra:extra]; +} + +-(void) didEndPlayingVideoInAdView:(ATNativeADView*)adView placementID:(NSString*)placementID extra:(NSDictionary *)extra { + //Drop ad view + [self invokeCallback:@"OnNativeAdVideoEnd" placementID:placementID error:nil extra:extra]; +} +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.m.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.m.meta new file mode 100644 index 0000000..15925d6 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeAdWrapper.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 4d00f3756b49d4f5cbc15a35d7282721 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.h new file mode 100644 index 0000000..ec2c260 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.h @@ -0,0 +1,35 @@ +// +// ATNativeSelfRenderView.h +// AnyThinkSDKDemo +// +// Created by GUO PENG on 2022/5/7. +// Copyright © 2022 AnyThink. All rights reserved. +// + +#import +#import + + +NS_ASSUME_NONNULL_BEGIN + +@interface ATNativeSelfRenderView : UIView + +@property(nonatomic, strong) UILabel *advertiserLabel; +@property(nonatomic, strong) UILabel *textLabel; +@property(nonatomic, strong) UILabel *titleLabel; +@property(nonatomic, strong) UILabel *ctaLabel; +@property(nonatomic, strong) UILabel *ratingLabel; +@property(nonatomic, strong) UIImageView *iconImageView; +@property(nonatomic, strong) UIImageView *mainImageView; +@property(nonatomic, strong) UIImageView *logoImageView; +@property(nonatomic, strong) UIImageView *sponsorImageView; +@property(nonatomic, strong) UIButton *dislikeButton; + +@property(nonatomic, strong) UIView *mediaView; + +-(void) configureMetrics:(NSDictionary *)metrics; +- (instancetype) initWithOffer:(ATNativeAdOffer *)offer; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.h.meta new file mode 100644 index 0000000..e50272b --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: ea80a2164caa74a8bb294b02bae5e928 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.m b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.m new file mode 100644 index 0000000..489ee8d --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.m @@ -0,0 +1,197 @@ +// +// ATNativeSelfRenderView.m +// AnyThinkSDKDemo +// +// Created by GUO PENG on 2022/5/7. +// Copyright © 2022 AnyThink. All rights reserved. +// + +#import "ATNativeSelfRenderView.h" +#import +#import "ATNativeAdWrapper.h" +#import "ATAutolayoutCategories.h" +#import "ATUnityUtilities.h" +#define random(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)/255.0] + +#define randomColor random(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256)) + +@interface ATNativeSelfRenderView() + +@property(nonatomic, strong) ATNativeAdOffer *nativeAdOffer; + +@end + + +@implementation ATNativeSelfRenderView + +- (void)dealloc{ + NSLog(@"🔥---ATNativeSelfRenderView--销毁"); +} + +- (instancetype) initWithOffer:(ATNativeAdOffer *)offer{ + + if (self = [super init]) { + + _nativeAdOffer = offer; + + [self addView]; + [self makeConstraintsForSubviews]; + + [self setupUI]; + } + return self; +} + +- (void)addView{ + + self.advertiserLabel = [[UILabel alloc]init]; + self.advertiserLabel.font = [UIFont boldSystemFontOfSize:15.0f]; + self.advertiserLabel.textColor = [UIColor blackColor]; + self.advertiserLabel.textAlignment = NSTextAlignmentLeft; + self.advertiserLabel.userInteractionEnabled = YES; + self.advertiserLabel.translatesAutoresizingMaskIntoConstraints = false; + [self addSubview:self.advertiserLabel]; + + self.titleLabel = [[UILabel alloc]init]; + self.titleLabel.font = [UIFont boldSystemFontOfSize:18.0f]; + self.titleLabel.textColor = [UIColor blackColor]; + self.titleLabel.textAlignment = NSTextAlignmentLeft; + self.titleLabel.userInteractionEnabled = YES; + self.titleLabel.translatesAutoresizingMaskIntoConstraints = false; + [self addSubview:self.titleLabel]; + + self.textLabel = [[UILabel alloc]init]; + self.textLabel.font = [UIFont systemFontOfSize:15.0f]; + self.textLabel.textColor = [UIColor blackColor]; + self.textLabel.userInteractionEnabled = YES; + self.textLabel.numberOfLines = 0; + self.textLabel.translatesAutoresizingMaskIntoConstraints = false; + [self addSubview:self.textLabel]; + + self.ctaLabel = [[UILabel alloc]init]; + self.ctaLabel.font = [UIFont systemFontOfSize:15.0f]; + self.ctaLabel.textColor = [UIColor blackColor]; + self.ctaLabel.userInteractionEnabled = YES; + self.ctaLabel.translatesAutoresizingMaskIntoConstraints = false; + [self addSubview:self.ctaLabel]; + + self.ratingLabel = [[UILabel alloc]init]; + self.ratingLabel.font = [UIFont systemFontOfSize:15.0f]; + self.ratingLabel.textColor = [UIColor blackColor]; + self.ratingLabel.userInteractionEnabled = YES; + self.ratingLabel.translatesAutoresizingMaskIntoConstraints = false; + [self addSubview:self.ratingLabel]; + + self.iconImageView = [[UIImageView alloc]init]; + self.iconImageView.layer.cornerRadius = 4.0f; + self.iconImageView.layer.masksToBounds = YES; + self.iconImageView.contentMode = UIViewContentModeScaleAspectFit; + self.iconImageView.translatesAutoresizingMaskIntoConstraints = false; + self.iconImageView.userInteractionEnabled = YES; + [self addSubview:self.iconImageView]; + + + self.mainImageView = [[UIImageView alloc]init]; + self.mainImageView.contentMode = UIViewContentModeScaleAspectFit; + self.mainImageView.userInteractionEnabled = YES; + self.mainImageView.translatesAutoresizingMaskIntoConstraints = false; + [self addSubview:self.mainImageView]; + + self.logoImageView = [[UIImageView alloc]init]; + self.logoImageView.contentMode = UIViewContentModeScaleAspectFit; + self.logoImageView.userInteractionEnabled = YES; + self.logoImageView.translatesAutoresizingMaskIntoConstraints = false; + [self addSubview:self.logoImageView]; + + self.dislikeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + self.dislikeButton.translatesAutoresizingMaskIntoConstraints = false; + UIImage *closeImg = [UIImage imageNamed:@"icon_webview_close" inBundle:[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"AnyThinkSDK" ofType:@"bundle"]] compatibleWithTraitCollection:nil]; + + self.dislikeButton.backgroundColor = [UIColor whiteColor]; + [self.dislikeButton setImage:closeImg forState:0]; + [self addSubview:self.dislikeButton]; +} + + +- (void)setupUI{ + + + if (self.nativeAdOffer.nativeAd.icon) { + self.iconImageView.image = self.nativeAdOffer.nativeAd.icon; + } + [[ATImageLoader shareLoader]loadImageWithURL:[NSURL URLWithString:self.nativeAdOffer.nativeAd.iconUrl] completion:^(UIImage *image, NSError *error) { + + if (!error) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.iconImageView setImage:image]; + }); + + + } + }]; + + + NSLog(@"🔥----iconUrl:%@",self.nativeAdOffer.nativeAd.iconUrl); + + [[ATImageLoader shareLoader]loadImageWithURL:[NSURL URLWithString:self.nativeAdOffer.nativeAd.imageUrl] completion:^(UIImage *image, NSError *error) { + + if (!error) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.mainImageView setImage:image]; + }); + + } + }]; + + + NSLog(@"🔥----imageUrl:%@",self.nativeAdOffer.nativeAd.imageUrl); + + [[ATImageLoader shareLoader]loadImageWithURL:[NSURL URLWithString:self.nativeAdOffer.nativeAd.logoUrl] completion:^(UIImage *image, NSError *error) { + + if (!error) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.logoImageView setImage:image]; + }); + } + }]; + + + + NSLog(@"🔥----logoUrl:%@",self.nativeAdOffer.nativeAd.logoUrl); + + + + self.advertiserLabel.text = self.nativeAdOffer.nativeAd.advertiser; + + + self.titleLabel.text = self.nativeAdOffer.nativeAd.title; + + self.textLabel.text = self.nativeAdOffer.nativeAd.mainText; + + self.ctaLabel.text = self.nativeAdOffer.nativeAd.ctaText; + + self.ratingLabel.text = [NSString stringWithFormat:@"%@", self.nativeAdOffer.nativeAd.rating ? self.nativeAdOffer.nativeAd.rating : @""]; +} + +-(void) makeConstraintsForSubviews { + + self.backgroundColor = [UIColor clearColor];// randomColor; + + self.titleLabel.backgroundColor = [UIColor clearColor]; + + self.textLabel.backgroundColor = [UIColor clearColor]; +} +-(void) configureMetrics:(NSDictionary *)metrics { + NSDictionary *views = @{kNativeAssetTitle:_titleLabel, kNativeAssetText:_textLabel, kNativeAssetCta:_ctaLabel, kNativeAssetRating:_ratingLabel, kNativeAssetAdvertiser:_advertiserLabel, kNativeAssetIcon:_iconImageView, kNativeAssetMainImage:_mainImageView, 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]; + [self addConstraintsWithVisualFormat:[NSString stringWithFormat:@"V:|-y-[%@(h)]", key] options:0 metrics:@{@"y":@(frame.origin.y), @"h":@(frame.size.height)} views:views]; + if ([obj respondsToSelector:@selector(setBackgroundColor:)] && [metrics[key] containsObjectForKey:@"background_color"]) [obj setBackgroundColor:[metrics[key][@"background_color"] hasPrefix:@"#"] ? [UIColor colorWithHexString:metrics[key][@"background_color"]] : [UIColor clearColor]]; + if ([obj respondsToSelector:@selector(setTextColor:)] && [metrics[key] containsObjectForKey:@"text_color"]) [obj setTextColor:[UIColor colorWithHexString:metrics[key][@"text_color"]]]; + if ([obj respondsToSelector:@selector(setFont:)] && [metrics[key] containsObjectForKey:@"text_size"] && [metrics[key][@"text_size"] respondsToSelector:@selector(doubleValue)]) [obj setFont:[UIFont systemFontOfSize:[metrics[key][@"text_size"] doubleValue]]]; + }]; + if ([metrics containsObjectForKey:kNativeAssetMedia]) self.mediaView.frame = CGRectFromString(metrics[kNativeAssetMedia][kParsedPropertiesFrameKey]); + else self.mediaView.frame = CGRectFromString(metrics[kNativeAssetMainImage][kParsedPropertiesFrameKey]); +} +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.m.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.m.meta new file mode 100644 index 0000000..bb7b16d --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATNativeSelfRenderView.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 8952ba4c07a0b4860b6142e05374013c +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.h new file mode 100644 index 0000000..5fa1cb5 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.h @@ -0,0 +1,12 @@ +// +// ATRewardedVideoWrapper.h +// UnityContainer +// +// Created by Martin Lau on 08/08/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import "ATBaseUnityWrapper.h" + +@interface ATRewardedVideoWrapper : ATBaseUnityWrapper +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.h.meta new file mode 100644 index 0000000..bede048 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: e19c1c56c316a4ce297fdfcce8318378 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.m b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.m new file mode 100644 index 0000000..7c0acd2 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.m @@ -0,0 +1,326 @@ +// +// ATRewardedVideoWrapper.m +// UnityContainer +// +// Created by Martin Lau on 08/08/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import "ATRewardedVideoWrapper.h" +#import "ATUnityUtilities.h" +#import + +NSString *const kLoadExtraUserIDKey = @"UserId"; +NSString *const kLoadExtraMediaExtraKey = @"UserExtraData"; +@interface ATRewardedVideoWrapper() +@end +@implementation ATRewardedVideoWrapper ++(instancetype)sharedInstance { + static ATRewardedVideoWrapper *sharedInstance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedInstance = [[ATRewardedVideoWrapper alloc] init]; + }); + return sharedInstance; +} + +- (id)selWrapperClassWithDict:(NSDictionary *)dict callback:(void(*)(const char*, const char*))callback { + NSString *selector = dict[@"selector"]; + NSArray* arguments = dict[@"arguments"]; + NSString *firstObject = @""; + NSString *lastObject = @""; + if (![ATUnityUtilities isEmpty:arguments]) { + for (int i = 0; i < arguments.count; i++) { + if (i == 0) { firstObject = arguments[i]; } + else { lastObject = arguments[i]; } + } + } + + if ([selector isEqualToString:@"loadRewardedVideoWithPlacementID:customDataJSONString:callback:"]) { + [self loadRewardedVideoWithPlacementID:firstObject customDataJSONString:lastObject callback:callback]; + } else if ([selector isEqualToString:@"rewardedVideoReadyForPlacementID:"]) { + return [NSNumber numberWithBool:[self rewardedVideoReadyForPlacementID:firstObject]]; + } else if ([selector isEqualToString:@"showRewardedVideoWithPlacementID:extraJsonString:"]) { + [self showRewardedVideoWithPlacementID:firstObject extraJsonString:lastObject]; + } else if ([selector isEqualToString:@"checkAdStatus:"]) { + return [self checkAdStatus:firstObject]; + } else if ([selector isEqualToString:@"clearCache"]) { + [self clearCache]; + } else if ([selector isEqualToString:@"setExtra:"]) { + [self setExtra:firstObject]; + } else if ([selector isEqualToString:@"getValidAdCaches:"]) { + return [self getValidAdCaches:firstObject]; + }else if ([selector isEqualToString:@"entryScenarioWithPlacementID:scenarioID:"]) { + [self entryScenarioWithPlacementID:firstObject scenarioID:lastObject]; + } + // auto + else if ([selector isEqualToString:@"addAutoLoadAdPlacementID:callback:"]){ + [self addAutoLoadAdPlacementID:firstObject callback:callback]; + }else if ([selector isEqualToString:@"removeAutoLoadAdPlacementID:"]){ + [self removeAutoLoadAdPlacementID:firstObject]; + }else if ([selector isEqualToString:@"autoLoadRewardedVideoReadyForPlacementID:"]){ + return [NSNumber numberWithBool:[self autoLoadRewardedVideoReadyForPlacementID:firstObject]]; + }else if ([selector isEqualToString:@"getAutoValidAdCaches:"]){ + return [self getAutoValidAdCaches:firstObject]; + }else if ([selector isEqualToString:@"setAutoLocalExtra:customDataJSONString:"]){ + [self setAutoLocalExtra:firstObject customDataJSONString:lastObject]; + }else if ([selector isEqualToString:@"entryAutoAdScenarioWithPlacementID:scenarioID:"]){ + [self entryAutoAdScenarioWithPlacementID:firstObject scenarioID:lastObject]; + }else if ([selector isEqualToString:@"showAutoRewardedVideoWithPlacementID:extraJsonString:"]){ + [self showAutoRewardedVideoWithPlacementID:firstObject extraJsonString:lastObject]; + }else if ([selector isEqualToString:@"checkAutoAdStatus:"]) { + return [self checkAutoAdStatus:firstObject]; + } + + + return nil; +} +#pragma mark - normal +-(void) loadRewardedVideoWithPlacementID:(NSString*)placementID customDataJSONString:(NSString*)customDataJSONString callback:(void(*)(const char*, const char*))callback { + [self setCallBack:callback forKey:placementID]; + NSMutableDictionary *extra = [NSMutableDictionary dictionary]; + if ([customDataJSONString isKindOfClass:[NSString class]] && [customDataJSONString length] > 0) { + NSDictionary *extraDict = [NSJSONSerialization JSONObjectWithData:[customDataJSONString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + NSLog(@"extraDict = %@", extra); + + if (extraDict[kLoadExtraUserIDKey] != nil) { extra[kATAdLoadingExtraUserIDKey] = extraDict[kLoadExtraUserIDKey]; } + if (extraDict[kLoadExtraMediaExtraKey] != nil) { extra[kATAdLoadingExtraMediaExtraKey] = extraDict[kLoadExtraMediaExtraKey]; } + } + + [[ATAdManager sharedManager] loadADWithPlacementID:placementID extra:[extra isKindOfClass:[NSMutableDictionary class]] ? extra : nil delegate:self]; +} + +-(BOOL) rewardedVideoReadyForPlacementID:(NSString*)placementID { + return [[ATAdManager sharedManager] rewardedVideoReadyForPlacementID:placementID]; +} + +-(NSString*) checkAdStatus:(NSString *)placementID { + ATCheckLoadModel *checkLoadModel = [[ATAdManager sharedManager] checkRewardedVideoLoadStatusForPlacementID:placementID]; + NSMutableDictionary *statusDict = [NSMutableDictionary dictionary]; + statusDict[@"isLoading"] = @(checkLoadModel.isLoading); + statusDict[@"isReady"] = @(checkLoadModel.isReady); + statusDict[@"adInfo"] = checkLoadModel.adOfferInfo; + NSLog(@"ATRewardedVideoWrapper::statusDict = %@", statusDict); + return statusDict.jsonString; +} + +-(NSString*) getValidAdCaches:(NSString *)placementID { + NSArray *array = [[ATAdManager sharedManager] getRewardedVideoValidAdsForPlacementID:placementID]; + NSLog(@"ATNativeAdWrapper::array = %@", array); + return array.jsonString; +} + +-(void) showRewardedVideoWithPlacementID:(NSString*)placementID extraJsonString:(NSString*)extraJsonString { + NSDictionary *extraDict = ([extraJsonString isKindOfClass:[NSString class]] && [extraJsonString dataUsingEncoding:NSUTF8StringEncoding] != nil) ? [NSJSONSerialization JSONObjectWithData:[extraJsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil] : nil; + NSLog(@"ATRewardedVideoWrapper::showRewardedVideoWithPlacementID = %@ extraJsonString = %@", placementID,extraJsonString); + NSLog(@"ATRewardedVideoWrapper::extraDict = %@", extraDict); + [[ATAdManager sharedManager] showRewardedVideoWithPlacementID:placementID scene:extraDict[kATUnityUtilitiesAdShowingExtraScenarioKey] inViewController:[UIApplication sharedApplication].delegate.window.rootViewController delegate:self]; +} + +-(void) clearCache { + +} + +-(void) setExtra:(NSString*)extra { + if ([extra isKindOfClass:[NSString class]]) { + NSDictionary *extraDict = [NSJSONSerialization JSONObjectWithData:[extra dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + if ([extraDict isKindOfClass:[NSDictionary class]]) [[ATAdManager sharedManager] setExtra:extraDict]; + } +} + +- (void)entryScenarioWithPlacementID:(NSString *)placementID scenarioID:(NSString *)scenarioID{ + + [[ATAdManager sharedManager] entryRewardedVideoScenarioWithPlacementID:placementID scene:scenarioID]; +} + +-(NSString*) scriptWrapperClass { + return @"ATRewardedVideoWrapper"; +} + +#pragma mark - auto +-(void) addAutoLoadAdPlacementID:(NSString*)placementID callback:(void(*)(const char*, const char*))callback { + + if (placementID == nil) { + return; + } + + [ATRewardedVideoAutoAdManager sharedInstance].delegate = self; + + + NSArray *placementIDArray = [self jsonStrToArray:placementID]; + + [placementIDArray enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [self setCallBack:callback forKey:obj]; + NSLog(@" addAutoLoadAdPlacementID--%@",placementID); + }]; + [[ATRewardedVideoAutoAdManager sharedInstance] addAutoLoadAdPlacementIDArray:placementIDArray]; + +} + +-(void) removeAutoLoadAdPlacementID:(NSString*)placementID{ + NSLog(@" removeAutoLoadAdPlacementID--%@",placementID); + + if (placementID == nil) { + return; + } + + NSArray *placementIDArray = [self jsonStrToArray:placementID]; + + [[ATRewardedVideoAutoAdManager sharedInstance] removeAutoLoadAdPlacementIDArray:placementIDArray]; +} + +-(BOOL) autoLoadRewardedVideoReadyForPlacementID:(NSString*)placementID { + NSLog(@"Unity: autoLoadRewardedVideoReadyForPlacementID--%@--%d",placementID,[[ATRewardedVideoAutoAdManager sharedInstance] autoLoadRewardedVideoReadyForPlacementID:placementID]); + return [[ATRewardedVideoAutoAdManager sharedInstance] autoLoadRewardedVideoReadyForPlacementID:placementID]; +} + +-(NSString*) getAutoValidAdCaches:(NSString *)placementID{ + NSArray *array = [[ATRewardedVideoAutoAdManager sharedInstance] checkValidAdCachesWithPlacementID:placementID]; + NSLog(@"Unity: getAutoValidAdCaches::array = %@", array); + return array.jsonString; +} + +-(NSString*) checkAutoAdStatus:(NSString *)placementID { + ATCheckLoadModel *checkLoadModel = [[ATRewardedVideoAutoAdManager sharedInstance] checkRewardedVideoLoadStatusForPlacementID:placementID]; + NSMutableDictionary *statusDict = [NSMutableDictionary dictionary]; + statusDict[@"isLoading"] = @(checkLoadModel.isLoading); + statusDict[@"isReady"] = @(checkLoadModel.isReady); + statusDict[@"adInfo"] = checkLoadModel.adOfferInfo; + NSLog(@"ATRewardedVideoWrapper::checkAutoAdStatus statusDict = %@", statusDict); + return statusDict.jsonString; + +} + +-(void) setAutoLocalExtra:(NSString*)placementID customDataJSONString:(NSString*)customDataJSONString{ + NSLog(@"Unity: setAutoLocalExtra::placementID = %@ customDataJSONString: %@", placementID,customDataJSONString); + + + + if ([customDataJSONString isKindOfClass:[NSString class]]) { + + NSDictionary *extraDict = [NSJSONSerialization JSONObjectWithData:[customDataJSONString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + + NSMutableDictionary *extra = [NSMutableDictionary dictionary]; + + + if ([extraDict isKindOfClass:[NSDictionary class]]) { + + if (extraDict[kLoadExtraUserIDKey] != nil) { + extra[kATAdLoadingExtraUserIDKey] = extraDict[kLoadExtraUserIDKey]; + } + if (extraDict[kLoadExtraMediaExtraKey] != nil) { extra[kATAdLoadingExtraMediaExtraKey] = extraDict[kLoadExtraMediaExtraKey]; + } + + }; + + + + [[ATRewardedVideoAutoAdManager sharedInstance] setLocalExtra:extra placementID:placementID]; + } +} + +-(void) entryAutoAdScenarioWithPlacementID:(NSString*)placementID scenarioID:(NSString*)scenarioID{ + NSLog(@"Unity: getAutoValidAdCaches::array = %@ scenarioID:%@", placementID,scenarioID); + + [[ATRewardedVideoAutoAdManager sharedInstance] entryAdScenarioWithPlacementID:placementID scenarioID:scenarioID]; +} + +-(void) showAutoRewardedVideoWithPlacementID:(NSString*)placementID extraJsonString:(NSString*)extraJsonString { + + NSDictionary *extraDict = ([extraJsonString isKindOfClass:[NSString class]] && [extraJsonString dataUsingEncoding:NSUTF8StringEncoding] != nil) ? [NSJSONSerialization JSONObjectWithData:[extraJsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil] : nil; + + NSLog(@"ATRewardedVideoWrapper::showAutoRewardedVideoWithPlacementID = %@ extraJsonString = %@", placementID,extraJsonString); + + NSLog(@"ATRewardedVideoWrapper::extraDict = %@", extraDict); + + [[ATRewardedVideoAutoAdManager sharedInstance] showAutoLoadRewardedVideoWithPlacementID:placementID scene:extraDict[kATUnityUtilitiesAdShowingExtraScenarioKey] inViewController:[UIApplication sharedApplication].delegate.window.rootViewController delegate:self]; +} + +#pragma mark - delegate +// ad +- (void)didStartLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"startLoadingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFinishLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"finishLoadingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFailToLoadADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error{ + [self invokeCallback:@"failToLoadADSource" placementID:placementID error:error extra:extra]; +} + +// bidding +- (void)didStartBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"startBiddingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFinishBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra{ + [self invokeCallback:@"finishBiddingADSource" placementID:placementID error:nil extra:extra]; +} + +- (void)didFailBiddingADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error{ + [self invokeCallback:@"failBiddingADSource" placementID:placementID error:error extra:extra]; +} + + +-(void) didFinishLoadingADWithPlacementID:(NSString *)placementID { + [self invokeCallback:@"OnRewardedVideoLoaded" placementID:placementID error:nil extra:nil]; +} + +-(void) didFailToLoadADWithPlacementID:(NSString*)placementID error:(NSError*)error { + error = error != nil ? error : [NSError errorWithDomain:@"com.anythink.Unity3DPackage" code:100001 userInfo:@{NSLocalizedDescriptionKey:@"AT has failed to load ad", NSLocalizedFailureReasonErrorKey:@"AT has failed to load ad"}]; + [self invokeCallback:@"OnRewardedVideoLoadFailure" placementID:placementID error:error extra:nil]; +} + +-(void) rewardedVideoDidStartPlayingForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnRewardedVideoPlayStart" placementID:placementID error:nil extra:extra]; + [[NSNotificationCenter defaultCenter] postNotificationName:kATUnityUtilitiesRewardedVideoImpressionNotification object:nil]; +} + +-(void) rewardedVideoDidEndPlayingForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnRewardedVideoPlayEnd" placementID:placementID error:nil extra:extra]; +} + +-(void) rewardedVideoDidFailToPlayForPlacementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary *)extra { + error = error != nil ? error : [NSError errorWithDomain:@"com.anythink.Unity3DPackage" code:100001 userInfo:@{NSLocalizedDescriptionKey:@"AT has failed to play video", NSLocalizedFailureReasonErrorKey:@"AT has failed to play video"}]; + [self invokeCallback:@"OnRewardedVideoPlayFailure" placementID:placementID error:error extra:extra]; +} + +-(void) rewardedVideoDidCloseForPlacementID:(NSString*)placementID rewarded:(BOOL)rewarded extra:(NSDictionary *)extra { + [self invokeCallback:@"OnRewardedVideoClose" placementID:placementID error:nil extra:@{@"rewarded":@(rewarded), @"extra":extra != nil ? extra : @{}}]; + [[NSNotificationCenter defaultCenter] postNotificationName:kATUnityUtilitiesRewardedVideoCloseNotification object:nil]; +} + +-(void) rewardedVideoDidClickForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra { + [self invokeCallback:@"OnRewardedVideoClick" placementID:placementID error:nil extra:extra]; +} + +-(void) rewardedVideoDidRewardSuccessForPlacemenID:(NSString*)placementID extra:(NSDictionary*)extra { + [self invokeCallback:@"OnRewardedVideoReward" placementID:placementID error:nil extra:extra]; +} + +//again +// rewarded video again +-(void) rewardedVideoAgainDidStartPlayingForPlacementID:(NSString*)placementID extra:(NSDictionary*)extra { + [self invokeCallback:@"OnRewardedVideoAdAgainPlayStart" placementID:placementID error:nil extra:extra]; +} + +-(void) rewardedVideoAgainDidEndPlayingForPlacementID:(NSString*)placementID extra:(NSDictionary*)extra { + [self invokeCallback:@"OnRewardedVideoAdAgainPlayEnd" placementID:placementID error:nil extra:extra]; +} + +-(void) rewardedVideoAgainDidFailToPlayForPlacementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary*)extra { + error = error != nil ? error : [NSError errorWithDomain:@"com.anythink.Unity3DPackage" code:100001 userInfo:@{NSLocalizedDescriptionKey:@"AT has failed to play video", NSLocalizedFailureReasonErrorKey:@"AT has failed to play video"}]; + [self invokeCallback:@"OnRewardedVideoAdAgainPlayFailed" placementID:placementID error:error extra:extra]; +} + +-(void) rewardedVideoAgainDidClickForPlacementID:(NSString*)placementID extra:(NSDictionary*)extra { + [self invokeCallback:@"OnRewardedVideoAdAgainPlayClicked" placementID:placementID error:nil extra:extra]; +} + +-(void) rewardedVideoAgainDidRewardSuccessForPlacemenID:(NSString*)placementID extra:(NSDictionary*)extra { + [self invokeCallback:@"OnAgainReward" placementID:placementID error:nil extra:extra]; +} + +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.m.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.m.meta new file mode 100644 index 0000000..d1e8506 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATRewardedVideoWrapper.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 455260d2805d443fb928d88d1ee38d33 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.h new file mode 100644 index 0000000..35e593a --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.h @@ -0,0 +1,15 @@ +// +// ATUnityManager.h +// UnityContainer +// +// Created by Martin Lau on 08/08/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import +#import "ATUnityWrapper.h" + +@interface ATUnityManager : NSObject ++(instancetype)sharedInstance; +- (id)selWrapperClassWithDict:(NSDictionary *)dict callback:(void(*)(const char*))callback; +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.h.meta new file mode 100644 index 0000000..0731334 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 98f8cf843a9a84838958bd1fe16f3fa4 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.m b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.m new file mode 100644 index 0000000..afc57f1 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.m @@ -0,0 +1,304 @@ +// +// ATUnityManager.m +// UnityContainer +// +// Created by Martin Lau on 08/08/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import "ATUnityManager.h" +#import +#import "ATUnityUtilities.h" +#import +#import +#import "ATBannerAdWrapper.h" +#import "ATNativeAdWrapper.h" +#import "ATInterstitialAdWrapper.h" +#import "ATRewardedVideoWrapper.h" + +/* + *class: + *selector: + *arguments: + */ +bool at_message_from_unity(const char *msg, void(*callback)(const char*, const char *)) { + NSString *msgStr = [NSString stringWithUTF8String:msg]; + NSDictionary *msgDict = [NSJSONSerialization JSONObjectWithData:[msgStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + Class class = NSClassFromString(msgDict[@"class"]); + + bool ret = false; + ret = [[[class sharedInstance] selWrapperClassWithDict:msgDict callback:callback != NULL ? callback : nil] boolValue]; + + return ret; +} + +int at_get_message_for_unity(const char *msg, void(*callback)(const char*, const char *)) { + NSString *msgStr = [NSString stringWithUTF8String:msg]; + NSDictionary *msgDict = [NSJSONSerialization JSONObjectWithData:[msgStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + + Class class = NSClassFromString(msgDict[@"class"]); + + int ret = 0; + ret = [[[class sharedInstance] selWrapperClassWithDict:msgDict callback:callback != NULL ? callback : nil] intValue]; + + return ret; +} + +char * at_get_string_message_for_unity(const char *msg, void(*callback)(const char*, const char *)) { + NSString *msgStr = [NSString stringWithUTF8String:msg]; + NSDictionary *msgDict = [NSJSONSerialization JSONObjectWithData:[msgStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + + Class class = NSClassFromString(msgDict[@"class"]); + + NSString *ret = @""; + ret = [[class sharedInstance] selWrapperClassWithDict:msgDict callback:callback != NULL ? callback : nil]; + + if ([ret UTF8String] == NULL) + return NULL; + + char* res = (char*)malloc(strlen([ret UTF8String]) + 1); + strcpy(res, [ret UTF8String]); + + return res; +} + +@interface ATUnityManager() +@property(nonatomic, readonly) NSMutableDictionary *consentInfo; +@end +@implementation ATUnityManager ++(instancetype)sharedInstance { + static ATUnityManager *sharedInstance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedInstance = [[ATUnityManager alloc] init]; + }); + return sharedInstance; +} + +-(instancetype) init { + self = [super init]; + if (self != nil) { + _consentInfo = [NSMutableDictionary dictionary]; + } + return self; +} + +- (id)selWrapperClassWithDict:(NSDictionary *)dict callback:(void(*)(const char*))callback { + NSString *selector = dict[@"selector"]; + NSArray* arguments = dict[@"arguments"]; + NSString *firstObject = @""; + NSString *lastObject = @""; + if (![ATUnityUtilities isEmpty:arguments]) { + for (int i = 0; i < arguments.count; i++) { + if (i == 0) { firstObject = arguments[i]; } + else { lastObject = arguments[i]; } + } + } + + if ([selector isEqualToString:@"startSDKWithAppID:appKey:"]) { + return [NSNumber numberWithBool:[self startSDKWithAppID:firstObject appKey:lastObject]]; + } else if ([selector isEqualToString:@"subjectToGDPR"]) { + return [NSNumber numberWithBool:[self subjectToGDPR]]; + } else if ([selector isEqualToString:@"presentDataConsentDialog"]) { + [self presentDataConsentDialog]; + } else if ([selector isEqualToString:@"getUserLocation:"]) { + [self getUserLocation:callback]; + } else if ([selector isEqualToString:@"setPurchaseFlag"]) { + [self setPurchaseFlag]; + } else if ([selector isEqualToString:@"clearPurchaseFlag"]) { + [self clearPurchaseFlag]; + } else if ([selector isEqualToString:@"purchaseFlag"]) { + return [NSNumber numberWithBool:[self purchaseFlag]]; + } else if ([selector isEqualToString:@"setChannel:"]) { + [self setChannel:firstObject]; + } else if ([selector isEqualToString:@"setSubChannel:"]) { + [self setSubChannel:firstObject]; + } else if ([selector isEqualToString:@"setCustomData:"]) { + [self setCustomData:firstObject]; + } else if ([selector isEqualToString:@"setCustomData:forPlacementID:"]) { + [self setCustomData:firstObject forPlacementID:lastObject]; + } else if ([selector isEqualToString:@"setDebugLog:"]) { + [self setDebugLog:firstObject]; + } else if ([selector isEqualToString:@"getDataConsent"]) { + return [NSNumber numberWithInt:[self getDataConsent]]; + } else if ([selector isEqualToString:@"setDataConsent:"]) { + [self setDataConsent:[NSNumber numberWithInt:firstObject.intValue]]; + } else if ([selector isEqualToString:@"inDataProtectionArea"]) { + return [NSNumber numberWithBool:[self inDataProtectionArea]]; + } else if ([selector isEqualToString:@"deniedUploadDeviceInfo:"]) { + [self deniedUploadDeviceInfo:firstObject]; + } else if ([selector isEqualToString:@"setDataConsent:network:"]) { + [self setDataConsent:firstObject network:[NSNumber numberWithInt:lastObject.intValue]]; + } else if ([selector isEqualToString:@"setExcludeBundleIdArray:"]) { + [self setExcludeBundleIdArray:firstObject]; + } else if ([selector isEqualToString:@"setExludePlacementid:unitIDArray:"]) { + [self setExludePlacementid:firstObject unitIDArray:lastObject]; + } else if ([selector isEqualToString:@"setSDKArea:"]) { + [self setSDKArea:[NSNumber numberWithInt:firstObject.intValue]]; + } else if ([selector isEqualToString:@"getArea:"]) { + [self getArea:callback]; + } else if ([selector isEqualToString:@"setWXStatus:"]) { + [self setWXStatus:firstObject]; + } else if ([selector isEqualToString:@"setLocationLongitude:dimension:"]) { + [self setLocationLongitude:[NSNumber numberWithDouble:firstObject.doubleValue] dimension:[NSNumber numberWithDouble:lastObject.doubleValue]]; + } + return nil; +} + +-(BOOL) startSDKWithAppID:(NSString*)appID appKey:(NSString*)appKey { + [[ATAPI sharedInstance]setSystemPlatformType:ATSystemPlatformTypeUnity]; + return [[ATAPI sharedInstance] startWithAppID:appID appKey:appKey error:nil]; +} + +- (BOOL) subjectToGDPR { + return [@[@"AT", @"BE", @"BG", @"HR", @"CY", @"CZ", @"DK", @"EE", @"FI", @"FR", @"DE", @"GR", @"HU", @"IS", @"IE", @"IT", @"LV", @"LI", @"LT", @"LU", @"MT", @"NL", @"NO", @"PL", @"PT", @"RO", @"SK", @"SI", @"ES", @"SE", @"GB", @"UK"] containsObject:[[CTTelephonyNetworkInfo new].subscriberCellularProvider.isoCountryCode length] > 0 ? [[CTTelephonyNetworkInfo new].subscriberCellularProvider.isoCountryCode uppercaseString] : @""]; +} + +-(void) presentDataConsentDialog { + [[ATAPI sharedInstance] presentDataConsentDialogInViewController:[UIApplication sharedApplication].delegate.window.rootViewController dismissalCallback:^{ + + }]; +} + +-(void) getUserLocation:(void(*)(const char*))callback { + [[ATAPI sharedInstance] getUserLocationWithCallback:^(ATUserLocation location) { + if (callback != NULL) { callback(@(location).stringValue.UTF8String); } + }]; +} + +-(void) setPurchaseFlag { + +} + +-(void) clearPurchaseFlag { + +} + +-(BOOL) purchaseFlag { + return NO; +} + +-(void) setChannel:(NSString*)channel { + [[ATAPI sharedInstance] setChannel:channel]; +} + +-(void) setSubChannel:(NSString*)subChannel { + [[ATAPI sharedInstance] setSubchannel:subChannel]; +} + +-(void) setCustomData:(NSString*)customDataStr { + if ([customDataStr isKindOfClass:[NSString class]] && [customDataStr length] > 0) { + NSDictionary *customData = [NSJSONSerialization JSONObjectWithData:[customDataStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + [[ATAPI sharedInstance] setCustomData:customData]; + } +} + +-(void) setCustomData:(NSString*)customDataStr forPlacementID:(NSString*)placementID { + if ([customDataStr isKindOfClass:[NSString class]] && [customDataStr length] > 0) { + NSDictionary *customData = [NSJSONSerialization JSONObjectWithData:[customDataStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + [[ATAPI sharedInstance] setCustomData:customData forPlacementID:placementID]; + } +} + +-(void) setDebugLog:(NSString*)flagStr { + [ATAPI setLogEnabled:[flagStr boolValue]]; +} + +-(int) getDataConsent { + return [@{@(ATDataConsentSetPersonalized):@0, @(ATDataConsentSetNonpersonalized):@1, @(ATDataConsentSetUnknown):@2}[@([ATAPI sharedInstance].dataConsentSet)] intValue]; +} + +-(void) setDataConsent:(NSNumber*)dataConsent { + [[ATAPI sharedInstance] setDataConsentSet:[@{@0:@(ATDataConsentSetPersonalized), @1:@(ATDataConsentSetNonpersonalized), @2:@(ATDataConsentSetUnknown)}[dataConsent] integerValue] consentString:nil]; +} + +-(BOOL) inDataProtectionArea { + return [[ATAPI sharedInstance] inDataProtectionArea]; +} + +-(void) deniedUploadDeviceInfo:(NSString *)deniedInfo { + NSLog(@"ATUnityManager::deniedUploadDeviceInfo = %@", deniedInfo); + if (![ATUnityUtilities isEmpty:deniedInfo]) { + NSArray *deniedInfoArray = [NSJSONSerialization JSONObjectWithData:[deniedInfo dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + [[ATAPI sharedInstance] setDeniedUploadInfoArray:deniedInfoArray]; + } +} + +/* + * + */ +-(void) setDataConsent:(NSString*)consentJsonString network:(NSNumber*)network { + NSLog(@"constenJsonString = %@, network = %@", consentJsonString, network); + NSDictionary *networks = @{@1:kATNetworkNameFacebook, @2:kATNetworkNameAdmob, @3:kATNetworkNameInmobi, @4:kATNetworkNameFlurry, @5:kATNetworkNameApplovin, @6:kATNetworkNameMintegral, @8:kATNetworkNameGDT, @9:kATNetworkNameChartboost, @10:kATNetworkNameTapjoy, @11:kATNetworkNameIronSource, @12:kATNetworkNameUnityAds, @13:kATNetworkNameVungle, @14:kATNetworkNameAdColony, @1:kATNetworkNameOneway, @18:kATNetworkNameMobPower, @20:kATNetworkNameYeahmobi, @21:kATNetworkNameAppnext, @22:kATNetworkNameBaidu}; + if ([networks containsObjectForKey:network]) { + if (([consentJsonString isKindOfClass:[NSString class]] && [consentJsonString dataUsingEncoding:NSUTF8StringEncoding] != nil)) { + NSDictionary *consentDict = [NSJSONSerialization JSONObjectWithData:[consentJsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + _consentInfo[networks[network]] = [consentDict containsObjectForKey:@"value"] ? consentDict[@"value"] : consentDict; + } else { + [_consentInfo removeObjectForKey:networks[network]]; + } + NSLog(@"consentInfo = %@", _consentInfo); + if ([_consentInfo[kATNetworkNameMintegral] isKindOfClass:[NSDictionary class]]) { + NSMutableDictionary* mintegralInfo = [NSMutableDictionary dictionary]; + [_consentInfo[kATNetworkNameMintegral] enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { + if ([key respondsToSelector:@selector(integerValue)] && [obj respondsToSelector:@selector(integerValue)]) mintegralInfo[@([key integerValue])] = @([obj integerValue]); + }]; + NSLog(@"consentInfo = %@, %@", [((NSDictionary*)_consentInfo[kATNetworkNameMintegral]).allKeys[0] class], [((NSDictionary*)_consentInfo[kATNetworkNameMintegral]).allValues[0] class]); + _consentInfo[kATNetworkNameMintegral] = mintegralInfo; + NSLog(@"consentInfo = %@, %@", [((NSDictionary*)_consentInfo[kATNetworkNameMintegral]).allKeys[0] class], [((NSDictionary*)_consentInfo[kATNetworkNameMintegral]).allValues[0] class]); + } + [[ATAPI sharedInstance] setNetworkConsentInfo:_consentInfo]; + } +} + +-(void) setExcludeBundleIdArray:(NSString*)bundleIds { + NSLog(@"ATUnityManager::setExcludeBundleIdArray = %@", bundleIds); + if (![ATUnityUtilities isEmpty:bundleIds]) { + NSArray *bundleIdArray = [NSJSONSerialization JSONObjectWithData:[bundleIds dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + [[ATAPI sharedInstance] setExludeAppleIdArray:bundleIdArray]; + } +} + +-(void) setExludePlacementid:(NSString*)placementID unitIDArray:(NSString*)adsourceIds { + NSLog(@"ATUnityManager::setExludePlacementid=%@ adsourceIds= %@",placementID ,adsourceIds); + if (![ATUnityUtilities isEmpty:adsourceIds]) { + NSArray *adsourceIdArray = [NSJSONSerialization JSONObjectWithData:[adsourceIds dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; + [[ATAdManager sharedManager] setExludePlacementid:placementID + unitIDArray:adsourceIdArray]; + } +} + +-(void) setSDKArea:(NSNumber*)area { + NSLog(@"ATUnityManager::setSDKArea=%@",area); +} + +-(void) getArea:(void(*)(const char *))callback { + NSLog(@"ATUnityManager::getArea"); + NSMutableDictionary *resultDict = [NSMutableDictionary dictionary]; + [[ATAPI sharedInstance] getAreaSuccess:^(NSString *areaCodeStr) { + NSLog(@"ATUnityManager::getArea:Success:%@",areaCodeStr); + if (areaCodeStr != nil) { + resultDict[@"areaCode"] = areaCodeStr; + if (callback != NULL) { callback(resultDict.jsonString.UTF8String); } + } + } failure:^(NSError *error) { + NSLog(@"ATUnityManager::getArea:failure:%@",error.domain); + if (error.domain != nil) { + resultDict[@"errorMsg"] = error.domain; + if (callback != NULL) { callback(resultDict.jsonString.UTF8String); } + } + }]; +} + +-(void) setWXStatus:(NSString *)statusStr { + NSLog(@"ATUnityManager::setWXStatus=%@",statusStr); + [[ATAPI sharedInstance] setWXStatus:[statusStr boolValue]]; +} + +-(void) setLocationLongitude:(NSNumber*)longitude dimension:(NSNumber*)latitude { + NSLog(@"ATUnityManager::setLocationLongitude=%@ dimension=%@",longitude,latitude); + [[ATAPI sharedInstance] setLocationLongitude:longitude.doubleValue dimension:latitude.doubleValue]; +} + +@end + diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.m.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.m.meta new file mode 100644 index 0000000..020e327 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityManager.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 89d5600c5aee24b9bba85b1aba2155c2 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.h new file mode 100644 index 0000000..f305718 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.h @@ -0,0 +1,40 @@ +// +// ATUnityUtilities.h +// UnityContainer +// +// Created by Martin Lau on 14/08/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import +extern NSString *const kATUnityUtilitiesInterstitialImpressionNotification; +extern NSString *const kATUnityUtilitiesInterstitialCloseNotification; +extern NSString *const kATUnityUtilitiesRewardedVideoImpressionNotification; +extern NSString *const kATUnityUtilitiesRewardedVideoCloseNotification; +extern NSString *const kATUnityUtilitiesAdShowingExtraScenarioKey; +@interface ATUnityUtilities : NSObject ++(BOOL)isEmpty:(id)object; +@end + +@interface NSDictionary (KAKit) +-(NSString*) jsonString; +-(BOOL)containsObjectForKey:(id)key; +@end + +@interface NSArray (KAKit) +-(NSString*) jsonString; +@end + +@interface NSData(ATKit) ++(instancetype) dataWithUTF8String:(const char*)string; +@end + +@interface UIColor (Hex) +// 透明度固定为1,以0x开头的十六进制转换成的颜色 ++ (UIColor *)colorWithHex:(long)hexColor; +// 0x开头的十六进制转换成的颜色,透明度可调整 ++ (UIColor *)colorWithHex:(long)hexColor alpha:(float)opacity; +// 颜色转换三:iOS中十六进制的颜色(以#开头)转换为UIColor ++ (UIColor *) colorWithHexString: (NSString *)color; + +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.h.meta new file mode 100644 index 0000000..7623a1f --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: d2933e44fa83d4a93819fa26ce99e040 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.m b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.m new file mode 100644 index 0000000..e8e9cbd --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.m @@ -0,0 +1,125 @@ +// +// ATUnityUtilities.m +// UnityContainer +// +// Created by Martin Lau on 14/08/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#import "ATUnityUtilities.h" +NSString *const kATUnityUtilitiesInterstitialImpressionNotification = @"com.anythink.kATUnityUtilitiesInterstitialImpressionNotification"; +NSString *const kATUnityUtilitiesInterstitialCloseNotification = @"kATUnityUtilitiesInterstitialCloseNotification"; +NSString *const kATUnityUtilitiesRewardedVideoImpressionNotification = @"kATUnityUtilitiesRewardedVideoImpressionNotification"; +NSString *const kATUnityUtilitiesRewardedVideoCloseNotification = @"kATUnityUtilitiesRewardedVideoCloseNotification"; +NSString *const kATUnityUtilitiesAdShowingExtraScenarioKey = @"Scenario"; + +@implementation ATUnityUtilities ++(BOOL)isEmpty:(id)object { + return (object == nil || [object isKindOfClass:[NSNull class]] || ([object respondsToSelector:@selector(length)] && [(NSData *)object length] == 0) || ([object respondsToSelector:@selector(count)] && [(NSArray *)object count] == 0)); +} +@end +@implementation NSDictionary (KAKit) +-(NSString*) jsonString { + NSError *error; + NSData *jsonData; + @try { + jsonData = [NSJSONSerialization dataWithJSONObject:self + options:kNilOptions + error:&error]; + } @catch (NSException *exception) { + return @"{}"; + } @finally {} + + if (!jsonData) { + return @"{}"; + } else { + return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + } +} + +-(BOOL)containsObjectForKey:(id)key { + return [self.allKeys containsObject:key]; +} +@end + +@implementation NSArray (KAKit) +-(NSString*) jsonString { + NSError *error; + NSData *jsonData; + @try { + jsonData = [NSJSONSerialization dataWithJSONObject:self + options:kNilOptions + error:&error]; + } @catch (NSException *exception) { + return @"[]"; + } @finally {} + + if (!jsonData) { + return @"[]"; + } else { + return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + } +} + +@end + +@implementation NSData(ATKit) ++(instancetype) dataWithUTF8String:(const char*)string { + return [[NSString stringWithUTF8String:string] dataUsingEncoding:NSUTF8StringEncoding]; +} +@end +@implementation UIColor (Hex) +// 透明度固定为1,以0x开头的十六进制转换成的颜色 ++ (UIColor*) colorWithHex:(long)hexColor; +{ + return [UIColor colorWithHex:hexColor alpha:1.]; +} +// 0x开头的十六进制转换成的颜色,透明度可调整 ++ (UIColor *)colorWithHex:(long)hexColor alpha:(float)opacity +{ + float red = ((float)((hexColor & 0xFF0000) >> 16))/255.0; + float green = ((float)((hexColor & 0xFF00) >> 8))/255.0; + float blue = ((float)(hexColor & 0xFF))/255.0; + return [UIColor colorWithRed:red green:green blue:blue alpha:opacity]; +} +// 颜色转换三:iOS中十六进制的颜色(以#开头)转换为UIColor ++ (UIColor *) colorWithHexString: (NSString *)color +{ + NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString]; + + // String should be 6 or 8 characters + if ([cString length] < 6) { + return [UIColor clearColor]; + } + + // 判断前缀并剪切掉 + if ([cString hasPrefix:@"0X"]) + cString = [cString substringFromIndex:2]; + if ([cString hasPrefix:@"#"]) + cString = [cString substringFromIndex:1]; + if ([cString length] != 6) + return [UIColor clearColor]; + + // 从六位数值中找到RGB对应的位数并转换 + NSRange range; + range.location = 0; + range.length = 2; + + //R、G、B + NSString *rString = [cString substringWithRange:range]; + + range.location = 2; + NSString *gString = [cString substringWithRange:range]; + + range.location = 4; + NSString *bString = [cString substringWithRange:range]; + + // Scan values + unsigned int r, g, b; + [[NSScanner scannerWithString:rString] scanHexInt:&r]; + [[NSScanner scannerWithString:gString] scanHexInt:&g]; + [[NSScanner scannerWithString:bString] scanHexInt:&b]; + + return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:1.0f]; +} +@end diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.m.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.m.meta new file mode 100644 index 0000000..86f99ef --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityUtilities.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 472fb35badd054a3a8e014a0959291e0 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityWrapper.h b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityWrapper.h new file mode 100644 index 0000000..cfa155d --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityWrapper.h @@ -0,0 +1,19 @@ +// +// ATUnityWrapper.h +// ATSDK +// +// Created by Martin Lau on 08/08/2018. +// Copyright © 2018 Martin Lau. All rights reserved. +// + +#ifndef ATUnityWrapper_h +#define ATUnityWrapper_h +@protocol ATUnityWrapper ++(instancetype) sharedInstance; +@optional +-(void) setCallBack:(void(*)(const char*, const char *))callback forKey:(NSString*)key; +-(void) removeCallbackForKey:(NSString*)key; +-(void(*)(const char*, const char *)) callbackForKey:(NSString*)key; +@end + +#endif /* ATUnityWrapper_h */ diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityWrapper.h.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityWrapper.h.meta new file mode 100644 index 0000000..61b092a --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/C/ATUnityWrapper.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 3d2152091af034234a24ed92e896c851 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/Script.meta new file mode 100644 index 0000000..2036d45 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 299bd02f216b54e2db98218be4653d60 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATAdWrapper.cs b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATAdWrapper.cs new file mode 100644 index 0000000..5a2da54 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATAdWrapper.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; +public class ATAdWrapper { + public ATAdWrapper() { + } + + public static void InvokeCallback(string callback, Dictionary msgDict) { + + } +} \ No newline at end of file diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATAdWrapper.cs.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATAdWrapper.cs.meta new file mode 100644 index 0000000..e76a016 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATAdWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 537bc1063718e45f19b33e189a05622e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATBannerAdWrapper.cs b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATBannerAdWrapper.cs new file mode 100644 index 0000000..69613f3 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATBannerAdWrapper.cs @@ -0,0 +1,219 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using AOT; +using AnyThinkAds.ThirdParty.LitJson; +using AnyThinkAds.iOS; +using AnyThinkAds.Api; +#pragma warning disable 0109 +public class ATBannerAdWrapper:ATAdWrapper { + static private Dictionary clients; + static private string CMessaageReceiverClass = "ATBannerAdWrapper"; + + static public new void InvokeCallback(JsonData jsonData) { + Debug.Log("Unity: ATBannerAdWrapper::InvokeCallback()"); + string extraJson = ""; + string callback = (string)jsonData["callback"]; + Dictionary msgDict = JsonMapper.ToObject>(jsonData["msg"].ToJson()); + JsonData msgJsonData = jsonData["msg"]; + IDictionary idic = (System.Collections.IDictionary)msgJsonData; + + if (idic.Contains("extra")) { + JsonData extraJsonDate = msgJsonData["extra"]; + if (extraJsonDate != null) { + extraJson = msgJsonData["extra"].ToJson(); + } + } + + if (callback.Equals("OnBannerAdLoad")) { + OnBannerAdLoad((string)msgDict["placement_id"]); + } else if (callback.Equals("OnBannerAdLoadFail")) { + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + OnBannerAdLoadFail((string)msgDict["placement_id"], (string)errorMsg["code"], (string)errorMsg["reason"]); + } else if (callback.Equals("OnBannerAdImpress")) { + OnBannerAdImpress((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnBannerAdClick")) { + OnBannerAdClick((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnBannerAdAutoRefresh")) { + OnBannerAdAutoRefresh((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnBannerAdAutoRefreshFail")) { + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + OnBannerAdAutoRefreshFail((string)msgDict["placement_id"], (string)errorMsg["code"], (string)errorMsg["reason"]); + } else if (callback.Equals("OnBannerAdClose")) { + OnBannerAdClose((string)msgDict["placement_id"]); + } else if (callback.Equals("OnBannerAdCloseButtonTapped")) { + OnBannerAdCloseButtonTapped((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("startLoadingADSource")) { + StartLoadingADSource((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("finishLoadingADSource")) { + FinishLoadingADSource((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("failToLoadADSource")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg["code"] != null) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg["reason"] != null) { errorDict.Add("message", errorMsg["reason"]); } + FailToLoadADSource((string)msgDict["placement_id"], extraJson,errorDict); + }else if (callback.Equals("startBiddingADSource")) { + StartBiddingADSource((string)msgDict["placement_id"], extraJson); + + }else if (callback.Equals("finishBiddingADSource")) { + FinishBiddingADSource((string)msgDict["placement_id"], extraJson); + + }else if (callback.Equals("failBiddingADSource")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg["code"] != null) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg["reason"] != null) { errorDict.Add("message", errorMsg["reason"]); } + FailBiddingADSource((string)msgDict["placement_id"],extraJson, errorDict); + } + + } + + static public void loadBannerAd(string placementID, string customData) { + Debug.Log("Unity: ATBannerAdWrapper::loadBannerAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "loadBannerAdWithPlacementID:customDataJSONString:callback:", new object[]{placementID, customData != null ? customData : ""}, true); + } + + static public string checkAdStatus(string placementID) { + Debug.Log("Unity: ATBannerAdWrapper::checkAdStatus(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessaageReceiverClass, "checkAdStatus:", new object[]{placementID}); + } + + static public string getValidAdCaches(string placementID) + { + Debug.Log("Unity: ATBannerAdWrapper::getValidAdCaches(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessaageReceiverClass, "getValidAdCaches:", new object[] { placementID }); + } + + static public void hideBannerAd(string placementID) { + Debug.Log("Unity: ATBannerAdWrapper::showBannerAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "hideBannerAdWithPlacementID:", new object[]{placementID}, false); + } + + static public void showBannerAd(string placementID) { + Debug.Log("Unity: ATBannerAdWrapper::showBannerAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "showBannerAdWithPlacementID:", new object[]{placementID}, false); + } + + static public void showBannerAd(string placementID, string position) + { + Debug.Log("Unity: ATBannerAdWrapper::showBannerAd(" + placementID + "," + position + ")"); + Dictionary rectDict = new Dictionary { { "position", position } }; + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "showBannerAdWithPlacementID:rect:extraJsonString:", new object[] { placementID, JsonMapper.ToJson(rectDict), null}, false); + } + + static public void showBannerAd(string placementID, string position, string mapJson) + { + Debug.Log("Unity: ATBannerAdWrapper::showBannerAd(" + placementID + "," + position + ")"); + Dictionary rectDict = new Dictionary { { "position", position } }; + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "showBannerAdWithPlacementID:rect:extraJsonString:", new object[] { placementID, JsonMapper.ToJson(rectDict), mapJson}, false); + } + + static public void showBannerAd(string placementID, ATRect rect) { + Debug.Log("Unity: ATBannerAdWrapper::showBannerAd(" + placementID + ")"); + Dictionary rectDict = new Dictionary{ {"x", rect.x}, {"y", rect.y}, {"width", rect.width}, {"height", rect.height}, {"uses_pixel", rect.usesPixel}}; + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "showBannerAdWithPlacementID:rect:extraJsonString:", new object[]{placementID, JsonMapper.ToJson(rectDict), null}, false); + } + + static public void showBannerAd(string placementID, ATRect rect, string mapJson) { + Debug.Log("Unity: ATBannerAdWrapper::showBannerAd(" + placementID + ")"); + Dictionary rectDict = new Dictionary{ {"x", rect.x}, {"y", rect.y}, {"width", rect.width}, {"height", rect.height}, {"uses_pixel", rect.usesPixel}}; + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "showBannerAdWithPlacementID:rect:extraJsonString:", new object[]{placementID, JsonMapper.ToJson(rectDict), mapJson}, false); + } + + static public void cleanBannerAd(string placementID) { + Debug.Log("Unity: ATBannerAdWrapper::cleanBannerAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "removeBannerAdWithPlacementID:", new object[]{placementID}, false); + } + + static public void clearCache() { + Debug.Log("Unity: ATBannerAdWrapper::clearCache()"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "clearCache", null); + } + + static public void setClientForPlacementID(string placementID, ATBannerAdClient client) { + if (clients == null) clients = new Dictionary(); + if (clients.ContainsKey(placementID)) clients.Remove(placementID); + clients.Add(placementID, client); + } + + static private void OnBannerAdLoad(string placementID) { + Debug.Log("Unity: ATBannerAdWrapper::OnBannerAdLoad()"); + if (clients[placementID] != null) clients[placementID].OnBannerAdLoad(placementID); + } + + static private void OnBannerAdLoadFail(string placementID, string code, string message) { + Debug.Log("Unity: ATBannerAdWrapper::OnBannerAdLoadFail()"); + if (clients[placementID] != null) clients[placementID].OnBannerAdLoadFail(placementID, code, message); + } + + static private void OnBannerAdImpress(string placementID, string callbackJson) { + Debug.Log("Unity: ATBannerAdWrapper::OnBannerAdImpress()"); + if (clients[placementID] != null) clients[placementID].OnBannerAdImpress(placementID, callbackJson); + } + + static private void OnBannerAdClick(string placementID, string callbackJson) { + Debug.Log("Unity: ATBannerAdWrapper::OnBannerAdClick()"); + if (clients[placementID] != null) clients[placementID].OnBannerAdClick(placementID, callbackJson); + } + + static private void OnBannerAdAutoRefresh(string placementID, string callbackJson) { + Debug.Log("Unity: ATBannerAdWrapper::OnBannerAdAutoRefresh()"); + if (clients[placementID] != null) clients[placementID].OnBannerAdAutoRefresh(placementID, callbackJson); + } + + static private void OnBannerAdAutoRefreshFail(string placementID, string code, string message) { + Debug.Log("Unity: ATBannerAdWrapper::OnBannerAdAutoRefreshFail()"); + if (clients[placementID] != null) clients[placementID].OnBannerAdAutoRefreshFail(placementID, code, message); + } + + static private void OnBannerAdCloseButtonTapped(string placementID, string callbackJson) { + Debug.Log("Unity: ATBannerAdWrapper::onAdCloseButtonTapped()"); + if (clients[placementID] != null) clients[placementID].OnBannerAdCloseButtonTapped(placementID, callbackJson); + } + + static private void OnBannerAdClose(string placementID) { + Debug.Log("Unity: ATBannerAdWrapper::OnBannerAdClose()"); + if (clients[placementID] != null) clients[placementID].OnBannerAdClose(placementID); + } + + // ad source callback + static public void StartLoadingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATBannerAdWrapper::StartLoadingADSource()"); + if (clients[placementID] != null) clients[placementID].startLoadingADSource(placementID, callbackJson); + } + static public void FinishLoadingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATBannerAdWrapper::FinishLoadingADSource()"); + if (clients[placementID] != null) clients[placementID].finishLoadingADSource(placementID, callbackJson); + } + + static public void FailToLoadADSource(string placementID,string callbackJson, Dictionary errorDict) + { + Debug.Log("Unity: ATBannerAdWrapper::FailToLoadADSource()"); + + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].failToLoadADSource(placementID,callbackJson, (string)errorDict["code"], (string)errorDict["message"]); + } + + static public void StartBiddingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATBannerAdWrapper::StartBiddingADSource()"); + if (clients[placementID] != null) clients[placementID].startBiddingADSource(placementID, callbackJson); + } + static public void FinishBiddingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATBannerAdWrapper::FinishBiddingADSource()"); + if (clients[placementID] != null) clients[placementID].finishBiddingADSource(placementID, callbackJson); + } + + static public void FailBiddingADSource(string placementID,string callbackJson, Dictionary errorDict) + { + Debug.Log("Unity: ATBannerAdWrapper::FailBiddingADSource()"); + + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].failBiddingADSource(placementID, callbackJson,(string)errorDict["code"], (string)errorDict["message"]); + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATBannerAdWrapper.cs.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATBannerAdWrapper.cs.meta new file mode 100644 index 0000000..cde1a7a --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATBannerAdWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ae4666e4042724da5bfb3d00bd1c5e74 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATInterstitialAdWrapper.cs b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATInterstitialAdWrapper.cs new file mode 100644 index 0000000..5631584 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATInterstitialAdWrapper.cs @@ -0,0 +1,263 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using AOT; +using AnyThinkAds.ThirdParty.LitJson; +using AnyThinkAds.iOS; +#pragma warning disable 0109 +public class ATInterstitialAdWrapper:ATAdWrapper { + static private Dictionary clients; + static private string CMessaageReceiverClass = "ATInterstitialAdWrapper"; + + static public new void InvokeCallback(JsonData jsonData) { + Debug.Log("Unity: ATInterstitialAdWrapper::InvokeCallback()"); + string extraJson = ""; + string callback = (string)jsonData["callback"]; + Dictionary msgDict = JsonMapper.ToObject>(jsonData["msg"].ToJson()); + JsonData msgJsonData = jsonData["msg"]; + IDictionary idic = (System.Collections.IDictionary)msgJsonData; + + if (idic.Contains("extra")) { + JsonData extraJsonDate = msgJsonData["extra"]; + if (extraJsonDate != null) { + extraJson = msgJsonData["extra"].ToJson(); + } + } + + if (callback.Equals("OnInterstitialAdLoaded")) { + OnInterstitialAdLoaded((string)msgDict["placement_id"]); + } else if (callback.Equals("OnInterstitialAdLoadFailure")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg.ContainsKey("code")) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg.ContainsKey("reason")) { errorDict.Add("message", errorMsg["reason"]); } + OnInterstitialAdLoadFailure((string)msgDict["placement_id"], errorDict); + } else if (callback.Equals("OnInterstitialAdVideoPlayFailure")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg.ContainsKey("code")) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg.ContainsKey("reason")) { errorDict.Add("message", errorMsg["reason"]); } + OnInterstitialAdVideoPlayFailure((string)msgDict["placement_id"], errorDict); + } else if (callback.Equals("OnInterstitialAdVideoPlayStart")) { + OnInterstitialAdVideoPlayStart((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnInterstitialAdVideoPlayEnd")) { + OnInterstitialAdVideoPlayEnd((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnInterstitialAdShow")) { + OnInterstitialAdShow((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnInterstitialAdClick")) { + OnInterstitialAdClick((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnInterstitialAdClose")) { + OnInterstitialAdClose((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnInterstitialAdFailedToShow")) { + OnInterstitialAdFailedToShow((string)msgDict["placement_id"]); + }else if (callback.Equals("startLoadingADSource")) { + StartLoadingADSource((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("finishLoadingADSource")) { + FinishLoadingADSource((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("failToLoadADSource")) { + + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg["code"] != null) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg["reason"] != null) { errorDict.Add("message", errorMsg["reason"]); } + FailToLoadADSource((string)msgDict["placement_id"],extraJson, errorDict); + + }else if (callback.Equals("startBiddingADSource")) { + StartBiddingADSource((string)msgDict["placement_id"], extraJson); + + }else if (callback.Equals("finishBiddingADSource")) { + FinishBiddingADSource((string)msgDict["placement_id"], extraJson); + + }else if (callback.Equals("failBiddingADSource")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg["code"] != null) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg["reason"] != null) { errorDict.Add("message", errorMsg["reason"]); } + FailBiddingADSource((string)msgDict["placement_id"],extraJson, errorDict); + } + + + } + + static public void setClientForPlacementID(string placementID, ATInterstitialAdClient client) { + if (clients == null) clients = new Dictionary(); + if (clients.ContainsKey(placementID)) clients.Remove(placementID); + clients.Add(placementID, client); + } + + static public void loadInterstitialAd(string placementID, string customData) { + Debug.Log("Unity: ATInterstitialAdWrapper::loadInterstitialAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "loadInterstitialAdWithPlacementID:customDataJSONString:callback:", new object[]{placementID, customData != null ? customData : ""}, true); + } + + static public bool hasInterstitialAdReady(string placementID) { + Debug.Log("Unity: ATInterstitialAdWrapper::isInterstitialAdReady(" + placementID + ")"); + return ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "interstitialAdReadyForPlacementID:", new object[]{placementID}); + } + + static public void showInterstitialAd(string placementID, string mapJson) { + Debug.Log("Unity: ATInterstitialAdWrapper::showInterstitialAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "showInterstitialAdWithPlacementID:extraJsonString:", new object[]{placementID, mapJson}); + } + + static public void clearCache(string placementID) { + Debug.Log("Unity: ATInterstitialAdWrapper::clearCache()"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "clearCache", null); + } + + static public string checkAdStatus(string placementID) { + Debug.Log("Unity: ATInterstitialAdWrapper::checkAdStatus(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessaageReceiverClass, "checkAdStatus:", new object[]{placementID}); + } + + static public string getValidAdCaches(string placementID) + { + Debug.Log("Unity: ATInterstitialAdWrapper::checkAdStatus(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessaageReceiverClass, "getValidAdCaches:", new object[] { placementID }); + } + + static public void entryScenarioWithPlacementID(string placementID, string scenarioID) + { + Debug.Log("Unity: ATInterstitialAdWrapper::entryScenarioWithPlacementID(" + placementID + scenarioID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "entryScenarioWithPlacementID:scenarioID:", new object[]{placementID, scenarioID}); + } + + //Callbacks + static private void OnInterstitialAdLoaded(string placementID) { + Debug.Log("Unity: ATInterstitialAdWrapper::OnInterstitialAdLoaded()"); + if (clients[placementID] != null) clients[placementID].OnInterstitialAdLoaded(placementID); + } + + static private void OnInterstitialAdLoadFailure(string placementID, Dictionary errorDict) { + Debug.Log("Unity: ATInterstitialAdWrapper::OnInterstitialAdLoadFailure()"); + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].OnInterstitialAdLoadFailure(placementID, (string)errorDict["code"], (string)errorDict["message"]); + } + + static private void OnInterstitialAdVideoPlayFailure(string placementID, Dictionary errorDict) { + Debug.Log("Unity: ATInterstitialAdWrapper::OnInterstitialAdVideoPlayFailure()"); + if (clients[placementID] != null) clients[placementID].OnInterstitialAdVideoPlayFailure(placementID, (string)errorDict["code"], (string)errorDict["message"]); + } + + static private void OnInterstitialAdVideoPlayStart(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdWrapper::OnInterstitialAdPlayStart()"); + if (clients[placementID] != null) clients[placementID].OnInterstitialAdVideoPlayStart(placementID, callbackJson); + } + + static private void OnInterstitialAdVideoPlayEnd(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdWrapper::OnInterstitialAdVideoPlayEnd()"); + if (clients[placementID] != null) clients[placementID].OnInterstitialAdVideoPlayEnd(placementID, callbackJson); + } + + static private void OnInterstitialAdShow(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdWrapper::OnInterstitialAdShow()"); + if (clients[placementID] != null) clients[placementID].OnInterstitialAdShow(placementID, callbackJson); + } + + static private void OnInterstitialAdFailedToShow(string placementID) { + Debug.Log("Unity: ATInterstitialAdWrapper::OnInterstitialAdFailedToShow()"); + if (clients[placementID] != null) clients[placementID].OnInterstitialAdFailedToShow(placementID); + } + + static private void OnInterstitialAdClick(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdWrapper::OnInterstitialAdClick()"); + if (clients[placementID] != null) clients[placementID].OnInterstitialAdClick(placementID, callbackJson); + } + + static private void OnInterstitialAdClose(string placementID, string callbackJson) { + Debug.Log("Unity: ATInterstitialAdWrapper::OnInterstitialAdClose()"); + if (clients[placementID] != null) clients[placementID].OnInterstitialAdClose(placementID, callbackJson); + } + // ad source callback + static public void StartLoadingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATInterstitialAdWrapper::StartLoadingADSource()"); + if (clients[placementID] != null) clients[placementID].startLoadingADSource(placementID, callbackJson); + } + static public void FinishLoadingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATInterstitialAdWrapper::FinishLoadingADSource()"); + if (clients[placementID] != null) clients[placementID].finishLoadingADSource(placementID, callbackJson); + } + + static public void FailToLoadADSource(string placementID,string callbackJson, Dictionary errorDict) + { + Debug.Log("Unity: ATInterstitialAdWrapper::FailToLoadADSource()"); + + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].failToLoadADSource(placementID,callbackJson,(string)errorDict["code"], (string)errorDict["message"]); + } + + static public void StartBiddingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATInterstitialAdWrapper::StartBiddingADSource()"); + if (clients[placementID] != null) clients[placementID].startBiddingADSource(placementID, callbackJson); + } + static public void FinishBiddingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATInterstitialAdWrapper::FinishBiddingADSource()"); + if (clients[placementID] != null) clients[placementID].finishBiddingADSource(placementID, callbackJson); + } + + static public void FailBiddingADSource(string placementID, string callbackJson,Dictionary errorDict) + { + Debug.Log("Unity: ATInterstitialAdWrapper::FailBiddingADSource()"); + + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].failBiddingADSource(placementID,callbackJson,(string)errorDict["code"], (string)errorDict["message"]); + } + + // Auto + static public void addAutoLoadAdPlacementID(string placementID) + { + Debug.Log("Unity: ATInterstitialAdWrapper::addAutoLoadAdPlacementID(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "addAutoLoadAdPlacementID:callback:", new object[]{placementID}, true); + } + + static public void removeAutoLoadAdPlacementID(string placementID) + { + Debug.Log("Unity: ATInterstitialAdWrapper::removeAutoLoadAdPlacementID(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "removeAutoLoadAdPlacementID:", new object[]{placementID}); + } + static public bool autoLoadInterstitialAdReadyForPlacementID(string placementID) + { + Debug.Log("Unity: ATInterstitialAdWrapper::autoLoadInterstitialAdReadyForPlacementID(" + placementID + ")"); + + return ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "autoLoadInterstitialAdReadyForPlacementID:", new object[]{placementID}); + } + static public string getAutoValidAdCaches(string placementID) + { + Debug.Log("Unity: ATInterstitialAdWrapper::getAutoValidAdCaches"); + return ATUnityCBridge.GetStringMessageFromC(CMessaageReceiverClass, "getAutoValidAdCaches:", new object[]{placementID}); + } + + static public string checkAutoAdStatus(string placementID) { + Debug.Log("Unity: ATInterstitialAdWrapper::checkAutoAdStatus(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessaageReceiverClass, "checkAutoAdStatus:", new object[]{placementID}); + } + + static public void setAutoLocalExtra(string placementID, string customData) + { + + Debug.Log("Unity: ATInterstitialAdWrapper::setAutoLocalExtra(" + placementID + customData + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "setAutoLocalExtra:customDataJSONString:", new object[] {placementID, customData != null ? customData : ""}); + } + + static public void entryAutoAdScenarioWithPlacementID(string placementID, string scenarioID) + { + Debug.Log("Unity: ATInterstitialAdWrapper::entryAutoAdScenarioWithPlacementID(" + placementID + scenarioID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "entryAutoAdScenarioWithPlacementID:scenarioID:", new object[]{placementID, scenarioID}); + } + + static public void showAutoInterstitialAd(string placementID, string mapJson) { + Debug.Log("Unity: ATInterstitialAdWrapper::showAutoInterstitialAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessaageReceiverClass, "showAutoInterstitialAd:extraJsonString:", new object[]{placementID, mapJson}); + } + + + +} + + + diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATInterstitialAdWrapper.cs.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATInterstitialAdWrapper.cs.meta new file mode 100644 index 0000000..f92866b --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATInterstitialAdWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bed7f683b131940ffa21d5da7386906e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATManager.cs b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATManager.cs new file mode 100644 index 0000000..a43fda8 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATManager.cs @@ -0,0 +1,123 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; + +public class ATManager { + private static bool SDKStarted; + public static bool StartSDK(string appID, string appKey) { + Debug.Log("Unity: ATManager::StartSDK(" + appID + "," + appKey + ")"); + if (!SDKStarted) { + Debug.Log("Has not been started before, will starting SDK"); + SDKStarted = true; + return ATUnityCBridge.SendMessageToC("ATUnityManager", "startSDKWithAppID:appKey:", new object[]{appID, appKey}); + } else { + Debug.Log("SDK has been started already, ignore this call"); + return false; + } + } + + public static void setPurchaseFlag() { + ATUnityCBridge.SendMessageToC("ATUnityManager", "setPurchaseFlag", null); + } + + public static void clearPurchaseFlag() { + ATUnityCBridge.SendMessageToC("ATUnityManager", "clearPurchaseFlag", null); + } + + public static bool purchaseFlag() { + return ATUnityCBridge.SendMessageToC("ATUnityManager", "clearPurchaseFlag", null); + } + + public static bool isEUTraffic() { + return ATUnityCBridge.SendMessageToC("ATUnityManager", "inDataProtectionArea", null); + } + + public static void getUserLocation(Func callback) + { + Debug.Log("Unity:ATManager::getUserLocation()"); + ATUnityCBridge.SendMessageToCWithCallBack("ATUnityManager", "getUserLocation:", new object[] { }, callback); + } + + public static void ShowGDPRAuthDialog() { + ATUnityCBridge.SendMessageToC("ATUnityManager", "presentDataConsentDialog", null); + } + + public static int GetDataConsent() { + return ATUnityCBridge.GetMessageFromC("ATUnityManager", "getDataConsent", null); + } + + public static void SetDataConsent(int consent) { + ATUnityCBridge.SendMessageToC("ATUnityManager", "setDataConsent:", new object[]{consent}); + } + + public static void SetNetworkGDPRInfo(int network, string mapJson) { + ATUnityCBridge.SendMessageToC("ATUnityManager", "setDataConsent:network:", new object[]{mapJson, network}); + } + + public static void setChannel(string channel) + { + ATUnityCBridge.SendMessageToC("ATUnityManager", "setChannel:", new object[] {channel}); + } + + public static void setSubChannel(string subchannel) + { + ATUnityCBridge.SendMessageToC("ATUnityManager", "setSubChannel:", new object[] {subchannel}); + } + + public static void setCustomMap(string jsonMap) + { + ATUnityCBridge.SendMessageToC("ATUnityManager", "setCustomData:", new object[] { jsonMap }); + } + + public static void setCustomDataForPlacementID(string customData, string placementID) + { + ATUnityCBridge.SendMessageToC("ATUnityManager", "setCustomData:forPlacementID:", new object[] {customData, placementID}); + } + + public static void setLogDebug(bool isDebug) + { + ATUnityCBridge.SendMessageToC("ATUnityManager", "setDebugLog:", new object[] { isDebug ? "true" : "false" }); + } + + public static void deniedUploadDeviceInfo(string deniedInfo) + { + ATUnityCBridge.SendMessageToC("ATUnityManager", "deniedUploadDeviceInfo:", new object[] {deniedInfo}); + } + + public static void setExcludeBundleIdArray(string bundleIds) + { + Debug.Log("Unity:ATManager::setExcludeBundleIdArray()"); + ATUnityCBridge.SendMessageToC("ATUnityManager", "setExcludeBundleIdArray:", new object[] {bundleIds}); + } + + public static void setExcludeAdSourceIdArrayForPlacementID(string placementID, string adSourceIds) + { + Debug.Log("Unity:ATManager::setExcludeAdSourceIdArrayForPlacementID()"); + ATUnityCBridge.SendMessageToC("ATUnityManager", "setExludePlacementid:unitIDArray:", new object[] {placementID, adSourceIds}); + } + + public static void setSDKArea(int area) + { + Debug.Log("Unity:ATManager::setSDKArea()"); + ATUnityCBridge.SendMessageToC("ATUnityManager", "setSDKArea:", new object[] {area}); + } + + public static void getArea(Func callback) + { + Debug.Log("Unity:ATManager::getArea()"); + ATUnityCBridge.SendMessageToCWithCallBack("ATUnityManager", "getArea:", new object[] { }, callback); + } + + public static void setWXStatus(bool install) + { + Debug.Log("Unity:ATManager::setWXStatus()"); + ATUnityCBridge.SendMessageToC("ATUnityManager", "setWXStatus:", new object[] {install}); + } + + public static void setLocation(double longitude, double latitude) + { + Debug.Log("Unity:ATManager::setLocation()"); + ATUnityCBridge.SendMessageToC("ATUnityManager", "setLocationLongitude:dimension:", new object[] {longitude, latitude}); + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATManager.cs.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATManager.cs.meta new file mode 100644 index 0000000..8bd41ae --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 774f18f08594f49e3bf4a8a2a7f37659 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeAdWrapper.cs b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeAdWrapper.cs new file mode 100644 index 0000000..5869b98 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeAdWrapper.cs @@ -0,0 +1,200 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using AOT; +using AnyThinkAds.ThirdParty.LitJson; +using AnyThinkAds.iOS; +#pragma warning disable 0109 +public class ATNativeAdWrapper:ATAdWrapper { + static private Dictionary clients; + static private string CMessageReceiverClass = "ATNativeAdWrapper"; + + static public new void InvokeCallback(JsonData jsonData) { + Debug.Log("Unity: ATNativeAdWrapper::InvokeCallback()"); + string extraJson = ""; + string callback = (string)jsonData["callback"]; + Dictionary msgDict = JsonMapper.ToObject>(jsonData["msg"].ToJson()); + JsonData msgJsonData = jsonData["msg"]; + IDictionary idic = (System.Collections.IDictionary)msgJsonData; + + if (idic.Contains("extra")) { + JsonData extraJsonDate = msgJsonData["extra"]; + if (extraJsonDate != null) { + extraJson = msgJsonData["extra"].ToJson(); + } + } + + if (callback.Equals("OnNativeAdLoaded")) { + OnNativeAdLoaded((string)msgDict["placement_id"]); + } else if (callback.Equals("OnNativeAdLoadingFailure")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg.ContainsKey("code")) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg.ContainsKey("reason")) { errorDict.Add("message", errorMsg["reason"]); } + OnNativeAdLoadingFailure((string)msgDict["placement_id"], errorDict); + } else if (callback.Equals("OnNaitveAdShow")) { + OnNaitveAdShow((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnNativeAdClick")) { + OnNativeAdClick((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnNativeAdVideoStart")) { + OnNativeAdVideoStart((string)msgDict["placement_id"]); + } else if (callback.Equals("OnNativeAdVideoEnd")) { + OnNativeAdVideoEnd((string)msgDict["placement_id"]); + } else if (callback.Equals("OnNativeAdCloseButtonClick")) { + OnNativeAdCloseButtonClick((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("startLoadingADSource")) { + StartLoadingADSource((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("finishLoadingADSource")) { + FinishLoadingADSource((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("failToLoadADSource")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg["code"] != null) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg["reason"] != null) { errorDict.Add("message", errorMsg["reason"]); } + FailToLoadADSource((string)msgDict["placement_id"],extraJson, errorDict); + }else if (callback.Equals("startBiddingADSource")) { + StartBiddingADSource((string)msgDict["placement_id"], extraJson); + + }else if (callback.Equals("finishBiddingADSource")) { + FinishBiddingADSource((string)msgDict["placement_id"], extraJson); + + }else if (callback.Equals("failBiddingADSource")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg["code"] != null) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg["reason"] != null) { errorDict.Add("message", errorMsg["reason"]); } + FailBiddingADSource((string)msgDict["placement_id"],extraJson, errorDict); + } + + } + + //Public method(s) + static public void setClientForPlacementID(string placementID, ATNativeAdClient client) { + if (clients == null) clients = new Dictionary(); + if (clients.ContainsKey(placementID)) clients.Remove(placementID); + clients.Add(placementID, client); + } + + static public void loadNativeAd(string placementID, string customData) { + Debug.Log("Unity: ATNativeAdWrapper::loadNativeAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "loadNativeAdWithPlacementID:customDataJSONString:callback:", new object[]{placementID, customData != null ? customData : ""}, true); + } + + static public bool isNativeAdReady(string placementID) { + Debug.Log("Unity: ATNativeAdWrapper::isNativeAdReady(" + placementID + ")"); + return ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "isNativeAdReadyForPlacementID:", new object[]{placementID}); + } + + static public string checkAdStatus(string placementID) { + Debug.Log("Unity: ATNativeAdWrapper::checkAdStatus(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessageReceiverClass, "checkAdStatus:", new object[]{placementID}); + } + + static public string getValidAdCaches(string placementID) + { + Debug.Log("Unity: ATNativeAdWrapper::getValidAdCaches(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessageReceiverClass, "getValidAdCaches:", new object[] { placementID }); + } + + static public void entryScenarioWithPlacementID(string placementID, string scenarioID) + { + Debug.Log("Unity: ATNativeAdWrapper::entryScenarioWithPlacementID(" + placementID + scenarioID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "entryScenarioWithPlacementID:scenarioID:", new object[]{placementID, scenarioID}); + } + + static public void showNativeAd(string placementID, string metrics) { + Debug.Log("Unity: ATNativeAdWrapper::showNativeAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "showNativeAdWithPlacementID:metricsJSONString:extraJsonString:", new object[]{placementID, metrics, null}); + } + + static public void showNativeAd(string placementID, string metrics, string mapJson) { + Debug.Log("Unity: ATNativeAdWrapper::showNativeAd(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "showNativeAdWithPlacementID:metricsJSONString:extraJsonString:", new object[]{placementID, metrics, mapJson}); + } + + static public void removeNativeAdView(string placementID) { + Debug.Log("Unity: ATNativeAdWrapper::removeNativeAdView(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "removeNativeAdViewWithPlacementID:", new object[]{placementID}); + } + + static public void clearCache() { + Debug.Log("Unity: ATNativeAdWrapper::clearCache()"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "clearCache", null); + } + + //Callbacks + static private void OnNativeAdLoaded(string placementID) { + Debug.Log("Unity: ATNativeAdWrapper::OnNativeAdLoaded(" + placementID + ")"); + if (clients[placementID] != null) clients[placementID].onNativeAdLoaded(placementID); + } + + static private void OnNativeAdLoadingFailure(string placementID, Dictionary errorDict) { + Debug.Log("Unity: ATNativeAdWrapper::OnNativeAdLoadingFailure()"); + if (clients[placementID] != null) clients[placementID].onNativeAdLoadFail(placementID, (string)errorDict["code"], (string)errorDict["message"]); + } + + static private void OnNaitveAdShow(string placementID, string callbackJson) { + if (clients[placementID] != null) clients[placementID].onAdImpressed(placementID, callbackJson); + Debug.Log("Unity: ATNativeAdWrapper::OnNaitveAdShow(" + placementID + ")"); + } + + static private void OnNativeAdClick(string placementID, string callbackJson) { + if (clients[placementID] != null) clients[placementID].onAdClicked(placementID, callbackJson); + Debug.Log("Unity: ATNativeAdWrapper::OnNativeAdClick(" + placementID + ")"); + } + + static private void OnNativeAdVideoStart(string placementID) { + if (clients[placementID] != null) clients[placementID].onAdVideoStart(placementID); + Debug.Log("Unity: ATNativeAdWrapper::OnNativeAdVideoStart(" + placementID + ")"); + } + + static private void OnNativeAdVideoEnd(string placementID) { + if (clients[placementID] != null) clients[placementID].onAdVideoEnd(placementID); + Debug.Log("Unity: ATNativeAdWrapper::OnNativeAdVideoEnd(" + placementID + ")"); + } + + static private void OnNativeAdCloseButtonClick(string placementID, string callbackJson) + { + if (clients[placementID] != null) clients[placementID].onAdCloseButtonClicked(placementID, callbackJson); + Debug.Log("Unity: ATNativeAdWrapper::OnNativeAdCloseButtonClick(" + placementID + ")"); + } + // ad source callback + static public void StartLoadingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATNativeAdWrapper::StartLoadingADSource()"); + if (clients[placementID] != null) clients[placementID].startLoadingADSource(placementID, callbackJson); + } + static public void FinishLoadingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATNativeAdWrapper::FinishLoadingADSource()"); + if (clients[placementID] != null) clients[placementID].finishLoadingADSource(placementID, callbackJson); + } + + static public void FailToLoadADSource(string placementID,string callbackJson, Dictionary errorDict) + { + Debug.Log("Unity: ATNativeAdWrapper::FailToLoadADSource()"); + + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].failToLoadADSource(placementID,callbackJson, (string)errorDict["code"], (string)errorDict["message"]); + } + + static public void StartBiddingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATNativeAdWrapper::StartBiddingADSource()"); + if (clients[placementID] != null) clients[placementID].startBiddingADSource(placementID, callbackJson); + } + static public void FinishBiddingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATNativeAdWrapper::FinishBiddingADSource()"); + if (clients[placementID] != null) clients[placementID].finishBiddingADSource(placementID, callbackJson); + } + + static public void FailBiddingADSource(string placementID,string callbackJson, Dictionary errorDict) + { + Debug.Log("Unity: ATNativeAdWrapper::FailBiddingADSource()"); + + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].failBiddingADSource(placementID, callbackJson,(string)errorDict["code"], (string)errorDict["message"]); + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeAdWrapper.cs.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeAdWrapper.cs.meta new file mode 100644 index 0000000..402870c --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeAdWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0e5bd5bbd67514cd5941ddd1f21db351 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeBannerAdWrapper.cs b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeBannerAdWrapper.cs new file mode 100644 index 0000000..fc168b1 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeBannerAdWrapper.cs @@ -0,0 +1,131 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using AOT; +using AnyThinkAds.ThirdParty.LitJson; +using AnyThinkAds.iOS; +using AnyThinkAds.Api; +#pragma warning disable 0109 +public class ATNativeBannerAdWrapper : ATAdWrapper { + static private Dictionary clients; + static private string CMessageReceiverClass = "ATNativeBannerAdWrapper"; + + static public new void InvokeCallback(JsonData jsonData) { + Debug.Log("Unity: ATNativeBannerAdWrapper::InvokeCallback()"); + string extraJson = ""; + string callback = (string)jsonData["callback"]; + Dictionary msgDict = JsonMapper.ToObject>(jsonData["msg"].ToJson()); + JsonData msgJsonData = jsonData["msg"]; + IDictionary idic = (System.Collections.IDictionary)msgJsonData; + + if (idic.Contains("extra")) { + JsonData extraJsonDate = msgJsonData["extra"]; + if (extraJsonDate != null) { + extraJson = msgJsonData["extra"].ToJson(); + } + } + + if (callback.Equals("OnNativeBannerAdLoaded")) { + OnNativeBannerAdLoaded((string)msgDict["placement_id"]); + } else if (callback.Equals("OnNativeBannerAdLoadingFailure")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg.ContainsKey("code")) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg.ContainsKey("reason")) { errorDict.Add("message", errorMsg["reason"]); } + OnNativeBannerAdLoadingFailure((string)msgDict["placement_id"], errorDict); + } else if (callback.Equals("OnNaitveBannerAdShow")) { + OnNaitveBannerAdShow((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnNativeBannerAdClick")) { + OnNativeBannerAdClick((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnNativeBannerAdAutorefresh")) { + OnNativeBannerAdAutorefresh((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnNativeBannerAdAutorefreshFailed")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg.ContainsKey("code")) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg.ContainsKey("reason")) { errorDict.Add("message", errorMsg["reason"]); } + OnNativeBannerAdAutorefreshFailed((string)msgDict["placement_id"], errorDict); + } else if (callback.Equals("OnNativeBannerAdCloseButtonClicked")) { + OnNativeBannerAdCloseButtonClicked((string)msgDict["placement_id"]); + } else if (callback.Equals("PauseAudio")) { + Debug.Log("c# : callback, PauseAudio"); + PauseAudio(); + } else if (callback.Equals("ResumeAudio")) { + Debug.Log("c# : callback, ResumeAudio"); + ResumeAudio(); + } + } + + static public void PauseAudio() { + Debug.Log("ATNativeBannerAdWrapper::PauseAudio()"); + } + + static public void ResumeAudio() { + Debug.Log("ATNativeBannerAdWrapper::ResumeAudio()"); + } + + static public void setClientForPlacementID(string placementID, ATNativeBannerAdClient client) { + Debug.Log("ATNativeBannerAdWrapper::setClientForPlacementID()"); + if (clients == null) clients = new Dictionary(); + if (clients.ContainsKey(placementID)) clients.Remove(placementID); + clients.Add(placementID, client); + } + + static public void loadAd(string placementID, string customData) { + Debug.Log("ATNativeBannerAdWrapper::loadAd()"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "loadNativeBannerAdWithPlacementID:customDataJSONString:callback:", new object[]{placementID, customData != null ? customData : ""}, true); + } + + static public bool adReady(string placementID) { + Debug.Log("ATNativeBannerAdWrapper::adReady()"); + return ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "isNativeBannerAdReadyForPlacementID:", new object[]{placementID}); + } + + static public void showAd(string placementID, ATRect rect, Dictionary pairs) { + Debug.Log("ATNativeBannerAdWrapper::showAd()"); + Dictionary rectDict = new Dictionary{ {"x", rect.x}, {"y", rect.y}, {"width", rect.width}, {"height", rect.height} }; + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "showNativeBannerAdWithPlacementID:rect:extra:", new object[]{placementID, JsonMapper.ToJson(rectDict), JsonMapper.ToJson(pairs != null ? pairs : new Dictionary())}, false); + } + + static public void removeAd(string placementID) { + Debug.Log("ATNativeBannerAdWrapper::removeAd()"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "removeNativeBannerAdWithPlacementID:", new object[]{placementID}, false); + } + + //Callbacks + static private void OnNativeBannerAdLoaded(string placementID) { + Debug.Log("Unity: ATNativeBannerAdWrapper::OnNativeBannerAdLoaded(" + placementID + ")"); + if (clients[placementID] != null) clients[placementID].onAdLoaded(placementID); + } + + static private void OnNativeBannerAdLoadingFailure(string placementID, Dictionary errorDict) { + Debug.Log("Unity: ATNativeBannerAdWrapper::OnNativeBannerAdLoadingFailure(" + placementID + ")"); + if (clients[placementID] != null) clients[placementID].onAdLoadFail(placementID, (string)errorDict["code"], (string)errorDict["message"]); + } + + static private void OnNaitveBannerAdShow(string placementID, string callbackJson) { + Debug.Log("Unity: ATNativeBannerAdWrapper::OnNaitveBannerAdShow(" + placementID + ")"); + if (clients[placementID] != null) clients[placementID].onAdImpressed(placementID, callbackJson); + } + + static private void OnNativeBannerAdClick(string placementID, string callbackJson) { + Debug.Log("Unity: ATNativeBannerAdWrapper::OnNativeBannerAdClick(" + placementID + ")"); + if (clients[placementID] != null) clients[placementID].onAdClicked(placementID, callbackJson); + } + + static private void OnNativeBannerAdAutorefresh(string placementID, string callbackJson) { + Debug.Log("Unity: ATNativeBannerAdWrapper::OnNativeBannerAdAutorefresh(" + placementID + ")"); + if (clients[placementID] != null) clients[placementID].onAdAutoRefresh(placementID, callbackJson); + } + + static private void OnNativeBannerAdAutorefreshFailed(string placementID, Dictionary errorDict) { + Debug.Log("Unity: ATNativeBannerAdWrapper::OnNativeBannerAdAutorefreshFailed(" + placementID + ")"); + if (clients[placementID] != null) clients[placementID].onAdAutoRefreshFailure(placementID, (string)errorDict["code"], (string)errorDict["message"]); + } + + static private void OnNativeBannerAdCloseButtonClicked(string placementID) { + Debug.Log("Unity: ATNativeBannerAdWrapper::OnNativeBannerAdCloseButtonClicked(" + placementID + ")"); + if (clients[placementID] != null) clients[placementID].onAdCloseButtonClicked(placementID); + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeBannerAdWrapper.cs.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeBannerAdWrapper.cs.meta new file mode 100644 index 0000000..4826cef --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATNativeBannerAdWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 12acd6131322e4e6ab58be44f49a76c7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATRewardedVideoWrapper.cs b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATRewardedVideoWrapper.cs new file mode 100644 index 0000000..b7ce57c --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATRewardedVideoWrapper.cs @@ -0,0 +1,313 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using AOT; +using AnyThinkAds.ThirdParty.LitJson; +using AnyThinkAds.iOS; +#pragma warning disable 0109 +public class ATRewardedVideoWrapper:ATAdWrapper { + static private Dictionary clients; + static private string CMessageReceiverClass = "ATRewardedVideoWrapper"; + + static public new void InvokeCallback(JsonData jsonData) { + Debug.Log("Unity: ATRewardedVideoWrapper::InvokeCallback()"); + string extraJson = ""; + string callback = (string)jsonData["callback"]; + Dictionary msgDict = JsonMapper.ToObject>(jsonData["msg"].ToJson()); + JsonData msgJsonData = jsonData["msg"]; + IDictionary idic = (System.Collections.IDictionary)msgJsonData; + + if (idic.Contains("extra")) { + JsonData extraJsonDate = msgJsonData["extra"]; + if (extraJsonDate != null) { + extraJson = msgJsonData["extra"].ToJson(); + } + } + + if (callback.Equals("OnRewardedVideoLoaded")) { + OnRewardedVideoLoaded((string)msgDict["placement_id"]); + } else if (callback.Equals("OnRewardedVideoLoadFailure")) { + + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg["code"] != null) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg["reason"] != null) { errorDict.Add("message", errorMsg["reason"]); } + OnRewardedVideoLoadFailure((string)msgDict["placement_id"], errorDict); + + } else if (callback.Equals("OnRewardedVideoPlayFailure")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg.ContainsKey("code")) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg.ContainsKey("reason")) { errorDict.Add("message", errorMsg["reason"]); } + OnRewardedVideoPlayFailure((string)msgDict["placement_id"], errorDict); + } else if (callback.Equals("OnRewardedVideoPlayStart")) { + OnRewardedVideoPlayStart((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnRewardedVideoPlayEnd")) { + OnRewardedVideoPlayEnd((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnRewardedVideoClick")) { + OnRewardedVideoClick((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnRewardedVideoClose")) { + OnRewardedVideoClose((string)msgDict["placement_id"], (bool)msgDict["rewarded"], extraJson); + } else if (callback.Equals("OnRewardedVideoReward")) { + OnRewardedVideoReward((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnRewardedVideoAdAgainPlayStart")) { + OnRewardedVideoAdAgainPlayStart((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnRewardedVideoAdAgainPlayEnd")) { + OnRewardedVideoAdAgainPlayEnd((string)msgDict["placement_id"], extraJson); + } else if (callback.Equals("OnRewardedVideoAdAgainPlayFailed")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg.ContainsKey("code")) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg.ContainsKey("reason")) { errorDict.Add("message", errorMsg["reason"]); } + OnRewardedVideoAdAgainPlayFailed((string)msgDict["placement_id"], errorDict); + } else if (callback.Equals("OnRewardedVideoAdAgainPlayClicked")) { + OnRewardedVideoAdAgainPlayClicked((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("OnAgainReward")) { + OnAgainReward((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("startLoadingADSource")) { + StartLoadingADSource((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("finishLoadingADSource")) { + FinishLoadingADSource((string)msgDict["placement_id"], extraJson); + }else if (callback.Equals("failToLoadADSource")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg["code"] != null) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg["reason"] != null) { errorDict.Add("message", errorMsg["reason"]); } + + FailToLoadADSource((string)msgDict["placement_id"],extraJson,errorDict); + }else if (callback.Equals("startBiddingADSource")) { + StartBiddingADSource((string)msgDict["placement_id"], extraJson); + + }else if (callback.Equals("finishBiddingADSource")) { + FinishBiddingADSource((string)msgDict["placement_id"], extraJson); + + }else if (callback.Equals("failBiddingADSource")) { + Dictionary errorDict = new Dictionary(); + Dictionary errorMsg = JsonMapper.ToObject>(msgJsonData["error"].ToJson()); + if (errorMsg["code"] != null) { errorDict.Add("code", errorMsg["code"]); } + if (errorMsg["reason"] != null) { errorDict.Add("message", errorMsg["reason"]); } + FailBiddingADSource((string)msgDict["placement_id"],extraJson, errorDict); + } + + + } + + //Public method(s) + static public void setClientForPlacementID(string placementID, ATRewardedVideoAdClient client) { + if (clients == null) clients = new Dictionary(); + if (clients.ContainsKey(placementID)) clients.Remove(placementID); + clients.Add(placementID, client); + } + + static public void setExtra(Dictionary extra) { + Debug.Log("Unity: ATRewardedVideoWrapper::setExtra()"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "setExtra:", new object[]{extra}); + } + + static public void loadRewardedVideo(string placementID, string customData) { + Debug.Log("Unity: ATRewardedVideoWrapper::loadRewardedVideo(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "loadRewardedVideoWithPlacementID:customDataJSONString:callback:", new object[]{placementID, customData != null ? customData : ""}, true); + } + + static public bool isRewardedVideoReady(string placementID) { + Debug.Log("Unity: ATRewardedVideoWrapper::isRewardedVideoReady(" + placementID + ")"); + return ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "rewardedVideoReadyForPlacementID:", new object[]{placementID}); + } + + static public void showRewardedVideo(string placementID, string mapJson) { + Debug.Log("Unity: ATRewardedVideoWrapper::showRewardedVideo(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "showRewardedVideoWithPlacementID:extraJsonString:", new object[]{placementID, mapJson}); + } + + static public void clearCache() { + Debug.Log("Unity: ATRewardedVideoWrapper::clearCache()"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "clearCache", null); + } + + static public string checkAdStatus(string placementID) { + Debug.Log("Unity: ATRewardedVideoWrapper::checkAdStatus(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessageReceiverClass, "checkAdStatus:", new object[]{placementID}); + } + + static public string getValidAdCaches(string placementID) + { + Debug.Log("Unity: ATRewardedVideoWrapper::getValidAdCaches(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessageReceiverClass, "getValidAdCaches:", new object[] { placementID }); + } + + static public void entryScenarioWithPlacementID(string placementID, string scenarioID) + { + Debug.Log("Unity: ATRewardedVideoWrapper::entryScenarioWithPlacementID(" + placementID + scenarioID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "entryScenarioWithPlacementID:scenarioID:", new object[]{placementID, scenarioID}); + } + + //Callbacks + static public void OnRewardedVideoLoaded(string placementID) { + Debug.Log("Unity: ATRewardedVideoWrapper::OnRewardedVideoLoaded()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdLoaded(placementID); + } + + static public void OnRewardedVideoLoadFailure(string placementID, Dictionary errorDict) { + Debug.Log("Unity: ATRewardedVideoWrapper::OnRewardedVideoLoadFailure()"); + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdFailed(placementID, (string)errorDict["code"], (string)errorDict["message"]); + } + + static public void OnRewardedVideoPlayFailure(string placementID, Dictionary errorDict) { + Debug.Log("Unity: ATRewardedVideoWrapper::OnRewardedVideoPlayFailure()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdPlayFailed(placementID, (string)errorDict["code"], (string)errorDict["message"]); + + } + + static public void OnRewardedVideoPlayStart(string placementID, string callbackJson) { + Debug.Log("Unity: ATRewardedVideoWrapper::OnRewardedVideoPlayStart()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdPlayStart(placementID, callbackJson); + } + + static public void OnRewardedVideoPlayEnd(string placementID, string callbackJson) { + Debug.Log("Unity: ATRewardedVideoWrapper::OnRewardedVideoPlayEnd()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdPlayEnd(placementID, callbackJson); + } + + static public void OnRewardedVideoClick(string placementID, string callbackJson) { + Debug.Log("Unity: ATRewardedVideoWrapper::OnRewardedVideoClick()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdPlayClicked(placementID, callbackJson); + } + + static public void OnRewardedVideoClose(string placementID, bool rewarded, string callbackJson) { + Debug.Log("Unity: ATRewardedVideoWrapper::OnRewardedVideoClose()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdClosed(placementID, rewarded, callbackJson); + } + static public void OnRewardedVideoReward(string placementID, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoWrapper::OnRewardedVideoReward()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoReward(placementID, callbackJson); + } + + //------again callback + static public void OnRewardedVideoAdAgainPlayStart(string placementID, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoWrapper::onRewardedVideoAdAgainPlayStart()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdAgainPlayStart(placementID, callbackJson); + } + + + static public void OnRewardedVideoAdAgainPlayEnd(string placementID, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoWrapper::onRewardedVideoAdAgainPlayEnd()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdAgainPlayEnd(placementID, callbackJson); + } + + + static public void OnRewardedVideoAdAgainPlayFailed(string placementID, Dictionary errorDict) + { + Debug.Log("Unity: ATRewardedVideoWrapper::onRewardedVideoAdAgainPlayFailed()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdAgainPlayFailed(placementID, (string)errorDict["code"], (string)errorDict["message"]); + } + + + static public void OnRewardedVideoAdAgainPlayClicked(string placementID, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoWrapper::onRewardedVideoAdAgainPlayClicked()"); + if (clients[placementID] != null) clients[placementID].onRewardedVideoAdAgainPlayClicked(placementID, callbackJson); + } + + + static public void OnAgainReward(string placementID, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoWrapper::onAgainReward()"); + if (clients[placementID] != null) clients[placementID].onAgainReward(placementID, callbackJson); + } + + // Auto + static public void addAutoLoadAdPlacementID(string placementID) + { + Debug.Log("Unity: ATRewardedVideoWrapper::addAutoLoadAdPlacementID(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "addAutoLoadAdPlacementID:callback:", new object[]{placementID}, true); + } + + static public void removeAutoLoadAdPlacementID(string placementID) + { + Debug.Log("Unity: ATRewardedVideoWrapper::removeAutoLoadAdPlacementID(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "removeAutoLoadAdPlacementID:", new object[]{placementID}); + } + static public bool autoLoadRewardedVideoReadyForPlacementID(string placementID) + { + Debug.Log("Unity: ATRewardedVideoWrapper::autoLoadRewardedVideoReadyForPlacementID(" + placementID + ")"); + return ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "autoLoadRewardedVideoReadyForPlacementID:", new object[]{placementID}); + } + static public string getAutoValidAdCaches(string placementID) + { + Debug.Log("Unity: ATRewardedVideoWrapper::getAutoValidAdCaches"); + return ATUnityCBridge.GetStringMessageFromC(CMessageReceiverClass, "getAutoValidAdCaches:", new object[]{placementID}); + } + + static public string checkAutoAdStatus(string placementID) { + Debug.Log("Unity: ATRewardedVideoWrapper::checkAutoAdStatus(" + placementID + ")"); + return ATUnityCBridge.GetStringMessageFromC(CMessageReceiverClass, "checkAutoAdStatus:", new object[]{placementID}); + } + + static public void setAutoLocalExtra(string placementID, string customData) + { + + Debug.Log("Unity: ATRewardedVideoWrapper::setAutoLocalExtra(" + placementID + customData + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "setAutoLocalExtra:customDataJSONString:", new object[] {placementID, customData != null ? customData : ""}); + } + + static public void entryAutoAdScenarioWithPlacementID(string placementID, string scenarioID) + { + Debug.Log("Unity: ATRewardedVideoWrapper::entryAutoAdScenarioWithPlacementID(" + placementID + scenarioID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "entryAutoAdScenarioWithPlacementID:scenarioID:", new object[]{placementID, scenarioID}); + } + + static public void showAutoRewardedVideo(string placementID, string mapJson) { + Debug.Log("Unity: ATRewardedVideoWrapper::showAutoRewardedVideo(" + placementID + ")"); + ATUnityCBridge.SendMessageToC(CMessageReceiverClass, "showAutoRewardedVideoWithPlacementID:extraJsonString:", new object[]{placementID, mapJson}); + } + + // ad source callback + static public void StartLoadingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoWrapper::StartLoadingADSource()"); + if (clients[placementID] != null) clients[placementID].startLoadingADSource(placementID, callbackJson); + } + static public void FinishLoadingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoWrapper::FinishLoadingADSource()"); + if (clients[placementID] != null) clients[placementID].finishLoadingADSource(placementID, callbackJson); + } + + static public void FailToLoadADSource(string placementID, string callbackJson, Dictionary errorDict) + { + Debug.Log("Unity: ATRewardedVideoWrapper::FailToLoadADSource()"); + + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].failToLoadADSource(placementID, callbackJson,(string)errorDict["code"], (string)errorDict["message"]); + } + + static public void StartBiddingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoWrapper::StartBiddingADSource()"); + if (clients[placementID] != null) clients[placementID].startBiddingADSource(placementID, callbackJson); + } + static public void FinishBiddingADSource(string placementID, string callbackJson) + { + Debug.Log("Unity: ATRewardedVideoWrapper::FinishBiddingADSource()"); + if (clients[placementID] != null) clients[placementID].finishBiddingADSource(placementID, callbackJson); + } + + static public void FailBiddingADSource(string placementID, string callbackJson,Dictionary errorDict) + { + Debug.Log("Unity: ATRewardedVideoWrapper::FailBiddingADSource()"); + + Debug.Log("placementID = " + placementID + "errorDict = " + JsonMapper.ToJson(errorDict)); + if (clients[placementID] != null) clients[placementID].failBiddingADSource(placementID,callbackJson,(string)errorDict["code"], (string)errorDict["message"]); + } + + + + +} + + diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATRewardedVideoWrapper.cs.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATRewardedVideoWrapper.cs.meta new file mode 100644 index 0000000..6624eba --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATRewardedVideoWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 612af243cdbe84e72bc98f1f3a25bfaf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATUnityCBridge.cs b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATUnityCBridge.cs new file mode 100644 index 0000000..260787f --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATUnityCBridge.cs @@ -0,0 +1,101 @@ +using System.Runtime.InteropServices; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using AOT; +using AnyThinkAds.ThirdParty.LitJson; +using System; + +public class ATUnityCBridge { + public delegate void CCallBack(string wrapperClass, string msg); + + #if UNITY_IOS || UNITY_IPHONE + [DllImport("__Internal")] + extern static bool at_message_from_unity(string msg, CCallBack callback); + + [DllImport("__Internal")] + extern static int at_get_message_for_unity(string msg, CCallBack callback); + + [DllImport("__Internal")] + extern static string at_get_string_message_for_unity(string msg, CCallBack callback); + #endif + + [MonoPInvokeCallback(typeof(CCallBack))] + static public void MessageFromC(string wrapperClass, string msg) { + Debug.Log("Unity: ATUnityCBridge::MessageFromC(" + wrapperClass + "," + msg + ")"); + JsonData jsonData = JsonMapper.ToObject(msg); + if (wrapperClass.Equals("ATRewardedVideoWrapper")) { + Debug.Log("Unity: ATUnityCBridge::MessageFromC(), hit rv"); + ATRewardedVideoWrapper.InvokeCallback(jsonData); + } else if (wrapperClass.Equals("ATNativeAdWrapper")) { + ATNativeAdWrapper.InvokeCallback(jsonData); + } else if (wrapperClass.Equals("ATInterstitialAdWrapper")) { + ATInterstitialAdWrapper.InvokeCallback(jsonData); + } else if (wrapperClass.Equals("ATBannerAdWrapper")) { + ATBannerAdWrapper.InvokeCallback(jsonData); + } else if (wrapperClass.Equals("ATNativeBannerAdWrapper")) { + ATNativeBannerAdWrapper.InvokeCallback(jsonData); + } + } + + static public bool SendMessageToC(string className, string selector, object[] arguments) { + return SendMessageToC(className, selector, arguments, false); + } + + static public int GetMessageFromC(string className, string selector, object[] arguments) { + Debug.Log("Unity: ATUnityCBridge::GetMessageFromC()"); + Dictionary msgDict = new Dictionary(); + msgDict.Add("class", className); + msgDict.Add("selector", selector); + msgDict.Add("arguments", arguments); + #if UNITY_IOS || UNITY_IPHONE + return at_get_message_for_unity(JsonMapper.ToJson(msgDict), null); + #else + return 0; + #endif + } + + static public string GetStringMessageFromC(string className, string selector, object[] arguments) { + Debug.Log("Unity: ATUnityCBridge::GetStringMessageFromC()"); + Dictionary msgDict = new Dictionary(); + msgDict.Add("class", className); + msgDict.Add("selector", selector); + msgDict.Add("arguments", arguments); + #if UNITY_IOS || UNITY_IPHONE + return at_get_string_message_for_unity(JsonMapper.ToJson(msgDict), null); + #else + return ""; + #endif + } + + static public bool SendMessageToC(string className, string selector, object[] arguments, bool carryCallback) { + Debug.Log("Unity: ATUnityCBridge::SendMessageToC()"); + Dictionary msgDict = new Dictionary(); + msgDict.Add("class", className); + msgDict.Add("selector", selector); + msgDict.Add("arguments", arguments); + CCallBack callback = null; + if (carryCallback) callback = MessageFromC; + #if UNITY_IOS || UNITY_IPHONE + return at_message_from_unity(JsonMapper.ToJson(msgDict), callback); + #else + return false; + #endif + } + +#if UNITY_IOS || UNITY_IPHONE + [DllImport("__Internal")] + extern static bool at_message_from_unity(string msg, Func callback); +#endif + static public void SendMessageToCWithCallBack(string className, string selector, object[] arguments, Func callback) + { + Debug.Log("Unity: ATUnityCBridge::SendMessageToCWithCallBack()"); + Dictionary msgDict = new Dictionary(); + msgDict.Add("class", className); + msgDict.Add("selector", selector); + msgDict.Add("arguments", arguments); +#if UNITY_IOS || UNITY_IPHONE + at_message_from_unity(JsonMapper.ToJson(msgDict), callback); +#endif + } +} diff --git a/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATUnityCBridge.cs.meta b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATUnityCBridge.cs.meta new file mode 100644 index 0000000..24c9cd7 --- /dev/null +++ b/Assets/AnyThinkAds/Platform/iOS/Internal/Script/ATUnityCBridge.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db058d5352b1c4a08a04f676cc103d79 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins.meta b/Assets/AnyThinkAds/Plugins.meta new file mode 100644 index 0000000..3c693e3 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 29db9515d99e97b4e86706b3b5a1b4f2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android.meta b/Assets/AnyThinkAds/Plugins/Android.meta new file mode 100644 index 0000000..f72f0e9 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5d10ccf786e1ad1489b35928a36f68a4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/AndroidManifest.xml b/Assets/AnyThinkAds/Plugins/Android/AndroidManifest.xml new file mode 100644 index 0000000..a2788cd --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/AndroidManifest.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Assets/AnyThinkAds/Plugins/Android/AndroidManifest.xml.meta b/Assets/AnyThinkAds/Plugins/Android/AndroidManifest.xml.meta new file mode 100644 index 0000000..dab57c7 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/AndroidManifest.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 62ceaa71d29d7bb4690d34b78b6d0fdf +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China.meta b/Assets/AnyThinkAds/Plugins/Android/China.meta new file mode 100644 index 0000000..84cf90e --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3732f65f0db68044d8a92831451f9edf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/Editor.meta b/Assets/AnyThinkAds/Plugins/Android/China/Editor.meta new file mode 100644 index 0000000..10d241e --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 66e0968f254244152ae5a813ed8d0b38 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/Editor/Dependencies.xml b/Assets/AnyThinkAds/Plugins/Android/China/Editor/Dependencies.xml new file mode 100644 index 0000000..ed3aa31 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/Editor/Dependencies.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Assets/AnyThinkAds/Plugins/Android/China/Editor/Dependencies.xml.meta b/Assets/AnyThinkAds/Plugins/Android/China/Editor/Dependencies.xml.meta new file mode 100644 index 0000000..480e7f8 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/Editor/Dependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8796f84f818a647e487c69b334805515 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base.meta b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base.meta new file mode 100644 index 0000000..b459e87 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3fed59c8c3f2f47edb4c1c29abbb1db1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_banner.aar b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_banner.aar new file mode 100644 index 0000000..10e675b Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_banner.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_banner.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_banner.aar.meta new file mode 100644 index 0000000..871ec22 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_banner.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 2d2eadb320c6448a7a4d2f4e2b90b4da +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_china_core.aar b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_china_core.aar new file mode 100644 index 0000000..7a26a63 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_china_core.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_china_core.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_china_core.aar.meta new file mode 100644 index 0000000..adfe725 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_china_core.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 48ab74722adda4a78a3cbdcaa8194930 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_core.aar b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_core.aar new file mode 100644 index 0000000..0bbe522 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_core.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_core.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_core.aar.meta new file mode 100644 index 0000000..21282b8 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_core.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: ba760aa6a72eb4d4fa5b45d56a01eb88 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_interstitial.aar b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_interstitial.aar new file mode 100644 index 0000000..1cc2abf Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_interstitial.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_interstitial.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_interstitial.aar.meta new file mode 100644 index 0000000..d7fe103 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_interstitial.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 3c51c213b59544f83af22c17ddb34baa +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_native.aar b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_native.aar new file mode 100644 index 0000000..f15cbd5 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_native.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_native.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_native.aar.meta new file mode 100644 index 0000000..fbf7e45 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_native.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 5cf0e27873d8640d58f965370b8e4894 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_rewardvideo.aar b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_rewardvideo.aar new file mode 100644 index 0000000..d46f9d6 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_rewardvideo.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_rewardvideo.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_rewardvideo.aar.meta new file mode 100644 index 0000000..57e10bf --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_rewardvideo.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 582c425272e48470eaa96bbc41a19ada +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_splash.aar b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_splash.aar new file mode 100644 index 0000000..3667f06 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_splash.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_splash.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_splash.aar.meta new file mode 100644 index 0000000..4f1fcd7 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/anythink_splash.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: e1253ef962331451c920d9a9cfec5d64 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/tramini_sdk.aar b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/tramini_sdk.aar new file mode 100644 index 0000000..2ab5c19 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/tramini_sdk.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/tramini_sdk.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/tramini_sdk.aar.meta new file mode 100644 index 0000000..13c9b9b --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/anythink_base/tramini_sdk.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 69eadc53c9e9c476494b0ec77e3bd34f +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation.meta new file mode 100644 index 0000000..f8734af --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3ed214925e60e2147bbab3c2f5dcd242 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt.meta new file mode 100644 index 0000000..33972a9 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b04c9b660ce4f441b97bbdf15e5f490b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/GDTSDK.unionNormal.4.510.1380.aar b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/GDTSDK.unionNormal.4.510.1380.aar new file mode 100644 index 0000000..47b584e Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/GDTSDK.unionNormal.4.510.1380.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/GDTSDK.unionNormal.4.510.1380.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/GDTSDK.unionNormal.4.510.1380.aar.meta new file mode 100644 index 0000000..4f5a1e5 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/GDTSDK.unionNormal.4.510.1380.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: c345117aff0e042ac85ce3315da4d6fb +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/anythink_network_unity_gdt.aar b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/anythink_network_unity_gdt.aar new file mode 100644 index 0000000..aa003b8 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/anythink_network_unity_gdt.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/anythink_network_unity_gdt.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/anythink_network_unity_gdt.aar.meta new file mode 100644 index 0000000..2ca3328 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/gdt/anythink_network_unity_gdt.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 5fbff6d0de904402ba1ed3df04ad07a3 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou.meta new file mode 100644 index 0000000..5070023 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 08a266e313dde4a4780f408a373e335f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor.meta new file mode 100644 index 0000000..df8d6f5 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7a15da55f9b843a78efbe062e5a4162 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor/Dependencies.xml b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor/Dependencies.xml new file mode 100644 index 0000000..fd380b3 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor/Dependencies.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor/Dependencies.xml.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor/Dependencies.xml.meta new file mode 100644 index 0000000..46c166f --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor/Dependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 453dd31576b994c3492c54fcf7750eb1 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/anythink_network_unity_kuaishou.aar b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/anythink_network_unity_kuaishou.aar new file mode 100644 index 0000000..2836bb4 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/anythink_network_unity_kuaishou.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/anythink_network_unity_kuaishou.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/anythink_network_unity_kuaishou.aar.meta new file mode 100644 index 0000000..ec057d2 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/anythink_network_unity_kuaishou.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: e86cd321b94404f92b07b2426514b866 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/kssdk-ad-3.3.34-publishRelease-e569e9b00.aar b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/kssdk-ad-3.3.34-publishRelease-e569e9b00.aar new file mode 100644 index 0000000..17b995b Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/kssdk-ad-3.3.34-publishRelease-e569e9b00.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/kssdk-ad-3.3.34-publishRelease-e569e9b00.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/kssdk-ad-3.3.34-publishRelease-e569e9b00.aar.meta new file mode 100644 index 0000000..3b53639 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/kssdk-ad-3.3.34-publishRelease-e569e9b00.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 4abbc90e2bfe9438083fa2bad2088718 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle.meta new file mode 100644 index 0000000..f97dada --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2e98980da5c894df4a84b91d90c80398 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/anythink_network_unity_pangle.aar b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/anythink_network_unity_pangle.aar new file mode 100644 index 0000000..86ba265 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/anythink_network_unity_pangle.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/anythink_network_unity_pangle.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/anythink_network_unity_pangle.aar.meta new file mode 100644 index 0000000..51621c4 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/anythink_network_unity_pangle.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: ba11efe87ceb04de0993c8cf97924e43 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/open_ad_sdk_5.0.0.4.aar b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/open_ad_sdk_5.0.0.4.aar new file mode 100644 index 0000000..25e65f7 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/open_ad_sdk_5.0.0.4.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/open_ad_sdk_5.0.0.4.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/open_ad_sdk_5.0.0.4.aar.meta new file mode 100644 index 0000000..2d8ddf5 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation/pangle/open_ad_sdk_5.0.0.4.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 1610503b01fd04462a2e8403e6b665b5 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin.meta new file mode 100644 index 0000000..ca2eb51 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 47210f282ec7e4e598d7af7d7929faf8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/disklrucache-4.9.0.jar b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/disklrucache-4.9.0.jar new file mode 100644 index 0000000..539a929 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/disklrucache-4.9.0.jar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/disklrucache-4.9.0.jar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/disklrucache-4.9.0.jar.meta new file mode 100644 index 0000000..e86c9e1 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/disklrucache-4.9.0.jar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 7740db6d6ef4c4268bb57a3003ad8d08 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gifdecoder-4.9.0.aar b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gifdecoder-4.9.0.aar new file mode 100644 index 0000000..5caad10 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gifdecoder-4.9.0.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gifdecoder-4.9.0.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gifdecoder-4.9.0.aar.meta new file mode 100644 index 0000000..0ff2091 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gifdecoder-4.9.0.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 9d2021a4299644d1eb7480659541aa89 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/glide-4.9.0.aar b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/glide-4.9.0.aar new file mode 100644 index 0000000..1365bf5 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/glide-4.9.0.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/glide-4.9.0.aar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/glide-4.9.0.aar.meta new file mode 100644 index 0000000..eda251e --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/glide-4.9.0.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: aed66fd54ff77459a87c03be0c243d31 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gson-2.8.4.jar b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gson-2.8.4.jar new file mode 100644 index 0000000..41bae96 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gson-2.8.4.jar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gson-2.8.4.jar.meta b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gson-2.8.4.jar.meta new file mode 100644 index 0000000..87f767e --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/China/mediation_plugin/gson-2.8.4.jar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 4c4732d77f090499fbcd167c6616152a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/anythink_bridge.aar b/Assets/AnyThinkAds/Plugins/Android/anythink_bridge.aar new file mode 100644 index 0000000..a9e5ee4 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/anythink_bridge.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/anythink_bridge.aar.meta b/Assets/AnyThinkAds/Plugins/Android/anythink_bridge.aar.meta new file mode 100644 index 0000000..8aafdfe --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/anythink_bridge.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 19407568a6ed74bcc83f3f2850b9ea1e +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/libs.meta b/Assets/AnyThinkAds/Plugins/Android/libs.meta new file mode 100644 index 0000000..b77422e --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/libs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9eafffd68d739204a9a9e9065e469602 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/libs/anythink_network_mobrain.aar b/Assets/AnyThinkAds/Plugins/Android/libs/anythink_network_mobrain.aar new file mode 100644 index 0000000..df8edb9 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/libs/anythink_network_mobrain.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/libs/anythink_network_mobrain.aar.meta b/Assets/AnyThinkAds/Plugins/Android/libs/anythink_network_mobrain.aar.meta new file mode 100644 index 0000000..0e15f03 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/libs/anythink_network_mobrain.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 886377a8441c8a54fb70274bb3cbe937 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/libs/mediation_ad_sdk_3.6.0.2.aar b/Assets/AnyThinkAds/Plugins/Android/libs/mediation_ad_sdk_3.6.0.2.aar new file mode 100644 index 0000000..c9343e3 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/libs/mediation_ad_sdk_3.6.0.2.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/libs/mediation_ad_sdk_3.6.0.2.aar.meta b/Assets/AnyThinkAds/Plugins/Android/libs/mediation_ad_sdk_3.6.0.2.aar.meta new file mode 100644 index 0000000..c8ad817 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/libs/mediation_ad_sdk_3.6.0.2.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 74e09de28a301e94384f0f4ea7700036 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/libs/pangle_adapter_4.7.1.2.0.aar b/Assets/AnyThinkAds/Plugins/Android/libs/pangle_adapter_4.7.1.2.0.aar new file mode 100644 index 0000000..027e0a0 Binary files /dev/null and b/Assets/AnyThinkAds/Plugins/Android/libs/pangle_adapter_4.7.1.2.0.aar differ diff --git a/Assets/AnyThinkAds/Plugins/Android/libs/pangle_adapter_4.7.1.2.0.aar.meta b/Assets/AnyThinkAds/Plugins/Android/libs/pangle_adapter_4.7.1.2.0.aar.meta new file mode 100644 index 0000000..47cd41a --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/libs/pangle_adapter_4.7.1.2.0.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 08bd2788a542b7846a7b963ec8761583 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/Android/proguard-android.txt b/Assets/AnyThinkAds/Plugins/Android/proguard-android.txt new file mode 100644 index 0000000..8731207 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/proguard-android.txt @@ -0,0 +1,90 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile + + +-optimizationpasses 5 + +#混淆时不会产生形形色色的类名 +-dontusemixedcaseclassnames + +#指定不去忽略非公共的库类 +-dontskipnonpubliclibraryclasses + +#不预校验 +-dontpreverify + +#不优化输入的类文件 +-dontoptimize + +-ignorewarnings + +-verbose + +#优化 +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* + +#保护内部类 +-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod + +## pangle 穿山甲原有的 +-keep class com.bytedance.sdk.openadsdk.** { *; } +-keep public interface com.bytedance.sdk.openadsdk.downloadnew.** {*;} +-keep class com.pgl.sys.ces.** {*;} +-keep class com.bytedance.embed_dr.** {*;} +-keep class com.bytedance.embedapplog.** {*;} + +## pangle 插件新增 穿山甲插件化版本新增 +-keep public class com.ss.android.**{*;} +-keeppackagenames com.bytedance.sdk.openadsdk.api +-keeppackagenames com.bytedance.embed_dr +-keeppackagenames com.bytedance.embedapplog +-keeppackagenames com.ss.android + +## 聚合混淆 +-keep class bykvm*.** +-keep class com.bytedance.msdk.adapter.**{ public *; } +-keep class com.bytedance.msdk.api.** { + public *; +} +-keep class com.bytedance.msdk.base.TTBaseAd{*;} +-keep class com.bytedance.msdk.adapter.TTAbsAdLoaderAdapter{ + public *; + protected ; +} + + +#oaid 不同的版本混淆代码不太一致,你注意你接入的oaid版本 ,不接入oaid可以不添加 +-dontwarn com.bun.** +-keep class com.bun.** {*;} +-keep class a.**{*;} +-keep class XI.CA.XI.**{*;} +-keep class XI.K0.XI.**{*;} +-keep class XI.XI.K0.**{*;} +-keep class XI.vs.K0.**{*;} +-keep class XI.xo.XI.XI.**{*;} +-keep class com.asus.msa.SupplementaryDID.**{*;} +-keep class com.asus.msa.sdid.**{*;} +-keep class com.huawei.hms.ads.identifier.**{*;} +-keep class com.samsung.android.deviceidservice.**{*;} +-keep class com.zui.opendeviceidlibrary.**{*;} +-keep class org.json.**{*;} +-keep public class com.netease.nis.sdkwrapper.Utils {public ;} \ No newline at end of file diff --git a/Assets/AnyThinkAds/Plugins/Android/proguard-android.txt.meta b/Assets/AnyThinkAds/Plugins/Android/proguard-android.txt.meta new file mode 100644 index 0000000..b009bb0 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/Android/proguard-android.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 25907b6a78178c84292053fc0872abeb +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS.meta b/Assets/AnyThinkAds/Plugins/iOS.meta new file mode 100644 index 0000000..bf977d6 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 57be5e05fa9c77145b5eccbfbbd79323 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/Core.meta b/Assets/AnyThinkAds/Plugins/iOS/Core.meta new file mode 100644 index 0000000..b395de5 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/Core.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 11a2320e9686c45cd8c34ce43c0350cc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/Core/Editor.meta b/Assets/AnyThinkAds/Plugins/iOS/Core/Editor.meta new file mode 100644 index 0000000..d9d56cb --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/Core/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 893161cf104444f32abed6c746aaca3e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/Core/Editor/Dependencies.xml b/Assets/AnyThinkAds/Plugins/iOS/Core/Editor/Dependencies.xml new file mode 100644 index 0000000..a8b4a4c --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/Core/Editor/Dependencies.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Assets/AnyThinkAds/Plugins/iOS/Core/Editor/Dependencies.xml.meta b/Assets/AnyThinkAds/Plugins/iOS/Core/Editor/Dependencies.xml.meta new file mode 100644 index 0000000..e842750 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/Core/Editor/Dependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 254348f606df14748ad325e21335c624 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/gdt.meta b/Assets/AnyThinkAds/Plugins/iOS/gdt.meta new file mode 100644 index 0000000..d37d216 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/gdt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 67086362fa1eb481ca26ce4fef7fee7d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/gdt/Editor.meta b/Assets/AnyThinkAds/Plugins/iOS/gdt/Editor.meta new file mode 100644 index 0000000..33a4119 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/gdt/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e6c11a31d760484e807c56acbfdeae2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/gdt/Editor/Dependencies.xml b/Assets/AnyThinkAds/Plugins/iOS/gdt/Editor/Dependencies.xml new file mode 100644 index 0000000..6820747 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/gdt/Editor/Dependencies.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Assets/AnyThinkAds/Plugins/iOS/gdt/Editor/Dependencies.xml.meta b/Assets/AnyThinkAds/Plugins/iOS/gdt/Editor/Dependencies.xml.meta new file mode 100644 index 0000000..7b467df --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/gdt/Editor/Dependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f21806e689b064f65aa0fd683db0d968 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/kuaishou.meta b/Assets/AnyThinkAds/Plugins/iOS/kuaishou.meta new file mode 100644 index 0000000..68ccdb4 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/kuaishou.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 775e79f97c0934ae59595995b78d5fa9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/kuaishou/Editor.meta b/Assets/AnyThinkAds/Plugins/iOS/kuaishou/Editor.meta new file mode 100644 index 0000000..3fdecd4 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/kuaishou/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 90aec42e9f3124004a0b4508d571866e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/kuaishou/Editor/Dependencies.xml b/Assets/AnyThinkAds/Plugins/iOS/kuaishou/Editor/Dependencies.xml new file mode 100644 index 0000000..e9e1630 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/kuaishou/Editor/Dependencies.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/Assets/AnyThinkAds/Plugins/iOS/kuaishou/Editor/Dependencies.xml.meta b/Assets/AnyThinkAds/Plugins/iOS/kuaishou/Editor/Dependencies.xml.meta new file mode 100644 index 0000000..7be18c3 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/kuaishou/Editor/Dependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cd72f2a8b68a442f9a784999739ff3fe +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/pangle_China.meta b/Assets/AnyThinkAds/Plugins/iOS/pangle_China.meta new file mode 100644 index 0000000..39849bf --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/pangle_China.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5b44b6b990df948d39ae46aa7669b95b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/pangle_China/Editor.meta b/Assets/AnyThinkAds/Plugins/iOS/pangle_China/Editor.meta new file mode 100644 index 0000000..32ee2e4 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/pangle_China/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2923aac3c298e4033a3b415a8f471a55 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Plugins/iOS/pangle_China/Editor/Dependencies.xml b/Assets/AnyThinkAds/Plugins/iOS/pangle_China/Editor/Dependencies.xml new file mode 100644 index 0000000..5e7a40a --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/pangle_China/Editor/Dependencies.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Assets/AnyThinkAds/Plugins/iOS/pangle_China/Editor/Dependencies.xml.meta b/Assets/AnyThinkAds/Plugins/iOS/pangle_China/Editor/Dependencies.xml.meta new file mode 100644 index 0000000..8794ca9 --- /dev/null +++ b/Assets/AnyThinkAds/Plugins/iOS/pangle_China/Editor/Dependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 31bf077fc98a646eba2c2bbab09fa1dd +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid.meta b/Assets/AnyThinkAds/Thrid.meta new file mode 100644 index 0000000..6c5ee8d --- /dev/null +++ b/Assets/AnyThinkAds/Thrid.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9a9b1732f138c4ea08e42f658dff47e4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/IJsonWrapper.cs b/Assets/AnyThinkAds/Thrid/IJsonWrapper.cs new file mode 100644 index 0000000..6956510 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/IJsonWrapper.cs @@ -0,0 +1,60 @@ +#region Header +/** + * IJsonWrapper.cs + * Interface that represents a type capable of handling all kinds of JSON + * data. This is mainly used when mapping objects through JsonMapper, and + * it's implemented by JsonData. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System.Collections; +using System.Collections.Specialized; + + +namespace AnyThinkAds.ThirdParty.LitJson +{ + public enum JsonType + { + None, + + Object, + Array, + String, + Int, + Long, + Double, + Boolean + } + + public interface IJsonWrapper : IList, IOrderedDictionary + { + bool IsArray { get; } + bool IsBoolean { get; } + bool IsDouble { get; } + bool IsInt { get; } + bool IsLong { get; } + bool IsObject { get; } + bool IsString { get; } + + bool GetBoolean (); + double GetDouble (); + int GetInt (); + JsonType GetJsonType (); + long GetLong (); + string GetString (); + + void SetBoolean (bool val); + void SetDouble (double val); + void SetInt (int val); + void SetJsonType (JsonType type); + void SetLong (long val); + void SetString (string val); + + string ToJson (); + void ToJson (JsonWriter writer); + } +} diff --git a/Assets/AnyThinkAds/Thrid/IJsonWrapper.cs.meta b/Assets/AnyThinkAds/Thrid/IJsonWrapper.cs.meta new file mode 100644 index 0000000..8ac3961 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/IJsonWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 87690f0fb18974e5ca2128fc1ecbb68e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/JsonData.cs b/Assets/AnyThinkAds/Thrid/JsonData.cs new file mode 100644 index 0000000..8205150 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonData.cs @@ -0,0 +1,1059 @@ +#region Header +/** + * JsonData.cs + * Generic type to hold JSON data (objects, arrays, and so on). This is + * the default type returned by JsonMapper.ToObject(). + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.IO; + + +namespace AnyThinkAds.ThirdParty.LitJson +{ + public class JsonData : IJsonWrapper, IEquatable + { + #region Fields + private IList inst_array; + private bool inst_boolean; + private double inst_double; + private int inst_int; + private long inst_long; + private IDictionary inst_object; + private string inst_string; + private string json; + private JsonType type; + + // Used to implement the IOrderedDictionary interface + private IList> object_list; + #endregion + + + #region Properties + public int Count { + get { return EnsureCollection ().Count; } + } + + public bool IsArray { + get { return type == JsonType.Array; } + } + + public bool IsBoolean { + get { return type == JsonType.Boolean; } + } + + public bool IsDouble { + get { return type == JsonType.Double; } + } + + public bool IsInt { + get { return type == JsonType.Int; } + } + + public bool IsLong { + get { return type == JsonType.Long; } + } + + public bool IsObject { + get { return type == JsonType.Object; } + } + + public bool IsString { + get { return type == JsonType.String; } + } + + public ICollection Keys { + get { EnsureDictionary (); return inst_object.Keys; } + } + + /// + /// Determines whether the json contains an element that has the specified key. + /// + /// The key to locate in the json. + /// true if the json contains an element that has the specified key; otherwise, false. + public Boolean ContainsKey(String key) { + EnsureDictionary(); + return this.inst_object.Keys.Contains(key); + } + #endregion + + + #region ICollection Properties + int ICollection.Count { + get { + return Count; + } + } + + bool ICollection.IsSynchronized { + get { + return EnsureCollection ().IsSynchronized; + } + } + + object ICollection.SyncRoot { + get { + return EnsureCollection ().SyncRoot; + } + } + #endregion + + + #region IDictionary Properties + bool IDictionary.IsFixedSize { + get { + return EnsureDictionary ().IsFixedSize; + } + } + + bool IDictionary.IsReadOnly { + get { + return EnsureDictionary ().IsReadOnly; + } + } + + ICollection IDictionary.Keys { + get { + EnsureDictionary (); + IList keys = new List (); + + foreach (KeyValuePair entry in + object_list) { + keys.Add (entry.Key); + } + + return (ICollection) keys; + } + } + + ICollection IDictionary.Values { + get { + EnsureDictionary (); + IList values = new List (); + + foreach (KeyValuePair entry in + object_list) { + values.Add (entry.Value); + } + + return (ICollection) values; + } + } + #endregion + + + + #region IJsonWrapper Properties + bool IJsonWrapper.IsArray { + get { return IsArray; } + } + + bool IJsonWrapper.IsBoolean { + get { return IsBoolean; } + } + + bool IJsonWrapper.IsDouble { + get { return IsDouble; } + } + + bool IJsonWrapper.IsInt { + get { return IsInt; } + } + + bool IJsonWrapper.IsLong { + get { return IsLong; } + } + + bool IJsonWrapper.IsObject { + get { return IsObject; } + } + + bool IJsonWrapper.IsString { + get { return IsString; } + } + #endregion + + + #region IList Properties + bool IList.IsFixedSize { + get { + return EnsureList ().IsFixedSize; + } + } + + bool IList.IsReadOnly { + get { + return EnsureList ().IsReadOnly; + } + } + #endregion + + + #region IDictionary Indexer + object IDictionary.this[object key] { + get { + return EnsureDictionary ()[key]; + } + + set { + if (! (key is String)) + throw new ArgumentException ( + "The key has to be a string"); + + JsonData data = ToJsonData (value); + + this[(string) key] = data; + } + } + #endregion + + + #region IOrderedDictionary Indexer + object IOrderedDictionary.this[int idx] { + get { + EnsureDictionary (); + return object_list[idx].Value; + } + + set { + EnsureDictionary (); + JsonData data = ToJsonData (value); + + KeyValuePair old_entry = object_list[idx]; + + inst_object[old_entry.Key] = data; + + KeyValuePair entry = + new KeyValuePair (old_entry.Key, data); + + object_list[idx] = entry; + } + } + #endregion + + + #region IList Indexer + object IList.this[int index] { + get { + return EnsureList ()[index]; + } + + set { + EnsureList (); + JsonData data = ToJsonData (value); + + this[index] = data; + } + } + #endregion + + + #region Public Indexers + public JsonData this[string prop_name] { + get { + EnsureDictionary (); + return inst_object[prop_name]; + } + + set { + EnsureDictionary (); + + KeyValuePair entry = + new KeyValuePair (prop_name, value); + + if (inst_object.ContainsKey (prop_name)) { + for (int i = 0; i < object_list.Count; i++) { + if (object_list[i].Key == prop_name) { + object_list[i] = entry; + break; + } + } + } else + object_list.Add (entry); + + inst_object[prop_name] = value; + + json = null; + } + } + + public JsonData this[int index] { + get { + EnsureCollection (); + + if (type == JsonType.Array) + return inst_array[index]; + + return object_list[index].Value; + } + + set { + EnsureCollection (); + + if (type == JsonType.Array) + inst_array[index] = value; + else { + KeyValuePair entry = object_list[index]; + KeyValuePair new_entry = + new KeyValuePair (entry.Key, value); + + object_list[index] = new_entry; + inst_object[entry.Key] = value; + } + + json = null; + } + } + #endregion + + + #region Constructors + public JsonData () + { + } + + public JsonData (bool boolean) + { + type = JsonType.Boolean; + inst_boolean = boolean; + } + + public JsonData (double number) + { + type = JsonType.Double; + inst_double = number; + } + + public JsonData (int number) + { + type = JsonType.Int; + inst_int = number; + } + + public JsonData (long number) + { + type = JsonType.Long; + inst_long = number; + } + + public JsonData (object obj) + { + if (obj is Boolean) { + type = JsonType.Boolean; + inst_boolean = (bool) obj; + return; + } + + if (obj is Double) { + type = JsonType.Double; + inst_double = (double) obj; + return; + } + + if (obj is Int32) { + type = JsonType.Int; + inst_int = (int) obj; + return; + } + + if (obj is Int64) { + type = JsonType.Long; + inst_long = (long) obj; + return; + } + + if (obj is String) { + type = JsonType.String; + inst_string = (string) obj; + return; + } + + throw new ArgumentException ( + "Unable to wrap the given object with JsonData"); + } + + public JsonData (string str) + { + type = JsonType.String; + inst_string = str; + } + #endregion + + + #region Implicit Conversions + public static implicit operator JsonData (Boolean data) + { + return new JsonData (data); + } + + public static implicit operator JsonData (Double data) + { + return new JsonData (data); + } + + public static implicit operator JsonData (Int32 data) + { + return new JsonData (data); + } + + public static implicit operator JsonData (Int64 data) + { + return new JsonData (data); + } + + public static implicit operator JsonData (String data) + { + return new JsonData (data); + } + #endregion + + + #region Explicit Conversions + public static explicit operator Boolean (JsonData data) + { + if (data.type != JsonType.Boolean) + throw new InvalidCastException ( + "Instance of JsonData doesn't hold a double"); + + return data.inst_boolean; + } + + public static explicit operator Double (JsonData data) + { + if (data.type != JsonType.Double) + throw new InvalidCastException ( + "Instance of JsonData doesn't hold a double"); + + return data.inst_double; + } + + public static explicit operator Int32(JsonData data) + { + if (data.type != JsonType.Int && data.type != JsonType.Long) + { + throw new InvalidCastException( + "Instance of JsonData doesn't hold an int"); + } + + // cast may truncate data... but that's up to the user to consider + return data.type == JsonType.Int ? data.inst_int : (int)data.inst_long; + } + + public static explicit operator Int64(JsonData data) + { + if (data.type != JsonType.Long && data.type != JsonType.Int) + { + throw new InvalidCastException( + "Instance of JsonData doesn't hold a long"); + } + + return data.type == JsonType.Long ? data.inst_long : data.inst_int; + } + + public static explicit operator String (JsonData data) + { + if (data.type != JsonType.String) + throw new InvalidCastException ( + "Instance of JsonData doesn't hold a string"); + + return data.inst_string; + } + #endregion + + + #region ICollection Methods + void ICollection.CopyTo (Array array, int index) + { + EnsureCollection ().CopyTo (array, index); + } + #endregion + + + #region IDictionary Methods + void IDictionary.Add (object key, object value) + { + JsonData data = ToJsonData (value); + + EnsureDictionary ().Add (key, data); + + KeyValuePair entry = + new KeyValuePair ((string) key, data); + object_list.Add (entry); + + json = null; + } + + void IDictionary.Clear () + { + EnsureDictionary ().Clear (); + object_list.Clear (); + json = null; + } + + bool IDictionary.Contains (object key) + { + return EnsureDictionary ().Contains (key); + } + + IDictionaryEnumerator IDictionary.GetEnumerator () + { + return ((IOrderedDictionary) this).GetEnumerator (); + } + + void IDictionary.Remove (object key) + { + EnsureDictionary ().Remove (key); + + for (int i = 0; i < object_list.Count; i++) { + if (object_list[i].Key == (string) key) { + object_list.RemoveAt (i); + break; + } + } + + json = null; + } + #endregion + + + #region IEnumerable Methods + IEnumerator IEnumerable.GetEnumerator () + { + return EnsureCollection ().GetEnumerator (); + } + #endregion + + + #region IJsonWrapper Methods + bool IJsonWrapper.GetBoolean () + { + if (type != JsonType.Boolean) + throw new InvalidOperationException ( + "JsonData instance doesn't hold a boolean"); + + return inst_boolean; + } + + double IJsonWrapper.GetDouble () + { + if (type != JsonType.Double) + throw new InvalidOperationException ( + "JsonData instance doesn't hold a double"); + + return inst_double; + } + + int IJsonWrapper.GetInt () + { + if (type != JsonType.Int) + throw new InvalidOperationException ( + "JsonData instance doesn't hold an int"); + + return inst_int; + } + + long IJsonWrapper.GetLong () + { + if (type != JsonType.Long) + throw new InvalidOperationException ( + "JsonData instance doesn't hold a long"); + + return inst_long; + } + + string IJsonWrapper.GetString () + { + if (type != JsonType.String) + throw new InvalidOperationException ( + "JsonData instance doesn't hold a string"); + + return inst_string; + } + + void IJsonWrapper.SetBoolean (bool val) + { + type = JsonType.Boolean; + inst_boolean = val; + json = null; + } + + void IJsonWrapper.SetDouble (double val) + { + type = JsonType.Double; + inst_double = val; + json = null; + } + + void IJsonWrapper.SetInt (int val) + { + type = JsonType.Int; + inst_int = val; + json = null; + } + + void IJsonWrapper.SetLong (long val) + { + type = JsonType.Long; + inst_long = val; + json = null; + } + + void IJsonWrapper.SetString (string val) + { + type = JsonType.String; + inst_string = val; + json = null; + } + + string IJsonWrapper.ToJson () + { + return ToJson (); + } + + void IJsonWrapper.ToJson (JsonWriter writer) + { + ToJson (writer); + } + #endregion + + + #region IList Methods + int IList.Add (object value) + { + return Add (value); + } + + void IList.Clear () + { + EnsureList ().Clear (); + json = null; + } + + bool IList.Contains (object value) + { + return EnsureList ().Contains (value); + } + + int IList.IndexOf (object value) + { + return EnsureList ().IndexOf (value); + } + + void IList.Insert (int index, object value) + { + EnsureList ().Insert (index, value); + json = null; + } + + void IList.Remove (object value) + { + EnsureList ().Remove (value); + json = null; + } + + void IList.RemoveAt (int index) + { + EnsureList ().RemoveAt (index); + json = null; + } + #endregion + + + #region IOrderedDictionary Methods + IDictionaryEnumerator IOrderedDictionary.GetEnumerator () + { + EnsureDictionary (); + + return new OrderedDictionaryEnumerator ( + object_list.GetEnumerator ()); + } + + void IOrderedDictionary.Insert (int idx, object key, object value) + { + string property = (string) key; + JsonData data = ToJsonData (value); + + this[property] = data; + + KeyValuePair entry = + new KeyValuePair (property, data); + + object_list.Insert (idx, entry); + } + + void IOrderedDictionary.RemoveAt (int idx) + { + EnsureDictionary (); + + inst_object.Remove (object_list[idx].Key); + object_list.RemoveAt (idx); + } + #endregion + + + #region Private Methods + private ICollection EnsureCollection () + { + if (type == JsonType.Array) + return (ICollection) inst_array; + + if (type == JsonType.Object) + return (ICollection) inst_object; + + throw new InvalidOperationException ( + "The JsonData instance has to be initialized first"); + } + + private IDictionary EnsureDictionary () + { + if (type == JsonType.Object) + return (IDictionary) inst_object; + + if (type != JsonType.None) + throw new InvalidOperationException ( + "Instance of JsonData is not a dictionary"); + + type = JsonType.Object; + inst_object = new Dictionary (); + object_list = new List> (); + + return (IDictionary) inst_object; + } + + private IList EnsureList () + { + if (type == JsonType.Array) + return (IList) inst_array; + + if (type != JsonType.None) + throw new InvalidOperationException ( + "Instance of JsonData is not a list"); + + type = JsonType.Array; + inst_array = new List (); + + return (IList) inst_array; + } + + private JsonData ToJsonData (object obj) + { + if (obj == null) + return null; + + if (obj is JsonData) + return (JsonData) obj; + + return new JsonData (obj); + } + + private static void WriteJson (IJsonWrapper obj, JsonWriter writer) + { + if (obj == null) { + writer.Write (null); + return; + } + + if (obj.IsString) { + writer.Write (obj.GetString ()); + return; + } + + if (obj.IsBoolean) { + writer.Write (obj.GetBoolean ()); + return; + } + + if (obj.IsDouble) { + writer.Write (obj.GetDouble ()); + return; + } + + if (obj.IsInt) { + writer.Write (obj.GetInt ()); + return; + } + + if (obj.IsLong) { + writer.Write (obj.GetLong ()); + return; + } + + if (obj.IsArray) { + writer.WriteArrayStart (); + foreach (object elem in (IList) obj) + WriteJson ((JsonData) elem, writer); + writer.WriteArrayEnd (); + + return; + } + + if (obj.IsObject) { + writer.WriteObjectStart (); + + foreach (DictionaryEntry entry in ((IDictionary) obj)) { + writer.WritePropertyName ((string) entry.Key); + WriteJson ((JsonData) entry.Value, writer); + } + writer.WriteObjectEnd (); + + return; + } + } + #endregion + + + public int Add (object value) + { + JsonData data = ToJsonData (value); + + json = null; + + return EnsureList ().Add (data); + } + + public bool Remove(object obj) + { + json = null; + if(IsObject) + { + JsonData value = null; + if (inst_object.TryGetValue((string)obj, out value)) + return inst_object.Remove((string)obj) && object_list.Remove(new KeyValuePair((string)obj, value)); + else + throw new KeyNotFoundException("The specified key was not found in the JsonData object."); + } + if(IsArray) + { + return inst_array.Remove(ToJsonData(obj)); + } + throw new InvalidOperationException ( + "Instance of JsonData is not an object or a list."); + } + + public void Clear () + { + if (IsObject) { + ((IDictionary) this).Clear (); + return; + } + + if (IsArray) { + ((IList) this).Clear (); + return; + } + } + + public bool Equals (JsonData x) + { + if (x == null) + return false; + + if (x.type != this.type) + { + // further check to see if this is a long to int comparison + if ((x.type != JsonType.Int && x.type != JsonType.Long) + || (this.type != JsonType.Int && this.type != JsonType.Long)) + { + return false; + } + } + + switch (this.type) { + case JsonType.None: + return true; + + case JsonType.Object: + return this.inst_object.Equals (x.inst_object); + + case JsonType.Array: + return this.inst_array.Equals (x.inst_array); + + case JsonType.String: + return this.inst_string.Equals (x.inst_string); + + case JsonType.Int: + { + if (x.IsLong) + { + if (x.inst_long < Int32.MinValue || x.inst_long > Int32.MaxValue) + return false; + return this.inst_int.Equals((int)x.inst_long); + } + return this.inst_int.Equals(x.inst_int); + } + + case JsonType.Long: + { + if (x.IsInt) + { + if (this.inst_long < Int32.MinValue || this.inst_long > Int32.MaxValue) + return false; + return x.inst_int.Equals((int)this.inst_long); + } + return this.inst_long.Equals(x.inst_long); + } + + case JsonType.Double: + return this.inst_double.Equals (x.inst_double); + + case JsonType.Boolean: + return this.inst_boolean.Equals (x.inst_boolean); + } + + return false; + } + + public JsonType GetJsonType () + { + return type; + } + + public void SetJsonType (JsonType type) + { + if (this.type == type) + return; + + switch (type) { + case JsonType.None: + break; + + case JsonType.Object: + inst_object = new Dictionary (); + object_list = new List> (); + break; + + case JsonType.Array: + inst_array = new List (); + break; + + case JsonType.String: + inst_string = default (String); + break; + + case JsonType.Int: + inst_int = default (Int32); + break; + + case JsonType.Long: + inst_long = default (Int64); + break; + + case JsonType.Double: + inst_double = default (Double); + break; + + case JsonType.Boolean: + inst_boolean = default (Boolean); + break; + } + + this.type = type; + } + + public string ToJson () + { + if (json != null) + return json; + + StringWriter sw = new StringWriter (); + JsonWriter writer = new JsonWriter (sw); + writer.Validate = false; + + WriteJson (this, writer); + json = sw.ToString (); + + return json; + } + + public void ToJson (JsonWriter writer) + { + bool old_validate = writer.Validate; + + writer.Validate = false; + + WriteJson (this, writer); + + writer.Validate = old_validate; + } + + public override string ToString () + { + switch (type) { + case JsonType.Array: + return "JsonData array"; + + case JsonType.Boolean: + return inst_boolean.ToString (); + + case JsonType.Double: + return inst_double.ToString (); + + case JsonType.Int: + return inst_int.ToString (); + + case JsonType.Long: + return inst_long.ToString (); + + case JsonType.Object: + return "JsonData object"; + + case JsonType.String: + return inst_string; + } + + return "Uninitialized JsonData"; + } + } + + + internal class OrderedDictionaryEnumerator : IDictionaryEnumerator + { + IEnumerator> list_enumerator; + + + public object Current { + get { return Entry; } + } + + public DictionaryEntry Entry { + get { + KeyValuePair curr = list_enumerator.Current; + return new DictionaryEntry (curr.Key, curr.Value); + } + } + + public object Key { + get { return list_enumerator.Current.Key; } + } + + public object Value { + get { return list_enumerator.Current.Value; } + } + + + public OrderedDictionaryEnumerator ( + IEnumerator> enumerator) + { + list_enumerator = enumerator; + } + + + public bool MoveNext () + { + return list_enumerator.MoveNext (); + } + + public void Reset () + { + list_enumerator.Reset (); + } + } +} diff --git a/Assets/AnyThinkAds/Thrid/JsonData.cs.meta b/Assets/AnyThinkAds/Thrid/JsonData.cs.meta new file mode 100644 index 0000000..507cc36 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b4f4c4d3351c413db1274a96252c3a0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/JsonException.cs b/Assets/AnyThinkAds/Thrid/JsonException.cs new file mode 100644 index 0000000..3f88a0f --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonException.cs @@ -0,0 +1,65 @@ +#region Header +/** + * JsonException.cs + * Base class throwed by LitJSON when a parsing error occurs. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; + + +namespace AnyThinkAds.ThirdParty.LitJson +{ + public class JsonException : +#if NETSTANDARD1_5 + Exception +#else + ApplicationException +#endif + { + public JsonException () : base () + { + } + + internal JsonException (ParserToken token) : + base (String.Format ( + "Invalid token '{0}' in input string", token)) + { + } + + internal JsonException (ParserToken token, + Exception inner_exception) : + base (String.Format ( + "Invalid token '{0}' in input string", token), + inner_exception) + { + } + + internal JsonException (int c) : + base (String.Format ( + "Invalid character '{0}' in input string", (char) c)) + { + } + + internal JsonException (int c, Exception inner_exception) : + base (String.Format ( + "Invalid character '{0}' in input string", (char) c), + inner_exception) + { + } + + + public JsonException (string message) : base (message) + { + } + + public JsonException (string message, Exception inner_exception) : + base (message, inner_exception) + { + } + } +} diff --git a/Assets/AnyThinkAds/Thrid/JsonException.cs.meta b/Assets/AnyThinkAds/Thrid/JsonException.cs.meta new file mode 100644 index 0000000..5b87817 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1e853ccc317144c2b9bfb14bafa3a0fc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/JsonMapper.cs b/Assets/AnyThinkAds/Thrid/JsonMapper.cs new file mode 100644 index 0000000..31a6541 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonMapper.cs @@ -0,0 +1,988 @@ +#region Header +/** + * JsonMapper.cs + * JSON to .Net object and object to JSON conversions. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Reflection; + + +namespace AnyThinkAds.ThirdParty.LitJson +{ + internal struct PropertyMetadata + { + public MemberInfo Info; + public bool IsField; + public Type Type; + } + + + internal struct ArrayMetadata + { + private Type element_type; + private bool is_array; + private bool is_list; + + + public Type ElementType { + get { + if (element_type == null) + return typeof (JsonData); + + return element_type; + } + + set { element_type = value; } + } + + public bool IsArray { + get { return is_array; } + set { is_array = value; } + } + + public bool IsList { + get { return is_list; } + set { is_list = value; } + } + } + + + internal struct ObjectMetadata + { + private Type element_type; + private bool is_dictionary; + + private IDictionary properties; + + + public Type ElementType { + get { + if (element_type == null) + return typeof (JsonData); + + return element_type; + } + + set { element_type = value; } + } + + public bool IsDictionary { + get { return is_dictionary; } + set { is_dictionary = value; } + } + + public IDictionary Properties { + get { return properties; } + set { properties = value; } + } + } + + + internal delegate void ExporterFunc (object obj, JsonWriter writer); + public delegate void ExporterFunc (T obj, JsonWriter writer); + + internal delegate object ImporterFunc (object input); + public delegate TValue ImporterFunc (TJson input); + + public delegate IJsonWrapper WrapperFactory (); + + + public class JsonMapper + { + #region Fields + private static readonly int max_nesting_depth; + + private static readonly IFormatProvider datetime_format; + + private static readonly IDictionary base_exporters_table; + private static readonly IDictionary custom_exporters_table; + + private static readonly IDictionary> base_importers_table; + private static readonly IDictionary> custom_importers_table; + + private static readonly IDictionary array_metadata; + private static readonly object array_metadata_lock = new Object (); + + private static readonly IDictionary> conv_ops; + private static readonly object conv_ops_lock = new Object (); + + private static readonly IDictionary object_metadata; + private static readonly object object_metadata_lock = new Object (); + + private static readonly IDictionary> type_properties; + private static readonly object type_properties_lock = new Object (); + + private static readonly JsonWriter static_writer; + private static readonly object static_writer_lock = new Object (); + #endregion + + + #region Constructors + static JsonMapper () + { + max_nesting_depth = 100; + + array_metadata = new Dictionary (); + conv_ops = new Dictionary> (); + object_metadata = new Dictionary (); + type_properties = new Dictionary> (); + + static_writer = new JsonWriter (); + + datetime_format = DateTimeFormatInfo.InvariantInfo; + + base_exporters_table = new Dictionary (); + custom_exporters_table = new Dictionary (); + + base_importers_table = new Dictionary> (); + custom_importers_table = new Dictionary> (); + + RegisterBaseExporters (); + RegisterBaseImporters (); + } + #endregion + + + #region Private Methods + private static void AddArrayMetadata (Type type) + { + if (array_metadata.ContainsKey (type)) + return; + + ArrayMetadata data = new ArrayMetadata (); + + data.IsArray = type.IsArray; + + if (type.GetInterface ("System.Collections.IList") != null) + data.IsList = true; + + foreach (PropertyInfo p_info in type.GetProperties ()) { + if (p_info.Name != "Item") + continue; + + ParameterInfo[] parameters = p_info.GetIndexParameters (); + + if (parameters.Length != 1) + continue; + + if (parameters[0].ParameterType == typeof (int)) + data.ElementType = p_info.PropertyType; + } + + lock (array_metadata_lock) { + try { + array_metadata.Add (type, data); + } catch (ArgumentException) { + return; + } + } + } + + private static void AddObjectMetadata (Type type) + { + if (object_metadata.ContainsKey (type)) + return; + + ObjectMetadata data = new ObjectMetadata (); + + if (type.GetInterface ("System.Collections.IDictionary") != null) + data.IsDictionary = true; + + data.Properties = new Dictionary (); + + foreach (PropertyInfo p_info in type.GetProperties ()) { + if (p_info.Name == "Item") { + ParameterInfo[] parameters = p_info.GetIndexParameters (); + + if (parameters.Length != 1) + continue; + + if (parameters[0].ParameterType == typeof (string)) + data.ElementType = p_info.PropertyType; + + continue; + } + + PropertyMetadata p_data = new PropertyMetadata (); + p_data.Info = p_info; + p_data.Type = p_info.PropertyType; + + data.Properties.Add (p_info.Name, p_data); + } + + foreach (FieldInfo f_info in type.GetFields ()) { + PropertyMetadata p_data = new PropertyMetadata (); + p_data.Info = f_info; + p_data.IsField = true; + p_data.Type = f_info.FieldType; + + data.Properties.Add (f_info.Name, p_data); + } + + lock (object_metadata_lock) { + try { + object_metadata.Add (type, data); + } catch (ArgumentException) { + return; + } + } + } + + private static void AddTypeProperties (Type type) + { + if (type_properties.ContainsKey (type)) + return; + + IList props = new List (); + + foreach (PropertyInfo p_info in type.GetProperties ()) { + if (p_info.Name == "Item") + continue; + + PropertyMetadata p_data = new PropertyMetadata (); + p_data.Info = p_info; + p_data.IsField = false; + props.Add (p_data); + } + + foreach (FieldInfo f_info in type.GetFields ()) { + PropertyMetadata p_data = new PropertyMetadata (); + p_data.Info = f_info; + p_data.IsField = true; + + props.Add (p_data); + } + + lock (type_properties_lock) { + try { + type_properties.Add (type, props); + } catch (ArgumentException) { + return; + } + } + } + + private static MethodInfo GetConvOp (Type t1, Type t2) + { + lock (conv_ops_lock) { + if (! conv_ops.ContainsKey (t1)) + conv_ops.Add (t1, new Dictionary ()); + } + + if (conv_ops[t1].ContainsKey (t2)) + return conv_ops[t1][t2]; + + MethodInfo op = t1.GetMethod ( + "op_Implicit", new Type[] { t2 }); + + lock (conv_ops_lock) { + try { + conv_ops[t1].Add (t2, op); + } catch (ArgumentException) { + return conv_ops[t1][t2]; + } + } + + return op; + } + + private static object ReadValue (Type inst_type, JsonReader reader) + { + reader.Read (); + + if (reader.Token == JsonToken.ArrayEnd) + return null; + + Type underlying_type = Nullable.GetUnderlyingType(inst_type); + Type value_type = underlying_type ?? inst_type; + + if (reader.Token == JsonToken.Null) { + #if NETSTANDARD1_5 + if (inst_type.IsClass() || underlying_type != null) { + return null; + } + #else + if (inst_type.IsClass || underlying_type != null) { + return null; + } + #endif + + throw new JsonException (String.Format ( + "Can't assign null to an instance of type {0}", + inst_type)); + } + + if (reader.Token == JsonToken.Double || + reader.Token == JsonToken.Int || + reader.Token == JsonToken.Long || + reader.Token == JsonToken.String || + reader.Token == JsonToken.Boolean) { + + Type json_type = reader.Value.GetType (); + + if (value_type.IsAssignableFrom (json_type)) + return reader.Value; + + // If there's a custom importer that fits, use it + if (custom_importers_table.ContainsKey (json_type) && + custom_importers_table[json_type].ContainsKey ( + value_type)) { + + ImporterFunc importer = + custom_importers_table[json_type][value_type]; + + return importer (reader.Value); + } + + // Maybe there's a base importer that works + if (base_importers_table.ContainsKey (json_type) && + base_importers_table[json_type].ContainsKey ( + value_type)) { + + ImporterFunc importer = + base_importers_table[json_type][value_type]; + + return importer (reader.Value); + } + + // Maybe it's an enum + #if NETSTANDARD1_5 + if (value_type.IsEnum()) + return Enum.ToObject (value_type, reader.Value); + #else + if (value_type.IsEnum) + return Enum.ToObject (value_type, reader.Value); + #endif + // Try using an implicit conversion operator + MethodInfo conv_op = GetConvOp (value_type, json_type); + + if (conv_op != null) + return conv_op.Invoke (null, + new object[] { reader.Value }); + + // No luck + throw new JsonException (String.Format ( + "Can't assign value '{0}' (type {1}) to type {2}", + reader.Value, json_type, inst_type)); + } + + object instance = null; + + if (reader.Token == JsonToken.ArrayStart) { + + AddArrayMetadata (inst_type); + ArrayMetadata t_data = array_metadata[inst_type]; + + if (! t_data.IsArray && ! t_data.IsList) + throw new JsonException (String.Format ( + "Type {0} can't act as an array", + inst_type)); + + IList list; + Type elem_type; + + if (! t_data.IsArray) { + list = (IList) Activator.CreateInstance (inst_type); + elem_type = t_data.ElementType; + } else { + list = new ArrayList (); + elem_type = inst_type.GetElementType (); + } + + list.Clear(); + + while (true) { + object item = ReadValue (elem_type, reader); + if (item == null && reader.Token == JsonToken.ArrayEnd) + break; + + list.Add (item); + } + + if (t_data.IsArray) { + int n = list.Count; + instance = Array.CreateInstance (elem_type, n); + + for (int i = 0; i < n; i++) + ((Array) instance).SetValue (list[i], i); + } else + instance = list; + + } else if (reader.Token == JsonToken.ObjectStart) { + AddObjectMetadata (value_type); + ObjectMetadata t_data = object_metadata[value_type]; + + instance = Activator.CreateInstance (value_type); + + while (true) { + reader.Read (); + + if (reader.Token == JsonToken.ObjectEnd) + break; + + string property = (string) reader.Value; + + if (t_data.Properties.ContainsKey (property)) { + PropertyMetadata prop_data = + t_data.Properties[property]; + + if (prop_data.IsField) { + ((FieldInfo) prop_data.Info).SetValue ( + instance, ReadValue (prop_data.Type, reader)); + } else { + PropertyInfo p_info = + (PropertyInfo) prop_data.Info; + + if (p_info.CanWrite) + p_info.SetValue ( + instance, + ReadValue (prop_data.Type, reader), + null); + else + ReadValue (prop_data.Type, reader); + } + + } else { + if (! t_data.IsDictionary) { + + if (! reader.SkipNonMembers) { + throw new JsonException (String.Format ( + "The type {0} doesn't have the " + + "property '{1}'", + inst_type, property)); + } else { + ReadSkip (reader); + continue; + } + } + + ((IDictionary) instance).Add ( + property, ReadValue ( + t_data.ElementType, reader)); + } + + } + + } + + return instance; + } + + private static IJsonWrapper ReadValue (WrapperFactory factory, + JsonReader reader) + { + reader.Read (); + + if (reader.Token == JsonToken.ArrayEnd || + reader.Token == JsonToken.Null) + return null; + + IJsonWrapper instance = factory (); + + if (reader.Token == JsonToken.String) { + instance.SetString ((string) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.Double) { + instance.SetDouble ((double) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.Int) { + instance.SetInt ((int) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.Long) { + instance.SetLong ((long) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.Boolean) { + instance.SetBoolean ((bool) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.ArrayStart) { + instance.SetJsonType (JsonType.Array); + + while (true) { + IJsonWrapper item = ReadValue (factory, reader); + if (item == null && reader.Token == JsonToken.ArrayEnd) + break; + + ((IList) instance).Add (item); + } + } + else if (reader.Token == JsonToken.ObjectStart) { + instance.SetJsonType (JsonType.Object); + + while (true) { + reader.Read (); + + if (reader.Token == JsonToken.ObjectEnd) + break; + + string property = (string) reader.Value; + + ((IDictionary) instance)[property] = ReadValue ( + factory, reader); + } + + } + + return instance; + } + + private static void ReadSkip (JsonReader reader) + { + ToWrapper ( + delegate { return new JsonMockWrapper (); }, reader); + } + + private static void RegisterBaseExporters () + { + base_exporters_table[typeof (byte)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToInt32 ((byte) obj)); + }; + + base_exporters_table[typeof (char)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToString ((char) obj)); + }; + + base_exporters_table[typeof (DateTime)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToString ((DateTime) obj, + datetime_format)); + }; + + base_exporters_table[typeof (decimal)] = + delegate (object obj, JsonWriter writer) { + writer.Write ((decimal) obj); + }; + + base_exporters_table[typeof (sbyte)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToInt32 ((sbyte) obj)); + }; + + base_exporters_table[typeof (short)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToInt32 ((short) obj)); + }; + + base_exporters_table[typeof (ushort)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToInt32 ((ushort) obj)); + }; + + base_exporters_table[typeof (uint)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToUInt64 ((uint) obj)); + }; + + base_exporters_table[typeof (ulong)] = + delegate (object obj, JsonWriter writer) { + writer.Write ((ulong) obj); + }; + + base_exporters_table[typeof(DateTimeOffset)] = + delegate (object obj, JsonWriter writer) { + writer.Write(((DateTimeOffset)obj).ToString("yyyy-MM-ddTHH:mm:ss.fffffffzzz", datetime_format)); + }; + } + + private static void RegisterBaseImporters () + { + ImporterFunc importer; + + importer = delegate (object input) { + return Convert.ToByte ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (byte), importer); + + importer = delegate (object input) { + return Convert.ToUInt64 ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (ulong), importer); + + importer = delegate (object input) { + return Convert.ToInt64((int)input); + }; + RegisterImporter(base_importers_table, typeof(int), + typeof(long), importer); + + importer = delegate (object input) { + return Convert.ToSByte ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (sbyte), importer); + + importer = delegate (object input) { + return Convert.ToInt16 ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (short), importer); + + importer = delegate (object input) { + return Convert.ToUInt16 ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (ushort), importer); + + importer = delegate (object input) { + return Convert.ToUInt32 ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (uint), importer); + + importer = delegate (object input) { + return Convert.ToSingle ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (float), importer); + + importer = delegate (object input) { + return Convert.ToDouble ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (double), importer); + + importer = delegate (object input) { + return Convert.ToDecimal ((double) input); + }; + RegisterImporter (base_importers_table, typeof (double), + typeof (decimal), importer); + + importer = delegate (object input) { + return Convert.ToSingle((double)input); + }; + RegisterImporter(base_importers_table, typeof(double), + typeof(float), importer); + + importer = delegate (object input) { + return Convert.ToUInt32 ((long) input); + }; + RegisterImporter (base_importers_table, typeof (long), + typeof (uint), importer); + + importer = delegate (object input) { + return Convert.ToChar ((string) input); + }; + RegisterImporter (base_importers_table, typeof (string), + typeof (char), importer); + + importer = delegate (object input) { + return Convert.ToDateTime ((string) input, datetime_format); + }; + RegisterImporter (base_importers_table, typeof (string), + typeof (DateTime), importer); + + importer = delegate (object input) { + return DateTimeOffset.Parse((string)input, datetime_format); + }; + RegisterImporter(base_importers_table, typeof(string), + typeof(DateTimeOffset), importer); + } + + private static void RegisterImporter ( + IDictionary> table, + Type json_type, Type value_type, ImporterFunc importer) + { + if (! table.ContainsKey (json_type)) + table.Add (json_type, new Dictionary ()); + + table[json_type][value_type] = importer; + } + + private static void WriteValue (object obj, JsonWriter writer, + bool writer_is_private, + int depth) + { + if (depth > max_nesting_depth) + throw new JsonException ( + String.Format ("Max allowed object depth reached while " + + "trying to export from type {0}", + obj.GetType ())); + + if (obj == null) { + writer.WriteObjectStart(); + writer.WriteObjectEnd(); + return; + } + + if (obj is IJsonWrapper) { + if (writer_is_private) + writer.TextWriter.Write (((IJsonWrapper) obj).ToJson ()); + else + ((IJsonWrapper) obj).ToJson (writer); + + return; + } + + if (obj is String) { + writer.Write ((string) obj); + return; + } + + if (obj is Double) { + writer.Write ((double) obj); + return; + } + + if (obj is Single) + { + writer.Write((float)obj); + return; + } + + if (obj is Int32) { + writer.Write ((int) obj); + return; + } + + if (obj is Boolean) { + writer.Write ((bool) obj); + return; + } + + if (obj is Int64) { + writer.Write ((long) obj); + return; + } + + if (obj is Array) { + writer.WriteArrayStart (); + + foreach (object elem in (Array) obj) + WriteValue (elem, writer, writer_is_private, depth + 1); + + writer.WriteArrayEnd (); + + return; + } + + if (obj is IList) { + writer.WriteArrayStart (); + foreach (object elem in (IList) obj) + WriteValue (elem, writer, writer_is_private, depth + 1); + writer.WriteArrayEnd (); + + return; + } + + if (obj is IDictionary dictionary) { + writer.WriteObjectStart (); + foreach (DictionaryEntry entry in dictionary) { + var propertyName = entry.Key is string key ? + key + : Convert.ToString(entry.Key, CultureInfo.InvariantCulture); + writer.WritePropertyName (propertyName); + WriteValue (entry.Value, writer, writer_is_private, + depth + 1); + } + writer.WriteObjectEnd (); + + return; + } + + Type obj_type = obj.GetType (); + + // See if there's a custom exporter for the object + if (custom_exporters_table.ContainsKey (obj_type)) { + ExporterFunc exporter = custom_exporters_table[obj_type]; + exporter (obj, writer); + + return; + } + + // If not, maybe there's a base exporter + if (base_exporters_table.ContainsKey (obj_type)) { + ExporterFunc exporter = base_exporters_table[obj_type]; + exporter (obj, writer); + + return; + } + + // Last option, let's see if it's an enum + if (obj is Enum) { + Type e_type = Enum.GetUnderlyingType (obj_type); + + if (e_type == typeof (long)) + writer.Write ((long) obj); + else if (e_type == typeof (uint)) + writer.Write ((uint) obj); + else if (e_type == typeof (ulong)) + writer.Write ((ulong) obj); + else if (e_type == typeof(ushort)) + writer.Write ((ushort)obj); + else if (e_type == typeof(short)) + writer.Write ((short)obj); + else if (e_type == typeof(byte)) + writer.Write ((byte)obj); + else if (e_type == typeof(sbyte)) + writer.Write ((sbyte)obj); + else + writer.Write ((int) obj); + + return; + } + + // Okay, so it looks like the input should be exported as an + // object + AddTypeProperties (obj_type); + IList props = type_properties[obj_type]; + + writer.WriteObjectStart (); + foreach (PropertyMetadata p_data in props) { + if (p_data.IsField) { + writer.WritePropertyName (p_data.Info.Name); + WriteValue (((FieldInfo) p_data.Info).GetValue (obj), + writer, writer_is_private, depth + 1); + } + else { + PropertyInfo p_info = (PropertyInfo) p_data.Info; + + if (p_info.CanRead) { + writer.WritePropertyName (p_data.Info.Name); + WriteValue (p_info.GetValue (obj, null), + writer, writer_is_private, depth + 1); + } + } + } + writer.WriteObjectEnd (); + } + #endregion + + + public static string ToJson (object obj) + { + lock (static_writer_lock) { + static_writer.Reset (); + + WriteValue (obj, static_writer, true, 0); + + return static_writer.ToString (); + } + } + + public static void ToJson (object obj, JsonWriter writer) + { + WriteValue (obj, writer, false, 0); + } + + public static JsonData ToObject (JsonReader reader) + { + return (JsonData) ToWrapper ( + delegate { return new JsonData (); }, reader); + } + + public static JsonData ToObject (TextReader reader) + { + JsonReader json_reader = new JsonReader (reader); + + return (JsonData) ToWrapper ( + delegate { return new JsonData (); }, json_reader); + } + + public static JsonData ToObject (string json) + { + return (JsonData) ToWrapper ( + delegate { return new JsonData (); }, json); + } + + public static T ToObject (JsonReader reader) + { + return (T) ReadValue (typeof (T), reader); + } + + public static T ToObject (TextReader reader) + { + JsonReader json_reader = new JsonReader (reader); + + return (T) ReadValue (typeof (T), json_reader); + } + + public static T ToObject (string json) + { + JsonReader reader = new JsonReader (json); + + return (T) ReadValue (typeof (T), reader); + } + + public static object ToObject(string json, Type ConvertType ) + { + JsonReader reader = new JsonReader(json); + + return ReadValue(ConvertType, reader); + } + + public static IJsonWrapper ToWrapper (WrapperFactory factory, + JsonReader reader) + { + return ReadValue (factory, reader); + } + + public static IJsonWrapper ToWrapper (WrapperFactory factory, + string json) + { + JsonReader reader = new JsonReader (json); + + return ReadValue (factory, reader); + } + + public static void RegisterExporter (ExporterFunc exporter) + { + ExporterFunc exporter_wrapper = + delegate (object obj, JsonWriter writer) { + exporter ((T) obj, writer); + }; + + custom_exporters_table[typeof (T)] = exporter_wrapper; + } + + public static void RegisterImporter ( + ImporterFunc importer) + { + ImporterFunc importer_wrapper = + delegate (object input) { + return importer ((TJson) input); + }; + + RegisterImporter (custom_importers_table, typeof (TJson), + typeof (TValue), importer_wrapper); + } + + public static void UnregisterExporters () + { + custom_exporters_table.Clear (); + } + + public static void UnregisterImporters () + { + custom_importers_table.Clear (); + } + } +} diff --git a/Assets/AnyThinkAds/Thrid/JsonMapper.cs.meta b/Assets/AnyThinkAds/Thrid/JsonMapper.cs.meta new file mode 100644 index 0000000..c007b8c --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonMapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 97447b6ac54b84529b0f140052a2fad0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/JsonMockWrapper.cs b/Assets/AnyThinkAds/Thrid/JsonMockWrapper.cs new file mode 100644 index 0000000..40d1c46 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonMockWrapper.cs @@ -0,0 +1,105 @@ +#region Header +/** + * JsonMockWrapper.cs + * Mock object implementing IJsonWrapper, to facilitate actions like + * skipping data more efficiently. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections; +using System.Collections.Specialized; + + +namespace AnyThinkAds.ThirdParty.LitJson +{ + public class JsonMockWrapper : IJsonWrapper + { + public bool IsArray { get { return false; } } + public bool IsBoolean { get { return false; } } + public bool IsDouble { get { return false; } } + public bool IsInt { get { return false; } } + public bool IsLong { get { return false; } } + public bool IsObject { get { return false; } } + public bool IsString { get { return false; } } + + public bool GetBoolean () { return false; } + public double GetDouble () { return 0.0; } + public int GetInt () { return 0; } + public JsonType GetJsonType () { return JsonType.None; } + public long GetLong () { return 0L; } + public string GetString () { return ""; } + + public void SetBoolean (bool val) {} + public void SetDouble (double val) {} + public void SetInt (int val) {} + public void SetJsonType (JsonType type) {} + public void SetLong (long val) {} + public void SetString (string val) {} + + public string ToJson () { return ""; } + public void ToJson (JsonWriter writer) {} + + + bool IList.IsFixedSize { get { return true; } } + bool IList.IsReadOnly { get { return true; } } + + object IList.this[int index] { + get { return null; } + set {} + } + + int IList.Add (object value) { return 0; } + void IList.Clear () {} + bool IList.Contains (object value) { return false; } + int IList.IndexOf (object value) { return -1; } + void IList.Insert (int i, object v) {} + void IList.Remove (object value) {} + void IList.RemoveAt (int index) {} + + + int ICollection.Count { get { return 0; } } + bool ICollection.IsSynchronized { get { return false; } } + object ICollection.SyncRoot { get { return null; } } + + void ICollection.CopyTo (Array array, int index) {} + + + IEnumerator IEnumerable.GetEnumerator () { return null; } + + + bool IDictionary.IsFixedSize { get { return true; } } + bool IDictionary.IsReadOnly { get { return true; } } + + ICollection IDictionary.Keys { get { return null; } } + ICollection IDictionary.Values { get { return null; } } + + object IDictionary.this[object key] { + get { return null; } + set {} + } + + void IDictionary.Add (object k, object v) {} + void IDictionary.Clear () {} + bool IDictionary.Contains (object key) { return false; } + void IDictionary.Remove (object key) {} + + IDictionaryEnumerator IDictionary.GetEnumerator () { return null; } + + + object IOrderedDictionary.this[int idx] { + get { return null; } + set {} + } + + IDictionaryEnumerator IOrderedDictionary.GetEnumerator () { + return null; + } + void IOrderedDictionary.Insert (int i, object k, object v) {} + void IOrderedDictionary.RemoveAt (int i) {} + } +} diff --git a/Assets/AnyThinkAds/Thrid/JsonMockWrapper.cs.meta b/Assets/AnyThinkAds/Thrid/JsonMockWrapper.cs.meta new file mode 100644 index 0000000..829dc87 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonMockWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15bb3624e17b247f88d544404fbadb32 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/JsonReader.cs b/Assets/AnyThinkAds/Thrid/JsonReader.cs new file mode 100644 index 0000000..543f066 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonReader.cs @@ -0,0 +1,478 @@ +#region Header +/** + * JsonReader.cs + * Stream-like access to JSON text. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; + + +namespace AnyThinkAds.ThirdParty.LitJson +{ + public enum JsonToken + { + None, + + ObjectStart, + PropertyName, + ObjectEnd, + + ArrayStart, + ArrayEnd, + + Int, + Long, + Double, + + String, + + Boolean, + Null + } + + + public class JsonReader + { + #region Fields + private static readonly IDictionary> parse_table; + + private Stack automaton_stack; + private int current_input; + private int current_symbol; + private bool end_of_json; + private bool end_of_input; + private Lexer lexer; + private bool parser_in_string; + private bool parser_return; + private bool read_started; + private TextReader reader; + private bool reader_is_owned; + private bool skip_non_members; + private object token_value; + private JsonToken token; + #endregion + + + #region Public Properties + public bool AllowComments { + get { return lexer.AllowComments; } + set { lexer.AllowComments = value; } + } + + public bool AllowSingleQuotedStrings { + get { return lexer.AllowSingleQuotedStrings; } + set { lexer.AllowSingleQuotedStrings = value; } + } + + public bool SkipNonMembers { + get { return skip_non_members; } + set { skip_non_members = value; } + } + + public bool EndOfInput { + get { return end_of_input; } + } + + public bool EndOfJson { + get { return end_of_json; } + } + + public JsonToken Token { + get { return token; } + } + + public object Value { + get { return token_value; } + } + #endregion + + + #region Constructors + static JsonReader () + { + parse_table = PopulateParseTable (); + } + + public JsonReader (string json_text) : + this (new StringReader (json_text), true) + { + } + + public JsonReader (TextReader reader) : + this (reader, false) + { + } + + private JsonReader (TextReader reader, bool owned) + { + if (reader == null) + throw new ArgumentNullException ("reader"); + + parser_in_string = false; + parser_return = false; + + read_started = false; + automaton_stack = new Stack (); + automaton_stack.Push ((int) ParserToken.End); + automaton_stack.Push ((int) ParserToken.Text); + + lexer = new Lexer (reader); + + end_of_input = false; + end_of_json = false; + + skip_non_members = true; + + this.reader = reader; + reader_is_owned = owned; + } + #endregion + + + #region Static Methods + private static IDictionary> PopulateParseTable () + { + // See section A.2. of the manual for details + IDictionary> parse_table = new Dictionary> (); + + TableAddRow (parse_table, ParserToken.Array); + TableAddCol (parse_table, ParserToken.Array, '[', + '[', + (int) ParserToken.ArrayPrime); + + TableAddRow (parse_table, ParserToken.ArrayPrime); + TableAddCol (parse_table, ParserToken.ArrayPrime, '"', + (int) ParserToken.Value, + + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, '[', + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, ']', + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, '{', + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.Number, + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.True, + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.False, + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.Null, + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + + TableAddRow (parse_table, ParserToken.Object); + TableAddCol (parse_table, ParserToken.Object, '{', + '{', + (int) ParserToken.ObjectPrime); + + TableAddRow (parse_table, ParserToken.ObjectPrime); + TableAddCol (parse_table, ParserToken.ObjectPrime, '"', + (int) ParserToken.Pair, + (int) ParserToken.PairRest, + '}'); + TableAddCol (parse_table, ParserToken.ObjectPrime, '}', + '}'); + + TableAddRow (parse_table, ParserToken.Pair); + TableAddCol (parse_table, ParserToken.Pair, '"', + (int) ParserToken.String, + ':', + (int) ParserToken.Value); + + TableAddRow (parse_table, ParserToken.PairRest); + TableAddCol (parse_table, ParserToken.PairRest, ',', + ',', + (int) ParserToken.Pair, + (int) ParserToken.PairRest); + TableAddCol (parse_table, ParserToken.PairRest, '}', + (int) ParserToken.Epsilon); + + TableAddRow (parse_table, ParserToken.String); + TableAddCol (parse_table, ParserToken.String, '"', + '"', + (int) ParserToken.CharSeq, + '"'); + + TableAddRow (parse_table, ParserToken.Text); + TableAddCol (parse_table, ParserToken.Text, '[', + (int) ParserToken.Array); + TableAddCol (parse_table, ParserToken.Text, '{', + (int) ParserToken.Object); + + TableAddRow (parse_table, ParserToken.Value); + TableAddCol (parse_table, ParserToken.Value, '"', + (int) ParserToken.String); + TableAddCol (parse_table, ParserToken.Value, '[', + (int) ParserToken.Array); + TableAddCol (parse_table, ParserToken.Value, '{', + (int) ParserToken.Object); + TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.Number, + (int) ParserToken.Number); + TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.True, + (int) ParserToken.True); + TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.False, + (int) ParserToken.False); + TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.Null, + (int) ParserToken.Null); + + TableAddRow (parse_table, ParserToken.ValueRest); + TableAddCol (parse_table, ParserToken.ValueRest, ',', + ',', + (int) ParserToken.Value, + (int) ParserToken.ValueRest); + TableAddCol (parse_table, ParserToken.ValueRest, ']', + (int) ParserToken.Epsilon); + + return parse_table; + } + + private static void TableAddCol (IDictionary> parse_table, ParserToken row, int col, + params int[] symbols) + { + parse_table[(int) row].Add (col, symbols); + } + + private static void TableAddRow (IDictionary> parse_table, ParserToken rule) + { + parse_table.Add ((int) rule, new Dictionary ()); + } + #endregion + + + #region Private Methods + private void ProcessNumber (string number) + { + if (number.IndexOf ('.') != -1 || + number.IndexOf ('e') != -1 || + number.IndexOf ('E') != -1) { + + double n_double; + if (double.TryParse (number, NumberStyles.Any, CultureInfo.InvariantCulture, out n_double)) { + token = JsonToken.Double; + token_value = n_double; + + return; + } + } + + int n_int32; + if (int.TryParse (number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_int32)) { + token = JsonToken.Int; + token_value = n_int32; + + return; + } + + long n_int64; + if (long.TryParse (number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_int64)) { + token = JsonToken.Long; + token_value = n_int64; + + return; + } + + ulong n_uint64; + if (ulong.TryParse(number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_uint64)) + { + token = JsonToken.Long; + token_value = n_uint64; + + return; + } + + // Shouldn't happen, but just in case, return something + token = JsonToken.Int; + token_value = 0; + } + + private void ProcessSymbol () + { + if (current_symbol == '[') { + token = JsonToken.ArrayStart; + parser_return = true; + + } else if (current_symbol == ']') { + token = JsonToken.ArrayEnd; + parser_return = true; + + } else if (current_symbol == '{') { + token = JsonToken.ObjectStart; + parser_return = true; + + } else if (current_symbol == '}') { + token = JsonToken.ObjectEnd; + parser_return = true; + + } else if (current_symbol == '"') { + if (parser_in_string) { + parser_in_string = false; + + parser_return = true; + + } else { + if (token == JsonToken.None) + token = JsonToken.String; + + parser_in_string = true; + } + + } else if (current_symbol == (int) ParserToken.CharSeq) { + token_value = lexer.StringValue; + + } else if (current_symbol == (int) ParserToken.False) { + token = JsonToken.Boolean; + token_value = false; + parser_return = true; + + } else if (current_symbol == (int) ParserToken.Null) { + token = JsonToken.Null; + parser_return = true; + + } else if (current_symbol == (int) ParserToken.Number) { + ProcessNumber (lexer.StringValue); + + parser_return = true; + + } else if (current_symbol == (int) ParserToken.Pair) { + token = JsonToken.PropertyName; + + } else if (current_symbol == (int) ParserToken.True) { + token = JsonToken.Boolean; + token_value = true; + parser_return = true; + + } + } + + private bool ReadToken () + { + if (end_of_input) + return false; + + lexer.NextToken (); + + if (lexer.EndOfInput) { + Close (); + + return false; + } + + current_input = lexer.Token; + + return true; + } + #endregion + + + public void Close () + { + if (end_of_input) + return; + + end_of_input = true; + end_of_json = true; + + if (reader_is_owned) + { + using(reader){} + } + + reader = null; + } + + public bool Read () + { + if (end_of_input) + return false; + + if (end_of_json) { + end_of_json = false; + automaton_stack.Clear (); + automaton_stack.Push ((int) ParserToken.End); + automaton_stack.Push ((int) ParserToken.Text); + } + + parser_in_string = false; + parser_return = false; + + token = JsonToken.None; + token_value = null; + + if (! read_started) { + read_started = true; + + if (! ReadToken ()) + return false; + } + + + int[] entry_symbols; + + while (true) { + if (parser_return) { + if (automaton_stack.Peek () == (int) ParserToken.End) + end_of_json = true; + + return true; + } + + current_symbol = automaton_stack.Pop (); + + ProcessSymbol (); + + if (current_symbol == current_input) { + if (! ReadToken ()) { + if (automaton_stack.Peek () != (int) ParserToken.End) + throw new JsonException ( + "Input doesn't evaluate to proper JSON text"); + + if (parser_return) + return true; + + return false; + } + + continue; + } + + try { + + entry_symbols = + parse_table[current_symbol][current_input]; + + } catch (KeyNotFoundException e) { + throw new JsonException ((ParserToken) current_input, e); + } + + if (entry_symbols[0] == (int) ParserToken.Epsilon) + continue; + + for (int i = entry_symbols.Length - 1; i >= 0; i--) + automaton_stack.Push (entry_symbols[i]); + } + } + + } +} diff --git a/Assets/AnyThinkAds/Thrid/JsonReader.cs.meta b/Assets/AnyThinkAds/Thrid/JsonReader.cs.meta new file mode 100644 index 0000000..5acd472 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonReader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1a5f5db4e2a9441f290275a9678a2ffe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/JsonWriter.cs b/Assets/AnyThinkAds/Thrid/JsonWriter.cs new file mode 100644 index 0000000..962a9ea --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonWriter.cs @@ -0,0 +1,484 @@ +#region Header +/** + * JsonWriter.cs + * Stream-like facility to output JSON text. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; + + +namespace AnyThinkAds.ThirdParty.LitJson +{ + internal enum Condition + { + InArray, + InObject, + NotAProperty, + Property, + Value + } + + internal class WriterContext + { + public int Count; + public bool InArray; + public bool InObject; + public bool ExpectingValue; + public int Padding; + } + + public class JsonWriter + { + #region Fields + private static readonly NumberFormatInfo number_format; + + private WriterContext context; + private Stack ctx_stack; + private bool has_reached_end; + private char[] hex_seq; + private int indentation; + private int indent_value; + private StringBuilder inst_string_builder; + private bool pretty_print; + private bool validate; + private bool lower_case_properties; + private TextWriter writer; + #endregion + + + #region Properties + public int IndentValue { + get { return indent_value; } + set { + indentation = (indentation / indent_value) * value; + indent_value = value; + } + } + + public bool PrettyPrint { + get { return pretty_print; } + set { pretty_print = value; } + } + + public TextWriter TextWriter { + get { return writer; } + } + + public bool Validate { + get { return validate; } + set { validate = value; } + } + + public bool LowerCaseProperties { + get { return lower_case_properties; } + set { lower_case_properties = value; } + } + #endregion + + + #region Constructors + static JsonWriter () + { + number_format = NumberFormatInfo.InvariantInfo; + } + + public JsonWriter () + { + inst_string_builder = new StringBuilder (); + writer = new StringWriter (inst_string_builder); + + Init (); + } + + public JsonWriter (StringBuilder sb) : + this (new StringWriter (sb)) + { + } + + public JsonWriter (TextWriter writer) + { + if (writer == null) + throw new ArgumentNullException ("writer"); + + this.writer = writer; + + Init (); + } + #endregion + + + #region Private Methods + private void DoValidation (Condition cond) + { + if (! context.ExpectingValue) + context.Count++; + + if (! validate) + return; + + if (has_reached_end) + throw new JsonException ( + "A complete JSON symbol has already been written"); + + switch (cond) { + case Condition.InArray: + if (! context.InArray) + throw new JsonException ( + "Can't close an array here"); + break; + + case Condition.InObject: + if (! context.InObject || context.ExpectingValue) + throw new JsonException ( + "Can't close an object here"); + break; + + case Condition.NotAProperty: + if (context.InObject && ! context.ExpectingValue) + throw new JsonException ( + "Expected a property"); + break; + + case Condition.Property: + if (! context.InObject || context.ExpectingValue) + throw new JsonException ( + "Can't add a property here"); + break; + + case Condition.Value: + if (! context.InArray && + (! context.InObject || ! context.ExpectingValue)) + throw new JsonException ( + "Can't add a value here"); + + break; + } + } + + private void Init () + { + has_reached_end = false; + hex_seq = new char[4]; + indentation = 0; + indent_value = 4; + pretty_print = false; + validate = true; + lower_case_properties = false; + + ctx_stack = new Stack (); + context = new WriterContext (); + ctx_stack.Push (context); + } + + private static void IntToHex (int n, char[] hex) + { + int num; + + for (int i = 0; i < 4; i++) { + num = n % 16; + + if (num < 10) + hex[3 - i] = (char) ('0' + num); + else + hex[3 - i] = (char) ('A' + (num - 10)); + + n >>= 4; + } + } + + private void Indent () + { + if (pretty_print) + indentation += indent_value; + } + + + private void Put (string str) + { + if (pretty_print && ! context.ExpectingValue) + for (int i = 0; i < indentation; i++) + writer.Write (' '); + + writer.Write (str); + } + + private void PutNewline () + { + PutNewline (true); + } + + private void PutNewline (bool add_comma) + { + if (add_comma && ! context.ExpectingValue && + context.Count > 1) + writer.Write (','); + + if (pretty_print && ! context.ExpectingValue) + writer.Write (Environment.NewLine); + } + + private void PutString (string str) + { + Put (String.Empty); + + writer.Write ('"'); + + int n = str.Length; + for (int i = 0; i < n; i++) { + switch (str[i]) { + case '\n': + writer.Write ("\\n"); + continue; + + case '\r': + writer.Write ("\\r"); + continue; + + case '\t': + writer.Write ("\\t"); + continue; + + case '"': + case '\\': + writer.Write ('\\'); + writer.Write (str[i]); + continue; + + case '\f': + writer.Write ("\\f"); + continue; + + case '\b': + writer.Write ("\\b"); + continue; + } + + if ((int) str[i] >= 32 && (int) str[i] <= 126) { + writer.Write (str[i]); + continue; + } + + // Default, turn into a \uXXXX sequence + IntToHex ((int) str[i], hex_seq); + writer.Write ("\\u"); + writer.Write (hex_seq); + } + + writer.Write ('"'); + } + + private void Unindent () + { + if (pretty_print) + indentation -= indent_value; + } + #endregion + + + public override string ToString () + { + if (inst_string_builder == null) + return String.Empty; + + return inst_string_builder.ToString (); + } + + public void Reset () + { + has_reached_end = false; + + ctx_stack.Clear (); + context = new WriterContext (); + ctx_stack.Push (context); + + if (inst_string_builder != null) + inst_string_builder.Remove (0, inst_string_builder.Length); + } + + public void Write (bool boolean) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (boolean ? "true" : "false"); + + context.ExpectingValue = false; + } + + public void Write (decimal number) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (Convert.ToString (number, number_format)); + + context.ExpectingValue = false; + } + + public void Write (double number) + { + DoValidation (Condition.Value); + PutNewline (); + + string str = Convert.ToString (number, number_format); + Put (str); + + if (str.IndexOf ('.') == -1 && + str.IndexOf ('E') == -1) + writer.Write (".0"); + + context.ExpectingValue = false; + } + + public void Write(float number) + { + DoValidation(Condition.Value); + PutNewline(); + + string str = Convert.ToString(number, number_format); + Put(str); + + context.ExpectingValue = false; + } + + public void Write (int number) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (Convert.ToString (number, number_format)); + + context.ExpectingValue = false; + } + + public void Write (long number) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (Convert.ToString (number, number_format)); + + context.ExpectingValue = false; + } + + public void Write (string str) + { + DoValidation (Condition.Value); + PutNewline (); + + if (str == null) + Put ("null"); + else + PutString (str); + + context.ExpectingValue = false; + } + + [CLSCompliant(false)] + public void Write (ulong number) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (Convert.ToString (number, number_format)); + + context.ExpectingValue = false; + } + + public void WriteArrayEnd () + { + DoValidation (Condition.InArray); + PutNewline (false); + + ctx_stack.Pop (); + if (ctx_stack.Count == 1) + has_reached_end = true; + else { + context = ctx_stack.Peek (); + context.ExpectingValue = false; + } + + Unindent (); + Put ("]"); + } + + public void WriteArrayStart () + { + DoValidation (Condition.NotAProperty); + PutNewline (); + + Put ("["); + + context = new WriterContext (); + context.InArray = true; + ctx_stack.Push (context); + + Indent (); + } + + public void WriteObjectEnd () + { + DoValidation (Condition.InObject); + PutNewline (false); + + ctx_stack.Pop (); + if (ctx_stack.Count == 1) + has_reached_end = true; + else { + context = ctx_stack.Peek (); + context.ExpectingValue = false; + } + + Unindent (); + Put ("}"); + } + + public void WriteObjectStart () + { + DoValidation (Condition.NotAProperty); + PutNewline (); + + Put ("{"); + + context = new WriterContext (); + context.InObject = true; + ctx_stack.Push (context); + + Indent (); + } + + public void WritePropertyName (string property_name) + { + DoValidation (Condition.Property); + PutNewline (); + string propertyName = (property_name == null || !lower_case_properties) + ? property_name + : property_name.ToLowerInvariant(); + + PutString (propertyName); + + if (pretty_print) { + if (propertyName.Length > context.Padding) + context.Padding = propertyName.Length; + + for (int i = context.Padding - propertyName.Length; + i >= 0; i--) + writer.Write (' '); + + writer.Write (": "); + } else + writer.Write (':'); + + context.ExpectingValue = true; + } + } +} diff --git a/Assets/AnyThinkAds/Thrid/JsonWriter.cs.meta b/Assets/AnyThinkAds/Thrid/JsonWriter.cs.meta new file mode 100644 index 0000000..78d9061 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/JsonWriter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bc816f874f38f4952b55f4620f995b94 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/Lexer.cs b/Assets/AnyThinkAds/Thrid/Lexer.cs new file mode 100644 index 0000000..82706af --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/Lexer.cs @@ -0,0 +1,912 @@ +#region Header +/** + * Lexer.cs + * JSON lexer implementation based on a finite state machine. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + + +namespace AnyThinkAds.ThirdParty.LitJson +{ + internal class FsmContext + { + public bool Return; + public int NextState; + public Lexer L; + public int StateStack; + } + + + internal class Lexer + { + #region Fields + private delegate bool StateHandler (FsmContext ctx); + + private static readonly int[] fsm_return_table; + private static readonly StateHandler[] fsm_handler_table; + + private bool allow_comments; + private bool allow_single_quoted_strings; + private bool end_of_input; + private FsmContext fsm_context; + private int input_buffer; + private int input_char; + private TextReader reader; + private int state; + private StringBuilder string_buffer; + private string string_value; + private int token; + private int unichar; + #endregion + + + #region Properties + public bool AllowComments { + get { return allow_comments; } + set { allow_comments = value; } + } + + public bool AllowSingleQuotedStrings { + get { return allow_single_quoted_strings; } + set { allow_single_quoted_strings = value; } + } + + public bool EndOfInput { + get { return end_of_input; } + } + + public int Token { + get { return token; } + } + + public string StringValue { + get { return string_value; } + } + #endregion + + + #region Constructors + static Lexer () + { + PopulateFsmTables (out fsm_handler_table, out fsm_return_table); + } + + public Lexer (TextReader reader) + { + allow_comments = true; + allow_single_quoted_strings = true; + + input_buffer = 0; + string_buffer = new StringBuilder (128); + state = 1; + end_of_input = false; + this.reader = reader; + + fsm_context = new FsmContext (); + fsm_context.L = this; + } + #endregion + + + #region Static Methods + private static int HexValue (int digit) + { + switch (digit) { + case 'a': + case 'A': + return 10; + + case 'b': + case 'B': + return 11; + + case 'c': + case 'C': + return 12; + + case 'd': + case 'D': + return 13; + + case 'e': + case 'E': + return 14; + + case 'f': + case 'F': + return 15; + + default: + return digit - '0'; + } + } + + private static void PopulateFsmTables (out StateHandler[] fsm_handler_table, out int[] fsm_return_table) + { + // See section A.1. of the manual for details of the finite + // state machine. + fsm_handler_table = new StateHandler[28] { + State1, + State2, + State3, + State4, + State5, + State6, + State7, + State8, + State9, + State10, + State11, + State12, + State13, + State14, + State15, + State16, + State17, + State18, + State19, + State20, + State21, + State22, + State23, + State24, + State25, + State26, + State27, + State28 + }; + + fsm_return_table = new int[28] { + (int) ParserToken.Char, + 0, + (int) ParserToken.Number, + (int) ParserToken.Number, + 0, + (int) ParserToken.Number, + 0, + (int) ParserToken.Number, + 0, + 0, + (int) ParserToken.True, + 0, + 0, + 0, + (int) ParserToken.False, + 0, + 0, + (int) ParserToken.Null, + (int) ParserToken.CharSeq, + (int) ParserToken.Char, + 0, + 0, + (int) ParserToken.CharSeq, + (int) ParserToken.Char, + 0, + 0, + 0, + 0 + }; + } + + private static char ProcessEscChar (int esc_char) + { + switch (esc_char) { + case '"': + case '\'': + case '\\': + case '/': + return Convert.ToChar (esc_char); + + case 'n': + return '\n'; + + case 't': + return '\t'; + + case 'r': + return '\r'; + + case 'b': + return '\b'; + + case 'f': + return '\f'; + + default: + // Unreachable + return '?'; + } + } + + private static bool State1 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') + continue; + + if (ctx.L.input_char >= '1' && ctx.L.input_char <= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 3; + return true; + } + + switch (ctx.L.input_char) { + case '"': + ctx.NextState = 19; + ctx.Return = true; + return true; + + case ',': + case ':': + case '[': + case ']': + case '{': + case '}': + ctx.NextState = 1; + ctx.Return = true; + return true; + + case '-': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 2; + return true; + + case '0': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 4; + return true; + + case 'f': + ctx.NextState = 12; + return true; + + case 'n': + ctx.NextState = 16; + return true; + + case 't': + ctx.NextState = 9; + return true; + + case '\'': + if (! ctx.L.allow_single_quoted_strings) + return false; + + ctx.L.input_char = '"'; + ctx.NextState = 23; + ctx.Return = true; + return true; + + case '/': + if (! ctx.L.allow_comments) + return false; + + ctx.NextState = 25; + return true; + + default: + return false; + } + } + + return true; + } + + private static bool State2 (FsmContext ctx) + { + ctx.L.GetChar (); + + if (ctx.L.input_char >= '1' && ctx.L.input_char<= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 3; + return true; + } + + switch (ctx.L.input_char) { + case '0': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 4; + return true; + + default: + return false; + } + } + + private static bool State3 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + + switch (ctx.L.input_char) { + case ',': + case ']': + case '}': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 1; + return true; + + case '.': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 5; + return true; + + case 'e': + case 'E': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 7; + return true; + + default: + return false; + } + } + return true; + } + + private static bool State4 (FsmContext ctx) + { + ctx.L.GetChar (); + + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + + switch (ctx.L.input_char) { + case ',': + case ']': + case '}': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 1; + return true; + + case '.': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 5; + return true; + + case 'e': + case 'E': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 7; + return true; + + default: + return false; + } + } + + private static bool State5 (FsmContext ctx) + { + ctx.L.GetChar (); + + if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 6; + return true; + } + + return false; + } + + private static bool State6 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + + switch (ctx.L.input_char) { + case ',': + case ']': + case '}': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 1; + return true; + + case 'e': + case 'E': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 7; + return true; + + default: + return false; + } + } + + return true; + } + + private static bool State7 (FsmContext ctx) + { + ctx.L.GetChar (); + + if (ctx.L.input_char >= '0' && ctx.L.input_char<= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 8; + return true; + } + + switch (ctx.L.input_char) { + case '+': + case '-': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 8; + return true; + + default: + return false; + } + } + + private static bool State8 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char >= '0' && ctx.L.input_char<= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char<= '\r') { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + + switch (ctx.L.input_char) { + case ',': + case ']': + case '}': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + return true; + } + + private static bool State9 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'r': + ctx.NextState = 10; + return true; + + default: + return false; + } + } + + private static bool State10 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'u': + ctx.NextState = 11; + return true; + + default: + return false; + } + } + + private static bool State11 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'e': + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State12 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'a': + ctx.NextState = 13; + return true; + + default: + return false; + } + } + + private static bool State13 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'l': + ctx.NextState = 14; + return true; + + default: + return false; + } + } + + private static bool State14 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 's': + ctx.NextState = 15; + return true; + + default: + return false; + } + } + + private static bool State15 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'e': + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State16 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'u': + ctx.NextState = 17; + return true; + + default: + return false; + } + } + + private static bool State17 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'l': + ctx.NextState = 18; + return true; + + default: + return false; + } + } + + private static bool State18 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'l': + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State19 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + switch (ctx.L.input_char) { + case '"': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 20; + return true; + + case '\\': + ctx.StateStack = 19; + ctx.NextState = 21; + return true; + + default: + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + } + + return true; + } + + private static bool State20 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case '"': + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State21 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'u': + ctx.NextState = 22; + return true; + + case '"': + case '\'': + case '/': + case '\\': + case 'b': + case 'f': + case 'n': + case 'r': + case 't': + ctx.L.string_buffer.Append ( + ProcessEscChar (ctx.L.input_char)); + ctx.NextState = ctx.StateStack; + return true; + + default: + return false; + } + } + + private static bool State22 (FsmContext ctx) + { + int counter = 0; + int mult = 4096; + + ctx.L.unichar = 0; + + while (ctx.L.GetChar ()) { + + if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9' || + ctx.L.input_char >= 'A' && ctx.L.input_char <= 'F' || + ctx.L.input_char >= 'a' && ctx.L.input_char <= 'f') { + + ctx.L.unichar += HexValue (ctx.L.input_char) * mult; + + counter++; + mult /= 16; + + if (counter == 4) { + ctx.L.string_buffer.Append ( + Convert.ToChar (ctx.L.unichar)); + ctx.NextState = ctx.StateStack; + return true; + } + + continue; + } + + return false; + } + + return true; + } + + private static bool State23 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + switch (ctx.L.input_char) { + case '\'': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 24; + return true; + + case '\\': + ctx.StateStack = 23; + ctx.NextState = 21; + return true; + + default: + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + } + + return true; + } + + private static bool State24 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case '\'': + ctx.L.input_char = '"'; + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State25 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case '*': + ctx.NextState = 27; + return true; + + case '/': + ctx.NextState = 26; + return true; + + default: + return false; + } + } + + private static bool State26 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char == '\n') { + ctx.NextState = 1; + return true; + } + } + + return true; + } + + private static bool State27 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char == '*') { + ctx.NextState = 28; + return true; + } + } + + return true; + } + + private static bool State28 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char == '*') + continue; + + if (ctx.L.input_char == '/') { + ctx.NextState = 1; + return true; + } + + ctx.NextState = 27; + return true; + } + + return true; + } + #endregion + + + private bool GetChar () + { + if ((input_char = NextChar ()) != -1) + return true; + + end_of_input = true; + return false; + } + + private int NextChar () + { + if (input_buffer != 0) { + int tmp = input_buffer; + input_buffer = 0; + + return tmp; + } + + return reader.Read (); + } + + public bool NextToken () + { + StateHandler handler; + fsm_context.Return = false; + + while (true) { + handler = fsm_handler_table[state - 1]; + + if (! handler (fsm_context)) + throw new JsonException (input_char); + + if (end_of_input) + return false; + + if (fsm_context.Return) { + string_value = string_buffer.ToString (); + string_buffer.Remove (0, string_buffer.Length); + token = fsm_return_table[state - 1]; + + if (token == (int) ParserToken.Char) + token = input_char; + + state = fsm_context.NextState; + + return true; + } + + state = fsm_context.NextState; + } + } + + private void UngetChar () + { + input_buffer = input_char; + } + } +} diff --git a/Assets/AnyThinkAds/Thrid/Lexer.cs.meta b/Assets/AnyThinkAds/Thrid/Lexer.cs.meta new file mode 100644 index 0000000..1c9d7d2 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/Lexer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8d67d3dfee14b471f87e197b70da5773 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/Netstandard15Polyfill.cs b/Assets/AnyThinkAds/Thrid/Netstandard15Polyfill.cs new file mode 100644 index 0000000..5766a3e --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/Netstandard15Polyfill.cs @@ -0,0 +1,24 @@ +#if NETSTANDARD1_5 +using System; +using System.Reflection; +namespace AnyThinkAds.ThirdParty.LitJson +{ + internal static class Netstandard15Polyfill + { + internal static Type GetInterface(this Type type, string name) + { + return type.GetTypeInfo().GetInterface(name); + } + + internal static bool IsClass(this Type type) + { + return type.GetTypeInfo().IsClass; + } + + internal static bool IsEnum(this Type type) + { + return type.GetTypeInfo().IsEnum; + } + } +} +#endif \ No newline at end of file diff --git a/Assets/AnyThinkAds/Thrid/Netstandard15Polyfill.cs.meta b/Assets/AnyThinkAds/Thrid/Netstandard15Polyfill.cs.meta new file mode 100644 index 0000000..2ccd9b2 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/Netstandard15Polyfill.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f9b885062ba4b4996a1ba1d80645f54f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkAds/Thrid/ParserToken.cs b/Assets/AnyThinkAds/Thrid/ParserToken.cs new file mode 100644 index 0000000..2a55de5 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/ParserToken.cs @@ -0,0 +1,44 @@ +#region Header +/** + * ParserToken.cs + * Internal representation of the tokens used by the lexer and the parser. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +namespace AnyThinkAds.ThirdParty.LitJson +{ + internal enum ParserToken + { + // Lexer tokens (see section A.1.1. of the manual) + None = System.Char.MaxValue + 1, + Number, + True, + False, + Null, + CharSeq, + // Single char + Char, + + // Parser Rules (see section A.2.1 of the manual) + Text, + Object, + ObjectPrime, + Pair, + PairRest, + Array, + ArrayPrime, + Value, + ValueRest, + String, + + // End of input + End, + + // The empty rule + Epsilon + } +} diff --git a/Assets/AnyThinkAds/Thrid/ParserToken.cs.meta b/Assets/AnyThinkAds/Thrid/ParserToken.cs.meta new file mode 100644 index 0000000..32051b1 --- /dev/null +++ b/Assets/AnyThinkAds/Thrid/ParserToken.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3cde16fe757d4b758801b008d733379 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin.meta b/Assets/AnyThinkPlugin.meta new file mode 100644 index 0000000..c873e37 --- /dev/null +++ b/Assets/AnyThinkPlugin.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7906f0e7a18774d7cacdf2ec692623de +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Editor.meta b/Assets/AnyThinkPlugin/Editor.meta new file mode 100644 index 0000000..a132777 --- /dev/null +++ b/Assets/AnyThinkPlugin/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 56682603f4c2844ed9707674254d306a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Editor/ATDownloadManager.cs b/Assets/AnyThinkPlugin/Editor/ATDownloadManager.cs new file mode 100644 index 0000000..a1f7a49 --- /dev/null +++ b/Assets/AnyThinkPlugin/Editor/ATDownloadManager.cs @@ -0,0 +1,561 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using System.Xml; + +using UnityEditor; +using UnityEngine; +using UnityEngine.Networking; +using ATJson; +using ATProviderInfo; +using ATNet; +using UnityEditor.PackageManager.Requests; +using UnityEditor.PackageManager; + +using ATConf; +public class ATDownloadManager : EditorWindow { + + private GUIStyle headerStyle; + private GUIStyle textStyle; + private GUIStyle boldTextStyle; + + internal class ProviderInfoComparor : IComparer + { + public int Compare(ATInfo x, ATInfo y) + { + return x.providerName.CompareTo(y.providerName); + } + } + + private string filePath = ATNetInfo.networkPath; + private const int Width = 760; + private const int Height = 760; + + private ATEditorCoroutines mEditorCoroutines; + + private UnityWebRequest downloadWebClient; + + private readonly GUILayoutOption buttonWidth = GUILayout.Width(90); + + private readonly SortedSet providersSet = new SortedSet(new ProviderInfoComparor()); + + private ATconfig localConfig = ATconfig.getLocalConfig(); + private ATconfig reqConfig; + private Boolean updateCore = false; + + private ATInfo currentProvider; + private ATInfo coreProvider; + private String versionNo = "-"; + + + public static void showManager(){ + var win = GetWindowWithRect(new Rect(0, 0, Width, Height), true); + win.titleContent = new GUIContent("AnyThink Integration Manager"); + win.Focus(); + } + + private void OnEnable() + { + + mEditorCoroutines = ATEditorCoroutines.StartEditorCoroutine(getVersions()); + + } + + private IEnumerator getVersions(){ + + filePath = ATNetInfo.networkPath; + + UnityWebRequest unityWebRequest = UnityWebRequest.Get(filePath); + var webRequest = unityWebRequest.SendWebRequest(); + while (!webRequest.isDone) + { + + yield return new WaitForSeconds(0.1f); + } + if (!unityWebRequest.isHttpError && !unityWebRequest.isNetworkError) + { + + string json = unityWebRequest.downloadHandler.text; + + Dictionary dic = new Dictionary(); + try + + { + dic = Json.Deserialize(json) as Dictionary; + reqConfig = JsonUtility.FromJson(json); + + Debug.Log("req version"); + // if (selected == 0 ){ + // reloadList(dic, "GlobalSdk"); + + // }else{ + // reloadList(dic, "ChinaSdk"); + // } + ATEditorCoroutines.StartEditorCoroutine(getNetworkList()); + } + + catch (Exception e) + { + Debug.Log("Error getting response " + e.ToString()); + } + + + } + + + Repaint(); + requested = true; + } + + private IEnumerator getNetworkList(){ + + + + filePath = ATNetInfo.getNetworkJson(versionNo); + + Debug.Log("get network list:"+filePath); + + UnityWebRequest unityWebRequest = UnityWebRequest.Get(filePath); + var webRequest = unityWebRequest.SendWebRequest(); + while (!webRequest.isDone) + { + + yield return new WaitForSeconds(0.1f); + } + if (!unityWebRequest.isHttpError && !unityWebRequest.isNetworkError) + { + providersSet.Clear(); + string json = unityWebRequest.downloadHandler.text; + + Dictionary dic = new Dictionary(); + try + + { + dic = Json.Deserialize(json) as Dictionary; + // reqConfig = JsonUtility.FromJson(json); + + Debug.Log("network list:"+ json); + if (selected == 0 ){ + reloadList(dic, "GlobalSdk"); + + }else{ + reloadList(dic, "ChinaSdk"); + } + } + + catch (Exception e) + { + Debug.Log("Error getting response " + e.ToString()); + } + + + } + + + Repaint(); + } + private void reloadList(Dictionary dic, string key){ + object providersJson; + if (dic.TryGetValue(key, out providersJson)) + { + if(providersJson!=null){ + foreach (var item in providersJson as Dictionary) + { + ATInfo info = new ATInfo(); + + if (info.GetFromJson(item.Key, item.Value as Dictionary)) + { + + if(info.displayProviderName != "Core"){ + providersSet.Add(info); + } + else{ + coreProvider = info; + } + + } + } + } + } + } + + private void drawHeaderVersion(){ + + selectedOption = EditorGUILayout.Popup("Version",selectedOption,reqConfig.versionList); + string ver = reqConfig.versionList[selectedOption]; + if(versionNo != ver){ + versionNo = ver; + // ATEditorCoroutines.StartEditorCoroutine(getNetworkList()); + } + GUILayout.Space(5); + + + + using (new EditorGUILayout.HorizontalScope( GUILayout.Width(280))) + { + + + + + GUI.enabled = true; + + // EditorGUILayout.LabelField("Region", GUILayout.Width(45)); + // int opsi = GUILayout.SelectionGrid(selected, options, options.Length, EditorStyles.radioButton); + // // if (selected >=0){ + // // ATEditorCoroutines.StartEditorCoroutine(getVersions()); + // // } + + // if (selected!=opsi) { + + // selected = opsi; + // ATEditorCoroutines.StartEditorCoroutine(getNetworkList()); + // } + + GUILayout.Space(5); + + + if(coreProvider != null){ + + coreProvider.latestUnityVersion = versionNo; + + if (coreProvider.currentUnityVersion == "-") + { + bool btn = GUILayout.Button(new GUIContent + { + text = "Install Core", + tooltip = "" + }, buttonWidth); + if (btn && downloadWebClient == null) + { + GUI.enabled = true; + currentProvider = coreProvider; + updateCore = false; + + + + ATEditorCoroutines.StartEditorCoroutine(DownloadFile(getDownloadUrl(coreProvider.displayProviderName))); + } + + } + else if (coreProvider.currentUnityVersion != versionNo) + { + var btn = GUILayout.Button(new GUIContent + { + text= "Update Core", + tooltip = "" + } + ,buttonWidth); + + if (btn && downloadWebClient == null) + { + GUI.enabled = true; + currentProvider = coreProvider; + updateCore = false; + ATEditorCoroutines.StartEditorCoroutine(DownloadFile(getDownloadUrl(coreProvider.displayProviderName))); + } + } + else + { + GUI.enabled = false; + GUILayout.Button(new GUIContent + { + text = "Core Updated", + tooltip = "" + }, buttonWidth); + } + GUILayout.Space(5); + GUI.enabled = true; + + + } + + } + } + + private void DrawSDKHeader() + { + + using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(false))) + { + + EditorGUILayout.LabelField("Current SDK Version", new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Bold, + fontSize = 13, + fixedHeight = 20, + stretchWidth = true, + fixedWidth = Width / 4, + clipping = TextClipping.Overflow, + padding = new RectOffset(Width / 4 + 15, 0, 0, 0) + }); + GUILayout.Space(85); + EditorGUILayout.LabelField("Latest SDK Version", new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Bold, + fontSize = 13, + fixedHeight = 20, + stretchWidth = true, + fixedWidth = Screen.width / 4, + clipping = TextClipping.Overflow, + }); + } + } + + void DrawProviderItem(ATInfo providerData) + { + if (!providerData.Equals(default(ATInfo))) + { + using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(false))) + { + GUI.enabled = true; + bool isNew = providerData.isNewProvider; + string isNewAddition = isNew ? " - New Network" : string.Empty; + string androidVersion = ""; + string iosVersion = ""; + string tooltipText = "Latest Version: \n " + providerData.providerName + " Adapter Version " + versionNo; + if (!providerData.sdkVersionDic.TryGetValue(ATNetInfo.Android, out androidVersion)) + { + androidVersion = ""; + } + else tooltipText = tooltipText + "\n Android SDK version " + androidVersion; + if (!providerData.sdkVersionDic.TryGetValue(ATNetInfo.iOS, out iosVersion)) + { + iosVersion = ""; + } + else tooltipText = tooltipText + "\n iOS SDK version " + iosVersion; + + EditorGUILayout.LabelField(providerData.displayProviderName + isNewAddition, isNew ? boldTextStyle : textStyle); + EditorGUILayout.LabelField(providerData.currentDisplayVersion, textStyle); + EditorGUILayout.LabelField(providerData.displayVersion, textStyle); + + if (providerData.currentStatues == ATInfo.Status.none) + { + bool btn = GUILayout.Button(new GUIContent + { + text = "Install", + tooltip = tooltipText + }, buttonWidth); + if (btn && downloadWebClient == null) + { + GUI.enabled = true; + currentProvider = providerData; + updateCore = false; + + + if (coreProvider.currentUnityVersion == "-"){ + EditorUtility.DisplayDialog("Install fail","Please install Core package first to proceed","Ok"); + }else{ + ATEditorCoroutines.StartEditorCoroutine(DownloadFile(getDownloadUrl(providerData.displayProviderName))); + } + + } + + } + else if (providerData.currentStatues == ATInfo.Status.installed) + { + var btn = GUILayout.Button(new GUIContent + { + text= "Update", + tooltip = tooltipText + } + ,buttonWidth); + + if (btn && downloadWebClient == null) + { + GUI.enabled = true; + currentProvider = providerData; + updateCore = false; + ATEditorCoroutines.StartEditorCoroutine(DownloadFile(getDownloadUrl(providerData.displayProviderName))); + } + } + else + { + GUI.enabled = false; + GUILayout.Button(new GUIContent + { + text = "Updated", + tooltip = tooltipText + }, buttonWidth); + } + GUILayout.Space(5); + GUI.enabled = true; + } + } + } + private String getDownloadUrl(string network){ + + string region = selected == 0 ? "NonChina" : "China"; + + return ATNetInfo.packagePath + versionNo +"/"+ region +"/"+ATNetInfo.platformName+network+".unitypackage"; + } + private IEnumerator DownloadFile(string downloadFileUrl) + { + + if(currentProvider.displayProviderName == "Core"){ + FileUtil.DeleteFileOrDirectory(ATNetInfo.ATDownloadDir); + FileUtil.DeleteFileOrDirectory(ATNetInfo.ATDependencyDir); + localConfig.resetNetwork(); + } + int fileNameIndex = downloadFileUrl.LastIndexOf("/") + 1; + string downloadFileName = downloadFileUrl.Substring(fileNameIndex); + string fileDownloading = string.Format("Downloading {0}", downloadFileName); + string genericFileName = Regex.Replace(downloadFileName, @"_v+(\d\.\d\.\d\.\d|\d\.\d\.\d)", ""); + string path = Path.Combine(ATNetInfo.ATDownloadDir, genericFileName); + bool isCancelled = false; + downloadWebClient = new UnityWebRequest(downloadFileUrl); + downloadWebClient.downloadHandler = new DownloadHandlerFile(path); + downloadWebClient.SendWebRequest(); + if (!downloadWebClient.isHttpError && !downloadWebClient.isNetworkError) + { + while (!downloadWebClient.isDone) + { + yield return new WaitForSeconds(0.1f); + if (EditorUtility.DisplayCancelableProgressBar("Download Manager", fileDownloading, downloadWebClient.downloadProgress)) + { + if (downloadWebClient.error != null) + { + Debug.LogError(downloadWebClient.error); + } + CancelDownload(); + isCancelled = true; + } + } + } + else + { + Debug.LogError("Error Downloading " + genericFileName + " : " + downloadWebClient.error); + } + + + EditorUtility.ClearProgressBar(); + + if (genericFileName.EndsWith(".unitypackage") && !isCancelled) + { + AssetDatabase.ImportPackage(Path.Combine(ATNetInfo.ATDownloadDir, genericFileName), true); + } + else + { + // in case the download was cancelled, delete the file + if(isCancelled && File.Exists(ATNetInfo.ATDownloadDir + genericFileName)) + { + File.Delete(ATNetInfo.ATDownloadDir + genericFileName); + } + + ATEditorCoroutines.StartEditorCoroutine(getVersions()); + } + + localConfig.updateNetwork(currentProvider); + AssetDatabase.Refresh(); + + + //clean the downloadWebClient object regardless of whether the request succeeded or failed + downloadWebClient.Dispose(); + downloadWebClient = null; + + ATEditorCoroutines.StartEditorCoroutine(getVersions()); + } + + private void CancelDownload() + { + // if downloader object is still active + if (downloadWebClient != null) + { + downloadWebClient.Abort(); + return; + } + + if (mEditorCoroutines != null) + { + mEditorCoroutines.StopEditorCoroutine(); + mEditorCoroutines = null; + } + + downloadWebClient = null; + } + + + void Awake() + { + headerStyle = new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Bold, + fontSize = 14, + fixedHeight = 20, + stretchWidth = true, + fixedWidth = Width / 4 + 5, + clipping = TextClipping.Overflow, + alignment = TextAnchor.MiddleLeft + }; + textStyle = new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Normal, + alignment = TextAnchor.MiddleLeft + + }; + boldTextStyle = new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Bold + }; + + + + } + private void OnDestroy() + { + CancelDownload(); + AssetDatabase.Refresh(); + } + +int selected = ATNetInfo.isGlobal; + static string[] options = new string[] { "Global", "China" }; + string[] dropoptions = new string[] + { + "Option1", "Option2", "Option3", + }; + bool requested = false; + + int selectedOption = 0; + + void OnGUI() + { + + + + GUILayout.Space(10); + + if(reqConfig==null ){ + return; + } + + using (new EditorGUILayout.VerticalScope("box")) + { + + GUILayout.Space(5); + + + drawHeaderVersion(); + GUILayout.Space(5); + DrawSDKHeader(); + GUILayout.Space(5); + GUILayout.BeginHorizontal(); + + } + + // if(coreProvider != null){ + // DrawProviderItem(coreProvider); + // } + + + + foreach (var provider in providersSet) + { + + DrawProviderItem(provider); + GUILayout.Space(2); + } + GUILayout.Space(30); + + } +} \ No newline at end of file diff --git a/Assets/AnyThinkPlugin/Editor/ATDownloadManager.cs.meta b/Assets/AnyThinkPlugin/Editor/ATDownloadManager.cs.meta new file mode 100644 index 0000000..1290ea9 --- /dev/null +++ b/Assets/AnyThinkPlugin/Editor/ATDownloadManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4655aa99cf2c1475eb148561285c1d0e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Editor/ATEditorCoroutines.cs b/Assets/AnyThinkPlugin/Editor/ATEditorCoroutines.cs new file mode 100644 index 0000000..dcc019e --- /dev/null +++ b/Assets/AnyThinkPlugin/Editor/ATEditorCoroutines.cs @@ -0,0 +1,37 @@ +using UnityEditor; +using System.Collections; + +public class ATEditorCoroutines +{ + readonly IEnumerator mRoutine; + + public static ATEditorCoroutines StartEditorCoroutine( IEnumerator routine) + { + ATEditorCoroutines coroutine = new ATEditorCoroutines(routine); + coroutine.start(); + return coroutine; + } + + ATEditorCoroutines(IEnumerator routine) + { + mRoutine = routine; + } + + void start() + { + EditorApplication.update += update; + } + + void update() + { + if(!mRoutine.MoveNext()) + { + StopEditorCoroutine(); + } + } + + public void StopEditorCoroutine() + { + EditorApplication.update -= update; + } +} diff --git a/Assets/AnyThinkPlugin/Editor/ATEditorCoroutines.cs.meta b/Assets/AnyThinkPlugin/Editor/ATEditorCoroutines.cs.meta new file mode 100644 index 0000000..672a799 --- /dev/null +++ b/Assets/AnyThinkPlugin/Editor/ATEditorCoroutines.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 653ebf512c3af46698bdf323cfb74f53 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Editor/ATMenu.cs b/Assets/AnyThinkPlugin/Editor/ATMenu.cs new file mode 100644 index 0000000..8a1cd93 --- /dev/null +++ b/Assets/AnyThinkPlugin/Editor/ATMenu.cs @@ -0,0 +1,27 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +public class ATMenu : UnityEditor.Editor +{ + // Start is called before the first frame update + [MenuItem("AnyThink/Documentation", false, 0)] + public static void Documentation() + { + Application.OpenURL("https://docs.toponad.com/#/en-us/unity/download/package?_t=YyEWrxzJVTjbQFhszxvWabdIARg7mzE4"); + } + + [MenuItem("AnyThink/SDK Manager", false, 0)] + public static void sdkManager() + { + ATDownloadManager.showManager(); + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/AnyThinkPlugin/Editor/ATMenu.cs.meta b/Assets/AnyThinkPlugin/Editor/ATMenu.cs.meta new file mode 100644 index 0000000..848a3ac --- /dev/null +++ b/Assets/AnyThinkPlugin/Editor/ATMenu.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82226c0ac90874afc9d1b46b47c9dfb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Editor/localConfig.json b/Assets/AnyThinkPlugin/Editor/localConfig.json new file mode 100644 index 0000000..d26659e --- /dev/null +++ b/Assets/AnyThinkPlugin/Editor/localConfig.json @@ -0,0 +1 @@ +{"version":"","sDKInfo":[{"network":"Core","version":"6.1.55","displayVersion":"iOS : 6.1.51 Android : 6.1.55"},{"network":"Pangle","version":"6.1.55","displayVersion":"iOS : 4.9.0.2 Android : 5.0.0.4"},{"network":"KuaiShou","version":"6.1.55","displayVersion":"iOS : 3.3.33 Android : 3.3.34"},{"network":"GDT","version":"6.1.55","displayVersion":"iOS : 4.13.90 Android : 4.510.1380"}],"versionList":[]} \ No newline at end of file diff --git a/Assets/AnyThinkPlugin/Editor/localConfig.json.meta b/Assets/AnyThinkPlugin/Editor/localConfig.json.meta new file mode 100644 index 0000000..214855b --- /dev/null +++ b/Assets/AnyThinkPlugin/Editor/localConfig.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 56e64f2bc9e07400cabd79e3b2c503c4 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Script.meta b/Assets/AnyThinkPlugin/Script.meta new file mode 100644 index 0000000..a2192c6 --- /dev/null +++ b/Assets/AnyThinkPlugin/Script.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 85f9836b0a7f4467c872a6d93df025b6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Script/ATConfig.cs b/Assets/AnyThinkPlugin/Script/ATConfig.cs new file mode 100644 index 0000000..4cb5439 --- /dev/null +++ b/Assets/AnyThinkPlugin/Script/ATConfig.cs @@ -0,0 +1,85 @@ + +using System; +using ATNet; +using ATJson; + +using UnityEditor; +using UnityEngine; +using UnityEngine.Networking; +using System.Collections.Generic; +using ATProviderInfo; +using System.IO; + namespace ATConf +{ + + [Serializable] + public class ATconfig + { + + public string version; + public List sDKInfo; + public String[] versionList; + + public void saveToLocal(){ + string potion = JsonUtility.ToJson(this); + System.IO.File.WriteAllText(ATNetInfo.localConfig,potion); + + } + + public void updateNetwork(ATInfo aTInfo){ + SDKInfo curInfo = null; + + Debug.Log("ver:"+aTInfo.latestUnityVersion); + + + foreach (SDKInfo info in this.sDKInfo){ + if(info.network == aTInfo.displayProviderName){ + curInfo = info; + } + } + if(curInfo == null){ + curInfo = new SDKInfo(); + curInfo.network = aTInfo.displayProviderName; + curInfo.version = aTInfo.latestUnityVersion; + curInfo.displayVersion = aTInfo.displayVersion; + + this.sDKInfo.Add(curInfo); + }else{ + curInfo.version = aTInfo.latestUnityVersion; + } + + + saveToLocal(); + } + + public void resetNetwork(){ + + this.sDKInfo = new List(); + saveToLocal(); + } + + public static ATconfig getLocalConfig(){ + String file = File.ReadAllText(ATNetInfo.localConfig); + ATconfig localConfig = JsonUtility.FromJson(file); + + if(localConfig == null){ + localConfig = new ATconfig(); + } + return localConfig; + + } + +} + + [Serializable] + public class SDKInfo { + public string network; + public string version; + + public string displayVersion; + + + } + + +} \ No newline at end of file diff --git a/Assets/AnyThinkPlugin/Script/ATConfig.cs.meta b/Assets/AnyThinkPlugin/Script/ATConfig.cs.meta new file mode 100644 index 0000000..77198af --- /dev/null +++ b/Assets/AnyThinkPlugin/Script/ATConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c9272816a9c944e828dd591dbae79e04 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Script/ATJson.cs b/Assets/AnyThinkPlugin/Script/ATJson.cs new file mode 100644 index 0000000..def52ac --- /dev/null +++ b/Assets/AnyThinkPlugin/Script/ATJson.cs @@ -0,0 +1,495 @@ +/* + * Based on the miniJSON by Calvin Rien + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; + +namespace ATJson +{ + public static class Json + { + public static object Deserialize (string json) + { + if (json == null) { + return null; + } + return Parser.Parse (json); + } + + sealed class Parser : IDisposable + { + const string WHITE_SPACE = " \t\n\r"; + const string WORD_BREAK = " \t\n\r{}[],:\""; + + enum TOKEN + { + NONE, + CURLY_OPEN, + CURLY_CLOSE, + SQUARED_OPEN, + SQUARED_CLOSE, + COLON, + COMMA, + STRING, + NUMBER, + TRUE, + FALSE, + NULL + } + ; + + StringReader json; + + Parser (string jsonString) + { + json = new StringReader (jsonString); + } + + public static object Parse (string jsonString) + { + using (var instance = new Parser(jsonString)) { + return instance.ParseValue (); + } + } + + public void Dispose () + { + json.Dispose (); + json = null; + } + + Dictionary ParseObject () + { + Dictionary table = new Dictionary (); + + // ditch opening brace + json.Read (); + + // { + while (true) { + switch (NextToken) { + case TOKEN.NONE: + return null; + case TOKEN.COMMA: + continue; + case TOKEN.CURLY_CLOSE: + return table; + default: + // name + string name = ParseString (); + if (name == null) { + return null; + } + + // : + if (NextToken != TOKEN.COLON) { + return null; + } + // ditch the colon + json.Read (); + + // value + table [name] = ParseValue (); + break; + } + } + } + + List ParseArray () + { + List array = new List (); + + // ditch opening bracket + json.Read (); + + // [ + var parsing = true; + while (parsing) { + TOKEN nextToken = NextToken; + + switch (nextToken) { + case TOKEN.NONE: + return null; + case TOKEN.COMMA: + continue; + case TOKEN.SQUARED_CLOSE: + parsing = false; + break; + default: + object value = ParseByToken (nextToken); + + array.Add (value); + break; + } + } + + return array; + } + + object ParseValue () + { + TOKEN nextToken = NextToken; + return ParseByToken (nextToken); + } + + object ParseByToken (TOKEN token) + { + switch (token) { + case TOKEN.STRING: + return ParseString (); + case TOKEN.NUMBER: + return ParseNumber (); + case TOKEN.CURLY_OPEN: + return ParseObject (); + case TOKEN.SQUARED_OPEN: + return ParseArray (); + case TOKEN.TRUE: + return true; + case TOKEN.FALSE: + return false; + case TOKEN.NULL: + return null; + default: + return null; + } + } + + string ParseString () + { + StringBuilder s = new StringBuilder (); + char c; + + // ditch opening quote + json.Read (); + + bool parsing = true; + while (parsing) { + + if (json.Peek () == -1) { + parsing = false; + break; + } + + c = NextChar; + switch (c) { + case '"': + parsing = false; + break; + case '\\': + if (json.Peek () == -1) { + parsing = false; + break; + } + + c = NextChar; + switch (c) { + case '"': + case '\\': + case '/': + s.Append (c); + break; + case 'b': + s.Append ('\b'); + break; + case 'f': + s.Append ('\f'); + break; + case 'n': + s.Append ('\n'); + break; + case 'r': + s.Append ('\r'); + break; + case 't': + s.Append ('\t'); + break; + case 'u': + var hex = new StringBuilder (); + + for (int i=0; i< 4; i++) { + hex.Append (NextChar); + } + + s.Append ((char)Convert.ToInt32 (hex.ToString (), 16)); + break; + } + break; + default: + s.Append (c); + break; + } + } + + return s.ToString (); + } + + object ParseNumber () + { + string number = NextWord; + + if (number.IndexOf ('.') == -1) { + long parsedInt; + Int64.TryParse (number, NumberStyles.Any, CultureInfo.InvariantCulture, out parsedInt); + return parsedInt; + } + + double parsedDouble; + Double.TryParse (number, NumberStyles.Any, CultureInfo.InvariantCulture, out parsedDouble); + return parsedDouble; + } + + void EatWhitespace () + { + while (WHITE_SPACE.IndexOf(PeekChar) != -1) { + json.Read (); + + if (json.Peek () == -1) { + break; + } + } + } + + char PeekChar { + get { + return Convert.ToChar (json.Peek ()); + } + } + + char NextChar { + get { + return Convert.ToChar (json.Read ()); + } + } + + string NextWord { + get { + StringBuilder word = new StringBuilder (); + + while (WORD_BREAK.IndexOf(PeekChar) == -1) { + word.Append (NextChar); + + if (json.Peek () == -1) { + break; + } + } + + return word.ToString (); + } + } + + TOKEN NextToken { + get { + EatWhitespace (); + + if (json.Peek () == -1) { + return TOKEN.NONE; + } + + char c = PeekChar; + switch (c) { + case '{': + return TOKEN.CURLY_OPEN; + case '}': + json.Read (); + return TOKEN.CURLY_CLOSE; + case '[': + return TOKEN.SQUARED_OPEN; + case ']': + json.Read (); + return TOKEN.SQUARED_CLOSE; + case ',': + json.Read (); + return TOKEN.COMMA; + case '"': + return TOKEN.STRING; + case ':': + return TOKEN.COLON; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + return TOKEN.NUMBER; + } + + string word = NextWord; + + switch (word) { + case "false": + return TOKEN.FALSE; + case "true": + return TOKEN.TRUE; + case "null": + return TOKEN.NULL; + } + + return TOKEN.NONE; + } + } + } + + /// + /// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string + /// + /// A Dictionary<string, object> / List<object> + /// A JSON encoded string, or null if object 'json' is not serializable + public static string Serialize (object obj) + { + return Serializer.Serialize (obj); + } + + sealed class Serializer + { + StringBuilder builder; + + Serializer () + { + builder = new StringBuilder (); + } + + public static string Serialize (object obj) + { + var instance = new Serializer (); + + instance.SerializeValue (obj); + + return instance.builder.ToString (); + } + + void SerializeValue (object value) + { + IList asList; + IDictionary asDict; + string asStr; + + if (value == null) { + builder.Append ("null"); + } else if ((asStr = value as string) != null) { + SerializeString (asStr); + } else if (value is bool) { + builder.Append (value.ToString ().ToLower ()); + } else if ((asList = value as IList) != null) { + SerializeArray (asList); + } else if ((asDict = value as IDictionary) != null) { + SerializeObject (asDict); + } else if (value is char) { + SerializeString (value.ToString ()); + } else { + SerializeOther (value); + } + } + + void SerializeObject (IDictionary obj) + { + bool first = true; + + builder.Append ('{'); + + foreach (object e in obj.Keys) { + if (!first) { + builder.Append (','); + } + + SerializeString (e.ToString ()); + builder.Append (':'); + + SerializeValue (obj [e]); + + first = false; + } + + builder.Append ('}'); + } + + void SerializeArray (IList anArray) + { + builder.Append ('['); + + bool first = true; + + foreach (object obj in anArray) { + if (!first) { + builder.Append (','); + } + + SerializeValue (obj); + + first = false; + } + + builder.Append (']'); + } + + void SerializeString (string str) + { + builder.Append ('\"'); + + char[] charArray = str.ToCharArray (); + foreach (var c in charArray) { + switch (c) { + case '"': + builder.Append ("\\\""); + break; + case '\\': + builder.Append ("\\\\"); + break; + case '\b': + builder.Append ("\\b"); + break; + case '\f': + builder.Append ("\\f"); + break; + case '\n': + builder.Append ("\\n"); + break; + case '\r': + builder.Append ("\\r"); + break; + case '\t': + builder.Append ("\\t"); + break; + default: + int codepoint = Convert.ToInt32 (c); + if ((codepoint >= 32) && (codepoint <= 126)) { + builder.Append (c); + } else { + builder.Append ("\\u" + Convert.ToString (codepoint, 16).PadLeft (4, '0')); + } + break; + } + } + + builder.Append ('\"'); + } + + void SerializeOther (object value) + { + if (value is float + || value is int + || value is uint + || value is long + || value is double + || value is sbyte + || value is byte + || value is short + || value is ushort + || value is ulong + || value is decimal) { + builder.Append (value.ToString ()); + } else { + SerializeString (value.ToString ()); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/AnyThinkPlugin/Script/ATJson.cs.meta b/Assets/AnyThinkPlugin/Script/ATJson.cs.meta new file mode 100644 index 0000000..d51edca --- /dev/null +++ b/Assets/AnyThinkPlugin/Script/ATJson.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fa8c0cec5bff04aeca5dc28fe21ffc89 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Script/ATNetInfo.cs b/Assets/AnyThinkPlugin/Script/ATNetInfo.cs new file mode 100644 index 0000000..63ce43c --- /dev/null +++ b/Assets/AnyThinkPlugin/Script/ATNetInfo.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections; +using System.Collections.Generic; + + +using UnityEngine; + +namespace ATNet { + + public static class ATNetInfo { + public static string platformName = "AnyThink"; + public static string ATDownloadDir = "Assets/AnyThinkAds/Dependencies/"; + public static string ATDependencyDir = "Assets/AnyThinkAds/Plugins/"; + public static string sdk = "sdk"; + public static string Android = "Android"; + public static string iOS = "iOS"; + public static string localConfig = "Assets/AnyThinkPlugin/Editor/localConfig.json"; + public static string networkPath = "http://topon-sdk-release.oss-cn-hangzhou.aliyuncs.com/Unity/network_config.json"; + public static string packagePath = "http://topon-sdk-release.oss-cn-hangzhou.aliyuncs.com/Unity/"; + public static int isGlobal=1; //0:国外 //1:国内 + + public static string getNetworkJson(String ver){ + return "http://topon-sdk-release.oss-cn-hangzhou.aliyuncs.com/Unity/"+ver+"/network.json"; + } + } + +} diff --git a/Assets/AnyThinkPlugin/Script/ATNetInfo.cs.meta b/Assets/AnyThinkPlugin/Script/ATNetInfo.cs.meta new file mode 100644 index 0000000..f438f15 --- /dev/null +++ b/Assets/AnyThinkPlugin/Script/ATNetInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5eb818e47fd664e968f08784520c3f36 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AnyThinkPlugin/Script/ATProviderInfo.cs b/Assets/AnyThinkPlugin/Script/ATProviderInfo.cs new file mode 100644 index 0000000..0a25765 --- /dev/null +++ b/Assets/AnyThinkPlugin/Script/ATProviderInfo.cs @@ -0,0 +1,173 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using System.Xml; +using UnityEditor; +using UnityEngine; +using UnityEngine.Networking; +using ATNet; +using ATConf; +namespace ATProviderInfo { + + public class ATInfo + { + + + + public Status currentStatues; + public string providerName; + public string currentUnityVersion; + public string latestUnityVersion; + public string downloadURL; + public string displayProviderName; + + public string currentDisplayVersion="-"; + public string displayVersion; + + public bool isNewProvider; + public string fileName; + + public string packageName; + + + + public Dictionary sdkVersionDic; + + public ATconfig localConfig; + + + public ATInfo() + { + isNewProvider = false; + fileName = string.Empty; + downloadURL = string.Empty; + currentUnityVersion = "none"; + sdkVersionDic = new Dictionary(); + localConfig = ATconfig.getLocalConfig(); + + } + + public enum Status + { + installed = 1, + none = 2, + updated = 3 + } + + public bool GetFromJson(string name, Dictionary dic) + { + providerName = name; + object obj; + + dic.TryGetValue("keyname", out obj); + if (obj != null) + { + this.displayProviderName = obj as string; + } + else this.displayProviderName = providerName; + + dic.TryGetValue("version", out obj); + + if (obj != null) + { + this.latestUnityVersion = obj as string; + } + + dic.TryGetValue("displayVersion", out obj); + + if (obj != null) + { + this.displayVersion = obj as string; + } + + + SDKInfo curInfo = null; + foreach (SDKInfo info in localConfig.sDKInfo){ + if(info.network == this.displayProviderName) + { + curInfo = info; + currentUnityVersion = info.version; + currentDisplayVersion = info.displayVersion; + } + } + if(curInfo == null){ // no saved in local + currentUnityVersion = "-"; + } + + if (currentUnityVersion.Equals("-")) + { + currentStatues = Status.none; + } + + else + { + if (isNewerVersion(currentUnityVersion, latestUnityVersion)) + { + currentStatues = Status.installed; + } + else + { + currentStatues = Status.updated; + } + } + + return true; + } + + private static string GetVersionFromXML(string fileName) + { + XmlDocument xmlDoc = new XmlDocument(); + string version = "none"; + try + { + xmlDoc.LoadXml(File.ReadAllText(ATNetInfo.ATDownloadDir + fileName)); + } + catch (Exception e) + { + Debug.Log("error--"+fileName+"--"+ e.Message); + return version; + } + var unityVersion = xmlDoc.SelectSingleNode("dependencies/unityversion"); + + + if (unityVersion != null) + { + return (unityVersion.InnerText); + } + File.Delete(ATNetInfo.ATDownloadDir + fileName); + return version; + } + + private static bool isNewerVersion(string current, string latest) + { + bool isNewer = false; + try + { + int[] currentVersion = Array.ConvertAll(current.Split('.'), int.Parse); + int[] remoteVersion = Array.ConvertAll(latest.Split('.'), int.Parse); + int remoteBuild = 0; + int curBuild = 0; + if (currentVersion.Length > 3) + { + curBuild = currentVersion[3]; + } + if (remoteVersion.Length > 3) + { + remoteBuild = remoteVersion[3]; + + } + System.Version cur = new System.Version(currentVersion[0], currentVersion[1], currentVersion[2], curBuild); + System.Version remote = new System.Version(remoteVersion[0], remoteVersion[1], remoteVersion[2], remoteBuild); + isNewer = cur < remote; + } + catch (Exception) + { + + } + return isNewer; + + } + } +} diff --git a/Assets/AnyThinkPlugin/Script/ATProviderInfo.cs.meta b/Assets/AnyThinkPlugin/Script/ATProviderInfo.cs.meta new file mode 100644 index 0000000..caa8a9b --- /dev/null +++ b/Assets/AnyThinkPlugin/Script/ATProviderInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1123279c1b9244e11aaf04a78f2550b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager.meta b/Assets/ExternalDependencyManager.meta new file mode 100644 index 0000000..f693961 --- /dev/null +++ b/Assets/ExternalDependencyManager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cba24325095f14c18b3427a6edda27ed +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor.meta b/Assets/ExternalDependencyManager/Editor.meta new file mode 100644 index 0000000..4818018 --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a721ae1e21d9c4e46a3fd71ea9e1e902 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/1.2.171.meta b/Assets/ExternalDependencyManager/Editor/1.2.171.meta new file mode 100644 index 0000000..45e9f36 --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/1.2.171.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 37823a26b763b4784b53b0c6f195b586 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/1.2.171/Google.IOSResolver.dll b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.IOSResolver.dll new file mode 100644 index 0000000..b41e503 Binary files /dev/null and b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.IOSResolver.dll differ diff --git a/Assets/ExternalDependencyManager/Editor/1.2.171/Google.IOSResolver.dll.meta b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.IOSResolver.dll.meta new file mode 100644 index 0000000..1824796 --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.IOSResolver.dll.meta @@ -0,0 +1,38 @@ +fileFormatVersion: 2 +guid: 8e27a970a6da4f8aa4f745ec6ef61677 +labels: +- gvh +- gvh_version-1.2.171 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.171/Google.IOSResolver.dll +- gvhp_targets-editor +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/1.2.171/Google.JarResolver.dll b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.JarResolver.dll new file mode 100644 index 0000000..639bd3f Binary files /dev/null and b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.JarResolver.dll differ diff --git a/Assets/ExternalDependencyManager/Editor/1.2.171/Google.JarResolver.dll.meta b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.JarResolver.dll.meta new file mode 100644 index 0000000..5061b7b --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.JarResolver.dll.meta @@ -0,0 +1,38 @@ +fileFormatVersion: 2 +guid: cba324dca42d428f81bdf633c93eaf03 +labels: +- gvh +- gvh_version-1.2.171 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.171/Google.JarResolver.dll +- gvhp_targets-editor +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/1.2.171/Google.PackageManagerResolver.dll b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.PackageManagerResolver.dll new file mode 100644 index 0000000..d578956 Binary files /dev/null and b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.PackageManagerResolver.dll differ diff --git a/Assets/ExternalDependencyManager/Editor/1.2.171/Google.PackageManagerResolver.dll.meta b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.PackageManagerResolver.dll.meta new file mode 100644 index 0000000..aeb5ef8 --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.PackageManagerResolver.dll.meta @@ -0,0 +1,38 @@ +fileFormatVersion: 2 +guid: 2d79a35ad25b49e48f9abadf7157f48b +labels: +- gvh +- gvh_version-1.2.171 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.171/Google.PackageManagerResolver.dll +- gvhp_targets-editor +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/1.2.171/Google.VersionHandlerImpl.dll b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.VersionHandlerImpl.dll new file mode 100644 index 0000000..e60fe92 Binary files /dev/null and b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.VersionHandlerImpl.dll differ diff --git a/Assets/ExternalDependencyManager/Editor/1.2.171/Google.VersionHandlerImpl.dll.meta b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.VersionHandlerImpl.dll.meta new file mode 100644 index 0000000..d7ba1cc --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/1.2.171/Google.VersionHandlerImpl.dll.meta @@ -0,0 +1,38 @@ +fileFormatVersion: 2 +guid: d6f1c39f4fa9490984fe8eae92b27f8e +labels: +- gvh +- gvh_version-1.2.171 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.171/Google.VersionHandlerImpl.dll +- gvhp_targets-editor +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/CHANGELOG.md b/Assets/ExternalDependencyManager/Editor/CHANGELOG.md new file mode 100644 index 0000000..bee4f5b --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/CHANGELOG.md @@ -0,0 +1,1357 @@ +# Version 1.2.170 - May 11, 2022 +* iOS Resolver - Change `Enable Swift Framework Support Workaround` setting to + be `ON` by default since more pods are using Swift Framework now. + +# Version 1.2.170 - Apr 4, 2022 +* Android Resolver - Fixes #498 - Fix the path separator of the Maven repo + injected to `mainTemplate.gradle`. +* iOS Resolver - Fixes #470 - Switch default Cocoapods master repo from Github + to CDN. +* iOS Resolver - `Link Framework Statically` setting is now default to `true`. + That is, `use_frameworks! :linkage => static` will be added to `Podfile` by + default instead of `use_frameworks!`. This can be changed in iOS Resolver + settings. This fixes odd behaviors when pods include static libraries, ex. + Firebase Analytics. +* iOS Resolver - Added a workaround when app crashes on launch due to + `Library not loaded: @rpath/libswiftCore.dylib` when some pods includes Swift + framework. This is turned `OFF` by default and can be changed in iOS Resolver + settings. + +# Version 1.2.169 - Jan 20, 2022 +* General - Fixes #425 - Change to save `GvhProjectSettings.xml` without + Unicode byte order mark (BoM). +* Android Resolver - Remove reference to `jcenter()` +* iOS Resolver - Force setting `LANG` when executing Cocoapods in shell mode on + Mac. + +# Version 1.2.168 - Dec 9, 2021 +* All - Fixes #472 by removing the use of `System.Diagnostics.Debug.Assert` +* All - Fixed #477 by properly enabling EDM4U libraries for Unity 2021.2+ when + the package is installed through `.tgz` + +# Version 1.2.167 - Oct 6, 2021 +* All - Moved versioned `.dll` in EDM4U to a versioned folder and remove their + version postfix in their filename. For instance, `IOSResolver.dll` will be + placed at `ExternalDependencyManager/Editor/1.2.167/Google.IOSResolver.dll`. +* Android Resolver - Fixed #243 by only using the highest version in + `mainTemplate.gradle` when duplicated dependencies are presented. +* Android Resolver - Added supports to x86_64 to ABI list for Android apps on + Chrome OS. + +# Version 1.2.166 - Jun 30, 2021 +* All - Fixed #440 and fixed #447 by specifying the parameter type while calling + `GetApplicationIdentifier()` Unity API using reflection, due to a new + overloaded method introduced in Unity 2021.2. +* Android Resolver - Fixed #442 by patching `Dependency.IsGreater()` when the + version strings end '+'. + +# Version 1.2.165 - Apr 28, 2021 +## Bug Fixes +* Version Handler - Fixed #431 by replacing the use of `HttpUtility.UrlEncode()` + which causes NullReferenceException in certain version of Unity. +* Android Resolver - Check that androidSdkRootPath directory exists before using + as sdkPath. +* Android Resolver - Fixed Android Resolver integration tests with Unity + 2019.3+. + +# Version 1.2.164 - Feb 4, 2021 +## New Features +* Android Resolver - Added support for Android packages with classifier in their + namespaces. +* iOS Resolver - Added new settings in iOS Resolver to configure generated + Podfile. +* iOS Resolver - Added a new attribute `addToAllTargets` in Dependencies.xml. + +## Bug Fixes +* iOS Resolver - Fixed XML parsing for `bitcodeEnabled` attribute in + Dependencies.xml. + +# Version 1.2.163 - Dec 15, 2020 +## Bug Fixes +* Version Handler - Fixed measurement reporting + +# Version 1.2.162 - Nov 19, 2020 +## Bug Fixes +* Version Handler - Improved #413 by preventing Version Handler from running + from static constructor when it is disabled. +* Package Manager Resolver - Remove GPR + +# Version 1.2.161 - Oct 12, 2020 +## Bug Fixes +* Android Resolver - Fixed the issue that Android Resolver does not resolve + again before build in Unity 2020 if it failed to resolve previously. + +# Version 1.2.160 - Sep 30, 2020 +## Bug Fixes +* Android Resolver - Fixed a regression that gradleResolver can be null until + Initialize() is called. +* Android Resolver - Fixed a regression that Android Resolver failed in Unity + 2019.3+ due to `gradleTemplate.properties` not enabled when + `mainTemplate.gradle` is not enabled at all. + +# Version 1.2.159 - Sep 11, 2020 +## Bug Fixes +* Android Resolver - Fixed #322 where the Unity editor will lose its target SDK + setting between Unity restarts if `>28` is selected in 2019. This is due to + Unity AndroidSdkVersions enum does not contain values above 28. +* Android Resolver - Fixed #360 where building Android app with Untiy 2019.3+ + may fail due to Jetifier and AndroidX not enabled properly in generated + Gradle project. This fix requires the user to enable + `Custom Gradle Properties Template` found under + `Player Settings > Settings for Android > Publishing Settings`. + +# Version 1.2.158 - Sep 3, 2020 +## Bug Fixes +* Version Handler: Fixed editor freeze when `-executeMethod` is used in + non-batch mode. +* Android Resolver: Normalized file paths when generating local Maven repo + since the path may contains a mix of forward and backward slash on Windows. +* Export Unity Package: Fixed generation of .unitypackage with tarfile on + Windows. + +# Version 1.2.157 - Aug 6, 2020 +## Bug Fixes +* Android Resolver: Delay initialization until active build target is Android + and the editor is not in play mode. +* iOS Resolver: Delay initialization until active build target is iOS + and the editor is not in play mode. +* Export Unity Package: Workaround directory creation racy if multiple export + operations are spawned at the same time. + +# Version 1.2.156 - June 10, 2020 +## Bug Fixes +* Android Resolver: Fixed that the generated local repo assets contains + redundent labels which are causing Version Handler to failed while + uninstalling packages. +* Android Resolver: Fixed that the repo url injected into mainTemplate.gradle + is incorrect when Unity is configured to export gradle project. +* Android Resolver: Limited to only create local Maven repo when the source + repo contains ".srcaar" file. + +## Changes +* All: Described EDM4U analytics data usage in readme. + +# Version 1.2.155 - May 14, 2020 +## Bug Fixes +* All: Fixed compiler error when build with Unity 5.4 or below due to the + usage of Rect.zero. +* All: Ignore cases when checking command line arguments. + +# Version 1.2.154 - May 14, 2020 +## Bug Fixes +* All: Make each MultiSelectWindow for different purposes to have its own + unique window. + +## Changes +* All: Replace all dialog with DialogWindow which is implemented from + EditorWindow. +* Package Manager Resolver: Clarify how manifest.json will be changed in Package + Manager Resolver window. + +# Version 1.2.153 - Apr 24, 2020 +## Bug Fixes +* Android Resolver: Fixed an exception when repainting the Android resolution + window in Unity 2019.3.x. + +# Version 1.2.152 - Apr 17, 2020 +## Bug Fixes +* Version Handler: Fixed exception when waiting for enabled editor DLLs to + load. +* Android Resolver: Fixed regression when using a Custom Gradle Template + on Windows. + +# Version 1.2.151 - Apr 16, 2020 +## Bug Fixes +* Version Handler: When waiting for newly enabled editor DLLs to load, ignore + all DLLs that do not have a file-system location. +* Android Resolver: Fixed resolution when using a Custom Gradle Template with + libraries stored in a local maven repository distributed with a plugin + installed with the Unity Package Manager. + +# Version 1.2.150 - Apr 9, 2020 +## Bug Fixes +* All: The new packaging script when run on MacOS was generating a + .unitypackage archive that could not be read by Unity on Windows. + This release simply repackages the plugin with tar/gzip to fix the problem. + +# Version 1.2.149 - Apr 8, 2020 +## Bug Fixes +* Package Manager Resolver: Fixed spurious error message when resuming + migration after installing a UPM package. + +# Version 1.2.148 - Apr 8, 2020 +## Bug Fixes +* Package Manager Resolver: Fixed an exception when resuming migration + after installing a UPM package. + +# Version 1.2.147 - Apr 8, 2020 +## Bug Fixes +* Version Handler: Fixed alias traversal bug which caused problems when + migrating from installed .unitypackage files to UPM packages. + +# Version 1.2.146 - Apr 8, 2020 +## Bug Fixes +* Version Handler: Fixed exception in manifest parsing when a manifest is + detected with no aliases. + +# Version 1.2.145 - Apr 2, 2020 +## New Features +* Package Manager Resolver: Added a method to migrate Version Handler + managed packages installed via `.unitypackage` to Unity Package Manager + packages. This is initially used to migrate the External Dependency Manager + to UPM. + +## Changes +* All: Verbose logging is now no longer automatically enabled in batch mode + across all components. Instead logging can be configured using each + component's verbose logging setting or by using the `-gvh_log_debug` command + line flag when starting Unity. +* Version Handler: Sped up version handler updates when the app domain isn't + reloaded. + +## Bug Fixes +* Version Handler: Fixed the display of the obsolete files clean up dialog + when the asset database refreshes. +* Version Handler: Improved reliability of callback from + the VersionHandler.UpdateCompleteMethods event when an asset database + refresh occurs. +* Version Handler: Fixed duplicate exportPath labels when 'Assets/' is the + root of paths assigned to files. +* Version Handler: Handle empty lines in manifest files. + +# Version 1.2.144 - Mar 23, 2020 +## Changed +* iOS Resolver: Removed the ability to configure the Xcode target a Cocoapod + is added to. + +## Bug Fixes +* iOS Resolver: Reverted support for adding Cocoapods to multiple targets as + it caused a regression (exception thrown during post-build step) in some + versions of Unity. + +# Version 1.2.143 - Mar 20, 2020 +## Bug Fixes +* Android Resolver: Fixed caching of resolution state which was causing + the resolver to always run when no dependencies had changed. + +# Version 1.2.142 - Mar 19, 2020 +## Changes +* Package Manager Resolver: Enabled auto-add by default. + +# Version 1.2.141 - Mar 19, 2020 +## Bug Fixes +* Fixed a bug when retrieving project settings. If a plugin was configured + to fetch project settings, if a setting was fetched (e.g "foo") and this + setting existed in the system settings but not the project settings the + system value would override the default value leading to unexpected + behavior. +* Fixed a warning when caching web request classes in Unity 5.6. + +# Version 1.2.140 - Mar 19, 2020 +## Bug Fixes +* Fixed measurement reporting in Unity 5.x. +* Version Handler: Fixed NullReferenceException when an asset doesn't have + an AssetImporter. + +# Version 1.2.139 - Mar 18, 2020 +## Changed +* Added documentation to the built plugin. + +# Version 1.2.138 - Mar 17, 2020 +## New Features +* Package Manager Resolver: Added the Package Manager Resolver + component that allows developers to easily boostrap Unity Package Manager + (UPM) registry addition using unitypackage plugins. +* Version Handler: Added a window that allows plugins to managed by the + Version Handler to be uninstalled. +* Version Handler: Added support for displaying installed plugins. +* Version Handler: Added support for moving files in plugins to their install + locations (if the plugin has been configured to support this). +* iOS Resolver: Added the ability to configure the Xcode target a Cocoapod is + added to. + +## Bug Fixes +* Fixed upgrade from version 1.2.137 and below after the plugin rename to + EDM4U broke the upgrade process. +* Android Resolver: Worked around PlayerSettings.Android.targetSdkVersion + returning empty names for some values in 2019.x. +* Version Handler: Fixed the display of the obsolete files clean up window. +* Version Handler: Fixed managed file check when assets are modified in the + project after plugin import. + +# Version 1.2.137 - Mar 6, 2020 +## Changed +* Renamed package to External Package Manager for Unity (EDM4U). + We changed this to reflect what this plugin is doing today which is far more + than the original scope which just consisted of importing jar files from the + Android SDK maven repository. + Scripts that used to pull `play-services-resolver*.unitypackage` will now have + to request `external-dependency-manager*.unitypackage` instead. + We'll still be shipping a `play-services-resolver*_manifest.txt` file to + handle upgrading from older versions of the plugin. + +## New Features +* All Components: Added reporting of usage so that we can remotely detect + errors and target improvements. +* Android Resolver: Added support for *Dependencies.xml files in Unity Package + Manager packages. +* iOS Resolver: Added support for *Dependencies.xml files in Unity Package + Manager packages. + +## Bug Fixes +* Version Handler: Disabled attempts to disable asset metadata modification + when assets are in a Unity Package Manager managed package. + +# Version 1.2.136 - Feb 19, 2019 +## Bug Fixes +* Android Resolver: Fixed OpenJDK path discovery in Unity 2019.3.1. + +# Version 1.2.135 - Dec 5, 2019 +## Bug Fixes +* All Components: Fixed stack overflow when loading project settings. + +# Version 1.2.134 - Dec 4, 2019 +## Bug Fixes +* All Components: Fixed an issue which caused project settings to be cleared + when running in batch mode. + +# Version 1.2.133 - Nov 18, 2019 +## Bug Fixes +* All Components: Failure to save project settings will now report an error + to the log rather than throwing an exception. + +# Version 1.2.132 - Nov 11, 2019 +## Bug Fixes +* Android Resolver: Worked around expansion of DIR_UNITYPROJECT on Windows + breaking Gradle builds when used as part of a file URI. +* Android Resolver: mainTemplate.gradle is only written if it needs to be + modified. + +# Version 1.2.131 - Oct 29, 2019 +## Bug Fixes +* Version Handler: Improved execution of events on the main thread in batch + mode. +* Version Handler: Improved log level configuration at startup. +* Version Handler: Improved performance of class lookup in deferred method + calls. +* Version Handler: Fixed rename to enable / disable for editor assets. +* iOS Resolver: Improved log level configuration at startup. +* Android Resolver: Improved local maven repo path reference in + mainTemplate.gradle using DIR_UNITYPROJECT. DIR_UNITYPROJECT by Unity + to point to the local filesystem path of the Unity project when Unity + generates the Gradle project. + +# Version 1.2.130 - Oct 23, 2019 +## New Features +* iOS Resolver: Added support for modifying the Podfile before `pod install` + is executed. + +## Bug Fixes +* Version Handler: Fixed invalid classname error when calling + `VersionHandler.UpdateVersionedAssets()`. + +# Version 1.2.129 - Oct 2, 2019 +## Bug Fixes +* iOS Resolver: Changed Cocoapod integration in Unity 2019.3+ to + only add Pods to the UnityFramework target. + +# Version 1.2.128 - Oct 1, 2019 +## Bug Fixes +* iOS Resolver: Fixed Cocoapod project integration mode with Unity + 2019.3+. + +# Version 1.2.127 - Sep 30, 2019 +## Changes +* Android Resolver: All Android Resolver settings File paths are now + serialized with POSIX directory separators. + +# Version 1.2.126 - Sep 27, 2019 +## Changes +* Android Resolver: File paths are now serialized with POSIX directory + separators. +## Bug Fixes +* Android Resolver: Fixed resolution when the parent directory of a Unity + project contains a Gradle project (i.e `settings.gradle` file). + +# Version 1.2.125 - Sep 23, 2019 +## Bug Fixes +* All components: Silenced a warning about not being able to set the console + encoding to UTF8. +* Android Resolver: Worked around broken AndroidSDKTools class in some + versions of Unity. +* iOS Resolver: Fixed iOS target SDK version check +* Version Handler: Changed clean up obsolete files window so that it doesn't + exceed the screen size. + +# Version 1.2.124 - Jul 28, 2019 +## Bug Fixes +* All components: Fixed regression with source control integration when using + Unity 2019.1+. + +# Version 1.2.123 - Jul 23, 2019 +## New Features +* All components: Source control integration for project settings. +## Changes +* Android Resolver: Removed AAR cache as it now makes little difference to + incremental resolution performance. +* Android Resolver: Improved embedded resource management so that embedded + resources should upgrade when the plugin is updated without restarting + the Unity editor. +## Bug Fixes +* Version Handler: Fixed InvokeMethod() and InvokeStaticMethod() when calling + methods that have interface typed arguments. + +# Version 1.2.122 - Jul 2, 2019 +## Bug Fixes +* iOS Resolver: Worked around Unity not loading the iOS Resolver DLL as it + referenced the Xcode extension in a public interface. The iOS Resolver + DLL still references the Xcode extension internally and just handles + missing type exceptions dynamically. + +# Version 1.2.121 - Jun 27, 2019 +## Bug Fixes +* Android Resolver: Fixed warning about missing Packages folder when loading + XML dependencies files in versions of Unity without the package manager. +* Android Resolver: Fixed resolution window progress bar exceeding 100%. +* Android Resolver: If AndroidX is detected in the set of resolved libraries, + the user will be prompted to enable the Jetifier. +* Android Resolver: Improved text splitting in text area windows. +* iOS Resolver: Added support for Unity's breaking changes to the Xcode API + in 2019.3.+. Cocoapods are now added to build targets, Unity-iPhone and + UnityFramework in Unity 2019.3+. + +# Version 1.2.120 - Jun 26, 2019 +## New Features +* Android Resolver: Added support for loading *Dependencies.xml files from + Unity Package Manager packages. +* Android Resolver: Resolution window is now closed if resolution runs as + a pre-build step. +* iOS Resolver: Added support for loading *Dependencies.xml files from + Unity Package Manager packages. +## Bug Fixes +* Android Resolver: Fixed generation of relative repo paths when using + mainTemplate.gradle resolver. +* Android Resolver: Fixed copy of .srcaar to .aar files in repos embedded in a + project when a project path has characters (e.g whitespace) that are escaped + during conversion to URIs. +* Android Resolver: Fixed auto-resolution always running if the Android SDK + is managed by Unity Hub. + +# Version 1.2.119 - Jun 19, 2019 +## Bug Fixes +* Android Resolver: Fixed error reported when using Jetifier integration + in Unity 2018+ if the target SDK is set to "highest installed". + +# Version 1.2.118 - Jun 18, 2019 +## New Features +* Android Resolver: Added initial + [Jetifier](https://developer.android.com/studio/command-line/jetifier) + integration which simplifies + [migration](ttps://developer.android.com/jetpack/androidx/migrate) + to Jetpack ([AndroidX](https://developer.android.com/jetpack/androidx)) + libraries in cases where all dependencies are managed by the Android + Resolver. + This can be enabled via the `Use Jetifier` option in the + `Assets > Play Services Resolver > Android Resolver > Settings` menu. + Caveats: + - If your project contains legacy Android Support Library .jar and .aar + files, these files will need to be removed and replaced with references to + artifacts on Maven via `*Dependencies.xml` files so that the Jetifier + can map them to Jetpack (AndroidX) libraries. + For example, remove the file `support-v4-27.0.2.jar` and replace it with + `` in a + `*Dependencies.xml` file. + - If your project contains .jar or .aar files that use the legacy Android + Support Libraries, these will need to be moved into a local Maven repo + [See this guide](https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html) + and then these files should be removed from your Unity project and instead + referenced via `*Dependencies.xml` files so that the Jetifier can + patch them to reference the Jetpack lirbaries. + +## Bug Fixes +* Android Resolver: Disabled version locking of com.android.support:multidex + does not use the same versioning scheme as other legacy Android support + libraries. +* Version Handler: Made Google.VersionHandler.dll's asset GUID stable across + releases. This faciliates error-free import into projects where + Google.VersionHandler.dll is moved from the default install location. + +# Version 1.2.117 - Jun 12, 2019 +## Bug Fixes +* Android Resolver: Fix copying of .srcaar to .aar files for + mainTemplate.gradle resolution. PluginImporter configuration was previously + not being applied to .aar files unless the Unity project was saved. + +# Version 1.2.116 - Jun 7, 2019 +## Bug Fixes +* Android Resolver: Fixed resolution of Android dependencies without version + specifiers. +* Android Resolver: Fixed Maven repo not found warning in Android Resolver. +* Android Resolver: Fixed Android Player directory not found exception in + Unity 2019.x when the Android Player isn't installed. + +# Version 1.2.115 - May 28, 2019 +## Bug Fixes +* Android Resolver: Fixed exception due to Unity 2019.3.0a4 removing + x86 from the set of supported ABIs. + +# Version 1.2.114 - May 27, 2019 +## New Features +* Android Resolver: Added support for ABI stripping when using + mainTemplate.gradle. This only works with AARs stored in repos + on the local filesystem. + +# Version 1.2.113 - May 24, 2019 +## New Features +* Android Resolver: If local repos are moved, the plugin will search the + project for matching directories in an attempt to correct the error. +* Version Handler: Files can be now targeted to multiple build targets + using multiple "gvh_" asset labels. +## Bug Fixes +* Android Resolver: "implementation" or "compile" are now added correctly + to mainTemplate.gradle in Unity versions prior to 2019. + +# Version 1.2.112 - May 22, 2019 +## New Features +* Android Resolver: Added option to disable addition of dependencies to + mainTemplate.gradle. + See `Assets > Play Services Resolver > Android Resolver > Settings`. +* Android Resolver: Made paths to local maven repositories in + mainTemplate.gradle relative to the Unity project when a project is not + being exported. +## Bug Fixes +* Android Resolver: Fixed builds with mainTemplate.gradle integration in + Unity 2019. +* Android Resolver: Changed dependency inclusion in mainTemplate.gradle to + use "implementation" or "compile" depending upon the version of Gradle + included with Unity. +* Android Resolver: Gracefully handled exceptions if the console encoding + can't be modified. +* Android Resolver: Now gracefully fails if the AndroidPlayer directory + can't be found. + +# Version 1.2.111 - May 9, 2019 +## Bug Fixes +* Version Handler: Fixed invocation of methods with named arguments. +* Version Handler: Fixed occasional hang when the editor is compiling + while activating plugins. + +# Version 1.2.110 - May 7, 2019 +## Bug Fixes +* Android Resolver: Fixed inclusion of some srcaar artifacts in builds with + Gradle builds when using mainTemplate.gradle. + +# Version 1.2.109 - May 6, 2019 +## New Features: +* Added links to documentation from menu. +* Android Resolver: Added option to auto-resolve Android libraries on build. +* Android Resolver: Added support for packaging specs of Android libraries. +* Android Resolver: Pop up a window when displaying Android dependencies. + +## Bug Fixes +* Android Resolver: Support for Unity 2019 Android SDK and JDK install locations +* Android Resolver: e-enable AAR explosion if internal builds are enabled. +* Android Resolver: Gracefully handle exceptions on file deletion. +* Android Resolver: Fixed Android Resolver log spam on load. +* Android Resolver: Fixed save of Android Resolver PromptBeforeAutoResolution + setting. +* Android Resolver: Fixed AAR processing failure when an AAR without + classes.jar is found. +* Android Resolver: Removed use of EditorUtility.DisplayProgressBar which + was occasionally left displayed when resolution had completed. +* Version Handler: Fixed asset rename to disable when a disabled file exists. + +# Version 1.2.108 - May 3, 2019 +## Bug Fixes: +* Version Handler: Fixed occasional hang on startup. + +# Version 1.2.107 - May 3, 2019 +## New Features: +* Version Handler: Added support for enabling / disabling assets that do not + support the PluginImporter, based upon build target selection. +* Android Resolver: Added support for the global specification of maven repos. +* iOS Resolver: Added support for the global specification of Cocoapod sources. + +# Version 1.2.106 - May 1, 2019 +## New Features +* iOS Resolver: Added support for development pods in Xcode project integration + mode. +* iOS Resolver: Added support for source pods with resources in Xcode project + integration mode. + +# Version 1.2.105 - Apr 30, 2019 +## Bug fixes +* Android Resolver: Fixed reference to Java tool path in logs. +* Android and iOS Resolvers: Changed command line execution to emit a warning + rather than throwing an exception and failing, when it is not possible to + change the console input and output encoding to UTF-8. +* Android Resolver: Added menu option and API to delete resolved libraries. +* Android Resolver: Added menu option and API to log the repos and libraries + currently included in the project. +* Android Resolver: If Plugins/Android/mainTemplate.gradle file is present and + Gradle is selected as the build type, resolution will simply patch the file + with Android dependencies specified by plugins in the project. + +# Version 1.2.104 - Apr 10, 2019 +## Bug Fixes +* Android Resolver: Changed Android ABI selection method from using whitelisted + Unity versions to type availability. This fixes an exception on resolution + in some versions of Unity 2017.4. + +# Version 1.2.103 - Apr 2, 2019 +## Bug Fixes +* Android Resolver: Whitelisted Unity 2017.4 and above with ARM64 support. +* Android Resolver: Fixed Java version check to work with Java SE 12 and above. + +# Version 1.2.102 - Feb 13, 2019 +## Bug Fixes +* Android Resolver: Fixed the text overflow on the Android Resolver + prompt before initial run to fit inside the buttons for + smaller screens. + +# Version 1.2.101 - Feb 12, 2019 +## New Features +* Android Resolver: Prompt the user before the resolver runs for the + first time and allow the user to elect to disable from the prompt. +* Android Resolver: Change popup warning when resolver is disabled + to be a console warning. + +# Version 1.2.100 - Jan 25, 2019 +## Bug Fixes +* Android Resolver: Fixed AAR processing sometimes failing on Windows + due to file permissions. + +# Version 1.2.99 - Jan 23, 2019 +## Bug Fixes +* Android Resolver: Improved performance of project property polling. +* Version Handler: Fixed callback of VersionHandler.UpdateCompleteMethods + when the update process is complete. + +# Version 1.2.98 - Jan 9, 2019 +## New Features +* iOS Resolver: Pod declaration properties can now be set via XML pod + references. For example, this can enable pods for a subset of build + configurations. +## Bug Fixes +* iOS Resolver: Fixed incremental builds after local pods support caused + regression in 1.2.96. + +# Version 1.2.97 - Dec 17, 2018 +## Bug Fixes +* Android Resolver: Reduced memory allocation for logic that monitors build + settings when auto-resolution is enabled. If auto-resolution is disabled, + almost all build settings are no longer polled for changes. + +# Version 1.2.96 - Dec 17, 2018 +## Bug Fixes +* Android Resolver: Fixed repacking of AARs to exclude .meta files. +* Android Resolver: Only perform auto-resolution on the first scene while + building. +* Android Resolver: Fixed parsing of version ranges that include whitespace. +* iOS Resolver: Added support for local development pods. +* Version Handler: Fixed Version Handler failing to rename some files. + +# Version 1.2.95 - Oct 23, 2018 +## Bug Fixes: +* Android Resolver: Fixed auto-resolution running in a loop in some scenarios. + +# Version 1.2.94 - Oct 22, 2018 +## Bug Fixes +* iOS Resolver: Added support for PODS_TARGET_SRCROOT in source Cocoapods. + +# Version 1.2.93 - Oct 22, 2018 +## Bug Fixes +* Android Resolver: Fixed removal of Android libraries on auto-resolution when + `*Dependencies.xml` files are deleted. + +# Version 1.2.92 - Oct 2, 2018 +## Bug Fixes +* Android Resolver: Worked around auto-resolution hang on Windows if + resolution starts before compilation is finished. + +# Version 1.2.91 - Sep 27, 2018 +## Bug Fixes +* Android Resolver: Fixed Android Resolution when the selected build target + isn't Android. +* Added C# assembly symbols the plugin to simplify debugging bug reports. + +# Version 1.2.90 - Sep 21, 2018 +## Bug Fixes +* Android Resolver: Fixed transitive dependency selection of version locked + packages. + +# Version 1.2.89 - Aug 31, 2018 +## Bug Fixes +* Fixed FileLoadException in ResolveUnityEditoriOSXcodeExtension an assembly + can't be loaded. + +# Version 1.2.88 - Aug 29, 2018 +## Changed +* Improved reporting of resolution attempts and conflicts found in the Android + Resolver. +## Bug Fixes +* iOS Resolver now correctly handles sample code in CocoaPods. Previously it + would add all sample code to the project when using project level + integration. +* Android Resolver now correctly handles Gradle conflict resolution when the + resolution results in a package that is compatible with all requested + dependencies. + +# Version 1.2.87 - Aug 23, 2018 +## Bug Fixes +* Fixed Android Resolver "Processing AARs" dialog getting stuck in Unity 5.6. + +# Version 1.2.86 - Aug 22, 2018 +## Bug Fixes +* Fixed Android Resolver exception in OnPostProcessScene() when the Android + platform isn't selected. + +# Version 1.2.85 - Aug 17, 2018 +## Changes +* Added support for synchronous resolution in the Android Resolver. + PlayServicesResolver.ResolveSync() now performs resolution synchronously. +* Auto-resolution in the Android Resolver now results in synchronous resolution + of Android dependencies before the Android application build starts via + UnityEditor.Callbacks.PostProcessSceneAttribute. + +# Version 1.2.84 - Aug 16, 2018 +## Bug Fixes +* Fixed Android Resolver crash when the AndroidResolverDependencies.xml + file can't be written. +* Reduced log spam when a conflicting Android library is pinned to a + specific version. + +# Version 1.2.83 - Aug 15, 2018 +## Bug Fixes +* Fixed Android Resolver failures due to an in-accessible AAR / JAR explode + cache file. If the cache can't be read / written the resolver now continues + with reduced performance following recompilation / DLL reloads. +* Fixed incorrect version number in plugin manifest on install. + This was a minor issue since the version handler rewrote the metadata + after installation. + +# Version 1.2.82 - Aug 14, 2018 +## Changed +* Added support for alphanumeric versions in the Android Resolver. + +## Bug Fixes +* Fixed Android Resolver selection of latest duplicated library. +* Fixed Android Resolver conflict resolution when version locked and non-version + locked dependencies are specified. +* Fixed Android Resolver conflict resolution when non-existent artifacts are + referenced. + +# Version 1.2.81 - Aug 9, 2018 +## Bug Fixes +* Fixed editor error that would occur when when + `PlayerSettings.Android.targetArchitectures` was set to + `AndroidArchitecture.All`. + +# Version 1.2.80 - Jul 24, 2018 +## Bug Fixes +* Fixed project level settings incorrectly falling back to system wide settings + when default property values were set. + +# Version 1.2.79 - Jul 23, 2018 +## Bug Fixes +* Fixed AndroidManifest.xml patching on Android Resolver load in Unity 2018.x. + +# Version 1.2.78 - Jul 19, 2018 +## Changed +* Added support for overriding conflicting dependencies. + +# Version 1.2.77 - Jul 19, 2018 +## Changed +* Android Resolver now supports Unity's 2018 ABI filter (i.e arm64-v8a). +* Reduced Android Resolver build option polling frequency. +* Disabled Android Resolver auto-resolution in batch mode. Users now need + to explicitly kick off resolution through the API. +* All Android Resolver and Version Handler dialogs are now disabled in batch + mode. +* Verbose logging for all plugins is now enabled by default in batch mode. +* Version Handler bootstrapper has been improved to no longer call + UpdateComplete multiple times. However, since Unity can still reload the + app domain after plugins have been enabled, users still need to store their + plugin state to persistent storage to handle reloads. + +## Bug Fixes +* Android Resolver no longer incorrectly adds MANIFEST.MF files to AARs. +* Android Resolver auto-resolution jobs are now unscheduled when an explicit + resolve job is started. + +# Version 1.2.76 - Jul 16, 2018 +## Bug Fixes +* Fixed variable replacement in AndroidManifest.xml files in the Android + Resolver. + Version 1.2.75 introduced a regression which caused all variable replacement + to replace the *entire* property value rather than the component of the + property that referenced a variable. For example, + given "applicationId = com.my.app", "${applicationId}.foo" would be + incorrectly expanded as "com.my.app" rather than "com.my.app.foo". This + resulted in numerous issues for Android builds where content provider + initialization would fail and services may not start. + +## Changed +* Gradle prebuild experimental feature has been removed from the Android + Resolver. The feature has been broken for some time and added around 8MB + to the plugin size. +* Added better support for execution of plugin components in batch mode. + In batch mode UnityEditor.update is sometimes never called - like when a + single method is executed - so the new job scheduler will execute all jobs + synchronously from the main thread. + +# Version 1.2.75 - Jun 20, 2018 +## New Features +* Android Resolver now monitors the Android SDK path when + auto-resolution is enabled and triggers resolution when the path is + modified. + +## Changed +* Android auto-resolution is now delayed by 3 seconds when the following build + settings are changed: + - Target ABI. + - Gradle build vs. internal build. + - Project export. +* Added a progress bar display when AARs are being processed during Android + resolution. + +## Bug Fixes +* Fixed incorrect Android package version selection when a mix of + version-locked and non-version-locked packages are specified. +* Fixed non-deterministic Android package version selection to select + the highest version of a specified package rather than the last + package specification passed to the Gradle resolution script. + +# Version 1.2.74 - Jun 19, 2018 +## New Features +* Added workaround for broken AndroidManifest.xml variable replacement in + Unity 2018.x. By default ${applicationId} variables will be replaced by + the bundle ID in the Plugins/Android/AndroidManifest.xml file. The + behavior can be disabled via the Android Resolver settings menu. + +# Version 1.2.73 - May 30, 2018 +## Bug Fixes +* Fixed spurious warning message about missing Android plugins directory on + Windows. + +# Version 1.2.72 - May 23, 2018 +## Bug Fixes +* Fixed spurious warning message about missing Android plugins directory. + +# Version 1.2.71 - May 10, 2018 +## Bug Fixes +* Fixed resolution of Android dependencies when the `Assets/Plugins/Android` + directory is named in a different case e.g `Assets/plugins/Android`. + +# Version 1.2.70 - May 7, 2018 +## Bug Fixes +* Fixed bitcode flag being ignored for iOS pods. + +# Version 1.2.69 - May 7, 2018 +## Bug Fixes +* Fixed escaping of local repository paths in Android Resolver. + +# Version 1.2.68 - May 3, 2018 +## Changes +* Added support for granular builds of Google Play Services. + +# Version 1.2.67 - May 1, 2018 +## Changes +* Improved support for iOS source-only pods in Unity 5.5 and below. + +# Version 1.2.66 - April 27, 2018 +## Bug Fixes +* Fixed Version Handler renaming of Linux libraries with hyphens in filenames. + Previously, libraries named Foo-1.2.3.so were not being renamed to + libFoo-1.2.3.so on Linux which could break native library loading on some + versions of Unity. + +# Version 1.2.65 - April 26, 2018 +## Bug Fixes +* Fix CocoaPods casing in logs and comments. + +# Version 1.2.64 - Mar 16, 2018 +## Bug Fixes +* Fixed bug in download_artifacts.gradle (used by Android Resolver) which + reported a failure if required artifacts already exist. + +# Version 1.2.63 - Mar 15, 2018 +## Bug Fixes +* Fixed iOS Resolver include search paths taking precedence over system headers + when using project level resolution. +* Fixed iOS Resolver includes relative to library root, when using project level + resolution. + +# Version 1.2.62 - Mar 12, 2018 +## Changes +* Improved error reporting when a file can't be moved to trash by the + Version Handler. +## Bug Fixes +* Fixed Android Resolver throwing NullReferenceException when the Android SDK + path isn't set. +* Fixed Version Handler renaming files with underscores if the + "Rename to Canonical Filenames" setting is enabled. + +# Version 1.2.61 - Jan 22, 2018 +## Bug Fixes +* Fixed Android Resolver reporting non-existent conflicting dependencies when + Gradle build system is enabled. + +# Version 1.2.60 - Jan 12, 2018 +## Changes +* Added support for Maven / Ivy version specifications for Android packages. +* Added support for Android SNAPSHOT packages. + +## Bug Fixes +* Fixed Openjdk version check. +* Fixed non-deterministic Android package resolution when two packages contain + an artifact with the same name. + +# Version 1.2.59 - Oct 19, 2017 +## Bug Fixes +* Fixed execution of Android Gradle resolution script when it's located + in a path with whitespace. + +# Version 1.2.58 - Oct 19, 2017 +## Changes +* Removed legacy resolution method from Android Resolver. + It is now only possible to use the Gradle or Gradle prebuild resolution + methods. + +# Version 1.2.57 - Oct 18, 2017 +## Bug Fixes +* Updated Gradle wrapper to 4.2.1 to fix issues using Gradle with the + latest Openjdk. +* Android Gradle resolution now also uses gradle.properties to pass + parameters to Gradle in an attempt to workaround problems with + command line argument parsing on Windows 10. + +# Version 1.2.56 - Oct 12, 2017 +## Bug Fixes +* Fixed Gradle artifact download with non-version locked artifacts. +* Changed iOS resolver to only load dependencies at build time. + +# Version 1.2.55 - Oct 4, 2017 +## Bug Fixes +* Force Android Resolution when the "Install Android Packages" setting changes. + +# Version 1.2.54 - Oct 4, 2017 +## Bug Fixes +* Fixed execution of command line tools on Windows when the path to the tool + contains a single quote (apostrophe). In this case we fallback to executing + the tool via the system shell. + +# Version 1.2.53 - Oct 2, 2017 +## New Features +* Changed Android Resolver "resolution complete" dialog so that it now displays + failures. +* Android Resolver now detects conflicting libraries that it does not manage + warning the user if they're newer than the managed libraries and prompting + the user to clean them up if they're older or at the same version. + +## Bug Fixes +* Improved Android Resolver auto-resolution speed. +* Fixed bug in the Gradle Android Resolver which would result in resolution + succeeding when some dependencies are not found. + +# Version 1.2.52 - Sep 25, 2017 +## New Features +* Changed Android Resolver's Gradle resolution to resolve conflicting + dependencies across Google Play services and Android Support library packages. + +# Version 1.2.51 - Sep 20, 2017 +## Changes +* Changed iOS Resolver to execute the CocoaPods "pod" command via the shell + by default. Some developers customize their shell environment to use + custom ssh certs to access internal git repositories that host pods so + executing "pod" via the shell will work for these scenarios. + The drawback of executing "pod" via the shell could potentially cause + users problems if they break their shell environment. Though users who + customize their shell environments will be able to resolve these issues. + +# Version 1.2.50 - Sep 18, 2017 +## New Features +* Added option to disable the Gradle daemon in the Android Resolver. + This daemon is now disabled by default as some users are getting into a state + where multiple daemon instances are being spawned when changing dependencies + which eventually results in Android resolution failing until all daemon + processes are manually killed. + +## Bug Fixes +* Android resolution is now always executed if the user declines the update + of their Android SDK. This ensure users can continue to use out of date + Android SDK packages if they desire. + +# Version 1.2.49 - Sep 18, 2017 +## Bug Fixes +* Removed modulemap parsing in iOS Resolver. + The framework *.modulemap did not need to be parsed by the iOS Resolver + when injecting Cocoapods into a Xcode project. Simply adding a modular + framework to a Xcode project results in Xcode's Clang parsing the associated + modulemap and injecting any compile and link flags into the build process. + +# Version 1.2.48 - Sep 12, 2017 +## New Features +* Changed settings to be per-project by default. + +## Bug Fixes +* Added Google maven repository to fix GradlePrebuild resolution with Google + components. +* Fixed Android Resolution failure with spaces in paths. + +# Version 1.2.47 - Aug 29, 2017 +## New Features +* Android and iOS dependencies can now be specified using *Dependencies.xml + files. This is now the preferred method for registering dependencies, + we may remove the API for dependency addition in future. +* Added "Reset to Defaults" button to each settings dialog to restore default + settings. +* Android Resolver now validates the configured JDK is new enough to build + recently released Android libraries. +## Bug Fixes +* Fixed a bug that caused dependencies with the "LATEST" version specification + to be ignored when using the Gradle mode of the Android Resolver. +* Fixed a race condition when running Android Resolution. +* Fixed Android Resolver logging if a PlayServicesSupport instance is created + with no logging enabled before the Android Resolver is initialized. +* Fixed iOS resolver dialog in Unity 4. +* Fixed iOS Cocoapod Xcode project integration in Unity 4. + +# Version 1.2.46 - Aug 22, 2017 +## Bug Fixes +* GradlePrebuild Android resolver on Windows now correctly locates dependent + data files. + +# Version 1.2.45 - Aug 22, 2017 +## Bug Fixes +* Improved Android package auto-resolution and fixed clean up of stale + dependencies when using Gradle dependency resolution. + +# Version 1.2.44 - Aug 21, 2017 +## Bug Fixes +* Enabled autoresolution for Gradle Prebuild. +* Made the command line dialog windows have selectable text. +* Fixed incorrect "Android Settings" dialog disabled groups. +* Updated PlayServicesResolver android platform detection to use the package + manager instead of the 'android' tool. +* UnityCompat reflection methods 'GetAndroidPlatform' and + 'GetAndroidBuildToolsVersion' are now Obsolete due to dependence on the + obsolete 'android' build tool. + +# Version 1.2.43 - Aug 18, 2017 +## Bug Fixes +* Fixed Gradle resolution in the Android Resolver when running + PlayServicesResolver.Resolve() in parallel or spawning multiple + resolutions before the previous resolve completed. + +# Version 1.2.42 - Aug 17, 2017 +## Bug Fixes +* Fixed Xcode project level settings not being applied by IOS Resolver when + Xcode project pod integration is enabled. + +# Version 1.2.41 - Aug 15, 2017 +## Bug Fixes +* IOS Resolver's Xcode workspace pod integration is now disabled when Unity + Cloud Build is detected. Unity Cloud Build does not follow the same build + process as the Unity editor and fails to open the generated xcworkspace at + this time. + +# Version 1.2.40 - Aug 15, 2017 +## Bug Fixes +* Moved Android Resolver Gradle Prebuild scripts into Google.JarResolver.dll. + They are now extracted from the DLL when required. +* AARs / JARs are now cleaned up when switching the Android resolution + strategy. + +# Version 1.2.39 - Aug 10, 2017 +## New Features +* Android Resolver now supports resolution with Gradle. This enables support + for non-local artifacts. +## Bug Fixes +* Android Resolver's Gradle Prebuild now uses Android build tools to determine + the Android platform tools version rather than relying upon internal Unity + APIs. +* Android Resolver's Gradle Prebuild now correctly strips binaries that are + not required for the target ABI. + +# Version 1.2.38 - Aug 7, 2017 +## Bug Fixes +* Fixed an issue in VersionHandler where disabled targets are ignored if + the "Any Platform" flag is set on a plugin DLL. + +# Version 1.2.37 - Aug 3, 2017 +## New Features +* Exposed GooglePlayServices.PlayServicesResolver.Resolve() so that it's + possible for a script to be notified when AAR / Jar resolution is complete. + This makes it easier to setup a project to build from the command line. + +# Version 1.2.36 - Aug 3, 2017 +## New Features +* VersionHandler.UpdateCompleteMethods allows a user to provide a list of + methods to be called when VersionHandlerImpl has completed an update. + This makes it easier to import a plugin and wait for VersionHandler to + execute prior executing a build. + +# Version 1.2.35 - Jul 28, 2017 +## New Features +* VersionHandler will now rename Linux libraries so they can target Unity + versions that require different file naming. Libraries need to be labelled + gvh_linuxlibname-${basename} in order to be considered for renaming. + e.g gvh\_linuxlibname-MyLib will be named MyLib.so in Unity 5.5 and below and + libMyLib.so in Unity 5.6 and above. + +# Version 1.2.34 - Jul 28, 2017 +## Bug Fixes +* Made VersionHandler bootstrap module more robust when calling static + methods before the implementation DLL is loaded. + +# Version 1.2.33 - Jul 27, 2017 +## New Features +* Added a bootstrap module for VersionHandler so the implementation + of the VersionHandler module can be versioned without resulting in + a compile error when imported at different versions across multiple + plugins. + +# Version 1.2.32 - Jul 20, 2017 +## New Features +* Added support for build target selection based upon .NET framework + version in the VersionHandler. + When applying either gvh\_dotnet-3.5 or gvh\_dotnet-4.5 labels to + assets, the VersionHandler will only enable the asset for the + specified set of build targets when the matching .NET framework version + is selected in Unity 2017's project settings. This allows assets + to be provided in a plugin that need to differ based upon .NET version. + +# Version 1.2.31 - Jul 5, 2017 +## Bug Fixes +* Force expansion of AARs with native components when using Unity 2017 + with the internal build system. In contrast to Unity 5.x, Unity 2017's + internal build system does not include native libraries included in AARs. + Forcing expansion of AARs with native components generates an + Ant / Eclipse project for each AAR which is correctly included by Unity + 2017's internal build system. + +# Version 1.2.30 - Jul 5, 2017 +## Bug Fixes +* Fixed Cocoapods being installed when the build target isn't iOS. +* Added support for malformed AARs with missing classes.jar. + +# Version 1.2.29 - Jun 16, 2017 +## New Features +* Added support for the Android sdkmanager tool. + +# Version 1.2.28 - Jun 8, 2017 +## Bug Fixes +* Fixed non-shell command line execution (regression from + Cocoapod installation patch). + +# Version 1.2.27 - Jun 7, 2017 +## Bug Fixes +* Added support for stdout / stderr redirection when executing + commands in shell mode. + This fixes CocoaPod tool installation when shell mode is + enabled. +* Fixed incremental builds when additional sources are specified + in the Podfile. + +# Version 1.2.26 - Jun 7, 2017 +## Bug Fixes +* Fixed a crash when importing Version Handler into Unity 4.7.x. + +# Version 1.2.25 - Jun 7, 2017 +## Bug Fixes +* Fixed an issue in the Jar Resolver which incorrectly notified + event handlers of bundle ID changes when the currently selected + (not active) build target changed in Unity 5.6 and above. + +# Version 1.2.24 - Jun 6, 2017 +## New Features +* Added option to control file renaming in Version Handler settings. + Disabling file renaming (default option) significantly increases + the speed of file version management operations with the downside + that any files that are referenced directly by canonical filename + rather than asset ID will no longer be valid. +* Improved logging in the Version Handler. +## Bug Fixes +* Fixed an issue in the Version Handler which caused it to not + re-enable plugins when re-importing a custom package with disabled + version managed files. + +# Version 1.2.23 - May 26, 2017 +## Bug Fixes +* Fixed a bug with gradle prebuild resolver on windows. + +# Version 1.2.22 - May 19, 2017 +## Bug Fixes +* Fixed a bug in the iOS resolver with incremental builds. +* Fixed misdetection of Cocoapods support with Unity beta 5.6. + +# Version 1.2.21 - May 8, 2017 +## Bug Fixes +* Fix for https://github.com/googlesamples/unity-jar-resolver/issues/48 + Android dependency version number parsing when "-alpha" (etc.) are + included in dependency (AAR / JAR) versions. + +# Version 1.2.20 - May 8, 2017 +## Bug Fixes +* Attempted to fix + https://github.com/googlesamples/unity-jar-resolver/issues/48 + where a NullReferenceException could occur if a target file does not + have a valid version string. + +# Version 1.2.19 - May 4, 2017 +## Bug Fixes +* Fixed Jar Resolver exploding and deleting AAR files it isn't managing. + +# Version 1.2.18 - May 4, 2017 +## New Features +* Added support for preserving Unity pods such as when GVR is enabled. + +# Version 1.2.17 - Apr 20, 2017 +## Bug Fixes +* Fixed auto-resolution when an Android application ID is modified. + +# Version 1.2.16 - Apr 17, 2017 +## Bug Fixes +* Fixed Unity version number parsing on machines with a locale that uses + "," for decimal points. +* Fixed null reference exception if JDK path isn't set. + +# Version 1.2.15 - Mar 17, 2017 +## New Features +* Added warning when the Jar Resolver's background resolution is disabled. +## Bug Fixes +* Fixed support of AARs with native libraries when using Gradle. +* Fixed extra repository paths when resolving dependencies. + +# Version 1.2.14 - Mar 7, 2017 +## New Features +* Added experimental Android resolution using Gradle. + This alternative resolver supports proguard stripping with Unity's + internal build system. +* Added Android support for single ABI builds when using AARs include + native libraries. +* Disabled Android resolution on changes to all .cs and .js files. + File patterns that are monitored for auto-resolution can be added + using PlayServicesResolver.AddAutoResolutionFilePatterns(). +* Added tracking of resolved AARs and JARs so they can be cleaned up + if they're no longer referenced by a project. +* Added persistence of AAR / JAR version replacement for each Unity + session. +* Added settings dialog to the iOS resolver. +* Integrated Cocoapod tool installation in the iOS resolver. +* Added option to run pod tool via the shell. +## Bug Fixes +* Fixed build of some source Cocoapods (e.g Protobuf). +* VersionHandler no longer prompts to delete obsolete manifests. +* iOS resolver handles Cocoapod installation when using Ruby < 2.2.2. +* Added workaround for package version selection when including + Google Play Services on Android. +* Fixed support for pods that reference static libraries. +* Fixed support for resource-only pods. + +# Version 1.2.12 - Feb 14, 2017 +## Bug Fixes +* Fixed re-explosion of AARs when the bundle ID is modified. + +# Version 1.2.11 - Jan 30, 2017 +## New Features +* Added support for Android Studio builds. +* Added support for native (C/C++) shared libraries in AARs. + +# Version 1.2.10 - Jan 11, 2017 +## Bug Fixes +* Fixed SDK manager path retrieval. +* Also, report stderr when it's not possible to run the "pod" tool. +* Handle exceptions thrown by Unity.Cecil on asset rename +* Fixed IOSResolver to handle PlayerSettings.iOS.targetOSVersionString + +# Version 1.2.9 - Dec 7, 2016 +## Bug Fixes +* Improved error reporting when "pod repo update" fails. +* Added detection of xml format xcode projects generated by old Cocoapods + installations. + +# Version 1.2.8 - Dec 6, 2016 +## Bug Fixes +* Increased speed of JarResolver resolution. +* Fixed JarResolver caches getting out of sync with requested dependencies + by removing the caches. +* Fixed JarResolver explode cache always being rewritten even when no + dependencies change. + +# Version 1.2.7 - Dec 2, 2016 +## Bug Fixes +* Fixed VersionHandler build errors with Unity 5.5, due to the constantly + changing BuildTarget enum. +* Added support for Unity configured JDK Path rather than requiring + JAVA_HOME to be set in the Jar Resolver. + +# Version 1.2.6 - Nov 15, 2016 +## Bug Fixes +* Fixed IOSResolver errors when iOS support is not installed. +* Added fallback to "pod" executable search which queries the Ruby Gems + package manager for the binary install location. + +# Version 1.2.5 - Nov 3, 2016 +## Bug Fixes +* Added crude support for source only Cocoapods to the IOSResolver. + +# Version 1.2.4 - Oct 27, 2016 +## Bug Fixes +* Automated resolution of out of date pod repositories. + +# Version 1.2.3 - Oct 25, 2016 +## Bug Fixes +* Fixed exception when reporting conflicting dependencies. + +# Version 1.2.2 - Oct 17, 2016 +## Bug Fixes +* Fixed issue working with Unity 5.5 +* Fixed issue with PlayServicesResolver corrupting other iOS dependencies. +* Updated build script to use Unity distributed tools for building. + +# Version 1.2.1 - Jul 25, 2016 +## Bug Fixes +* Removed 1.2 Resolver and hardcoded whitelist of AARs to expand. +* Improved error reporting when the "jar" executable can't be found. +* Removed the need to set JAVA_HOME if "jar" is in the user's path. +* Fixed spurious copying of partially matching AARs. +* Changed resolver to only copy / expand when source AARs change. +* Auto-resolution of dependencies is now performed when the Android + build target is selected. + +## New Features +* Expand AARs that contain manifests with variable expansion like + ${applicationId}. +* Added optional logging in the JarResolverLib module. +* Integration with the Android SDK manager for dependencies that + declare required Android SDK packages. + +# Version 1.2.0 - May 11 2016 +## Bug Fixes +* Handles resolving dependencies when the artifacts are split across 2 repos. +* #4 Misdetecting version for versions like 1.2-alpha. These are now string + compared if alphanumeric +* Removed resolver creation via reflection since it did not work all the time. + Now a resolver needs to be loaded externally (which is existing behavior). + +## New Features +* Expose PlayServicesResolver properties to allow for script access. +* Explodes firebase-common and firebase-measurement aar files to support + ${applicationId} substitution. + +# Version 1.1.1 - 25 Feb 2016 +## Bug Fixes +* #1 Spaces in project path not handled when exploding Aar file. +* #2 Script compilation error: TypeLoadException. + +# Version 1.1.0 - 5 Feb 2016 +## New Features +* Adds friendly alert when JAVA_HOME is not set on Windows platforms. +* Adds flag for disabling background resolution. +* Expands play-services-measurement and replaces ${applicationId} with the + bundle Id. + + ## Bug Fixes +* Fixes infinite loop of resolution triggered by resolution. diff --git a/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta b/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta new file mode 100644 index 0000000..a21230d --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 54156dbf561a48eea988cc27fcae3f90 +labels: +- gvh +- gvh_version-1.2.171 +- gvhp_exportpath-ExternalDependencyManager/Editor/CHANGELOG.md +timeCreated: 1584567712 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll b/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll new file mode 100644 index 0000000..be7c1b4 Binary files /dev/null and b/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll differ diff --git a/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta b/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta new file mode 100644 index 0000000..972f8e4 --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta @@ -0,0 +1,36 @@ +fileFormatVersion: 2 +guid: 8c409ab99e4f4317b2bec2f54be2a2fc +labels: +- gvh +- gvh_version-1.2.171 +- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll +- gvhp_targets-editor +timeCreated: 1480838400 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/LICENSE b/Assets/ExternalDependencyManager/Editor/LICENSE new file mode 100644 index 0000000..6258cc4 --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/LICENSE @@ -0,0 +1,245 @@ +Copyright (C) 2014 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +==================================================================================================== +This package uses MiniJSON + +Copyright (c) 2013 Calvin Rien + +Based on the JSON parser by Patrick van Bergen +http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html + +Simplified it so that it doesn't throw exceptions +and can be used in Unity iPhone with maximum code stripping. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Assets/ExternalDependencyManager/Editor/LICENSE.meta b/Assets/ExternalDependencyManager/Editor/LICENSE.meta new file mode 100644 index 0000000..aa4b40b --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/LICENSE.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: be6c1c4d98f8402ba4815e95e4b85883 +labels: +- gvh +- gvh_version-1.2.171 +- gvhp_exportpath-ExternalDependencyManager/Editor/LICENSE +timeCreated: 1584567712 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/README.md b/Assets/ExternalDependencyManager/Editor/README.md new file mode 100644 index 0000000..b49cf1e --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/README.md @@ -0,0 +1,768 @@ +External Dependency Manager for Unity +======== + +# Overview + +The External Dependency Manager for Unity (EDM4U) +(formerly Play Services Resolver / Jar Resolver) is intended to be used by any +Unity plugin that requires: + + * Android specific libraries (e.g + [AARs](https://developer.android.com/studio/projects/android-library.html)). + * iOS [CocoaPods](https://cocoapods.org/). + * Version management of transitive dependencies. + * Management of Package Manager (PM) Registries. + +Updated releases are available on +[GitHub](https://github.com/googlesamples/unity-jar-resolver) + +# Background + +Many Unity plugins have dependencies upon Android specific libraries, iOS +CocoaPods, and sometimes have transitive dependencies upon other Unity plugins. +This causes the following problems: + + * Integrating platform specific (e.g Android and iOS) libraries within a + Unity project can be complex and a burden on a Unity plugin maintainer. + * The process of resolving conflicting dependencies on platform specific + libraries is pushed to the developer attempting to use a Unity plugin. + The developer trying to use your plugin is very likely to give up when + faced with Android or iOS specific build errors. + * The process of resolving conflicting Unity plugins (due to shared Unity + plugin components) is pushed to the developer attempting to use your Unity + plugin. In an effort to resolve conflicts, the developer will very likely + attempt to resolve problems by deleting random files in your plugin, + report bugs when that doesn't work and finally give up. + +EDM provides solutions for each of these problems. + +## Android Dependency Management + +The *Android Resolver* component of this plugin will download and integrate +Android library dependencies and handle any conflicts between plugins that share +the same dependencies. + +Without the Android Resolver, typically Unity plugins bundle their AAR and +JAR dependencies, e.g. a Unity plugin `SomePlugin` that requires the Google +Play Games Android library would redistribute the library and its transitive +dependencies in the folder `SomePlugin/Android/`. When a user imports +`SomeOtherPlugin` that includes the same libraries (potentially at different +versions) in `SomeOtherPlugin/Android/`, the developer using `SomePlugin` and +`SomeOtherPlugin` will see an error when building for Android that can be hard +to interpret. + +Using the Android Resolver to manage Android library dependencies: + + * Solves Android library conflicts between plugins. + * Handles all of the various processing steps required to use Android + libraries (AARs, JARs) in Unity 4.x and above projects. Almost all + versions of Unity have - at best - partial support for AARs. + * (Experimental) Supports minification of included Java components without + exporting a project. + +## iOS Dependency Management + +The *iOS Resolver* component of this plugin integrates with +[CocoaPods](https://cocoapods.org/) to download and integrate iOS libraries +and frameworks into the Xcode project Unity generates when building for iOS. +Using CocoaPods allows multiple plugins to utilize shared components without +forcing developers to fix either duplicate or incompatible versions of +libraries included through multiple Unity plugins in their project. + +## Package Manager Registry Setup + +The [Package Manager](https://docs.unity3d.com/Manual/Packages.html) +(PM) makes use of [NPM](https://www.npmjs.com/) registry servers for package +hosting and provides ways to discover, install, upgrade and uninstall packages. +This makes it easier for developers to manage plugins within their projects. + +However, installing additional package registries requires a few manual steps +that can potentially be error prone. The *Package Manager Resolver* +component of this plugin integrates with +[PM](https://docs.unity3d.com/Manual/Packages.html) to provide a way to +auto-install PM package registries when a `.unitypackage` is installed which +allows plugin maintainers to ship a `.unitypackage` that can provide access +to their own PM registry server to make it easier for developers to +manage their plugins. + +## Unity Plugin Version Management + +Finally, the *Version Handler* component of this plugin simplifies the process +of managing transitive dependencies of Unity plugins and each plugin's upgrade +process. + +For example, without the Version Handler plugin, if: + + * Unity plugin `SomePlugin` includes `EDM4U` plugin at + version 1.1. + * Unity plugin `SomeOtherPlugin` includes `EDM4U` + plugin at version 1.2. + +The version of `EDM4U` included in the developer's project depends upon the +order the developer imports `SomePlugin` or `SomeOtherPlugin`. + +This results in: + + * `EDM4U` at version 1.2, if `SomePlugin` is imported then `SomeOtherPlugin` + is imported. + * `EDM4U` at version 1.1, if `SomeOtherPlugin` is imported then + `SomePlugin` is imported. + +The Version Handler solves the problem of managing transitive dependencies by: + + * Specifying a set of packaging requirements that enable a plugin at + different versions to be imported into a Unity project. + * Providing activation logic that selects the latest version of a plugin + within a project. + +When using the Version Handler to manage `EDM4U` included in `SomePlugin` and +`SomeOtherPlugin`, from the prior example, version 1.2 will always be the +version activated in a developer's Unity project. + +Plugin creators are encouraged to adopt this library to ease integration for +their customers. For more information about integrating EDM4U +into your own plugin, see the [Plugin Redistribution](#plugin-redistribution) +section of this document. + +# Analytics + +The External Dependency Manager for Unity plugin by default logs usage to Google +Analytics. The purpose of the logging is to quantitatively measure the usage of +functionality, to gather reports on integration failures and to inform future +improvements to the developer experience of the External Dependency Manager +plugin. Note that the analytics collected are limited to the scope of the EDM4U +plugin’s usage. + +For details of what is logged, please refer to the usage of +`EditorMeasurement.Report()` in the source code. + +# Requirements + +The *Android Resolver* and *iOS Resolver* components of the plugin only work +with Unity version 4.6.8 or higher. + +The *Version Handler* component only works with Unity 5.x or higher as it +depends upon the `PluginImporter` UnityEditor API. + +The *Package Manager Resolver* component only works with +Unity 2018.4 or above, when +[scoped registry](https://docs.unity3d.com/Manual/upm-scoped.html) +support was added to the Package Manager. + +# Getting Started + +Before you import EDM4U into your plugin project, you first +need to consider whether you intend to *redistribute* `EDM4U` +along with your own plugin. + +## Plugin Redistribution + +If you're a plugin maintainer, redistributing `EDM4U` inside your own plugin +will ease the integration process for your users, by resolving dependency +conflicts between your plugin and other plugins in a user's project. + +If you wish to redistribute `EDM4U` inside your plugin, +you **must** follow these steps when importing the +`external-dependency-manager-*.unitypackage`, and when exporting your own plugin +package: + + 1. Import the `external-dependency-manager-*.unitypackage` into your plugin + project by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), ensuring that + you add the `-gvh_disable` option. + 1. Export your plugin by [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), ensuring that + you: + - Include the contents of the `Assets/PlayServicesResolver` and + `Assets/ExternalDependencyManager` directory. + - Add the `-gvh_disable` option. + +You **must** specify the `-gvh_disable` option in order for the Version +Handler to work correctly! + +For example, the following command will import the +`external-dependency-manager-1.2.46.0.unitypackage` into the project +`MyPluginProject` and export the entire Assets folder to +`MyPlugin.unitypackage`: + +``` +Unity -gvh_disable \ + -batchmode \ + -importPackage external-dependency-manager-1.2.46.0.unitypackage \ + -projectPath MyPluginProject \ + -exportPackage Assets MyPlugin.unitypackage \ + -quit +``` + +### Background + +The *Version Handler* component relies upon deferring the load of editor DLLs +so that it can run first and determine the latest version of a plugin component +to activate. The build of `EDM4U` plugin has Unity asset metadata that is +configured so that the editor components are not initially enabled when it's +imported into a Unity project. To maintain this configuration when importing +the `external-dependency-manager.unitypackage` into a Unity plugin project, you +*must* specify the command line option `-gvh_disable` which will prevent the +Version Handler component from running and changing the Unity asset metadata. + +# Android Resolver Usage + +The Android Resolver copies specified dependencies from local or remote Maven +repositories into the Unity project when a user selects Android as the build +target in the Unity editor. + + 1. Add the `external-dependency-manager-*.unitypackage` to your plugin + project (assuming you are developing a plugin). If you are redistributing + EDM4U with your plugin, you **must** follow the + import steps in the [Getting Started](#getting-started) section! + + 2. Copy and rename the + [SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) + file into your plugin and add the dependencies your plugin requires. + + The XML file just needs to be under an `Editor` directory and match the + name `*Dependencies.xml`. For example, + `MyPlugin/Editor/MyPluginDependencies.xml`. + + 3. Follow the steps in the [Getting Started](#getting-started) + section when you are exporting your plugin package. + +For example, to add the Google Play Games library +(`com.google.android.gms:play-services-games` package) at version `9.8.0` to +the set of a plugin's Android dependencies: + +``` + + + + + extra-google-m2repository + + + + +``` + +The version specification (last component) supports: + + * Specific versions e.g `9.8.0` + * Partial matches e.g `9.8.+` would match 9.8.0, 9.8.1 etc. choosing the most + recent version. + * Latest version using `LATEST` or `+`. We do *not* recommend using this + unless you're 100% sure the library you depend upon will not break your + Unity plugin in future. + +The above example specifies the dependency as a component of the Android SDK +manager such that the Android SDK manager will be executed to install the +package if it's not found. If your Android dependency is located on Maven +central it's possible to specify the package simply using the `androidPackage` +element: + +``` + + + + + +``` + +## Auto-resolution + +By default the Android Resolver automatically monitors the dependencies you have +specified and the `Plugins/Android` folder of your Unity project. The +resolution process runs when the specified dependencies are not present in your +project. + +The *auto-resolution* process can be disabled via the +`Assets > External Dependency Manager > Android Resolver > Settings` menu. + +Manual resolution can be performed using the following menu options: + + * `Assets > External Dependency Manager > Android Resolver > Resolve` + * `Assets > External Dependency Manager > Android Resolver > Force Resolve` + +## Deleting libraries + +Resolved packages are tracked via asset labels by the Android Resolver. +They can easily be deleted using the +`Assets > External Dependency Manager > Android Resolver > Delete Resolved Libraries` +menu item. + +## Android Manifest Variable Processing + +Some AAR files (for example play-services-measurement) contain variables that +are processed by the Android Gradle plugin. Unfortunately, Unity does not +perform the same processing when using Unity's Internal Build System, so the +Android Resolver plugin handles known cases of this variable substitution +by exploding the AAR into a folder and replacing `${applicationId}` with the +`bundleID`. + +Disabling AAR explosion and therefore Android manifest processing can be done +via the `Assets > External Dependency Manager > Android Resolver > Settings` +menu. You may want to disable explosion of AARs if you're exporting a project +to be built with Gradle / Android Studio. + +## ABI Stripping + +Some AAR files contain native libraries (.so files) for each ABI supported +by Android. Unfortunately, when targeting a single ABI (e.g x86), Unity does +not strip native libraries for unused ABIs. To strip unused ABIs, the Android +Resolver plugin explodes an AAR into a folder and removes unused ABIs to +reduce the built APK size. Furthermore, if native libraries are not stripped +from an APK (e.g you have a mix of Unity's x86 library and some armeabi-v7a +libraries) Android may attempt to load the wrong library for the current +runtime ABI completely breaking your plugin when targeting some architectures. + +AAR explosion and therefore ABI stripping can be disabled via the +`Assets > External Dependency Manager > Android Resolver > Settings` menu. +You may want to disable explosion of AARs if you're exporting a project to be +built with Gradle / Android Studio. + +## Resolution Strategies + +By default the Android Resolver will use Gradle to download dependencies prior +to integrating them into a Unity project. This works with Unity's internal +build system and Gradle / Android Studio project export. + +It's possible to change the resolution strategy via the +`Assets > External Dependency Manager > Android Resolver > Settings` menu. + +### Download Artifacts with Gradle + +Using the default resolution strategy, the Android resolver executes the +following operations: + + - Remove the result of previous Android resolutions. + e.g Delete all files and directories labeled with "gpsr" under + `Plugins/Android` from the project. + - Collect the set of Android dependencies (libraries) specified by a + project's `*Dependencies.xml` files. + - Run `download_artifacts.gradle` with Gradle to resolve conflicts and, + if successful, download the set of resolved Android libraries (AARs, JARs). + - Process each AAR / JAR so that it can be used with the currently selected + Unity build system (e.g Internal vs. Gradle, Export vs. No Export). + This involves patching each reference to `applicationId` in the + AndroidManifest.xml with the project's bundle ID. This means resolution + must be run if the bundle ID is changed again. + - Move the processed AARs to `Plugins/Android` so they will be included when + Unity invokes the Android build. + +### Integrate into mainTemplate.gradle + +Unity 5.6 introduced support for customizing the `build.gradle` used to build +Unity projects with Gradle. When the *Patch mainTemplate.gradle* setting is +enabled, rather than downloading artifacts before the build, Android resolution +results in the execution of the following operations: + + - Remove the result of previous Android resolutions. + e.g Delete all files and directories labeled with "gpsr" under + `Plugins/Android` from the project and remove sections delimited with + `// Android Resolver * Start` and `// Android Resolver * End` lines. + - Collect the set of Android dependencies (libraries) specified by a + project's `*Dependencies.xml` files. + - Rename any `.srcaar` files in the build to `.aar` and exclude them from + being included directly by Unity in the Android build as + `mainTemplate.gradle` will be patched to include them instead from their + local maven repositories. + - Inject the required Gradle repositories into `mainTemplate.gradle` at the + line matching the pattern + `.*apply plugin: 'com\.android\.(application|library)'.*` or the section + starting at the line `// Android Resolver Repos Start`. + If you want to control the injection point in the file, the section + delimited by the lines `// Android Resolver Repos Start` and + `// Android Resolver Repos End` should be placed in the global scope + before the `dependencies` section. + - Inject the required Android dependencies (libraries) into + `mainTemplate.gradle` at the line matching the pattern `***DEPS***` or + the section starting at the line `// Android Resolver Dependencies Start`. + If you want to control the injection point in the file, the section + delimited by the lines `// Android Resolver Dependencies Start` and + `// Android Resolver Dependencies End` should be placed in the + `dependencies` section. + - Inject the packaging options logic, which excludes architecture specific + libraries based upon the selected build target, into `mainTemplate.gradle` + at the line matching the pattern `android +{` or the section starting at + the line `// Android Resolver Exclusions Start`. + If you want to control the injection point in the file, the section + delimited by the lines `// Android Resolver Exclusions Start` and + `// Android Resolver Exclusions End` should be placed in the global + scope before the `android` section. + +## Dependency Tracking + +The Android Resolver creates the +`ProjectSettings/AndroidResolverDependencies.xml` to quickly determine the set +of resolved dependencies in a project. This is used by the auto-resolution +process to only run the expensive resolution process when necessary. + +## Displaying Dependencies + +It's possible to display the set of dependencies the Android Resolver +would download and process in your project via the +`Assets > External Dependency Manager > Android Resolver > Display Libraries` +menu item. + +# iOS Resolver Usage + +The iOS resolver component of this plugin manages +[CocoaPods](https://cocoapods.org/). A CocoaPods `Podfile` is generated and +the `pod` tool is executed as a post build process step to add dependencies +to the Xcode project exported by Unity. + +Dependencies for iOS are added by referring to CocoaPods. + + 1. Add the `external-dependency-manager-*.unitypackage` to your plugin + project (assuming you are developing a plugin). If you are redistributing + EDM4U with your plugin, you **must** follow the + import steps in the [Getting Started](#getting-started) section! + + 2. Copy and rename the + [SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) + file into your plugin and add the dependencies your plugin requires. + + The XML file just needs to be under an `Editor` directory and match the + name `*Dependencies.xml`. For example, + `MyPlugin/Editor/MyPluginDependencies.xml`. + + 3. Follow the steps in the [Getting Started](#getting-started) + section when you are exporting your plugin package. + +For example, to add the AdMob pod, version 7.0 or greater with bitcode enabled: + +``` + + + + + +``` + +## Integration Strategies + +The `CocoaPods` are either: + * Downloaded and injected into the Xcode project file directly, rather than + creating a separate xcworkspace. We call this `Xcode project` integration. + * If the Unity version supports opening a xcworkspace file, the `pod` tool + is used as intended to generate a xcworkspace which references the + CocoaPods. We call this `Xcode workspace` integration. + +The resolution strategy can be changed via the +`Assets > External Dependency Manager > iOS Resolver > Settings` menu. + +### Appending text to generated Podfile +In order to modify the generated Podfile you can create a script like this: +``` +using System.IO; +public class PostProcessIOS : MonoBehaviour { +[PostProcessBuildAttribute(45)]//must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's added before "pod install" (50) +private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) +{ + if (target == BuildTarget.iOS) + { + + using (StreamWriter sw = File.AppendText(buildPath + "/Podfile")) + { + //in this example I'm adding an app extension + sw.WriteLine("\ntarget 'NSExtension' do\n pod 'Firebase/Messaging', '6.6.0'\nend"); + } + } +} +``` + +# Package Manager Resolver Usage + +Adding registries to the +[Package Manager](https://docs.unity3d.com/Manual/Packages.html) +(PM) is a manual process. The Package Manager Resolver (PMR) component +of this plugin makes it easy for plugin maintainers to distribute new PM +registry servers and easy for plugin users to manage PM registry servers. + +## Adding Registries + + 1. Add the `external-dependency-manager-*.unitypackage` to your plugin + project (assuming you are developing a plugin). If you are redistributing + EDM4U with your plugin, you **must** follow the + import steps in the [Getting Started](#getting-started) section! + + 2. Copy and rename the + [SampleRegistries.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/sample/Assets/ExternalDependencyManager/Editor/SampleRegistries.xml) + file into your plugin and add the registries your plugin requires. + + The XML file just needs to be under an `Editor` directory and match the + name `*Registries.xml` or labeled with `gumpr_registries`. For example, + `MyPlugin/Editor/MyPluginRegistries.xml`. + + 3. Follow the steps in the [Getting Started](#getting-started) + section when you are exporting your plugin package. + +For example, to add a registry for plugins in the scope `com.coolstuff`: + +``` + + + + com.coolstuff + + + +``` + +When PMR is loaded it will prompt the developer to add the registry to their +project if it isn't already present in the `Packages/manifest.json` file. + +For more information, see Unity's documentation on +[scoped package registries](https://docs.unity3d.com/Manual/upm-scoped.html). + +## Managing Registries + +It's possible to add and remove registries that are specified via PMR +XML configuration files via the following menu options: + +* `Assets > External Dependency Manager > Package Manager Resolver > + Add Registries` will prompt the user with a window which allows them to + add registries discovered in the project to the Package Manager. +* `Assets > External Dependency Manager > Package Manager Resolver > + Remove Registries` will prompt the user with a window which allows them to + remove registries discovered in the project from the Package Manager. +* `Assets > External Dependency Manager > Package Manager Resolver > + Modify Registries` will prompt the user with a window which allows them to + add or remove registries discovered in the project. + +## Migration + +PMR can migrate Version Handler packages installed in the `Assets` folder +to PM packages. This requires the plugins to implement the following: + +* `.unitypackage` must include a Version Handler manifests that describes + the components of the plugin. If the plugin has no dependencies + the manifest would just include the files in the plugin. +* The PM package JSON provided by the registry must include a keyword + (in the `versions.VERSION.keyword` list) that maps the PM package + to a Version Handler package using the format + `vh-name:VERSION_HANDLER_MANIFEST_NAME` where `VERSION_HANDLER_MANIFEST_NAME` + is the name of the manifest defined in the `.unitypackage`. For + more information see the description of the `gvhp_manifestname` asset label + in the *Version Handler Usage* section. + +When using the `Assets > External Dependency Manager > +Package Manager Resolver > Migrate Packages` menu option, PMR then +will: + +* List all Version Handler manager packages in the project. +* Search all available packages in the PM registries and fetch keywords + associated with each package parsing the Version Handler manifest names + for each package. +* Map each installed Version Handler package to a PM package. +* Prompt the user to migrate the discovered packages. +* Perform package migration for all selected packages if the user clicks + the `Apply` button. + +## Configuration + +PMR can be configured via the `Assets > External Dependency Manager > +Package Manager Resolver > Settings` menu option: + +* `Add package registries` when enabled, when the plugin loads or registry + configuration files change, this will prompt the user to add registries + that are not present in the Package Manager. +* `Prompt to add package registries` will cause a developer to be prompted + with a window that will ask for confirmation before adding registries. + When this is disabled registries are added silently to the project. +* `Prompt to migrate packages` will cause a developer to be prompted + with a window that will ask for confirmation before migrating packages + installed in the `Assets` directory to PM packages. +* `Enable Analytics Reporting` when enabled, reports the use of the plugin + to the developers so they can make imrpovements. +* `Verbose logging` when enabled prints debug information to the console + which can be useful when filing bug reports. + +# Version Handler Usage + +The Version Handler component of this plugin manages: + +* Shared Unity plugin dependencies. +* Upgrading Unity plugins by cleaning up old files from previous versions. +* Uninstallation of plugins that are distributed with manifest files. +* Restoration of plugin assets to their original install locations if assets + are tagged with the `exportpath` label. + +Since the Version Handler needs to modify Unity asset metadata (`.meta` files), +to enable / disable components, rename and delete asset files it does not +work with Package Manager installed packages. It's still possible to +include EDM4U in Package Manager packages, the Version Handler component +simply won't do anything to PM plugins in this case. + +## Using Version Handler Managed Plugins + +If a plugin is imported at multiple different versions into a project, if +the Version Handler is enabled, it will automatically check all managed +assets to determine the set of assets that are out of date and assets that +should be removed. To disable automatic checking managed assets disable +the `Enable version management` option in the +`Assets > External Dependency Manager > Version Handler > Settings` menu. + +If version management is disabled, it's possible to check managed assets +manually using the +`Assets > External Dependency Manager > Version Handler > Update` menu option. + +### Listing Managed Plugins + +Plugins managed by the Version Handler, those that ship with manifest files, +can displayed using the `Assets > External Dependency Manager > +Version Handler > Display Managed Packages` menu option. The list of plugins +are written to the console window along with the set of files used by each +plugin. + +### Uninstalling Managed Plugins + +Plugins managed by the Version Handler, those that ship with manifest files, +can be removed using the `Assets > External Dependency Manager > +Version Handler > Uninstall Managed Packages` menu option. This operation +will display a window that allows a developer to select a set of plugins to +remove which will remove all files owned by each plugin excluding those that +are in use by other installed plugins. + +Files managed by the Version Handler, those labeled with the `gvh` asset label, +can be checked to see whether anything needs to be upgraded, disabled or +removed using the `Assets > External Dependency Manager > +Version Handler > Update` menu option. + +### Restore Install Paths + +Some developers move assets around in their project which can make it +harder for plugin maintainers to debug issues if this breaks Unity's +[special folders](https://docs.unity3d.com/Manual/SpecialFolders.html) rules. +If assets are labeled with their original install / export path +(see `gvhp_exportpath` below), Version Handler can restore assets to their +original locations when using the `Assets > External Dependency Manager > +Version Handler > Move Files To Install Locations` menu option. + +### Settings + +Some behavior of the Version Handler can be configured via the +`Assets > External Dependency Manager > Version Handler > Settings` menu +option. + +* `Enable version management` controls whether the plugin should automatically + check asset versions and apply changes. If this is disabled the process + should be run manually when installing or upgrading managed plugins using + `Assets > External Dependency Manager > Version Handler > Update`. +* `Rename to canonical filenames` is a legacy option that will rename files to + remove version numbers and other labels from filenames. +* `Prompt for obsolete file deletion` enables the display of a window when + obsolete files are deleted allowing the developer to select which files to + delete and those to keep. +* `Allow disabling files via renaming` controls whether obsolete or disabled + files should be disabled by renaming them to `myfilename_DISABLED`. + Renaming to disable files is required in some scenarios where Unity doesn't + support removing files from the build via the PluginImporter. +* `Enable Analytics Reporting` enables / disables usage reporting to plugin + developers to improve the product. +* `Verbose logging` enables _very_ noisy log output that is useful for + debugging while filing a bug report or building a new managed plugin. +* `Use project settings` saves settings for the plugin in the project rather + than system-wide. + +## Redistributing a Managed Plugin + +The Version Handler employs a couple of methods for managing version +selection, upgrade and removal of plugins. + +* Each plugin can ship with a manifest file that lists the files it includes. + This makes it possible for Version Handler to calculate the difference + in assets between the most recent release of a plugin and the previous + release installed in a project. If a files are removed the Version Handler + will prompt the user to clean up obsolete files. +* Plugins can ship using assets with unique names, unique GUIDs and version + number labels. Version numbers can be attached to assets using labels or + added to the filename (e.g `myfile.txt` would be `myfile_version-x.y.z.txt). + This allows the Version Handler to determine which set of files are the + same file at different versions, select the most recent version and prompt + the developer to clean up old versions. + +Unity plugins can be managed by the Version Handler using the following steps: + + 1. Add the `gvh` asset label to each asset (file) you want Version Handler + to manage. + 1. Add the `gvh_version-VERSION` label to each asset where `VERSION` is the + version of the plugin you're releasing (e.g 1.2.3). + 1. Add the `gvhp_exportpath-PATH` label to each asset where `PATH` is the + export path of the file when the `.unitypackage` is created. This is + used to track files if they're moved around in a project by developers. + 1. Optional: Add `gvh_targets-editor` label to each editor DLL in your + plugin and disable `editor` as a target platform for the DLL. + The Version Handler will enable the most recent version of this DLL when + the plugin is imported. + 1. Optional: If your plugin is included in other Unity plugins, you should + add the version number to each filename and change the GUID of each asset. + This allows multiple versions of your plugin to be imported into a Unity + project, with the Version Handler component activating only the most + recent version. + 1. Create a manifest text file named `MY_UNIQUE_PLUGIN_NAME_VERSION.txt` + that lists all the files in your plugin relative to the project root. + Then add the `gvh_manifest` label to the asset to indicate this file is + a plugin manifest. + 1. Optional: Add a `gvhp_manifestname-NAME` label to your manifest file + to provide a human readable name for your package. If this isn't provided + the name of the manifest file will be used as the package name. + NAME can match the pattern `[0-9]+[a-zA-Z -]' where a leading integer + will set the priority of the name where `0` is the highest priority + and preferably used as the display name. The lowest value (i.e highest + priority name) will be used as the display name and all other specified + names will be aliases of the display name. Aliases can refer to previous + names of the package allowing renaming across published versions. + 1. Redistribute EDM4U Unity plugin with your plugin. + See the [Plugin Redistribution](#plugin-redistribution) for the details. + +If you follow these steps: + + * When users import a newer version of your plugin, files referenced by the + older version's manifest are cleaned up. + * The latest version of the plugin will be selected when users import + multiple packages that include your plugin, assuming the steps in + [Plugin Redistribution](#plugin-redistribution) are followed. + +# Building from Source + +To build this plugin from source you need the following tools installed: + * Unity (with iOS and Android modules installed) + +You can build the plugin by running the following from your shell +(Linux / OSX): + +``` +./gradlew build +``` + +or Windows: + +``` +./gradlew.bat build +``` + +# Releasing + +Each time a new build of this plugin is checked into the source tree you +need to do the following: + + * Bump the plugin version variable `pluginVersion` in `build.gradle` + * Update `CHANGELOG.md` with the new version number and changes included in + the release. + * Build the release using `./gradlew release` which performs the following: + * Updates `external-dependency-manager-*.unitypackage` + * Copies the unpacked plugin to the `exploded` directory. + * Updates template metadata files in the `plugin` directory. + The GUIDs of all asset metadata is modified due to the version number + change. Each file within the plugin is versioned to allow multiple + versions of the plugin to be imported into a Unity project which allows + the most recent version to be activated by the Version Handler + component. + * Create release commit using `./gradlew gitCreateReleaseCommit` which + performs `git commit -a -m "description from CHANGELOG.md"` + * Once the release commit is merge, tag the release using + `./gradlew gitTagRelease` which performs the following: + * `git tag -a pluginVersion -m "version RELEASE"` to tag the release. + * Update tags on remote branch using `git push --tag REMOTE HEAD:master` diff --git a/Assets/ExternalDependencyManager/Editor/README.md.meta b/Assets/ExternalDependencyManager/Editor/README.md.meta new file mode 100644 index 0000000..949481e --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/README.md.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7123392a386740f98057fd61a3c1c2d4 +labels: +- gvh +- gvh_version-1.2.171 +- gvhp_exportpath-ExternalDependencyManager/Editor/README.md +timeCreated: 1584567712 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.171_manifest.txt b/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.171_manifest.txt new file mode 100644 index 0000000..2e7c74e --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.171_manifest.txt @@ -0,0 +1,13 @@ +Assets/ExternalDependencyManager/Editor/1.2.171/Google.IOSResolver.dll +Assets/ExternalDependencyManager/Editor/1.2.171/Google.IOSResolver.dll.mdb +Assets/ExternalDependencyManager/Editor/1.2.171/Google.JarResolver.dll +Assets/ExternalDependencyManager/Editor/1.2.171/Google.JarResolver.dll.mdb +Assets/ExternalDependencyManager/Editor/1.2.171/Google.PackageManagerResolver.dll +Assets/ExternalDependencyManager/Editor/1.2.171/Google.PackageManagerResolver.dll.mdb +Assets/ExternalDependencyManager/Editor/1.2.171/Google.VersionHandlerImpl.dll +Assets/ExternalDependencyManager/Editor/1.2.171/Google.VersionHandlerImpl.dll.mdb +Assets/ExternalDependencyManager/Editor/CHANGELOG.md +Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll +Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb +Assets/ExternalDependencyManager/Editor/LICENSE +Assets/ExternalDependencyManager/Editor/README.md diff --git a/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.171_manifest.txt.meta b/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.171_manifest.txt.meta new file mode 100644 index 0000000..af98f34 --- /dev/null +++ b/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.171_manifest.txt.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2e3b0e03078047389e8508173114de35 +labels: +- gvh +- gvh_manifest +- gvh_version-1.2.171 +- gvhp_exportpath-ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.171_manifest.txt +- gvhp_manifestname-0External Dependency Manager +- gvhp_manifestname-play-services-resolver +timeCreated: 1474401009 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100644 index 0000000..b825c19 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7d609560bbe578041b4e51f3414d4086 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Android.meta b/Assets/Plugins/Android.meta new file mode 100644 index 0000000..444f7f6 --- /dev/null +++ b/Assets/Plugins/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0ab81a6ad546c03418e309bb694407a8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Android/AndroidManifest.xml b/Assets/Plugins/Android/AndroidManifest.xml new file mode 100644 index 0000000..244800e --- /dev/null +++ b/Assets/Plugins/Android/AndroidManifest.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Assets/Plugins/Android/AndroidManifest.xml.meta b/Assets/Plugins/Android/AndroidManifest.xml.meta new file mode 100644 index 0000000..ab9e902 --- /dev/null +++ b/Assets/Plugins/Android/AndroidManifest.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e61f19774db0d2c4489400341a504c1f +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Android/launcherTemplate.gradle b/Assets/Plugins/Android/launcherTemplate.gradle new file mode 100644 index 0000000..7b080a7 --- /dev/null +++ b/Assets/Plugins/Android/launcherTemplate.gradle @@ -0,0 +1,61 @@ +apply plugin: 'com.android.application' + +dependencies { + implementation project(':unityLibrary') + } + +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + + multiDexEnabled true //添加此配置,是为了当代码行数超过64k的时候设置的 + } + + aaptOptions { + noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ') + ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~" + }**SIGN** + + lintOptions { + abortOnError false + } + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG** + } + }**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS** +**BUILT_APK_LOCATION** + bundle { + language { + enableSplit = false + } + density { + enableSplit = false + } + abi { + enableSplit = true + } + } +}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP** diff --git a/Assets/Plugins/Android/launcherTemplate.gradle.meta b/Assets/Plugins/Android/launcherTemplate.gradle.meta new file mode 100644 index 0000000..e66eb7f --- /dev/null +++ b/Assets/Plugins/Android/launcherTemplate.gradle.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 447f769e7e33b6b4b8c6bf167ff64d51 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Android/mainTemplate.gradle b/Assets/Plugins/Android/mainTemplate.gradle new file mode 100644 index 0000000..50d872a --- /dev/null +++ b/Assets/Plugins/Android/mainTemplate.gradle @@ -0,0 +1,67 @@ +// Android Resolver Repos Start +([rootProject] + (rootProject.subprojects as List)).each { project -> + project.repositories { + def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/") + maven { + url "https://maven.google.com" + } + mavenLocal() + mavenCentral() + } +} +// Android Resolver Repos End +apply plugin: 'com.android.library' +**APPLY_PLUGINS** + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +// Android Resolver Dependencies Start + implementation 'com.android.support:appcompat-v7:28.0.0' // Assets/AnyThinkAds/Plugins/Android/China/Editor/Dependencies.xml:3 + implementation 'com.android.support:design:28.0.0' // Assets/AnyThinkAds/Plugins/Android/China/mediation/kuaishou/Editor/Dependencies.xml:3 +// Android Resolver Dependencies End +**DEPS**} + +// Android Resolver Exclusions Start +android { + packagingOptions { + exclude ('/lib/arm64-v8a/*' + '*') + exclude ('/lib/armeabi/*' + '*') + exclude ('/lib/mips/*' + '*') + exclude ('/lib/mips64/*' + '*') + exclude ('/lib/x86/*' + '*') + exclude ('/lib/x86_64/*' + '*') + } +} +// Android Resolver Exclusions End +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD** + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ') + ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~" + }**PACKAGING_OPTIONS** +}**REPOSITORIES** +**IL_CPP_BUILD_SETUP** +**SOURCE_BUILD_SETUP** +**EXTERNAL_SOURCES** diff --git a/Assets/Plugins/Android/mainTemplate.gradle.meta b/Assets/Plugins/Android/mainTemplate.gradle.meta new file mode 100644 index 0000000..90ea407 --- /dev/null +++ b/Assets/Plugins/Android/mainTemplate.gradle.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f78a8058118e9824db89e5c1b18d3e47 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sample.meta b/Assets/Sample.meta new file mode 100644 index 0000000..7fe8e10 --- /dev/null +++ b/Assets/Sample.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 131a6b21c8605f84396be9f6751fb6e3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sample/AdConfig_topon_android.asset b/Assets/Sample/AdConfig_topon_android.asset new file mode 100644 index 0000000..65eb3fc --- /dev/null +++ b/Assets/Sample/AdConfig_topon_android.asset @@ -0,0 +1,28 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b31b835f394db4a51957c3f0f3ac32, type: 3} + m_Name: AdConfig_topon_android + m_EditorClassIdentifier: + ConfigName: toponAndroid + Id: a6317141b2cabe + Key: be384c35a0549e3491078200fcaf452e + Key2: + BaseAwardAdKeyValue: + key: + value: b63171442e3c3b + BaseInteractionAdKeyValue: + key: + value: b6317145db6f9d + BaseSplashAdKeyValue: + key: + value: + CommonKeyValues: [] diff --git a/Assets/Sample/AdConfig_topon_android.asset.meta b/Assets/Sample/AdConfig_topon_android.asset.meta new file mode 100644 index 0000000..8bc5921 --- /dev/null +++ b/Assets/Sample/AdConfig_topon_android.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9930e05cb9939e54d8faba3fa27fabc0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sample/SampleScene.unity b/Assets/Sample/SampleScene.unity new file mode 100644 index 0000000..9421266 --- /dev/null +++ b/Assets/Sample/SampleScene.unity @@ -0,0 +1,208 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &519420028 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 519420032} + - component: {fileID: 519420031} + - component: {fileID: 519420029} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &519420029 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + m_Enabled: 1 +--- !u!20 &519420031 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 0 + m_HDR: 1 + m_AllowMSAA: 0 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &519420032 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Sample/SampleScene.unity.meta b/Assets/Sample/SampleScene.unity.meta new file mode 100644 index 0000000..c1e3c88 --- /dev/null +++ b/Assets/Sample/SampleScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2cda990e2423bbf4892e6590ba056729 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta new file mode 100644 index 0000000..4c9d850 --- /dev/null +++ b/Assets/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 74f398a705d0cb74bbdbc21503dfe214 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ADListenerAggregator.cs b/Assets/Scripts/ADListenerAggregator.cs new file mode 100644 index 0000000..85a6328 --- /dev/null +++ b/Assets/Scripts/ADListenerAggregator.cs @@ -0,0 +1,163 @@ +using AnyThinkAds.Api; +using AnyThinkAds.Common; + + +/// +/// @foldcc +/// 用于绑定旧版本的listener监听事件 +/// +public class ADListenerAggregator +{ + private ATRewardedVideoListener _awardVideoListener; + private ATInterstitialAdListener _interstitialListener; + + public void BindAwardVideoListener(IATRewardedVideoAdClient client, ATRewardedVideoListener listener) + { + if (this._awardVideoListener == null) + { + client.onRewardEvent += this.onReward; + client.onAdClickEvent += this.onRewardedVideoAdPlayClicked; + client.onAdLoadEvent += this.onRewardedVideoAdLoaded; + client.onAdLoadFailureEvent += this.onRewardedVideoAdLoadFail; + client.onAdVideoEndEvent += this.onRewardedVideoAdPlayEnd; + client.onAdVideoCloseEvent += this.onRewardedVideoAdPlayClosed; + client.onAdVideoFailureEvent += this.onRewardedVideoAdPlayFail; + } + + this._awardVideoListener = listener; + } + + public void BindInterstitialAdListener(IATInterstitialAdClient client, ATInterstitialAdListener listener) + { + if (this._interstitialListener == null) + { + client.onAdLoadEvent += this.onInterstitialAdLoad; + client.onAdLoadFailureEvent += this.onInterstitialAdLoadFail; + client.onAdClickEvent += this.onInterstitialAdClick; + client.onAdCloseEvent += this.onInterstitialAdClose; + client.onAdShowEvent += this.onInterstitialAdShow; + client.onAdShowFailureEvent += this.onInterstitialAdFailedToShow; + } + + this._interstitialListener = listener; + } + + + void onRewardedVideoAdLoaded(object sender, ATAdEventArgs callbackInfo) + { + this._awardVideoListener?.onRewardedVideoAdLoaded(callbackInfo.placementId); + } + + /*** + * The Ad load fail (note: for Android, all callback methods are not in the main thread of Unity) + */ + void onRewardedVideoAdLoadFail(object sender, ATAdErrorEventArgs callbackInfo) + { + this._awardVideoListener?.onRewardedVideoAdLoadFail(callbackInfo.placementId, callbackInfo.errorCode, + callbackInfo.errorMessage); + } + + + /*** + * The Ad play end (note: for Android, all callback methods are not in the main thread of Unity) + */ + void onRewardedVideoAdPlayEnd(object sender, ATAdEventArgs callbackInfo) + { + this._awardVideoListener?.onRewardedVideoAdPlayEnd(callbackInfo.placementId, callbackInfo.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(object sender, ATAdErrorEventArgs callbackInfo) + { + this._awardVideoListener?.onRewardedVideoAdPlayFail(callbackInfo.placementId, callbackInfo.errorCode, + callbackInfo.errorMessage); + } + + /** + * The Ad close(note: for Android, all callback methods are not in the main thread of Unity) + * @param isReward + */ + void onRewardedVideoAdPlayClosed(object sender, ATAdRewardEventArgs callbackInfo) + { + this._awardVideoListener?.onRewardedVideoAdPlayClosed(callbackInfo.placementId, callbackInfo.isRewarded, + callbackInfo.callbackInfo); + } + + /*** + * The Ad click(note: for Android, all callback methods are not in the main thread of Unity) + */ + void onRewardedVideoAdPlayClicked(object sender, ATAdEventArgs callbackInfo) + { + this._awardVideoListener?.onRewardedVideoAdPlayClicked(callbackInfo.placementId, callbackInfo.callbackInfo); + } + + /** + * The Ad reward(note: for Android, all callback methods are not in the main thread of Unity) + */ + private void onReward(object sender, ATAdEventArgs callbackInfo) + { + this._awardVideoListener?.onReward(callbackInfo.placementId, callbackInfo.callbackInfo); + } + + + /*** +* 加载广告成功(注意:对于Android来说,所有回调方法均不在Unity的主线程) +* @param placementId 广告位id +*/ + void onInterstitialAdLoad(object sender, ATAdEventArgs atAdEventArgs) + { + this._interstitialListener?.onInterstitialAdLoad(atAdEventArgs.placementId); + } + + /*** + * 加载广告失败(注意:对于Android来说,所有回调方法均不在Unity的主线程) + * @param placementId 广告位id + * @param code 错误码 + * @param message 错误信息 + */ + void onInterstitialAdLoadFail(object sender, ATAdErrorEventArgs atAdErrorEventArgs) + { + this._interstitialListener?.onInterstitialAdLoadFail(atAdErrorEventArgs.placementId, + atAdErrorEventArgs.errorCode, atAdErrorEventArgs.errorMessage); + } + + /*** + * 广告展示(注意:对于Android来说,所有回调方法均不在Unity的主线程) + * @param placementId 广告位id + */ + void onInterstitialAdShow(object sender, ATAdEventArgs atAdEventArgs) + { + this._interstitialListener?.onInterstitialAdShow(atAdEventArgs.placementId, atAdEventArgs.callbackInfo); + } + + /*** + * 广告展示失败(注意:对于Android来说,所有回调方法均不在Unity的主线程) + * @param placementId 广告位id + */ + void onInterstitialAdFailedToShow(object sender, ATAdErrorEventArgs atAdErrorEventArgs) + { + this._interstitialListener?.onInterstitialAdFailedToShow(atAdErrorEventArgs.placementId); + } + + /*** + * 广告关闭(注意:对于Android来说,所有回调方法均不在Unity的主线程) + * @param placementId 广告位id + */ + void onInterstitialAdClose(object sender, ATAdEventArgs atAdEventArgs) + { + this._interstitialListener?.onInterstitialAdClose(atAdEventArgs.placementId, atAdEventArgs.callbackInfo); + } + + /*** + * 广告点击(注意:对于Android来说,所有回调方法均不在Unity的主线程) + * @param placementId 广告位id + */ + void onInterstitialAdClick(object sender, ATAdEventArgs atAdEventArgs) + { + this._interstitialListener?.onInterstitialAdClick(atAdEventArgs.placementId, atAdEventArgs.callbackInfo); + } +} \ No newline at end of file diff --git a/Assets/Scripts/ADListenerAggregator.cs.meta b/Assets/Scripts/ADListenerAggregator.cs.meta new file mode 100644 index 0000000..b199f0f --- /dev/null +++ b/Assets/Scripts/ADListenerAggregator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: afdb282e107142e981754e553721cf94 +timeCreated: 1674902675 \ No newline at end of file diff --git a/Assets/Scripts/AwardVideoPlayer.cs b/Assets/Scripts/AwardVideoPlayer.cs new file mode 100644 index 0000000..155223b --- /dev/null +++ b/Assets/Scripts/AwardVideoPlayer.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using AnyThinkAds.Api; +using Runtime.ADAggregator; +using UnityEngine; + +public class AwardVideoPlayer : ADPlayer , ATRewardedVideoListener +{ + private ATRewardedVideo _atRewardedVideo; + private Action _onVideoComplete; + private ADListenerAggregator _aggregator; + + public override void OnInit() + { + this._atRewardedVideo = ATRewardedVideo.Instance; + // this._atRewardedVideo.client.setListener(this); //由于新版本广告sdk弃用该方式,通过以下方式重新桥接监听事件 + this._aggregator = new ADListenerAggregator(); + this._aggregator.BindAwardVideoListener(this._atRewardedVideo.client , this); + // var adClient = this._atRewardedVideo.client; + // adClient.on + } + + + public override void ShowAD(Action onClose, Action onVideoComplete) + { + if (this.IsReadly()) + { + this._onVideoComplete = onVideoComplete; + this.adListener.onClose = onClose; + this.adListener.onVideoComplete = this.OnVideoComplete; + this._atRewardedVideo.showAd(this.Key); + this.curState = 0; + } + } + + private void OnVideoComplete(bool obj) + { + this._onVideoComplete?.Invoke(obj); + this._onVideoComplete = null; + } + + public override bool IsReadly() + { + return this.curState == 2; + } + + public override void LoadAD() + { + if (curState == 0) + { + { + Dictionary jsonmap = new Dictionary(); + //ATConst.USERID_KEY必传,用于标识每个用户;ATConst.USER_EXTRA_DATA为可选参数,传入后将透传到开发者的服务器 + jsonmap.Add(ATConst.USERID_KEY, ADManager.Instance.UserId); + jsonmap.Add(ATConst.USER_EXTRA_DATA, "user_extra_data"); + curState = 1; + this._atRewardedVideo.loadVideoAd(this.Key, jsonmap); + } + } + } + + #region SDK + + public void onRewardedVideoAdLoaded(string placementId) + { + this.curState = 2; + } + + public void onRewardedVideoAdLoadFail(string placementId, string code, string message) + { + Debug.LogError($"激励视频加载失败: {message} , code:{code} , placementId: {placementId}"); + this.curState = 0; + } + + public void onRewardedVideoAdPlayStart(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void onRewardedVideoAdPlayEnd(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void onRewardedVideoAdPlayFail(string placementId, string code, string message) + { + Debug.LogError($"激励视频播放失败: {message} , code:{code} , placementId: {placementId}"); + curState = 0; + this.adListener.OnShowError(); + } + + public void onRewardedVideoAdPlayClosed(string placementId, bool isReward, ATCallbackInfo callbackInfo) + { + this.adListener.OnRewardVerify(isReward , 1 , ""); + this.adListener.OnAdClose(); + } + + public void onRewardedVideoAdPlayClicked(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void onReward(string placementId, ATCallbackInfo callbackInfo) + { + this.adListener.OnRewardVerify(true , 1 , ""); + this.adListener.OnAdClose(); + } + + public void startLoadingADSource(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void finishLoadingADSource(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void failToLoadADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message) + { + this.OnError(code , message); + } + + public void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void finishBiddingADSource(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void failBiddingADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message) + { + } + + #endregion + +} \ No newline at end of file diff --git a/Assets/Scripts/AwardVideoPlayer.cs.meta b/Assets/Scripts/AwardVideoPlayer.cs.meta new file mode 100644 index 0000000..1ee7f19 --- /dev/null +++ b/Assets/Scripts/AwardVideoPlayer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1091d31820014e7794cbbce68c61c84d +timeCreated: 1674895752 \ No newline at end of file diff --git a/Assets/Scripts/InteractionPlayer.cs b/Assets/Scripts/InteractionPlayer.cs new file mode 100644 index 0000000..06d8567 --- /dev/null +++ b/Assets/Scripts/InteractionPlayer.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using AnyThinkAds.Api; +using Runtime.ADAggregator; +using UnityEngine; + +public class InteractionPlayer : ADPlayer , ATInterstitialAdListener +{ + private ATInterstitialAd _atInterstitialAd; + private ADListenerAggregator _aggregator; + + public override void OnInit() + { + this._atInterstitialAd = ATInterstitialAd.Instance; + this._aggregator = new ADListenerAggregator(); + this._aggregator.BindInterstitialAdListener(this._atInterstitialAd.client,this); + } + + public override void ShowAD(Action onClose, Action onVideoComplete) + { + if (curState == 2) + { + ATInterstitialAd.Instance.showInterstitialAd(this.Key); + curState = 0; + } + } + + public override void LoadAD() + { + if (curState == 0) + { + { + //加载广告 + Dictionary jsonmap = new Dictionary(); + //只针对Sigmob,Sigmob的激励视频广告源当做插屏使用 + // jsonmap.Add(AnyThinkAds.Api.ATConst.USE_REWARDED_VIDEO_AS_INTERSTITIAL, AnyThinkAds.Api.ATConst.USE_REWARDED_VIDEO_AS_INTERSTITIAL_NO); + var width = (int) (Screen.width * 0.7f); + ATSize atSize = new ATSize(width, (int) (width * 1.5f)); + jsonmap.Add(ATInterstitialAdLoadingExtra.kATInterstitialAdLoadingExtraInterstitialAdSizeStruct , atSize); + curState = 1; + this._atInterstitialAd.loadInterstitialAd(this.Key, jsonmap); + } + } + } + + #region SDK + + public void onInterstitialAdLoad(string placementId) + { + this.curState = 2; + } + + public void onInterstitialAdLoadFail(string placementId, string code, string message) + { + this.curState = 0; + } + + public void onInterstitialAdShow(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void onInterstitialAdFailedToShow(string placementId) + { + } + + public void onInterstitialAdClose(string placementId, ATCallbackInfo callbackInfo) + { + this.adListener.OnAdClose(); + this.adListener.OnShowComplete(); + } + + public void onInterstitialAdClick(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void onInterstitialAdStartPlayingVideo(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void onInterstitialAdEndPlayingVideo(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void onInterstitialAdFailedToPlayVideo(string placementId, string code, string message) + { + } + + public void startLoadingADSource(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void finishLoadingADSource(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void failToLoadADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message) + { + this.OnError(code , message); + } + + public void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void finishBiddingADSource(string placementId, ATCallbackInfo callbackInfo) + { + } + + public void failBiddingADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message) + { + this.OnError(code , message); + } + + #endregion +} \ No newline at end of file diff --git a/Assets/Scripts/InteractionPlayer.cs.meta b/Assets/Scripts/InteractionPlayer.cs.meta new file mode 100644 index 0000000..b51c3d7 --- /dev/null +++ b/Assets/Scripts/InteractionPlayer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4b6e02b53a734744a4a4aba98087bc37 +timeCreated: 1674903496 \ No newline at end of file diff --git a/Assets/Scripts/ToponAdController.cs b/Assets/Scripts/ToponAdController.cs new file mode 100644 index 0000000..b6800fc --- /dev/null +++ b/Assets/Scripts/ToponAdController.cs @@ -0,0 +1,51 @@ +using System; +using AnyThinkAds.Api; +using Runtime.ADAggregator; + +public class ToponAdController : IAdController +{ + private Action _maskAction; + private Action _logEventAction; + + private ADConfig _adConfig; + + public void Init(ADConfig adConfig, object[] args) + { + _adConfig = adConfig; + ATSDKAPI.setChannel(args[0].ToString()); + ATSDKAPI.setLogDebug(args.Length > 1 && (bool)args[1]); + ATSDKAPI.initSDK(adConfig.Id , adConfig.Key); + } + + public void SetListener(Action adMaskAction ,Action logEventAction) + { + _maskAction = adMaskAction; + _logEventAction = logEventAction; + } + + public ADPlayer CreateAdPlayer(AD_Type type) + { + switch (type) + { + case AD_Type.AwardVideo: + var awardVideoPlayer = new AwardVideoPlayer(); + return awardVideoPlayer.Init(_adConfig.BaseAwardAdKeyValue.value); + case AD_Type.Splash: + break; + case AD_Type.Interaction: + var interactionPlayer = new InteractionPlayer(); + return interactionPlayer.Init(_adConfig.BaseInteractionAdKeyValue.value); + } + return null; + } + + public void EventLog(string eventTable, string eventValue, string eventMessage = null) + { + _logEventAction?.Invoke(eventTable , eventValue); + } + + public void SetMask(bool isOpen) + { + _maskAction?.Invoke(isOpen); + } +} \ No newline at end of file diff --git a/Assets/Scripts/ToponAdController.cs.meta b/Assets/Scripts/ToponAdController.cs.meta new file mode 100644 index 0000000..1f79a65 --- /dev/null +++ b/Assets/Scripts/ToponAdController.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: eb67fd736cc0411d974ca91dda02b8a1 +timeCreated: 1674964988 \ No newline at end of file diff --git a/Assets/package.json b/Assets/package.json new file mode 100644 index 0000000..5028e67 --- /dev/null +++ b/Assets/package.json @@ -0,0 +1,24 @@ +{ + "name": "com.commercialization.topon", + "displayName": "Commercialization.topon", + "description": "基于topon的广告sdk封装,依赖基础商业化模块", + "version": "1.0.0", + "unity": "2021.1", + "license": "MIT", + "repository": { + "type": "git", + "url": "http://private.lightyears.ltd:18640/foldcc/Commercialization.topon" + }, + "author": { + "name": "foldcc", + "email": "lhyuau@qq.com", + "url": "https://gitee.com/foldcc" + }, + "dependencies": + { + "com.foldcc.cc-framework.commercialization" : "http://private.lightyears.ltd:18640/foldcc/CC-Framework.Commercialization.git#1.0.1" + }, + "keywords": [ + "Framework" + ] +} diff --git a/Assets/package.json.meta b/Assets/package.json.meta new file mode 100644 index 0000000..4617fe3 --- /dev/null +++ b/Assets/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6bdc75239432ff3458a7b98e29519e6d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json new file mode 100644 index 0000000..31fd4bc --- /dev/null +++ b/Packages/manifest.json @@ -0,0 +1,46 @@ +{ + "dependencies": { + "com.foldcc.cc-framework.commercialization" : "http://private.lightyears.ltd:18640/foldcc/CC-Framework.Commercialization.git#1.0.3", + "com.unity.collab-proxy": "1.17.6", + "com.unity.feature.2d": "1.0.0", + "com.unity.ide.rider": "3.0.16", + "com.unity.ide.visualstudio": "2.0.16", + "com.unity.ide.vscode": "1.2.5", + "com.unity.test-framework": "1.1.31", + "com.unity.textmeshpro": "3.0.6", + "com.unity.timeline": "1.6.4", + "com.unity.ugui": "1.0.0", + "com.unity.visualscripting": "1.7.8", + "com.unity.modules.ai": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.cloth": "1.0.0", + "com.unity.modules.director": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.physics2d": "1.0.0", + "com.unity.modules.screencapture": "1.0.0", + "com.unity.modules.terrain": "1.0.0", + "com.unity.modules.terrainphysics": "1.0.0", + "com.unity.modules.tilemap": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.umbra": "1.0.0", + "com.unity.modules.unityanalytics": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.unitywebrequesttexture": "1.0.0", + "com.unity.modules.unitywebrequestwww": "1.0.0", + "com.unity.modules.vehicles": "1.0.0", + "com.unity.modules.video": "1.0.0", + "com.unity.modules.vr": "1.0.0", + "com.unity.modules.wind": "1.0.0", + "com.unity.modules.xr": "1.0.0" + } +} diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json new file mode 100644 index 0000000..d17a39e --- /dev/null +++ b/Packages/packages-lock.json @@ -0,0 +1,490 @@ +{ + "dependencies": { + "com.foldcc.cc-framework.commercialization": { + "version": "http://private.lightyears.ltd:18640/foldcc/CC-Framework.Commercialization.git#1.0.3", + "depth": 0, + "source": "git", + "dependencies": {}, + "hash": "4a813fa4813657fce8887e6ed75d6c46d6f4ddbf" + }, + "com.unity.2d.animation": { + "version": "7.0.8", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.2d.common": "6.0.5", + "com.unity.2d.sprite": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.uielements": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.2d.common": { + "version": "6.0.5", + "depth": 2, + "source": "registry", + "dependencies": { + "com.unity.2d.sprite": "1.0.0", + "com.unity.mathematics": "1.1.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.burst": "1.5.1" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.2d.path": { + "version": "5.0.2", + "depth": 2, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.cn" + }, + "com.unity.2d.pixel-perfect": { + "version": "5.0.1", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.cn" + }, + "com.unity.2d.psdimporter": { + "version": "6.0.6", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.2d.animation": "7.0.8", + "com.unity.2d.common": "6.0.5", + "com.unity.2d.sprite": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.2d.sprite": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": {} + }, + "com.unity.2d.spriteshape": { + "version": "7.0.6", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.mathematics": "1.1.0", + "com.unity.2d.common": "6.0.4", + "com.unity.2d.path": "5.0.2", + "com.unity.modules.physics2d": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.2d.tilemap": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": {} + }, + "com.unity.2d.tilemap.extras": { + "version": "2.2.3", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.modules.tilemap": "1.0.0", + "com.unity.2d.tilemap": "1.0.0", + "com.unity.ugui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.burst": { + "version": "1.6.6", + "depth": 3, + "source": "registry", + "dependencies": { + "com.unity.mathematics": "1.2.1" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.collab-proxy": { + "version": "1.17.6", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.services.core": "1.0.1" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.ext.nunit": { + "version": "1.0.6", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.cn" + }, + "com.unity.feature.2d": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.2d.animation": "7.0.8", + "com.unity.2d.pixel-perfect": "5.0.1", + "com.unity.2d.psdimporter": "6.0.6", + "com.unity.2d.sprite": "1.0.0", + "com.unity.2d.spriteshape": "7.0.6", + "com.unity.2d.tilemap": "1.0.0", + "com.unity.2d.tilemap.extras": "2.2.3" + } + }, + "com.unity.ide.rider": { + "version": "3.0.16", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ext.nunit": "1.0.6" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.ide.visualstudio": { + "version": "2.0.16", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.1.9" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.ide.vscode": { + "version": "1.2.5", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.cn" + }, + "com.unity.mathematics": { + "version": "1.2.6", + "depth": 2, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.cn" + }, + "com.unity.nuget.newtonsoft-json": { + "version": "3.0.2", + "depth": 2, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.cn" + }, + "com.unity.services.core": { + "version": "1.6.0", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.nuget.newtonsoft-json": "3.0.2", + "com.unity.modules.androidjni": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.test-framework": { + "version": "1.1.31", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ext.nunit": "1.0.6", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.textmeshpro": { + "version": "3.0.6", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.timeline": { + "version": "1.6.4", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.director": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.ugui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0" + } + }, + "com.unity.visualscripting": { + "version": "1.7.8", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.modules.ai": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.androidjni": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.animation": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.assetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.audio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.cloth": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.director": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.animation": "1.0.0" + } + }, + "com.unity.modules.imageconversion": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.imgui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.jsonserialize": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.particlesystem": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics2d": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.screencapture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.subsystems": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.terrain": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.terrainphysics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.terrain": "1.0.0" + } + }, + "com.unity.modules.tilemap": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics2d": "1.0.0" + } + }, + "com.unity.modules.ui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.uielements": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.uielementsnative": "1.0.0" + } + }, + "com.unity.modules.uielementsnative": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.umbra": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unityanalytics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.unitywebrequest": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unitywebrequestassetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestaudio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.audio": "1.0.0" + } + }, + "com.unity.modules.unitywebrequesttexture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestwww": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.vehicles": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.video": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.vr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.xr": "1.0.0" + } + }, + "com.unity.modules.wind": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.xr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.subsystems": "1.0.0" + } + } + } +} diff --git a/ProjectSettings/AndroidResolverDependencies.xml b/ProjectSettings/AndroidResolverDependencies.xml new file mode 100644 index 0000000..ed9cf72 --- /dev/null +++ b/ProjectSettings/AndroidResolverDependencies.xml @@ -0,0 +1,22 @@ + + + com.android.support:appcompat-v7:28.0.0 + com.android.support:design:28.0.0 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProjectSettings/AudioManager.asset b/ProjectSettings/AudioManager.asset new file mode 100644 index 0000000..27287fe --- /dev/null +++ b/ProjectSettings/AudioManager.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!11 &1 +AudioManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Volume: 1 + Rolloff Scale: 1 + Doppler Factor: 1 + Default Speaker Mode: 2 + m_SampleRate: 0 + m_DSPBufferSize: 1024 + m_VirtualVoiceCount: 512 + m_RealVoiceCount: 32 + m_SpatializerPlugin: + m_AmbisonicDecoderPlugin: + m_DisableAudio: 0 + m_VirtualizeEffects: 1 + m_RequestedDSPBufferSize: 0 diff --git a/ProjectSettings/AutoStreamingSettings.asset b/ProjectSettings/AutoStreamingSettings.asset new file mode 100644 index 0000000..d3e071e --- /dev/null +++ b/ProjectSettings/AutoStreamingSettings.asset @@ -0,0 +1,21 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1200 &1 +AutoStreamingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + mSearchMode: 15 + mCustomSearchFile: + mTextureSearchString: + mMeshSearchString: + mTextures: [] + mAudios: [] + mMeshes: [] + mScenes: [] + mConfigCCD: + useCCD: 0 + cosKey: + projectGuid: + bucketUuid: + bucketName: + badgeName: diff --git a/ProjectSettings/ClusterInputManager.asset b/ProjectSettings/ClusterInputManager.asset new file mode 100644 index 0000000..e7886b2 --- /dev/null +++ b/ProjectSettings/ClusterInputManager.asset @@ -0,0 +1,6 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!236 &1 +ClusterInputManager: + m_ObjectHideFlags: 0 + m_Inputs: [] diff --git a/ProjectSettings/DynamicsManager.asset b/ProjectSettings/DynamicsManager.asset new file mode 100644 index 0000000..72d1430 --- /dev/null +++ b/ProjectSettings/DynamicsManager.asset @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!55 &1 +PhysicsManager: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_Gravity: {x: 0, y: -9.81, z: 0} + m_DefaultMaterial: {fileID: 0} + m_BounceThreshold: 2 + m_DefaultMaxDepenetrationVelocity: 10 + m_SleepThreshold: 0.005 + m_DefaultContactOffset: 0.01 + m_DefaultSolverIterations: 6 + m_DefaultSolverVelocityIterations: 1 + m_QueriesHitBackfaces: 0 + m_QueriesHitTriggers: 1 + m_EnableAdaptiveForce: 0 + m_ClothInterCollisionDistance: 0.1 + m_ClothInterCollisionStiffness: 0.2 + m_ContactsGeneration: 1 + m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + m_AutoSimulation: 1 + m_AutoSyncTransforms: 0 + m_ReuseCollisionCallbacks: 1 + m_ClothInterCollisionSettingsToggle: 0 + m_ClothGravity: {x: 0, y: -9.81, z: 0} + m_ContactPairsMode: 0 + m_BroadphaseType: 0 + m_WorldBounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 250, y: 250, z: 250} + m_WorldSubdivisions: 8 + m_FrictionType: 0 + m_EnableEnhancedDeterminism: 0 + m_EnableUnifiedHeightmaps: 1 + m_SolverType: 0 + m_DefaultMaxAngularSpeed: 50 diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset new file mode 100644 index 0000000..9a1a779 --- /dev/null +++ b/ProjectSettings/EditorBuildSettings.asset @@ -0,0 +1,11 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1045 &1 +EditorBuildSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Scenes: + - enabled: 1 + path: Assets/Sample/SampleScene.unity + guid: 2cda990e2423bbf4892e6590ba056729 + m_configObjects: {} diff --git a/ProjectSettings/EditorSettings.asset b/ProjectSettings/EditorSettings.asset new file mode 100644 index 0000000..fa3ed49 --- /dev/null +++ b/ProjectSettings/EditorSettings.asset @@ -0,0 +1,40 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!159 &1 +EditorSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_SerializationMode: 2 + m_LineEndingsForNewScripts: 0 + m_DefaultBehaviorMode: 1 + m_PrefabRegularEnvironment: {fileID: 0} + m_PrefabUIEnvironment: {fileID: 0} + m_SpritePackerMode: 4 + m_SpritePackerPaddingPower: 1 + m_EtcTextureCompressorBehavior: 1 + m_EtcTextureFastCompressor: 1 + m_EtcTextureNormalCompressor: 2 + m_EtcTextureBestCompressor: 4 + m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp + m_ProjectGenerationRootNamespace: + m_EnableTextureStreamingInEditMode: 1 + m_EnableTextureStreamingInPlayMode: 1 + m_AsyncShaderCompilation: 1 + m_CachingShaderPreprocessor: 1 + m_PrefabModeAllowAutoSave: 1 + m_EnterPlayModeOptionsEnabled: 0 + m_EnterPlayModeOptions: 3 + m_GameObjectNamingDigits: 1 + m_GameObjectNamingScheme: 0 + m_AssetNamingUsesSpace: 1 + m_UseLegacyProbeSampleCount: 0 + m_SerializeInlineMappingsOnOneLine: 1 + m_DisableCookiesInLightmapper: 1 + m_AssetPipelineMode: 1 + m_CacheServerMode: 0 + m_CacheServerEndpoint: + m_CacheServerNamespacePrefix: default + m_CacheServerEnableDownload: 1 + m_CacheServerEnableUpload: 1 + m_CacheServerEnableAuth: 0 + m_CacheServerEnableTls: 0 diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset new file mode 100644 index 0000000..c165afb --- /dev/null +++ b/ProjectSettings/GraphicsSettings.asset @@ -0,0 +1,64 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!30 &1 +GraphicsSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_Deferred: + m_Mode: 1 + m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} + m_DeferredReflections: + m_Mode: 1 + m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} + m_ScreenSpaceShadows: + m_Mode: 1 + m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} + m_LegacyDeferred: + m_Mode: 1 + m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} + m_DepthNormals: + m_Mode: 1 + m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} + m_MotionVectors: + m_Mode: 1 + m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} + m_LightHalo: + m_Mode: 1 + m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} + m_LensFlare: + m_Mode: 1 + m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} + m_VideoShadersIncludeMode: 2 + m_AlwaysIncludedShaders: + - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} + m_PreloadedShaders: [] + m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_CustomRenderPipeline: {fileID: 0} + m_TransparencySortMode: 0 + m_TransparencySortAxis: {x: 0, y: 0, z: 1} + m_DefaultRenderingPath: 1 + m_DefaultMobileRenderingPath: 1 + m_TierSettings: [] + m_LightmapStripping: 0 + m_FogStripping: 0 + m_InstancingStripping: 0 + m_LightmapKeepPlain: 1 + m_LightmapKeepDirCombined: 1 + m_LightmapKeepDynamicPlain: 1 + m_LightmapKeepDynamicDirCombined: 1 + m_LightmapKeepShadowMask: 1 + m_LightmapKeepSubtractive: 1 + m_FogKeepLinear: 1 + m_FogKeepExp: 1 + m_FogKeepExp2: 1 + m_AlbedoSwatchInfos: [] + m_LightsUseLinearIntensity: 0 + m_LightsUseColorTemperature: 0 + m_DefaultRenderingLayerMask: 1 + m_LogWhenShaderIsCompiled: 0 diff --git a/ProjectSettings/GvhProjectSettings.xml b/ProjectSettings/GvhProjectSettings.xml new file mode 100644 index 0000000..3d7f0d7 --- /dev/null +++ b/ProjectSettings/GvhProjectSettings.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset new file mode 100644 index 0000000..b16147e --- /dev/null +++ b/ProjectSettings/InputManager.asset @@ -0,0 +1,487 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!13 &1 +InputManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Axes: + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: a + altPositiveButton: d + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: s + altPositiveButton: w + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left ctrl + altNegativeButton: + altPositiveButton: mouse 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left alt + altNegativeButton: + altPositiveButton: mouse 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left shift + altNegativeButton: + altPositiveButton: mouse 2 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: space + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse X + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse Y + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse ScrollWheel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 2 + joyNum: 0 + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 0 + type: 2 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 1 + type: 2 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 0 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 1 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 2 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: return + altNegativeButton: + altPositiveButton: joystick button 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: enter + altNegativeButton: + altPositiveButton: space + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Cancel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: escape + altNegativeButton: + altPositiveButton: joystick button 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Enable Debug Button 1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left ctrl + altNegativeButton: + altPositiveButton: joystick button 8 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Enable Debug Button 2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: backspace + altNegativeButton: + altPositiveButton: joystick button 9 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Reset + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left alt + altNegativeButton: + altPositiveButton: joystick button 1 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Next + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: page down + altNegativeButton: + altPositiveButton: joystick button 5 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Previous + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: page up + altNegativeButton: + altPositiveButton: joystick button 4 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Validate + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: return + altNegativeButton: + altPositiveButton: joystick button 0 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Persistent + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: right shift + altNegativeButton: + altPositiveButton: joystick button 2 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Multiplier + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left shift + altNegativeButton: + altPositiveButton: joystick button 3 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 2 + axis: 6 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 2 + axis: 5 + joyNum: 0 diff --git a/ProjectSettings/MemorySettings.asset b/ProjectSettings/MemorySettings.asset new file mode 100644 index 0000000..5b5face --- /dev/null +++ b/ProjectSettings/MemorySettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!387306366 &1 +MemorySettings: + m_ObjectHideFlags: 0 + m_EditorMemorySettings: + m_MainAllocatorBlockSize: -1 + m_ThreadAllocatorBlockSize: -1 + m_MainGfxBlockSize: -1 + m_ThreadGfxBlockSize: -1 + m_CacheBlockSize: -1 + m_TypetreeBlockSize: -1 + m_ProfilerBlockSize: -1 + m_ProfilerEditorBlockSize: -1 + m_BucketAllocatorGranularity: -1 + m_BucketAllocatorBucketsCount: -1 + m_BucketAllocatorBlockSize: -1 + m_BucketAllocatorBlockCount: -1 + m_ProfilerBucketAllocatorGranularity: -1 + m_ProfilerBucketAllocatorBucketsCount: -1 + m_ProfilerBucketAllocatorBlockSize: -1 + m_ProfilerBucketAllocatorBlockCount: -1 + m_TempAllocatorSizeMain: -1 + m_JobTempAllocatorBlockSize: -1 + m_BackgroundJobTempAllocatorBlockSize: -1 + m_JobTempAllocatorReducedBlockSize: -1 + m_TempAllocatorSizeGIBakingWorker: -1 + m_TempAllocatorSizeNavMeshWorker: -1 + m_TempAllocatorSizeAudioWorker: -1 + m_TempAllocatorSizeCloudWorker: -1 + m_TempAllocatorSizeGfx: -1 + m_TempAllocatorSizeJobWorker: -1 + m_TempAllocatorSizeBackgroundWorker: -1 + m_TempAllocatorSizePreloadManager: -1 + m_PlatformMemorySettings: {} diff --git a/ProjectSettings/NavMeshAreas.asset b/ProjectSettings/NavMeshAreas.asset new file mode 100644 index 0000000..ad2654e --- /dev/null +++ b/ProjectSettings/NavMeshAreas.asset @@ -0,0 +1,93 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!126 &1 +NavMeshProjectSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + areas: + - name: Walkable + cost: 1 + - name: Not Walkable + cost: 1 + - name: Jump + cost: 2 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + m_LastAgentTypeID: -887442657 + m_Settings: + - serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.75 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_SettingNames: + - Humanoid diff --git a/ProjectSettings/NetworkManager.asset b/ProjectSettings/NetworkManager.asset new file mode 100644 index 0000000..5dc6a83 --- /dev/null +++ b/ProjectSettings/NetworkManager.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!149 &1 +NetworkManager: + m_ObjectHideFlags: 0 + m_DebugLevel: 0 + m_Sendrate: 15 + m_AssetToPrefab: {} diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset new file mode 100644 index 0000000..88ca802 --- /dev/null +++ b/ProjectSettings/PackageManagerSettings.asset @@ -0,0 +1,36 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_EnablePreReleasePackages: 0 + m_EnablePackageDependencies: 0 + m_AdvancedSettingsExpanded: 1 + m_ScopedRegistriesSettingsExpanded: 1 + m_SeeAllPackageVersions: 0 + oneTimeWarningShown: 0 + m_Registries: + - m_Id: main + m_Name: + m_Url: https://packages.unity.cn + m_Scopes: [] + m_IsDefault: 1 + m_Capabilities: 7 + m_ConfigSource: 0 + m_UserSelectedRegistryName: + m_UserAddingNewScopedRegistry: 0 + m_RegistryInfoDraft: + m_Modified: 0 + m_ErrorMessage: + m_UserModificationsInstanceId: -836 + m_OriginalInstanceId: -838 + m_LoadAssets: 0 diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset new file mode 100644 index 0000000..6cfcdda --- /dev/null +++ b/ProjectSettings/Physics2DSettings.asset @@ -0,0 +1,56 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!19 &1 +Physics2DSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_Gravity: {x: 0, y: -9.81} + m_DefaultMaterial: {fileID: 0} + m_VelocityIterations: 8 + m_PositionIterations: 3 + m_VelocityThreshold: 1 + m_MaxLinearCorrection: 0.2 + m_MaxAngularCorrection: 8 + m_MaxTranslationSpeed: 100 + m_MaxRotationSpeed: 360 + m_BaumgarteScale: 0.2 + m_BaumgarteTimeOfImpactScale: 0.75 + m_TimeToSleep: 0.5 + m_LinearSleepTolerance: 0.01 + m_AngularSleepTolerance: 2 + m_DefaultContactOffset: 0.01 + m_JobOptions: + serializedVersion: 2 + useMultithreading: 0 + useConsistencySorting: 0 + m_InterpolationPosesPerJob: 100 + m_NewContactsPerJob: 30 + m_CollideContactsPerJob: 100 + m_ClearFlagsPerJob: 200 + m_ClearBodyForcesPerJob: 200 + m_SyncDiscreteFixturesPerJob: 50 + m_SyncContinuousFixturesPerJob: 50 + m_FindNearestContactsPerJob: 100 + m_UpdateTriggerContactsPerJob: 100 + m_IslandSolverCostThreshold: 100 + m_IslandSolverBodyCostScale: 1 + m_IslandSolverContactCostScale: 10 + m_IslandSolverJointCostScale: 10 + m_IslandSolverBodiesPerJob: 50 + m_IslandSolverContactsPerJob: 50 + m_SimulationMode: 0 + m_QueriesHitTriggers: 1 + m_QueriesStartInColliders: 1 + m_CallbacksOnDisable: 1 + m_ReuseCollisionCallbacks: 1 + m_AutoSyncTransforms: 0 + m_AlwaysShowColliders: 0 + m_ShowColliderSleep: 1 + m_ShowColliderContacts: 0 + m_ShowColliderAABB: 0 + m_ContactArrowScale: 0.2 + m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} + m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} + m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} + m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} + m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/ProjectSettings/PresetManager.asset b/ProjectSettings/PresetManager.asset new file mode 100644 index 0000000..67a94da --- /dev/null +++ b/ProjectSettings/PresetManager.asset @@ -0,0 +1,7 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1386491679 &1 +PresetManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_DefaultPresets: {} diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset new file mode 100644 index 0000000..d505631 --- /dev/null +++ b/ProjectSettings/ProjectSettings.asset @@ -0,0 +1,875 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!129 &1 +PlayerSettings: + m_ObjectHideFlags: 0 + serializedVersion: 23 + productGUID: be0fb72fcadb36149a1a31297c876651 + AndroidProfiler: 0 + AndroidFilterTouchesWhenObscured: 0 + AndroidEnableSustainedPerformanceMode: 0 + defaultScreenOrientation: 4 + targetDevice: 2 + useOnDemandResources: 0 + accelerometerFrequency: 60 + companyName: DefaultCompany + productName: Commercialization.Topon + defaultCursor: {fileID: 0} + cursorHotspot: {x: 0, y: 0} + m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} + m_ShowUnitySplashScreen: 1 + m_ShowUnitySplashLogo: 1 + m_SplashScreenOverlayOpacity: 1 + m_SplashScreenAnimation: 1 + m_SplashScreenLogoStyle: 1 + m_SplashScreenDrawMode: 0 + m_SplashScreenBackgroundAnimationZoom: 1 + m_SplashScreenLogoAnimationZoom: 1 + m_SplashScreenBackgroundLandscapeAspect: 1 + m_SplashScreenBackgroundPortraitAspect: 1 + m_SplashScreenBackgroundLandscapeUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenBackgroundPortraitUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenLogos: [] + m_VirtualRealitySplashScreen: {fileID: 0} + m_ShowUnitySplashAds: 0 + m_AdsAndroidGameId: + m_AdsIosGameId: + m_ShowSplashAdsSlogan: 0 + m_SloganImage: {fileID: 0} + m_SloganHeight: 150 + m_HolographicTrackingLossScreen: {fileID: 0} + defaultScreenWidth: 1920 + defaultScreenHeight: 1080 + defaultScreenWidthWeb: 960 + defaultScreenHeightWeb: 600 + m_StereoRenderingPath: 0 + m_ActiveColorSpace: 0 + m_MTRendering: 1 + mipStripping: 0 + numberOfMipsStripped: 0 + m_StackTraceTypes: 010000000100000001000000010000000100000001000000 + iosShowActivityIndicatorOnLoading: -1 + androidShowActivityIndicatorOnLoading: -1 + iosUseCustomAppBackgroundBehavior: 0 + iosAllowHTTPDownload: 1 + allowedAutorotateToPortrait: 1 + allowedAutorotateToPortraitUpsideDown: 1 + allowedAutorotateToLandscapeRight: 1 + allowedAutorotateToLandscapeLeft: 1 + useOSAutorotation: 1 + use32BitDisplayBuffer: 1 + preserveFramebufferAlpha: 0 + disableDepthAndStencilBuffers: 0 + androidStartInFullscreen: 1 + androidRenderOutsideSafeArea: 1 + androidUseSwappy: 1 + androidBlitType: 0 + androidResizableWindow: 0 + androidDefaultWindowWidth: 1920 + androidDefaultWindowHeight: 1080 + androidMinimumWindowWidth: 400 + androidMinimumWindowHeight: 300 + androidFullscreenMode: 1 + defaultIsNativeResolution: 1 + macRetinaSupport: 1 + runInBackground: 0 + captureSingleScreen: 0 + muteOtherAudioSources: 0 + Prepare IOS For Recording: 0 + Force IOS Speakers When Recording: 0 + deferSystemGesturesMode: 0 + hideHomeButton: 0 + submitAnalytics: 1 + usePlayerLog: 1 + autoStreaming: 0 + useAnimationStreaming: 0 + useFontStreaming: 0 + autoStreamingId: + instantGameAppId: + bakeCollisionMeshes: 0 + forceSingleInstance: 0 + useFlipModelSwapchain: 1 + resizableWindow: 0 + useMacAppStoreValidation: 0 + macAppStoreCategory: public.app-category.games + gpuSkinning: 0 + xboxPIXTextureCapture: 0 + xboxEnableAvatar: 0 + xboxEnableKinect: 0 + xboxEnableKinectAutoTracking: 0 + xboxEnableFitness: 0 + visibleInBackground: 1 + allowFullscreenSwitch: 1 + fullscreenMode: 1 + xboxSpeechDB: 0 + xboxEnableHeadOrientation: 0 + xboxEnableGuest: 0 + xboxEnablePIXSampling: 0 + metalFramebufferOnly: 0 + xboxOneResolution: 0 + xboxOneSResolution: 0 + xboxOneXResolution: 3 + xboxOneMonoLoggingLevel: 0 + xboxOneLoggingLevel: 1 + xboxOneDisableEsram: 0 + xboxOneEnableTypeOptimization: 0 + xboxOnePresentImmediateThreshold: 0 + switchQueueCommandMemory: 1048576 + switchQueueControlMemory: 16384 + switchQueueComputeMemory: 262144 + switchNVNShaderPoolsGranularity: 33554432 + switchNVNDefaultPoolsGranularity: 16777216 + switchNVNOtherPoolsGranularity: 16777216 + switchNVNMaxPublicTextureIDCount: 0 + switchNVNMaxPublicSamplerIDCount: 0 + stadiaPresentMode: 0 + stadiaTargetFramerate: 0 + vulkanNumSwapchainBuffers: 3 + vulkanEnableSetSRGBWrite: 0 + vulkanEnablePreTransform: 0 + vulkanEnableLateAcquireNextImage: 0 + vulkanEnableCommandBufferRecycling: 1 + m_SupportedAspectRatios: + 4:3: 1 + 5:4: 1 + 16:10: 1 + 16:9: 1 + Others: 1 + bundleVersion: 1.0 + preloadedAssets: [] + metroInputSource: 0 + wsaTransparentSwapchain: 0 + m_HolographicPauseOnTrackingLoss: 1 + xboxOneDisableKinectGpuReservation: 1 + xboxOneEnable7thCore: 1 + vrSettings: + enable360StereoCapture: 0 + isWsaHolographicRemotingEnabled: 0 + enableFrameTimingStats: 0 + enableOpenGLProfilerGPURecorders: 1 + useHDRDisplay: 0 + D3DHDRBitDepth: 0 + m_ColorGamuts: 00000000 + targetPixelDensity: 30 + resolutionScalingMode: 0 + resetResolutionOnWindowResize: 0 + androidSupportedAspectRatio: 1 + androidMaxAspectRatio: 2.1 + applicationIdentifier: + Standalone: com.DefaultCompany.2DProject + buildNumber: + Standalone: 0 + iPhone: 0 + tvOS: 0 + overrideDefaultApplicationIdentifier: 1 + AndroidBundleVersionCode: 1 + AndroidMinSdkVersion: 22 + AndroidTargetSdkVersion: 0 + AndroidPreferredInstallLocation: 1 + aotOptions: + stripEngineCode: 1 + iPhoneStrippingLevel: 0 + iPhoneScriptCallOptimization: 0 + ForceInternetPermission: 0 + ForceSDCardPermission: 0 + CreateWallpaper: 0 + APKExpansionFiles: 0 + keepLoadedShadersAlive: 0 + StripUnusedMeshComponents: 0 + VertexChannelCompressionMask: 4054 + iPhoneSdkVersion: 988 + iOSTargetOSVersionString: 11.0 + tvOSSdkVersion: 0 + tvOSRequireExtendedGameController: 0 + tvOSTargetOSVersionString: 11.0 + uIPrerenderedIcon: 0 + uIRequiresPersistentWiFi: 0 + uIRequiresFullScreen: 1 + uIStatusBarHidden: 1 + uIExitOnSuspend: 0 + uIStatusBarStyle: 0 + appleTVSplashScreen: {fileID: 0} + appleTVSplashScreen2x: {fileID: 0} + tvOSSmallIconLayers: [] + tvOSSmallIconLayers2x: [] + tvOSLargeIconLayers: [] + tvOSLargeIconLayers2x: [] + tvOSTopShelfImageLayers: [] + tvOSTopShelfImageLayers2x: [] + tvOSTopShelfImageWideLayers: [] + tvOSTopShelfImageWideLayers2x: [] + iOSLaunchScreenType: 0 + iOSLaunchScreenPortrait: {fileID: 0} + iOSLaunchScreenLandscape: {fileID: 0} + iOSLaunchScreenBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreenFillPct: 100 + iOSLaunchScreenSize: 100 + iOSLaunchScreenCustomXibPath: + iOSLaunchScreeniPadType: 0 + iOSLaunchScreeniPadImage: {fileID: 0} + iOSLaunchScreeniPadBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreeniPadFillPct: 100 + iOSLaunchScreeniPadSize: 100 + iOSLaunchScreeniPadCustomXibPath: + iOSLaunchScreenCustomStoryboardPath: + iOSLaunchScreeniPadCustomStoryboardPath: + iOSDeviceRequirements: [] + iOSURLSchemes: [] + macOSURLSchemes: [] + iOSBackgroundModes: 0 + iOSMetalForceHardShadows: 0 + metalEditorSupport: 1 + metalAPIValidation: 1 + iOSRenderExtraFrameOnPause: 0 + iosCopyPluginsCodeInsteadOfSymlink: 0 + appleDeveloperTeamID: + iOSManualSigningProvisioningProfileID: + tvOSManualSigningProvisioningProfileID: + iOSManualSigningProvisioningProfileType: 0 + tvOSManualSigningProvisioningProfileType: 0 + appleEnableAutomaticSigning: 0 + iOSRequireARKit: 0 + iOSAutomaticallyDetectAndAddCapabilities: 1 + appleEnableProMotion: 0 + shaderPrecisionModel: 0 + clonedFromGUID: 10ad67313f4034357812315f3c407484 + templatePackageId: com.unity.template.2d@6.1.1 + templateDefaultScene: Assets/Scenes/SampleScene.unity + useCustomMainManifest: 1 + useCustomLauncherManifest: 0 + useCustomMainGradleTemplate: 1 + useCustomLauncherGradleManifest: 1 + useCustomBaseGradleTemplate: 0 + useCustomGradlePropertiesTemplate: 0 + useCustomProguardFile: 0 + AndroidTargetArchitectures: 1 + AndroidTargetDevices: 0 + AndroidSplashScreenScale: 0 + androidSplashScreen: {fileID: 0} + AndroidKeystoreName: + AndroidKeyaliasName: + AndroidBuildApkPerCpuArchitecture: 0 + AndroidTVCompatibility: 0 + AndroidIsGame: 1 + AndroidEnableTango: 0 + androidEnableBanner: 1 + androidUseLowAccuracyLocation: 0 + androidUseCustomKeystore: 0 + m_AndroidBanners: + - width: 320 + height: 180 + banner: {fileID: 0} + androidGamepadSupportLevel: 0 + chromeosInputEmulation: 1 + AndroidMinifyWithR8: 0 + AndroidMinifyRelease: 0 + AndroidMinifyDebug: 0 + AndroidValidateAppBundleSize: 1 + AndroidAppBundleSizeToValidate: 150 + m_BuildTargetIcons: [] + m_BuildTargetPlatformIcons: + - m_BuildTarget: iPhone + m_Icons: + - m_Textures: [] + m_Width: 180 + m_Height: 180 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 120 + m_Height: 120 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 167 + m_Height: 167 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 152 + m_Height: 152 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 76 + m_Height: 76 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 120 + m_Height: 120 + m_Kind: 3 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 80 + m_Height: 80 + m_Kind: 3 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 80 + m_Height: 80 + m_Kind: 3 + m_SubKind: iPad + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 3 + m_SubKind: iPad + - m_Textures: [] + m_Width: 87 + m_Height: 87 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 58 + m_Height: 58 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 29 + m_Height: 29 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 58 + m_Height: 58 + m_Kind: 1 + m_SubKind: iPad + - m_Textures: [] + m_Width: 29 + m_Height: 29 + m_Kind: 1 + m_SubKind: iPad + - m_Textures: [] + m_Width: 60 + m_Height: 60 + m_Kind: 2 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 2 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 2 + m_SubKind: iPad + - m_Textures: [] + m_Width: 20 + m_Height: 20 + m_Kind: 2 + m_SubKind: iPad + - m_Textures: [] + m_Width: 1024 + m_Height: 1024 + m_Kind: 4 + m_SubKind: App Store + - m_BuildTarget: Android + m_Icons: + - m_Textures: [] + m_Width: 432 + m_Height: 432 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 324 + m_Height: 324 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 216 + m_Height: 216 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 162 + m_Height: 162 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 108 + m_Height: 108 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 81 + m_Height: 81 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 192 + m_Height: 192 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 144 + m_Height: 144 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 96 + m_Height: 96 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 72 + m_Height: 72 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 48 + m_Height: 48 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 36 + m_Height: 36 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 192 + m_Height: 192 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 144 + m_Height: 144 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 96 + m_Height: 96 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 72 + m_Height: 72 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 48 + m_Height: 48 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 36 + m_Height: 36 + m_Kind: 0 + m_SubKind: + m_BuildTargetBatching: [] + m_BuildTargetShaderSettings: [] + m_BuildTargetGraphicsJobs: + - m_BuildTarget: MacStandaloneSupport + m_GraphicsJobs: 0 + - m_BuildTarget: Switch + m_GraphicsJobs: 0 + - m_BuildTarget: MetroSupport + m_GraphicsJobs: 0 + - m_BuildTarget: AppleTVSupport + m_GraphicsJobs: 0 + - m_BuildTarget: BJMSupport + m_GraphicsJobs: 0 + - m_BuildTarget: LinuxStandaloneSupport + m_GraphicsJobs: 0 + - m_BuildTarget: PS4Player + m_GraphicsJobs: 0 + - m_BuildTarget: iOSSupport + m_GraphicsJobs: 0 + - m_BuildTarget: WindowsStandaloneSupport + m_GraphicsJobs: 0 + - m_BuildTarget: XboxOnePlayer + m_GraphicsJobs: 0 + - m_BuildTarget: LuminSupport + m_GraphicsJobs: 0 + - m_BuildTarget: AndroidPlayer + m_GraphicsJobs: 0 + - m_BuildTarget: WebGLSupport + m_GraphicsJobs: 0 + m_BuildTargetGraphicsJobMode: [] + m_BuildTargetGraphicsAPIs: + - m_BuildTarget: AndroidPlayer + m_APIs: 150000000b000000 + m_Automatic: 1 + - m_BuildTarget: iOSSupport + m_APIs: 10000000 + m_Automatic: 1 + m_BuildTargetVRSettings: [] + m_DefaultShaderChunkSizeInMB: 16 + m_DefaultShaderChunkCount: 0 + openGLRequireES31: 0 + openGLRequireES31AEP: 0 + openGLRequireES32: 0 + m_TemplateCustomTags: {} + mobileMTRendering: + Android: 1 + iPhone: 1 + tvOS: 1 + m_BuildTargetGroupLightmapEncodingQuality: [] + m_BuildTargetGroupLightmapSettings: [] + m_BuildTargetNormalMapEncoding: [] + m_BuildTargetDefaultTextureCompressionFormat: + - m_BuildTarget: Android + m_Format: 3 + playModeTestRunnerEnabled: 0 + runPlayModeTestAsEditModeTest: 0 + actionOnDotNetUnhandledException: 1 + enableInternalProfiler: 0 + logObjCUncaughtExceptions: 1 + enableCrashReportAPI: 0 + cameraUsageDescription: + locationUsageDescription: + microphoneUsageDescription: + bluetoothUsageDescription: + switchNMETAOverride: + switchNetLibKey: + switchSocketMemoryPoolSize: 6144 + switchSocketAllocatorPoolSize: 128 + switchSocketConcurrencyLimit: 14 + switchScreenResolutionBehavior: 2 + switchUseCPUProfiler: 0 + switchUseGOLDLinker: 0 + switchLTOSetting: 0 + switchApplicationID: 0x01004b9000490000 + switchNSODependencies: + switchTitleNames_0: + switchTitleNames_1: + switchTitleNames_2: + switchTitleNames_3: + switchTitleNames_4: + switchTitleNames_5: + switchTitleNames_6: + switchTitleNames_7: + switchTitleNames_8: + switchTitleNames_9: + switchTitleNames_10: + switchTitleNames_11: + switchTitleNames_12: + switchTitleNames_13: + switchTitleNames_14: + switchTitleNames_15: + switchPublisherNames_0: + switchPublisherNames_1: + switchPublisherNames_2: + switchPublisherNames_3: + switchPublisherNames_4: + switchPublisherNames_5: + switchPublisherNames_6: + switchPublisherNames_7: + switchPublisherNames_8: + switchPublisherNames_9: + switchPublisherNames_10: + switchPublisherNames_11: + switchPublisherNames_12: + switchPublisherNames_13: + switchPublisherNames_14: + switchPublisherNames_15: + switchIcons_0: {fileID: 0} + switchIcons_1: {fileID: 0} + switchIcons_2: {fileID: 0} + switchIcons_3: {fileID: 0} + switchIcons_4: {fileID: 0} + switchIcons_5: {fileID: 0} + switchIcons_6: {fileID: 0} + switchIcons_7: {fileID: 0} + switchIcons_8: {fileID: 0} + switchIcons_9: {fileID: 0} + switchIcons_10: {fileID: 0} + switchIcons_11: {fileID: 0} + switchIcons_12: {fileID: 0} + switchIcons_13: {fileID: 0} + switchIcons_14: {fileID: 0} + switchIcons_15: {fileID: 0} + switchSmallIcons_0: {fileID: 0} + switchSmallIcons_1: {fileID: 0} + switchSmallIcons_2: {fileID: 0} + switchSmallIcons_3: {fileID: 0} + switchSmallIcons_4: {fileID: 0} + switchSmallIcons_5: {fileID: 0} + switchSmallIcons_6: {fileID: 0} + switchSmallIcons_7: {fileID: 0} + switchSmallIcons_8: {fileID: 0} + switchSmallIcons_9: {fileID: 0} + switchSmallIcons_10: {fileID: 0} + switchSmallIcons_11: {fileID: 0} + switchSmallIcons_12: {fileID: 0} + switchSmallIcons_13: {fileID: 0} + switchSmallIcons_14: {fileID: 0} + switchSmallIcons_15: {fileID: 0} + switchManualHTML: + switchAccessibleURLs: + switchLegalInformation: + switchMainThreadStackSize: 1048576 + switchPresenceGroupId: + switchLogoHandling: 0 + switchReleaseVersion: 0 + switchDisplayVersion: 1.0.0 + switchStartupUserAccount: 0 + switchTouchScreenUsage: 0 + switchSupportedLanguagesMask: 0 + switchLogoType: 0 + switchApplicationErrorCodeCategory: + switchUserAccountSaveDataSize: 0 + switchUserAccountSaveDataJournalSize: 0 + switchApplicationAttribute: 0 + switchCardSpecSize: -1 + switchCardSpecClock: -1 + switchRatingsMask: 0 + switchRatingsInt_0: 0 + switchRatingsInt_1: 0 + switchRatingsInt_2: 0 + switchRatingsInt_3: 0 + switchRatingsInt_4: 0 + switchRatingsInt_5: 0 + switchRatingsInt_6: 0 + switchRatingsInt_7: 0 + switchRatingsInt_8: 0 + switchRatingsInt_9: 0 + switchRatingsInt_10: 0 + switchRatingsInt_11: 0 + switchRatingsInt_12: 0 + switchLocalCommunicationIds_0: + switchLocalCommunicationIds_1: + switchLocalCommunicationIds_2: + switchLocalCommunicationIds_3: + switchLocalCommunicationIds_4: + switchLocalCommunicationIds_5: + switchLocalCommunicationIds_6: + switchLocalCommunicationIds_7: + switchParentalControl: 0 + switchAllowsScreenshot: 1 + switchAllowsVideoCapturing: 1 + switchAllowsRuntimeAddOnContentInstall: 0 + switchDataLossConfirmation: 0 + switchUserAccountLockEnabled: 0 + switchSystemResourceMemory: 16777216 + switchSupportedNpadStyles: 22 + switchNativeFsCacheSize: 32 + switchIsHoldTypeHorizontal: 0 + switchSupportedNpadCount: 8 + switchSocketConfigEnabled: 0 + switchTcpInitialSendBufferSize: 32 + switchTcpInitialReceiveBufferSize: 64 + switchTcpAutoSendBufferSizeMax: 256 + switchTcpAutoReceiveBufferSizeMax: 256 + switchUdpSendBufferSize: 9 + switchUdpReceiveBufferSize: 42 + switchSocketBufferEfficiency: 4 + switchSocketInitializeEnabled: 1 + switchNetworkInterfaceManagerInitializeEnabled: 1 + switchPlayerConnectionEnabled: 1 + switchUseNewStyleFilepaths: 0 + switchUseMicroSleepForYield: 1 + switchEnableRamDiskSupport: 0 + switchMicroSleepForYieldTime: 25 + switchRamDiskSpaceSize: 12 + ps4NPAgeRating: 12 + ps4NPTitleSecret: + ps4NPTrophyPackPath: + ps4ParentalLevel: 11 + ps4ContentID: ED1633-NPXX51362_00-0000000000000000 + ps4Category: 0 + ps4MasterVersion: 01.00 + ps4AppVersion: 01.00 + ps4AppType: 0 + ps4ParamSfxPath: + ps4VideoOutPixelFormat: 0 + ps4VideoOutInitialWidth: 1920 + ps4VideoOutBaseModeInitialWidth: 1920 + ps4VideoOutReprojectionRate: 60 + ps4PronunciationXMLPath: + ps4PronunciationSIGPath: + ps4BackgroundImagePath: + ps4StartupImagePath: + ps4StartupImagesFolder: + ps4IconImagesFolder: + ps4SaveDataImagePath: + ps4SdkOverride: + ps4BGMPath: + ps4ShareFilePath: + ps4ShareOverlayImagePath: + ps4PrivacyGuardImagePath: + ps4ExtraSceSysFile: + ps4NPtitleDatPath: + ps4RemotePlayKeyAssignment: -1 + ps4RemotePlayKeyMappingDir: + ps4PlayTogetherPlayerCount: 0 + ps4EnterButtonAssignment: 2 + ps4ApplicationParam1: 0 + ps4ApplicationParam2: 0 + ps4ApplicationParam3: 0 + ps4ApplicationParam4: 0 + ps4DownloadDataSize: 0 + ps4GarlicHeapSize: 2048 + ps4ProGarlicHeapSize: 2560 + playerPrefsMaxSize: 32768 + ps4Passcode: bi9UOuSpM2Tlh01vOzwvSikHFswuzleh + ps4pnSessions: 1 + ps4pnPresence: 1 + ps4pnFriends: 1 + ps4pnGameCustomData: 1 + playerPrefsSupport: 0 + enableApplicationExit: 0 + resetTempFolder: 1 + restrictedAudioUsageRights: 0 + ps4UseResolutionFallback: 0 + ps4ReprojectionSupport: 0 + ps4UseAudio3dBackend: 0 + ps4UseLowGarlicFragmentationMode: 1 + ps4SocialScreenEnabled: 0 + ps4ScriptOptimizationLevel: 2 + ps4Audio3dVirtualSpeakerCount: 14 + ps4attribCpuUsage: 0 + ps4PatchPkgPath: + ps4PatchLatestPkgPath: + ps4PatchChangeinfoPath: + ps4PatchDayOne: 0 + ps4attribUserManagement: 0 + ps4attribMoveSupport: 0 + ps4attrib3DSupport: 0 + ps4attribShareSupport: 0 + ps4attribExclusiveVR: 0 + ps4disableAutoHideSplash: 0 + ps4videoRecordingFeaturesUsed: 0 + ps4contentSearchFeaturesUsed: 0 + ps4CompatibilityPS5: 0 + ps4AllowPS5Detection: 0 + ps4GPU800MHz: 1 + ps4attribEyeToEyeDistanceSettingVR: 0 + ps4IncludedModules: [] + ps4attribVROutputEnabled: 0 + monoEnv: + splashScreenBackgroundSourceLandscape: {fileID: 0} + splashScreenBackgroundSourcePortrait: {fileID: 0} + blurSplashScreenBackground: 1 + spritePackerPolicy: + webGLMemorySize: 32 + webGLExceptionSupport: 1 + webGLNameFilesAsHashes: 0 + webGLDataCaching: 1 + webGLDebugSymbols: 0 + webGLEmscriptenArgs: + webGLModulesDirectory: + webGLTemplate: APPLICATION:Default + webGLAnalyzeBuildSize: 0 + webGLUseEmbeddedResources: 0 + webGLCompressionFormat: 0 + webGLWasmArithmeticExceptions: 0 + webGLLinkerTarget: 1 + webGLThreadsSupport: 0 + webGLDecompressionFallback: 0 + webGLPowerPreference: 2 + scriptingDefineSymbols: {} + additionalCompilerArguments: {} + platformArchitecture: {} + scriptingBackend: {} + il2cppCompilerConfiguration: {} + managedStrippingLevel: {} + incrementalIl2cppBuild: {} + suppressCommonWarnings: 1 + allowUnsafeCode: 0 + useDeterministicCompilation: 1 + enableRoslynAnalyzers: 1 + selectedPlatform: 2 + additionalIl2CppArgs: + scriptingRuntimeVersion: 1 + gcIncremental: 1 + assemblyVersionValidation: 1 + gcWBarrierValidation: 0 + apiCompatibilityLevelPerPlatform: {} + m_RenderingPath: 1 + m_MobileRenderingPath: 1 + metroPackageName: 2D_BuiltInRenderer + metroPackageVersion: + metroCertificatePath: + metroCertificatePassword: + metroCertificateSubject: + metroCertificateIssuer: + metroCertificateNotAfter: 0000000000000000 + metroApplicationDescription: 2D_BuiltInRenderer + wsaImages: {} + metroTileShortName: + metroTileShowName: 0 + metroMediumTileShowName: 0 + metroLargeTileShowName: 0 + metroWideTileShowName: 0 + metroSupportStreamingInstall: 0 + metroLastRequiredScene: 0 + metroDefaultTileSize: 1 + metroTileForegroundText: 2 + metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} + metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1} + metroSplashScreenUseBackgroundColor: 0 + platformCapabilities: {} + metroTargetDeviceFamilies: {} + metroFTAName: + metroFTAFileTypes: [] + metroProtocolName: + vcxProjDefaultLanguage: + XboxOneProductId: + XboxOneUpdateKey: + XboxOneSandboxId: + XboxOneContentId: + XboxOneTitleId: + XboxOneSCId: + XboxOneGameOsOverridePath: + XboxOnePackagingOverridePath: + XboxOneAppManifestOverridePath: + XboxOneVersion: 1.0.0.0 + XboxOnePackageEncryption: 0 + XboxOnePackageUpdateGranularity: 2 + XboxOneDescription: + XboxOneLanguage: + - enus + XboxOneCapability: [] + XboxOneGameRating: {} + XboxOneIsContentPackage: 0 + XboxOneEnhancedXboxCompatibilityMode: 0 + XboxOneEnableGPUVariability: 1 + XboxOneSockets: {} + XboxOneSplashScreen: {fileID: 0} + XboxOneAllowedProductIds: [] + XboxOnePersistentLocalStorageSize: 0 + XboxOneXTitleMemory: 8 + XboxOneOverrideIdentityName: + XboxOneOverrideIdentityPublisher: + vrEditorSettings: {} + cloudServicesEnabled: {} + luminIcon: + m_Name: + m_ModelFolderPath: + m_PortalFolderPath: + luminCert: + m_CertPath: + m_SignPackage: 1 + luminIsChannelApp: 0 + luminVersion: + m_VersionCode: 1 + m_VersionName: + apiCompatibilityLevel: 6 + activeInputHandler: 0 + windowsGamepadBackendHint: 0 + cloudProjectId: + framebufferDepthMemorylessMode: 0 + qualitySettingsNames: [] + projectName: + organizationId: + cloudEnabled: 0 + legacyClampBlendShapeWeights: 0 + playerDataPath: + forceSRGBBlit: 1 + virtualTexturingSupportEnabled: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt new file mode 100644 index 0000000..33eb42a --- /dev/null +++ b/ProjectSettings/ProjectVersion.txt @@ -0,0 +1,2 @@ +m_EditorVersion: 2021.3.14f1c1 +m_EditorVersionWithRevision: 2021.3.14f1c1 (3aa525a93a5f) diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset new file mode 100644 index 0000000..bcd6706 --- /dev/null +++ b/ProjectSettings/QualitySettings.asset @@ -0,0 +1,239 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!47 &1 +QualitySettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_CurrentQuality: 5 + m_QualitySettings: + - serializedVersion: 2 + name: Very Low + pixelLightCount: 0 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 15 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + skinWeights: 1 + textureQuality: 1 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 0 + lodBias: 0.3 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 4 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Low + pixelLightCount: 0 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 20 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + skinWeights: 2 + textureQuality: 0 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 0 + lodBias: 0.4 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 16 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Medium + pixelLightCount: 1 + shadows: 1 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 20 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + skinWeights: 2 + textureQuality: 0 + anisotropicTextures: 1 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 1 + lodBias: 0.7 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 64 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: High + pixelLightCount: 2 + shadows: 2 + shadowResolution: 1 + shadowProjection: 1 + shadowCascades: 2 + shadowDistance: 40 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + skinWeights: 2 + textureQuality: 0 + anisotropicTextures: 1 + antiAliasing: 0 + softParticles: 0 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 256 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Very High + pixelLightCount: 3 + shadows: 2 + shadowResolution: 2 + shadowProjection: 1 + shadowCascades: 2 + shadowDistance: 70 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + skinWeights: 4 + textureQuality: 0 + anisotropicTextures: 2 + antiAliasing: 2 + softParticles: 1 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1.5 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 1024 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Ultra + pixelLightCount: 4 + shadows: 2 + shadowResolution: 2 + shadowProjection: 1 + shadowCascades: 4 + shadowDistance: 150 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + skinWeights: 255 + textureQuality: 0 + anisotropicTextures: 2 + antiAliasing: 2 + softParticles: 1 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 2 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 4096 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + m_PerPlatformDefaultQuality: + Android: 2 + Lumin: 5 + GameCoreScarlett: 5 + GameCoreXboxOne: 5 + Nintendo Switch: 5 + PS4: 5 + PS5: 5 + Stadia: 5 + Standalone: 5 + WebGL: 3 + Windows Store Apps: 5 + XboxOne: 5 + iPhone: 2 + tvOS: 2 diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset new file mode 100644 index 0000000..1c92a78 --- /dev/null +++ b/ProjectSettings/TagManager.asset @@ -0,0 +1,43 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!78 &1 +TagManager: + serializedVersion: 2 + tags: [] + layers: + - Default + - TransparentFX + - Ignore Raycast + - + - Water + - UI + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + m_SortingLayers: + - name: Default + uniqueID: 0 + locked: 0 diff --git a/ProjectSettings/TimeManager.asset b/ProjectSettings/TimeManager.asset new file mode 100644 index 0000000..558a017 --- /dev/null +++ b/ProjectSettings/TimeManager.asset @@ -0,0 +1,9 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!5 &1 +TimeManager: + m_ObjectHideFlags: 0 + Fixed Timestep: 0.02 + Maximum Allowed Timestep: 0.33333334 + m_TimeScale: 1 + Maximum Particle Timestep: 0.03 diff --git a/ProjectSettings/UnityConnectSettings.asset b/ProjectSettings/UnityConnectSettings.asset new file mode 100644 index 0000000..4c136ae --- /dev/null +++ b/ProjectSettings/UnityConnectSettings.asset @@ -0,0 +1,38 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!310 &1 +UnityConnectSettings: + m_ObjectHideFlags: 0 + serializedVersion: 1 + m_Enabled: 0 + m_TestMode: 0 + m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events + m_EventUrl: https://cdp.cloud.unity3d.com/v1/events + m_ConfigUrl: https://config.uca.cloud.unity3d.com + m_DashboardUrl: https://dashboard.unity3d.com + m_CNEventUrl: https://cdp.cloud.unity.cn/v1/events + m_CNConfigUrl: https://cdp.cloud.unity.cn/config + m_TestInitMode: 0 + CrashReportingSettings: + m_EventUrl: https://perf-events.cloud.unity.cn + m_Enabled: 0 + m_LogBufferSize: 10 + m_CaptureEditorExceptions: 1 + UnityPurchasingSettings: + m_Enabled: 0 + m_TestMode: 0 + UnityAnalyticsSettings: + m_Enabled: 1 + m_TestMode: 0 + m_InitializeOnStartup: 1 + m_PackageRequiringCoreStatsPresent: 0 + UnityAdsSettings: + m_Enabled: 0 + m_InitializeOnStartup: 1 + m_TestMode: 0 + m_IosGameId: + m_AndroidGameId: + m_GameIds: {} + m_GameId: + PerformanceReportingSettings: + m_Enabled: 0 diff --git a/ProjectSettings/VFXManager.asset b/ProjectSettings/VFXManager.asset new file mode 100644 index 0000000..46f38e1 --- /dev/null +++ b/ProjectSettings/VFXManager.asset @@ -0,0 +1,14 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!937362698 &1 +VFXManager: + m_ObjectHideFlags: 0 + m_IndirectShader: {fileID: 0} + m_CopyBufferShader: {fileID: 0} + m_SortShader: {fileID: 0} + m_StripUpdateShader: {fileID: 0} + m_RenderPipeSettingsPath: + m_FixedTimeStep: 0.016666668 + m_MaxDeltaTime: 0.05 + m_CompiledVersion: 0 + m_RuntimeVersion: 0 diff --git a/ProjectSettings/VersionControlSettings.asset b/ProjectSettings/VersionControlSettings.asset new file mode 100644 index 0000000..dca2881 --- /dev/null +++ b/ProjectSettings/VersionControlSettings.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!890905787 &1 +VersionControlSettings: + m_ObjectHideFlags: 0 + m_Mode: Visible Meta Files + m_CollabEditorSettings: + inProgressEnabled: 1 diff --git a/ProjectSettings/XRSettings.asset b/ProjectSettings/XRSettings.asset new file mode 100644 index 0000000..482590c --- /dev/null +++ b/ProjectSettings/XRSettings.asset @@ -0,0 +1,10 @@ +{ + "m_SettingKeys": [ + "VR Device Disabled", + "VR Device User Alert" + ], + "m_SettingValues": [ + "False", + "False" + ] +} \ No newline at end of file diff --git a/ProjectSettings/boot.config b/ProjectSettings/boot.config new file mode 100644 index 0000000..e69de29 diff --git a/Update Upm.bat b/Update Upm.bat new file mode 100644 index 0000000..833171e --- /dev/null +++ b/Update Upm.bat @@ -0,0 +1,22 @@ +@echo off +color a +echo ʼύgit upm.... +echo ύupmǰȷǰ֧иĶѾύ +:setVersion +set /p var=뱾ύUpm汾 -------- +set /p Flg=ȷύİ汾%var%Ƿʼύ(y/n) -------- : + +IF "%Flg%" equ "y" ( + echo ʼύرոôڣ + git subtree split --prefix=Assets --branch upm + git tag %var% upm + git push origin upm --tags + GOTO :END +) + +GOTO :setVersion + +:END +echo ִ! +pause +exit \ No newline at end of file