添加 topon SDK
This commit is contained in:
parent
ba023aa592
commit
252cae776d
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: eeff680af0e614c868711d401f3a1cc6
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6906a18bbd98b4ba8ae1df69e7a45531
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6e450fee0707f449a85d8d46819fd720
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,218 @@
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using AnyThinkAds.Api;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
|
||||||
|
public class ATAdEventArgs
|
||||||
|
{
|
||||||
|
public String placementId { get; }
|
||||||
|
public ATCallbackInfo callbackInfo { get; }
|
||||||
|
public bool isTimeout { get; }
|
||||||
|
|
||||||
|
public bool isDeeplinkSucceed { get; }
|
||||||
|
|
||||||
|
public ATAdEventArgs(string id, string callbackJson = "", bool timeout = false, bool isDeeplinkSucceess = false)
|
||||||
|
{
|
||||||
|
placementId = id;
|
||||||
|
callbackInfo = new ATCallbackInfo(callbackJson);
|
||||||
|
isTimeout = timeout;
|
||||||
|
isDeeplinkSucceed = isDeeplinkSucceess;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public ATAdEventArgs(String id, String callbackJson)
|
||||||
|
// {
|
||||||
|
// placementId = id;
|
||||||
|
// callbackInfo = new ATCallbackInfo(callbackJson);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ATAdErrorEventArgs : ATAdEventArgs
|
||||||
|
{
|
||||||
|
public String errorMessage { get; }
|
||||||
|
public String errorCode { get; }
|
||||||
|
|
||||||
|
public ATAdErrorEventArgs(String placementId, String code, String message)
|
||||||
|
: base(placementId)
|
||||||
|
{
|
||||||
|
errorMessage = message;
|
||||||
|
errorCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ATAdErrorEventArgs(String placementId, String callbackJson, String code, String message)
|
||||||
|
: base(placementId, callbackJson)
|
||||||
|
{
|
||||||
|
errorMessage = message;
|
||||||
|
errorCode = code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ATAdProgressEventArgs : ATAdEventArgs
|
||||||
|
{
|
||||||
|
public int adProgress { get; }
|
||||||
|
|
||||||
|
public ATAdProgressEventArgs(String placementId, String callbackJson, int progress)
|
||||||
|
: base(placementId, callbackJson)
|
||||||
|
{
|
||||||
|
adProgress = progress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ATAdRewardEventArgs : ATAdEventArgs
|
||||||
|
{
|
||||||
|
public bool isRewarded { get; }
|
||||||
|
|
||||||
|
public ATAdRewardEventArgs(String placementId, String callbackJson, bool doReward)
|
||||||
|
: base(placementId, callbackJson)
|
||||||
|
{
|
||||||
|
isRewarded = doReward;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface IHCommonEvents
|
||||||
|
{
|
||||||
|
// triggers when the ad has been succesfully loaded
|
||||||
|
event EventHandler<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
|
||||||
|
// triggers when the ad has failed to load
|
||||||
|
event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
|
||||||
|
// triggers when a the ad has started to load
|
||||||
|
event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
|
||||||
|
// triggers when a the ad has finished to load
|
||||||
|
event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
|
||||||
|
// triggers when a the ad has started to load
|
||||||
|
event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
|
||||||
|
// triggers when a the ad has started to load
|
||||||
|
event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
|
||||||
|
// triggers when a the ad has started to load
|
||||||
|
event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
|
||||||
|
// triggers when a the ad has started to load
|
||||||
|
event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface IATBannerEvents: IHCommonEvents
|
||||||
|
{
|
||||||
|
// triggers when a banner ad generates an impression
|
||||||
|
event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||||
|
|
||||||
|
// triggers when the user clicks a banner ad
|
||||||
|
event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
|
||||||
|
// triggers when the ad refreshes
|
||||||
|
event EventHandler<ATAdEventArgs> onAdAutoRefreshEvent;
|
||||||
|
|
||||||
|
// triggers when the ad fails to auto refresh
|
||||||
|
event EventHandler<ATAdErrorEventArgs> onAdAutoRefreshFailureEvent;
|
||||||
|
|
||||||
|
// triggers when the banner ad is closed
|
||||||
|
event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
|
||||||
|
// triggers when the users closes the ad via the button
|
||||||
|
event EventHandler<ATAdEventArgs> onAdCloseButtonTappedEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IATInterstitialAdEvents : IHCommonEvents
|
||||||
|
{
|
||||||
|
// called when the ad is shown
|
||||||
|
event EventHandler<ATAdEventArgs> onAdShowEvent;
|
||||||
|
|
||||||
|
// called if the ad has failed to be shown
|
||||||
|
event EventHandler<ATAdErrorEventArgs> onAdShowFailureEvent;
|
||||||
|
|
||||||
|
// called when the ad is closed
|
||||||
|
event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
|
||||||
|
// called when an user has clicked an ad
|
||||||
|
event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
|
||||||
|
// called when a video ad has started playing
|
||||||
|
event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
|
||||||
|
// called if an ad video has failed to be displayed
|
||||||
|
event EventHandler<ATAdErrorEventArgs> onAdVideoFailureEvent;
|
||||||
|
|
||||||
|
// called when ad video has finished
|
||||||
|
event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IATNativeAdEvents : IHCommonEvents
|
||||||
|
{
|
||||||
|
// triggers when the ad generates an impression
|
||||||
|
event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||||
|
|
||||||
|
// triggers when the user clicks the ad
|
||||||
|
event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
|
||||||
|
// triggers when the ad video starts
|
||||||
|
event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
|
||||||
|
// triggers when the ad video ends
|
||||||
|
event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
|
||||||
|
// triggers if the ad progresses
|
||||||
|
event EventHandler<ATAdProgressEventArgs> onAdVideoProgressEvent;
|
||||||
|
|
||||||
|
// triggers when the ad is closed
|
||||||
|
event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IATRewardedVideoEvents : IHCommonEvents
|
||||||
|
{
|
||||||
|
// triggers on video start
|
||||||
|
event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
|
||||||
|
// triggers on video end
|
||||||
|
event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
|
||||||
|
// triggers if the video fails to play
|
||||||
|
event EventHandler<ATAdErrorEventArgs> onAdVideoFailureEvent;
|
||||||
|
|
||||||
|
// triggers when the user has closed the ad
|
||||||
|
event EventHandler<ATAdRewardEventArgs> onAdVideoCloseEvent;
|
||||||
|
|
||||||
|
// triggers when the user has clicked the ad
|
||||||
|
event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
|
||||||
|
// triggers when the user has finsihed watching the ad and should be rewarded
|
||||||
|
event EventHandler<ATAdEventArgs> onRewardEvent;
|
||||||
|
|
||||||
|
event EventHandler<ATAdEventArgs> onPlayAgainStart;
|
||||||
|
|
||||||
|
event EventHandler<ATAdEventArgs> onPlayAgainEnd;
|
||||||
|
|
||||||
|
event EventHandler<ATAdErrorEventArgs> onPlayAgainFailure;
|
||||||
|
|
||||||
|
event EventHandler<ATAdEventArgs> onPlayAgainClick;
|
||||||
|
|
||||||
|
event EventHandler<ATAdEventArgs> onPlayAgainReward;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IATSplashEvents : IHCommonEvents
|
||||||
|
{
|
||||||
|
// called when the ad is shown
|
||||||
|
event EventHandler<ATAdEventArgs> onAdShowEvent;
|
||||||
|
|
||||||
|
// called if the ad has failed to be shown
|
||||||
|
event EventHandler<ATAdErrorEventArgs> onAdShowFailureEvent;
|
||||||
|
|
||||||
|
// called when the ad is closed
|
||||||
|
event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
|
||||||
|
// called when an user has clicked an ad
|
||||||
|
event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
|
||||||
|
event EventHandler<ATAdEventArgs> onAdLoadTimeoutEvent;
|
||||||
|
event EventHandler<ATAdEventArgs> onDeeplinkEvent;
|
||||||
|
event EventHandler<ATAdEventArgs> onDownloadConfirmEvent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1873e4bb153b945a18427021948855ea
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Reflection;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using AnyThinkAds.Common;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATBannerAdLoadingExtra
|
||||||
|
{
|
||||||
|
public static readonly string kATBannerAdLoadingExtraBannerAdSize = "banner_ad_size";
|
||||||
|
public static readonly string kATBannerAdLoadingExtraBannerAdSizeStruct = "banner_ad_size_struct";
|
||||||
|
public static readonly string kATBannerAdSizeUsesPixelFlagKey = "uses_pixel";
|
||||||
|
public static readonly string kATBannerAdShowingPisitionTop = "top";
|
||||||
|
public static readonly string kATBannerAdShowingPisitionBottom = "bottom";
|
||||||
|
|
||||||
|
//Deprecated in v5.7.3
|
||||||
|
public static readonly string kATBannerAdLoadingExtraInlineAdaptiveWidth = "inline_adaptive_width";
|
||||||
|
public static readonly string kATBannerAdLoadingExtraInlineAdaptiveOrientation = "inline_adaptive_orientation";
|
||||||
|
public static readonly int kATBannerAdLoadingExtraInlineAdaptiveOrientationCurrent = 0;
|
||||||
|
public static readonly int kATBannerAdLoadingExtraInlineAdaptiveOrientationPortrait = 1;
|
||||||
|
public static readonly int kATBannerAdLoadingExtraInlineAdaptiveOrientationLandscape = 2;
|
||||||
|
//Deprecated in v5.7.3
|
||||||
|
|
||||||
|
public static readonly string kATBannerAdLoadingExtraAdaptiveWidth = "adaptive_width";
|
||||||
|
public static readonly string kATBannerAdLoadingExtraAdaptiveOrientation = "adaptive_orientation";
|
||||||
|
public static readonly int kATBannerAdLoadingExtraAdaptiveOrientationCurrent = 0;
|
||||||
|
public static readonly int kATBannerAdLoadingExtraAdaptiveOrientationPortrait = 1;
|
||||||
|
public static readonly int kATBannerAdLoadingExtraAdaptiveOrientationLandscape = 2;
|
||||||
|
|
||||||
|
}
|
||||||
|
public class ATBannerAd
|
||||||
|
{
|
||||||
|
private static readonly ATBannerAd instance = new ATBannerAd();
|
||||||
|
public IATBannerAdClient client;
|
||||||
|
|
||||||
|
private ATBannerAd()
|
||||||
|
{
|
||||||
|
client = GetATBannerAdClient();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ATBannerAd Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
API
|
||||||
|
*/
|
||||||
|
public void loadBannerAd(string placementId, Dictionary<string,object> pairs)
|
||||||
|
{
|
||||||
|
if (pairs != null && pairs.ContainsKey(ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSize))
|
||||||
|
{
|
||||||
|
client.loadBannerAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
else if (pairs != null && pairs.ContainsKey(ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSizeStruct))
|
||||||
|
{
|
||||||
|
ATSize size = (ATSize)(pairs[ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSizeStruct]);
|
||||||
|
pairs.Add(ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSize, size.width + "x" + size.height);
|
||||||
|
pairs.Add(ATBannerAdLoadingExtra.kATBannerAdSizeUsesPixelFlagKey, size.usesPixel);
|
||||||
|
|
||||||
|
//Dictionary<string, object> newPaires = new Dictionary<string, object> { { ATBannerAdLoadingExtra.kATBannerAdLoadingExtraBannerAdSize, size.width + "x" + size.height }, { ATBannerAdLoadingExtra.kATBannerAdSizeUsesPixelFlagKey, size.usesPixel } };
|
||||||
|
client.loadBannerAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
client.loadBannerAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public string checkAdStatus(string placementId)
|
||||||
|
{
|
||||||
|
return client.checkAdStatus(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string getValidAdCaches(string placementId)
|
||||||
|
{
|
||||||
|
return client.getValidAdCaches(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void showBannerAd(string placementId, ATRect rect)
|
||||||
|
{
|
||||||
|
client.showBannerAd(placementId, rect, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showBannerAd(string placementId, ATRect rect, Dictionary<string,string> pairs)
|
||||||
|
{
|
||||||
|
client.showBannerAd(placementId, rect, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showBannerAd(string placementId, string position)
|
||||||
|
{
|
||||||
|
client.showBannerAd(placementId, position, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showBannerAd(string placementId, string position, Dictionary<string,string> pairs)
|
||||||
|
{
|
||||||
|
client.showBannerAd(placementId, position, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showBannerAd(string placementId)
|
||||||
|
{
|
||||||
|
client.showBannerAd(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hideBannerAd(string placementId)
|
||||||
|
{
|
||||||
|
client.hideBannerAd(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cleanBannerAd(string placementId)
|
||||||
|
{
|
||||||
|
client.cleanBannerAd(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IATBannerAdClient GetATBannerAdClient()
|
||||||
|
{
|
||||||
|
return AnyThinkAds.ATAdsClientFactory.BuildBannerAdClient();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6a3de7186fc0c4769b4be98aa9d6dd2b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 14409d00636a347a38d6c005ec2b104c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,189 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATCallbackInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
public readonly int network_firm_id;
|
||||||
|
public readonly string adsource_id;
|
||||||
|
public readonly int adsource_index;
|
||||||
|
public readonly double adsource_price;
|
||||||
|
public readonly int adsource_isheaderbidding;
|
||||||
|
|
||||||
|
public readonly string id;
|
||||||
|
public readonly double publisher_revenue;
|
||||||
|
public readonly string currency;
|
||||||
|
public readonly string country;
|
||||||
|
public readonly string adunit_id;
|
||||||
|
|
||||||
|
public readonly string adunit_format;
|
||||||
|
public readonly string precision;
|
||||||
|
public readonly string network_type;
|
||||||
|
public readonly string network_placement_id;
|
||||||
|
public readonly int ecpm_level;
|
||||||
|
|
||||||
|
public readonly int segment_id;
|
||||||
|
public readonly string scenario_id;
|
||||||
|
public readonly string scenario_reward_name;
|
||||||
|
public readonly int scenario_reward_number;
|
||||||
|
|
||||||
|
public readonly string sub_channel;
|
||||||
|
public readonly string channel;
|
||||||
|
public readonly Dictionary<string, object> custom_rule;
|
||||||
|
|
||||||
|
public readonly Dictionary<string, object> ext_info;
|
||||||
|
public readonly Dictionary<string, object> user_load_extra_data;
|
||||||
|
public readonly int abtest_id;
|
||||||
|
|
||||||
|
public readonly string reward_custom_data;
|
||||||
|
public readonly int placement_type;
|
||||||
|
public readonly string shared_placement_id;
|
||||||
|
public readonly string bid_floor;
|
||||||
|
public readonly int dismiss_type;
|
||||||
|
public readonly int ad_source_type;
|
||||||
|
public readonly string ad_source_custom_ext;
|
||||||
|
public readonly string network_name;
|
||||||
|
public readonly string show_custom_ext;
|
||||||
|
public readonly string e_c;
|
||||||
|
public readonly int s_id;
|
||||||
|
|
||||||
|
private string callbackJson;
|
||||||
|
|
||||||
|
public ATCallbackInfo(string callbackJson)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.callbackJson = callbackJson;
|
||||||
|
|
||||||
|
|
||||||
|
JsonData jsonData = JsonMapper.ToObject(callbackJson);
|
||||||
|
|
||||||
|
network_firm_id = int.Parse(jsonData.ContainsKey("network_firm_id") ? jsonData["network_firm_id"].ToString() : "0");
|
||||||
|
adsource_id = jsonData.ContainsKey("adsource_id") ? (string)jsonData["adsource_id"] : "";
|
||||||
|
adsource_index = int.Parse(jsonData.ContainsKey("adsource_index") ? jsonData["adsource_index"].ToString() : "-1");
|
||||||
|
adsource_price = double.Parse(jsonData.ContainsKey("adsource_price") ? jsonData["adsource_price"].ToString() : "0");
|
||||||
|
|
||||||
|
adsource_isheaderbidding = 0;
|
||||||
|
if (jsonData.ContainsKey("adsource_isheaderbidding")) {
|
||||||
|
adsource_isheaderbidding = int.Parse(jsonData.ContainsKey("adsource_isheaderbidding") ? jsonData["adsource_isheaderbidding"].ToString() : "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
id = jsonData.ContainsKey("id") ? (string)jsonData["id"] : "";
|
||||||
|
publisher_revenue = double.Parse(jsonData.ContainsKey("publisher_revenue") ? jsonData["publisher_revenue"].ToString() : "0");
|
||||||
|
currency = jsonData.ContainsKey("currency") ? (string)jsonData["currency"] : "";
|
||||||
|
country = jsonData.ContainsKey("country") ? (string)jsonData["country"] : "";
|
||||||
|
|
||||||
|
adunit_format = jsonData.ContainsKey("adunit_format") ? (string)jsonData["adunit_format"] : "";
|
||||||
|
adunit_id = jsonData.ContainsKey("adunit_id") ? (string)jsonData["adunit_id"] : "";
|
||||||
|
|
||||||
|
precision = jsonData.ContainsKey("precision") ? (string)jsonData["precision"] : "";
|
||||||
|
|
||||||
|
network_type = jsonData.ContainsKey("network_type") ? (string)jsonData["network_type"] : "";
|
||||||
|
|
||||||
|
network_placement_id = jsonData.ContainsKey("network_placement_id") ? (string)jsonData["network_placement_id"] : "";
|
||||||
|
ecpm_level = int.Parse(jsonData.ContainsKey("ecpm_level") ? jsonData["ecpm_level"].ToString() : "0");
|
||||||
|
abtest_id = int.Parse(jsonData.ContainsKey("abtest_id") ? jsonData["abtest_id"].ToString() : "0");
|
||||||
|
segment_id = int.Parse(jsonData.ContainsKey("segment_id") ? jsonData["segment_id"].ToString() : "0");
|
||||||
|
scenario_id = jsonData.ContainsKey("scenario_id") ? (string)jsonData["scenario_id"] : "";// RewardVideo & Interstitial
|
||||||
|
|
||||||
|
if (jsonData.ContainsKey("user_load_extra_data")) {
|
||||||
|
user_load_extra_data = JsonMapper.ToObject<Dictionary<string, object>>(jsonData["user_load_extra_data"].ToJson());
|
||||||
|
}
|
||||||
|
|
||||||
|
scenario_reward_name = jsonData.ContainsKey("scenario_reward_name") ? (string)jsonData["scenario_reward_name"] : "";
|
||||||
|
scenario_reward_number = int.Parse(jsonData.ContainsKey("scenario_reward_number") ? jsonData["scenario_reward_number"].ToString() : "0");
|
||||||
|
|
||||||
|
channel = jsonData.ContainsKey("channel") ? (string)jsonData["channel"] : "";
|
||||||
|
sub_channel = jsonData.ContainsKey("sub_channel") ? (string)jsonData["sub_channel"] : "";
|
||||||
|
custom_rule = jsonData.ContainsKey("custom_rule") ? JsonMapper.ToObject<Dictionary<string, object>>(jsonData["custom_rule"].ToJson()) : null;
|
||||||
|
ext_info = jsonData.ContainsKey("ext_info") ? JsonMapper.ToObject<Dictionary<string, object>>(jsonData["ext_info"].ToJson()) : null;
|
||||||
|
|
||||||
|
reward_custom_data = jsonData.ContainsKey("reward_custom_data") ? (string)jsonData["reward_custom_data"] : "";
|
||||||
|
|
||||||
|
placement_type = int.Parse(jsonData.ContainsKey("placement_type") ? jsonData["placement_type"].ToString() : "0");
|
||||||
|
shared_placement_id = jsonData.ContainsKey("shared_placement_id") ? jsonData["shared_placement_id"].ToString() : "";
|
||||||
|
bid_floor = jsonData.ContainsKey("bid_floor") ? jsonData["bid_floor"].ToString() : "";
|
||||||
|
dismiss_type = int.Parse(jsonData.ContainsKey("dismiss_type") ? jsonData["dismiss_type"].ToString() : "0");
|
||||||
|
ad_source_type = int.Parse(jsonData.ContainsKey("ad_source_type") ? jsonData["ad_source_type"].ToString() : "0");
|
||||||
|
ad_source_custom_ext = jsonData.ContainsKey("ad_source_custom_ext") ? jsonData["ad_source_custom_ext"].ToString() : "";
|
||||||
|
network_name = jsonData.ContainsKey("network_name") ? jsonData["network_name"].ToString() : "";
|
||||||
|
show_custom_ext = jsonData.ContainsKey("show_custom_ext") ? jsonData["show_custom_ext"].ToString() : "";
|
||||||
|
e_c = jsonData.ContainsKey("e_c") ? jsonData["e_c"].ToString() : "";
|
||||||
|
s_id = int.Parse(jsonData.ContainsKey("s_id") ? jsonData["s_id"].ToString() : "0");
|
||||||
|
}
|
||||||
|
catch (System.Exception e) {
|
||||||
|
System.Console.WriteLine("Exception caught: {0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string getOriginJSONString()
|
||||||
|
{
|
||||||
|
return callbackJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, object> toAdsourceDictionary()
|
||||||
|
{
|
||||||
|
Dictionary<string, object> dataDictionary = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
dataDictionary.Add("adsource_id", adsource_id);
|
||||||
|
dataDictionary.Add("adsource_price", adsource_price);
|
||||||
|
dataDictionary.Add("adunit_id", adunit_id);
|
||||||
|
dataDictionary.Add("currency", currency);
|
||||||
|
dataDictionary.Add("network_firm_id",network_firm_id);
|
||||||
|
dataDictionary.Add("network_placement_id",network_placement_id);
|
||||||
|
return dataDictionary;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, object> toDictionary()
|
||||||
|
{
|
||||||
|
Dictionary<string, object> dataDictionary = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
dataDictionary.Add("network_firm_id",network_firm_id);
|
||||||
|
dataDictionary.Add("adsource_id", adsource_id);
|
||||||
|
dataDictionary.Add("adsource_index", adsource_index);
|
||||||
|
dataDictionary.Add("adsource_price", adsource_price);
|
||||||
|
dataDictionary.Add("adsource_isheaderbidding", adsource_isheaderbidding);
|
||||||
|
dataDictionary.Add("id", id);
|
||||||
|
dataDictionary.Add("publisher_revenue", publisher_revenue);
|
||||||
|
dataDictionary.Add("currency", currency);
|
||||||
|
dataDictionary.Add("country", country);
|
||||||
|
dataDictionary.Add("adunit_id", adunit_id);
|
||||||
|
dataDictionary.Add("adunit_format", adunit_format);
|
||||||
|
dataDictionary.Add("precision", precision);
|
||||||
|
dataDictionary.Add("network_type", network_type);
|
||||||
|
dataDictionary.Add("network_placement_id",network_placement_id);
|
||||||
|
dataDictionary.Add("ecpm_level", ecpm_level);
|
||||||
|
dataDictionary.Add("segment_id", segment_id);
|
||||||
|
dataDictionary.Add("scenario_id", scenario_id);
|
||||||
|
dataDictionary.Add("user_load_extra_data", user_load_extra_data);
|
||||||
|
dataDictionary.Add("scenario_reward_name", scenario_reward_name);
|
||||||
|
dataDictionary.Add("scenario_reward_number", scenario_reward_number);
|
||||||
|
dataDictionary.Add("abtest_id", abtest_id);
|
||||||
|
|
||||||
|
dataDictionary.Add("sub_channel", sub_channel);
|
||||||
|
dataDictionary.Add("channel", channel);
|
||||||
|
dataDictionary.Add("custom_rule", custom_rule);
|
||||||
|
dataDictionary.Add("ext_info", ext_info);
|
||||||
|
dataDictionary.Add("reward_custom_data", reward_custom_data);
|
||||||
|
dataDictionary.Add("placement_type", placement_type);
|
||||||
|
dataDictionary.Add("shared_placement_id", shared_placement_id);
|
||||||
|
dataDictionary.Add("bid_floor", bid_floor);
|
||||||
|
dataDictionary.Add("dismiss_type", dismiss_type);
|
||||||
|
dataDictionary.Add("ad_source_type", ad_source_type);
|
||||||
|
dataDictionary.Add("ad_source_custom_ext", ad_source_custom_ext);
|
||||||
|
dataDictionary.Add("network_name", network_name);
|
||||||
|
dataDictionary.Add("show_custom_ext", show_custom_ext);
|
||||||
|
dataDictionary.Add("e_c", e_c);
|
||||||
|
dataDictionary.Add("s_id", s_id);
|
||||||
|
|
||||||
|
return dataDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8829d744b2f8b445495d55152f9ffc35
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 81be0ce7c637b4a7098f6c0d53904a2e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6bbee7503778a43b0b9120f7a550347a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 12983d140829a46f08eeaf46eb36280f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Reflection;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using AnyThinkAds.Common;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATInterstitialAdLoadingExtra
|
||||||
|
{
|
||||||
|
public static readonly string kATInterstitialAdLoadingExtraInterstitialAdSize = "interstitial_ad_size";
|
||||||
|
public static readonly string kATInterstitialAdLoadingExtraInterstitialAdSizeStruct = "interstitial_ad_size_struct";
|
||||||
|
public static readonly string kATInterstitialAdSizeUsesPixelFlagKey = "uses_pixel";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ATInterstitialAd
|
||||||
|
{
|
||||||
|
private static readonly ATInterstitialAd instance = new ATInterstitialAd();
|
||||||
|
public IATInterstitialAdClient client;
|
||||||
|
|
||||||
|
private ATInterstitialAd()
|
||||||
|
{
|
||||||
|
client = GetATInterstitialAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ATInterstitialAd Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadInterstitialAd(string placementId, Dictionary<string,object> pairs)
|
||||||
|
{
|
||||||
|
if (pairs != null && pairs.ContainsKey(ATInterstitialAdLoadingExtra.kATInterstitialAdLoadingExtraInterstitialAdSizeStruct))
|
||||||
|
{
|
||||||
|
ATSize size = (ATSize)(pairs[ATInterstitialAdLoadingExtra.kATInterstitialAdLoadingExtraInterstitialAdSizeStruct]);
|
||||||
|
pairs.Add(ATInterstitialAdLoadingExtra.kATInterstitialAdLoadingExtraInterstitialAdSize, size.width + "x" + size.height);
|
||||||
|
pairs.Add(ATInterstitialAdLoadingExtra.kATInterstitialAdSizeUsesPixelFlagKey, size.usesPixel);
|
||||||
|
|
||||||
|
client.loadInterstitialAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
client.loadInterstitialAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool hasInterstitialAdReady(string placementId)
|
||||||
|
{
|
||||||
|
return client.hasInterstitialAdReady(placementId);
|
||||||
|
}
|
||||||
|
public void entryScenarioWithPlacementID(string placementId, string scenarioID)
|
||||||
|
{
|
||||||
|
client.entryScenarioWithPlacementID(placementId,scenarioID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string checkAdStatus(string placementId)
|
||||||
|
{
|
||||||
|
return client.checkAdStatus(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string getValidAdCaches(string placementId)
|
||||||
|
{
|
||||||
|
return client.getValidAdCaches(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showInterstitialAd(string placementId)
|
||||||
|
{
|
||||||
|
client.showInterstitialAd(placementId, JsonMapper.ToJson(new Dictionary<string, string>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showInterstitialAd(string placementId, Dictionary<string, string> pairs)
|
||||||
|
{
|
||||||
|
client.showInterstitialAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IATInterstitialAdClient GetATInterstitialAdClient()
|
||||||
|
{
|
||||||
|
return AnyThinkAds.ATAdsClientFactory.BuildInterstitialAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5156b3afa9c234defa31b9e43c21309c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public interface ATInterstitialAdListener
|
||||||
|
{
|
||||||
|
/***
|
||||||
|
* 加载广告成功(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
* @param placementId 广告位id
|
||||||
|
*/
|
||||||
|
void onInterstitialAdLoad(string placementId);
|
||||||
|
/***
|
||||||
|
* 加载广告失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
* @param placementId 广告位id
|
||||||
|
* @param code 错误码
|
||||||
|
* @param message 错误信息
|
||||||
|
*/
|
||||||
|
void onInterstitialAdLoadFail(string placementId, string code, string message);
|
||||||
|
/***
|
||||||
|
* 广告展示(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
* @param placementId 广告位id
|
||||||
|
*/
|
||||||
|
void onInterstitialAdShow(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/***
|
||||||
|
* 广告展示失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
* @param placementId 广告位id
|
||||||
|
*/
|
||||||
|
void onInterstitialAdFailedToShow(string placementId);
|
||||||
|
/***
|
||||||
|
* 广告关闭(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
* @param placementId 广告位id
|
||||||
|
*/
|
||||||
|
void onInterstitialAdClose(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/***
|
||||||
|
* 广告点击(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
* @param placementId 广告位id
|
||||||
|
*/
|
||||||
|
void onInterstitialAdClick(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/**
|
||||||
|
*广告开始播放视频(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
* @param placementId 广告位id
|
||||||
|
*/
|
||||||
|
void onInterstitialAdStartPlayingVideo(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/**
|
||||||
|
*广告视频播放结束(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
* @param placementId 广告位id
|
||||||
|
*/
|
||||||
|
void onInterstitialAdEndPlayingVideo(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/**
|
||||||
|
*广告播放视频失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
* @param placementId 广告位id
|
||||||
|
* @param code 错误码
|
||||||
|
* @param message 错误信息
|
||||||
|
*/
|
||||||
|
void onInterstitialAdFailedToPlayVideo(string placementId, string code, string message);
|
||||||
|
|
||||||
|
void startLoadingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void finishLoadingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void failToLoadADSource(string placementId,ATCallbackInfo callbackInfo,string code, string message);
|
||||||
|
|
||||||
|
void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void finishBiddingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void failBiddingADSource(string placementId,ATCallbackInfo callbackInfo,string code, string message);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0d331dade788243748d28c8e34b8f7f5
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Reflection;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using AnyThinkAds.Common;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
|
||||||
|
public class ATInterstitialAutoAd
|
||||||
|
{
|
||||||
|
private static readonly ATInterstitialAutoAd instance = new ATInterstitialAutoAd();
|
||||||
|
public IATInterstitialAdClient client;
|
||||||
|
|
||||||
|
private ATInterstitialAutoAd()
|
||||||
|
{
|
||||||
|
client = GetATInterstitialAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ATInterstitialAutoAd Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IATInterstitialAdClient GetATInterstitialAdClient()
|
||||||
|
{
|
||||||
|
return AnyThinkAds.ATAdsClientFactory.BuildInterstitialAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// auto
|
||||||
|
|
||||||
|
public void addAutoLoadAdPlacementID(string[] placementIDList)
|
||||||
|
{
|
||||||
|
client.addAutoLoadAdPlacementID(placementIDList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAutoLoadAdPlacementID(string[] placementIDList)
|
||||||
|
{
|
||||||
|
if (placementIDList != null && placementIDList.Length > 0)
|
||||||
|
{
|
||||||
|
string placementIDListString = JsonMapper.ToJson(placementIDList);
|
||||||
|
client.removeAutoLoadAdPlacementID(placementIDListString);
|
||||||
|
Debug.Log("removeAutoLoadAdPlacementID, placementIDList === " + placementIDListString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("removeAutoLoadAdPlacementID, placementIDList = null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string checkAutoAdStatus(string placementId)
|
||||||
|
{
|
||||||
|
return client.checkAutoAdStatus(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool autoLoadInterstitialAdReadyForPlacementID(string placementId)
|
||||||
|
{
|
||||||
|
return client.autoLoadInterstitialAdReadyForPlacementID(placementId);
|
||||||
|
}
|
||||||
|
public string getAutoValidAdCaches(string placementId)
|
||||||
|
{
|
||||||
|
return client.getAutoValidAdCaches(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoLocalExtra(string placementId, Dictionary<string,string> pairs)
|
||||||
|
{
|
||||||
|
client.setAutoLocalExtra(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID)
|
||||||
|
{
|
||||||
|
client.entryAutoAdScenarioWithPlacementID(placementId, scenarioID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAutoAd(string placementId)
|
||||||
|
{
|
||||||
|
client.showAutoAd(placementId, JsonMapper.ToJson(new Dictionary<string, string>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAutoAd(string placementId, Dictionary<string, string> pairs)
|
||||||
|
{
|
||||||
|
client.showAutoAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 53db171e8bdb94471b37886d51adb5d3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Reflection;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using AnyThinkAds.Common;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATNativeAdLoadingExtra
|
||||||
|
{
|
||||||
|
public static readonly string kATNativeAdLoadingExtraNativeAdSizeStruct = "native_ad_size_struct";
|
||||||
|
public static readonly string kATNativeAdLoadingExtraNativeAdSize = "native_ad_size";
|
||||||
|
public static readonly string kATNativeAdSizeUsesPixelFlagKey = "uses_pixel";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ATNativeAd
|
||||||
|
{
|
||||||
|
|
||||||
|
private static readonly ATNativeAd instance = new ATNativeAd();
|
||||||
|
public IATNativeAdClient client;
|
||||||
|
|
||||||
|
public ATNativeAd(){
|
||||||
|
client = GetATNativeAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ATNativeAd Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void loadNativeAd(string placementId, Dictionary<String,object> pairs){
|
||||||
|
if (pairs != null && pairs.ContainsKey(ATNativeAdLoadingExtra.kATNativeAdLoadingExtraNativeAdSizeStruct))
|
||||||
|
{
|
||||||
|
ATSize size = (ATSize)(pairs[ATNativeAdLoadingExtra.kATNativeAdLoadingExtraNativeAdSizeStruct]);
|
||||||
|
pairs.Add(ATNativeAdLoadingExtra.kATNativeAdLoadingExtraNativeAdSize, size.width + "x" + size.height);
|
||||||
|
pairs.Add(ATNativeAdLoadingExtra.kATNativeAdSizeUsesPixelFlagKey, size.usesPixel);
|
||||||
|
}
|
||||||
|
client.loadNativeAd(placementId,JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool hasAdReady(string placementId){
|
||||||
|
return client.hasAdReady(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string checkAdStatus(string placementId)
|
||||||
|
{
|
||||||
|
return client.checkAdStatus(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string getValidAdCaches(string placementId)
|
||||||
|
{
|
||||||
|
return client.getValidAdCaches(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void entryScenarioWithPlacementID(string placementId, string scenarioID)
|
||||||
|
{
|
||||||
|
client.entryScenarioWithPlacementID(placementId,scenarioID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderAdToScene(string placementId, ATNativeAdView anyThinkNativeAdView){
|
||||||
|
client.renderAdToScene(placementId, anyThinkNativeAdView, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderAdToScene(string placementId, ATNativeAdView anyThinkNativeAdView, Dictionary<string,string> pairs){
|
||||||
|
client.renderAdToScene(placementId, anyThinkNativeAdView, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cleanAdView(string placementId, ATNativeAdView anyThinkNativeAdView){
|
||||||
|
client.cleanAdView(placementId, anyThinkNativeAdView);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onApplicationForces(string placementId, ATNativeAdView anyThinkNativeAdView){
|
||||||
|
client.onApplicationForces(placementId, anyThinkNativeAdView);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onApplicationPasue(string placementId, ATNativeAdView anyThinkNativeAdView){
|
||||||
|
client.onApplicationPasue(placementId, anyThinkNativeAdView);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cleanCache(string placementId){
|
||||||
|
client.cleanCache(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public IATNativeAdClient GetATNativeAdClient()
|
||||||
|
{
|
||||||
|
return AnyThinkAds.ATAdsClientFactory.BuildNativeAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ff4a301239a2c463eb38ee921c41de3b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4af6ae003832148048195c2a7e804588
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATNativeAdView
|
||||||
|
{
|
||||||
|
public ATNativeConfig config;
|
||||||
|
public ATNativeAdView(ATNativeConfig config)
|
||||||
|
{
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string parentKey = "parent";
|
||||||
|
private string appIconKey = "appIcon";
|
||||||
|
private string mainImageKey = "mainImage";
|
||||||
|
private string titleKey = "title";
|
||||||
|
private string descKey = "desc";
|
||||||
|
private string adLogoKey = "adLogo";
|
||||||
|
private string ctaButtonKey = "cta";
|
||||||
|
private string dislikeButtonKey = "dislike";
|
||||||
|
private string elementsKey = "elements";
|
||||||
|
|
||||||
|
public string toJSON()
|
||||||
|
{
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.Append("{");
|
||||||
|
if(config.parentProperty != null)
|
||||||
|
{
|
||||||
|
builder.Append("\"").Append(parentKey).Append("\"");
|
||||||
|
builder.Append(":");
|
||||||
|
builder.Append(JsonUtility.ToJson(config.parentProperty));
|
||||||
|
builder.Append(",");
|
||||||
|
}
|
||||||
|
if(config.appIconProperty != null){
|
||||||
|
builder.Append("\"").Append(appIconKey).Append("\"");
|
||||||
|
builder.Append(":");
|
||||||
|
builder.Append(JsonUtility.ToJson(config.appIconProperty));
|
||||||
|
builder.Append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.mainImageProperty != null)
|
||||||
|
{
|
||||||
|
builder.Append("\"").Append(mainImageKey).Append("\"");
|
||||||
|
builder.Append(":");
|
||||||
|
builder.Append(JsonUtility.ToJson(config.mainImageProperty));
|
||||||
|
builder.Append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.titleProperty != null)
|
||||||
|
{
|
||||||
|
builder.Append("\"").Append(titleKey).Append("\"");
|
||||||
|
builder.Append(":");
|
||||||
|
builder.Append(JsonUtility.ToJson(config.titleProperty));
|
||||||
|
builder.Append(",");
|
||||||
|
}
|
||||||
|
if(config.descProperty != null)
|
||||||
|
{
|
||||||
|
builder.Append("\"").Append(descKey).Append("\"");
|
||||||
|
builder.Append(":");
|
||||||
|
builder.Append(JsonUtility.ToJson(config.descProperty));
|
||||||
|
builder.Append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.adLogoProperty != null)
|
||||||
|
{
|
||||||
|
builder.Append("\"").Append(adLogoKey).Append("\"");
|
||||||
|
builder.Append(":");
|
||||||
|
builder.Append(JsonUtility.ToJson(config.adLogoProperty));
|
||||||
|
builder.Append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.ctaButtonProperty != null)
|
||||||
|
{
|
||||||
|
builder.Append("\"").Append(ctaButtonKey).Append("\"");
|
||||||
|
builder.Append(":");
|
||||||
|
builder.Append(JsonUtility.ToJson(config.ctaButtonProperty));
|
||||||
|
builder.Append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.dislikeButtonProperty != null)
|
||||||
|
{
|
||||||
|
builder.Append("\"").Append(dislikeButtonKey).Append("\"");
|
||||||
|
builder.Append(":");
|
||||||
|
builder.Append(JsonUtility.ToJson(config.dislikeButtonProperty));
|
||||||
|
builder.Append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.elementsProperty != null)
|
||||||
|
{
|
||||||
|
builder.Append("\"").Append(elementsKey).Append("\"");
|
||||||
|
builder.Append(":");
|
||||||
|
builder.Append(JsonUtility.ToJson(config.elementsProperty));
|
||||||
|
}
|
||||||
|
|
||||||
|
string temp = builder.ToString();
|
||||||
|
|
||||||
|
if (temp.EndsWith(","))
|
||||||
|
{
|
||||||
|
temp = temp.Substring(0, temp.Length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = temp + "}";
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c5dfbc036b5454843865c420afe58802
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Reflection;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using AnyThinkAds.Common;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATNativeBannerAdShowingExtra
|
||||||
|
{
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraBackgroundColor = "background_color";
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraAutorefreshInterval = "autorefresh_interval";
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraHideCloseButtonFlag = "hide_close_button_flag";
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraCTAButtonBackgroundColor = "cta_button_background_color";
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraCTATextColor = "cta_button_title_color";//of type string, example:#3e2f10
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraCTATextFont = "cta_text_font";//of type double
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraTitleColor = "title_color";
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraTitleFont = "title_font";
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraTextColor = "text_color";
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraTextFont = "text_font";
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraAdvertiserTextFont = "sponsor_text_font";
|
||||||
|
public static readonly string kATNativeBannerAdShowingExtraAdvertiserTextColor = "spnosor_text_color";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ATNativeBannerAd
|
||||||
|
{
|
||||||
|
private static readonly ATNativeBannerAd instance = new ATNativeBannerAd();
|
||||||
|
public IATNativeBannerAdClient client;
|
||||||
|
public ATNativeBannerAd() {
|
||||||
|
client = GetATNativeBannerAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ATNativeBannerAd Instance {
|
||||||
|
get {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadAd(string placementId, Dictionary<String, String> pairs) {
|
||||||
|
Debug.Log("ATNativeBannerAd::loadAd(" + placementId + ")");
|
||||||
|
client.loadAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool adReady(string placementId) {
|
||||||
|
Debug.Log("ATNativeBannerAd::adReady(" + placementId + ")");
|
||||||
|
return client.adReady(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListener(ATNativeBannerAdListener listener) {
|
||||||
|
Debug.Log("ATNativeBannerAd::setListener");
|
||||||
|
client.setListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAd(string placementId, ATRect rect, Dictionary<string, string> pairs) {
|
||||||
|
Debug.Log("ATNativeBannerAd::showAd");
|
||||||
|
client.showAd(placementId, rect, pairs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAd(string placementId) {
|
||||||
|
Debug.Log("ATNativeBannerAd::removeAd");
|
||||||
|
client.removeAd(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IATNativeBannerAdClient GetATNativeBannerAdClient()
|
||||||
|
{
|
||||||
|
return AnyThinkAds.ATAdsClientFactory.BuildNativeBannerAdClient();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8425d877df61b4bdd9a237203df1cd6a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public interface ATNativeBannerAdListener
|
||||||
|
{
|
||||||
|
/***
|
||||||
|
* 广告请求成功(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
*/
|
||||||
|
void onAdLoaded(string placementId);
|
||||||
|
/***
|
||||||
|
* 广告请求失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
*/
|
||||||
|
void onAdLoadFail(string placementId, string code, string message);
|
||||||
|
/***
|
||||||
|
* 广告展示(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
*/
|
||||||
|
void onAdImpressed(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/**
|
||||||
|
* 广告点击(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
*/
|
||||||
|
void onAdClicked(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/**
|
||||||
|
* 广告自动刷新(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
*/
|
||||||
|
void onAdAutoRefresh(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/**
|
||||||
|
* 广告自动刷新失败(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
*/
|
||||||
|
void onAdAutoRefreshFailure(string placementId, string code, string message);
|
||||||
|
/**
|
||||||
|
* 关闭按钮被点击(内部逻辑不会移除ad view)(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
*/
|
||||||
|
void onAdCloseButtonClicked(string placementId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e6318609c7806472dabe4189668a6c0b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATNativeConfig
|
||||||
|
{
|
||||||
|
public ATNativeItemProperty parentProperty;
|
||||||
|
public ATNativeItemProperty appIconProperty;
|
||||||
|
public ATNativeItemProperty mainImageProperty;
|
||||||
|
public ATNativeItemProperty titleProperty;
|
||||||
|
public ATNativeItemProperty descProperty;
|
||||||
|
public ATNativeItemProperty adLogoProperty;
|
||||||
|
public ATNativeItemProperty ctaButtonProperty;
|
||||||
|
public ATNativeItemProperty dislikeButtonProperty;
|
||||||
|
public ATNativeItemProperty elementsProperty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d7bd4d96b427b425abe6e9acef00fe0f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
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.backgroundColor = backgroundColor;
|
||||||
|
this.textColor = textColor;
|
||||||
|
this.textSize = textSize;
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
this.usesPixel = true;
|
||||||
|
#else
|
||||||
|
this.usesPixel = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e57124f06079543f982965959cdfe0d3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int x = 0;
|
||||||
|
public int y = 0;
|
||||||
|
public int width = 0;
|
||||||
|
public int height = 0;
|
||||||
|
// public bool usesPixel = false;
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
public bool usesPixel = true;
|
||||||
|
#else
|
||||||
|
public bool usesPixel = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int width = 0;
|
||||||
|
public int height = 0;
|
||||||
|
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
public bool usesPixel = true;
|
||||||
|
#else
|
||||||
|
public bool usesPixel = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2779600e6766c4201864a4c3d8465746
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Reflection;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using AnyThinkAds.Common;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATRewardedAutoVideo
|
||||||
|
{
|
||||||
|
private static readonly ATRewardedAutoVideo instance = new ATRewardedAutoVideo();
|
||||||
|
public IATRewardedVideoAdClient client;
|
||||||
|
|
||||||
|
private ATRewardedAutoVideo()
|
||||||
|
{
|
||||||
|
client = GetATRewardedClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ATRewardedAutoVideo Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto
|
||||||
|
public void addAutoLoadAdPlacementID(string[] placementIDList)
|
||||||
|
{
|
||||||
|
client.addAutoLoadAdPlacementID(placementIDList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAutoLoadAdPlacementID(string[] placementIDList)
|
||||||
|
{
|
||||||
|
if (placementIDList != null && placementIDList.Length > 0)
|
||||||
|
{
|
||||||
|
string placementIDListString = JsonMapper.ToJson(placementIDList);
|
||||||
|
client.removeAutoLoadAdPlacementID(placementIDListString);
|
||||||
|
Debug.Log("removeAutoLoadAdPlacementID, placementIDList === " + placementIDListString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("removeAutoLoadAdPlacementID, placementIDList = null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool autoLoadRewardedVideoReadyForPlacementID(string placementId)
|
||||||
|
{
|
||||||
|
return client.autoLoadRewardedVideoReadyForPlacementID(placementId);
|
||||||
|
}
|
||||||
|
public string getAutoValidAdCaches(string placementId)
|
||||||
|
{
|
||||||
|
return client.getAutoValidAdCaches(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string checkAutoAdStatus(string placementId)
|
||||||
|
{
|
||||||
|
return client.checkAutoAdStatus(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setAutoLocalExtra(string placementId, Dictionary<string,string> pairs)
|
||||||
|
{
|
||||||
|
client.setAutoLocalExtra(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
public void entryAutoAdScenarioWithPlacementID(string placementId, string scenarioID)
|
||||||
|
{
|
||||||
|
client.entryAutoAdScenarioWithPlacementID(placementId, scenarioID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAutoAd(string placementId)
|
||||||
|
{
|
||||||
|
client.showAutoAd(placementId, JsonMapper.ToJson(new Dictionary<string, string>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAutoAd(string placementId, Dictionary<string, string> pairs)
|
||||||
|
{
|
||||||
|
client.showAutoAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IATRewardedVideoAdClient GetATRewardedClient()
|
||||||
|
{
|
||||||
|
return AnyThinkAds.ATAdsClientFactory.BuildRewardedVideoAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9b7859a96f8dd46f18bcc62fc76a371b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Reflection;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using AnyThinkAds.Common;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATRewardedVideo
|
||||||
|
{
|
||||||
|
private static readonly ATRewardedVideo instance = new ATRewardedVideo();
|
||||||
|
public IATRewardedVideoAdClient client;
|
||||||
|
|
||||||
|
private ATRewardedVideo()
|
||||||
|
{
|
||||||
|
client = GetATRewardedClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ATRewardedVideo Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void loadVideoAd(string placementId, Dictionary<string,string> pairs)
|
||||||
|
{
|
||||||
|
client.loadVideoAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool hasAdReady(string placementId)
|
||||||
|
{
|
||||||
|
return client.hasAdReady(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void entryScenarioWithPlacementID(string placementId, string scenarioID)
|
||||||
|
{
|
||||||
|
client.entryScenarioWithPlacementID(placementId,scenarioID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string checkAdStatus(string placementId)
|
||||||
|
{
|
||||||
|
return client.checkAdStatus(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string getValidAdCaches(string placementId)
|
||||||
|
{
|
||||||
|
return client.getValidAdCaches(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAd(string placementId)
|
||||||
|
{
|
||||||
|
client.showAd(placementId, JsonMapper.ToJson(new Dictionary<string, string>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAd(string placementId, Dictionary<string, string> pairs)
|
||||||
|
{
|
||||||
|
client.showAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IATRewardedVideoAdClient GetATRewardedClient()
|
||||||
|
{
|
||||||
|
return AnyThinkAds.ATAdsClientFactory.BuildRewardedVideoAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 464138f9e35214456adacd5ef4f103ff
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public interface ATRewardedVideoListener
|
||||||
|
{
|
||||||
|
/***
|
||||||
|
* The Ad load successfully (note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdLoaded(string placementId);
|
||||||
|
/***
|
||||||
|
* The Ad load fail (note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdLoadFail(string placementId,string code, string message);
|
||||||
|
/***
|
||||||
|
* The Ad play (note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdPlayStart(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/***
|
||||||
|
* The Ad play end (note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdPlayEnd(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/***
|
||||||
|
* The Ad play fail(note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
* @param code error code
|
||||||
|
* @param message error message
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdPlayFail(string placementId,string code, string message);
|
||||||
|
/**
|
||||||
|
* The Ad close(note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
* @param isReward
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdPlayClosed(string placementId,bool isReward, ATCallbackInfo callbackInfo);
|
||||||
|
/***
|
||||||
|
* The Ad click(note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdPlayClicked(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/**
|
||||||
|
* The Ad reward(note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onReward(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
|
||||||
|
void startLoadingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void finishLoadingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void failToLoadADSource(string placementId,ATCallbackInfo callbackInfo,string code, string message);
|
||||||
|
|
||||||
|
void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void finishBiddingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void failBiddingADSource(string placementId,ATCallbackInfo callbackInfo,string code, string message);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ATRewardedVideoExListener : ATRewardedVideoListener {
|
||||||
|
/***
|
||||||
|
* The Ad play again (note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdAgainPlayStart(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/***
|
||||||
|
* The Ad play end again(note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdAgainPlayEnd(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/***
|
||||||
|
* The Ad play fail again(note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdAgainPlayFail(string placementId, string code, string message);
|
||||||
|
|
||||||
|
/***
|
||||||
|
* The Ad click again(note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onRewardedVideoAdAgainPlayClicked(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
/**
|
||||||
|
* The Ad reward again(note: for Android, all callback methods are not in the main thread of Unity)
|
||||||
|
*/
|
||||||
|
void onAgainReward(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9f798faca56bf4d4e9a8aa14eb694b96
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,234 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
using AnyThinkAds.Common;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public interface ATGetUserLocationListener
|
||||||
|
{
|
||||||
|
void didGetUserLocation(int location);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ATConsentDismissListener
|
||||||
|
{
|
||||||
|
void onConsentDismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface ATGetAreaListener
|
||||||
|
{
|
||||||
|
void onArea(string area);
|
||||||
|
void onError(string message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ATSDKAPI
|
||||||
|
{
|
||||||
|
public static readonly int kATUserLocationUnknown = 0;
|
||||||
|
public static readonly int kATUserLocationInEU = 1;
|
||||||
|
public static readonly int kATUserLocationOutOfEU = 2;
|
||||||
|
|
||||||
|
public static readonly int PERSONALIZED = 0;
|
||||||
|
public static readonly int NONPERSONALIZED = 1;
|
||||||
|
public static readonly int UNKNOWN = 2;
|
||||||
|
|
||||||
|
public static readonly int AREA_GLOBAL = 0;
|
||||||
|
public static readonly int AREA_CHINESE_MAINLAND = 1;
|
||||||
|
|
||||||
|
|
||||||
|
//for android and ios
|
||||||
|
public static readonly string OS_VERSION_NAME = "os_vn";
|
||||||
|
public static readonly string OS_VERSION_CODE = "os_vc";
|
||||||
|
public static readonly string APP_PACKAGE_NAME = "package_name";
|
||||||
|
public static readonly string APP_VERSION_NAME = "app_vn";
|
||||||
|
public static readonly string APP_VERSION_CODE = "app_vc";
|
||||||
|
|
||||||
|
public static readonly string BRAND = "brand";
|
||||||
|
public static readonly string MODEL = "model";
|
||||||
|
public static readonly string DEVICE_SCREEN_SIZE = "screen";
|
||||||
|
public static readonly string MNC = "mnc";
|
||||||
|
public static readonly string MCC = "mcc";
|
||||||
|
|
||||||
|
public static readonly string LANGUAGE = "language";
|
||||||
|
public static readonly string TIMEZONE = "timezone";
|
||||||
|
public static readonly string USER_AGENT = "ua";
|
||||||
|
public static readonly string ORIENTATION = "orient";
|
||||||
|
public static readonly string NETWORK_TYPE = "network_type";
|
||||||
|
|
||||||
|
//for android
|
||||||
|
public static readonly string INSTALLER = "it_src";
|
||||||
|
public static readonly string ANDROID_ID = "android_id";
|
||||||
|
public static readonly string GAID = "gaid";
|
||||||
|
public static readonly string MAC = "mac";
|
||||||
|
public static readonly string IMEI = "imei";
|
||||||
|
public static readonly string OAID = "oaid";
|
||||||
|
|
||||||
|
//for ios
|
||||||
|
public static readonly string IDFA = "idfa";
|
||||||
|
public static readonly string IDFV = "idfv";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static readonly IATSDKAPIClient client = GetATSDKAPIClient();
|
||||||
|
|
||||||
|
public static void initSDK(string appId, string appKey)
|
||||||
|
{
|
||||||
|
client.initSDK(appId, appKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initSDK(string appId, string appKey, ATSDKInitListener listener)
|
||||||
|
{
|
||||||
|
client.initSDK(appId, appKey, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showDebuggerUI()
|
||||||
|
{
|
||||||
|
client.showDebuggerUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showDebuggerUI(string debugKey)
|
||||||
|
{
|
||||||
|
client.showDebuggerUI(debugKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setGDPRLevel(int level)
|
||||||
|
{
|
||||||
|
client.setGDPRLevel(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void getUserLocation(ATGetUserLocationListener listener)
|
||||||
|
{
|
||||||
|
client.getUserLocation(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getGDPRLevel() {
|
||||||
|
return client.getGDPRLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool isEUTraffic() {
|
||||||
|
return client.isEUTraffic();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setChannel(string channel)
|
||||||
|
{
|
||||||
|
client.setChannel(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setSubChannel(string subChannel)
|
||||||
|
{
|
||||||
|
client.setSubChannel(subChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initCustomMap(Dictionary<string, string> customMap)
|
||||||
|
{
|
||||||
|
client.initCustomMap(JsonMapper.ToJson(customMap));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCustomDataForPlacementID(Dictionary<string, string> customData, string placementID)
|
||||||
|
{
|
||||||
|
client.setCustomDataForPlacementID(JsonMapper.ToJson(customData), placementID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showGDPRAuth()
|
||||||
|
{
|
||||||
|
client.showGDPRAuth();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showGDPRConsentDialog(ATConsentDismissListener listener)
|
||||||
|
{
|
||||||
|
client.showGDPRConsentDialog(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setLogDebug(bool isDebug)
|
||||||
|
{
|
||||||
|
client.setLogDebug(isDebug);
|
||||||
|
ATLogger.IsDebug = isDebug;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addNetworkGDPRInfo(int networkType, Dictionary<string,object> dictionary)
|
||||||
|
{
|
||||||
|
client.addNetworkGDPRInfo(networkType, JsonMapper.ToJson(dictionary));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void deniedUploadDeviceInfo(string[] deniedInfo)
|
||||||
|
{
|
||||||
|
if (deniedInfo != null && deniedInfo.Length > 0)
|
||||||
|
{
|
||||||
|
string deniedString = JsonMapper.ToJson(deniedInfo);
|
||||||
|
client.deniedUploadDeviceInfo(deniedString);
|
||||||
|
Debug.Log("deniedUploadDeviceInfo, deniedInfo === " + deniedString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("deniedUploadDeviceInfo, deniedInfo = null");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IATSDKAPIClient GetATSDKAPIClient(){
|
||||||
|
Debug.Log("GetATSDKAPIClient");
|
||||||
|
return AnyThinkAds.ATAdsClientFactory.BuildSDKAPIClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setExcludeBundleIdArray(string[] bundleIds)
|
||||||
|
{
|
||||||
|
if (bundleIds != null && bundleIds.Length > 0)
|
||||||
|
{
|
||||||
|
string bundleIdsString = JsonMapper.ToJson(bundleIds);
|
||||||
|
Debug.Log("setExcludeBundleIdArray, bundleIdsString === " + bundleIdsString);
|
||||||
|
|
||||||
|
client.setExcludeBundleIdArray(bundleIdsString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("setExcludeBundleIdArray, bundleIdsString = null");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setExcludeAdSourceIdArrayForPlacementID(string placementID, string[] adSourceIds)
|
||||||
|
{
|
||||||
|
if (adSourceIds != null && adSourceIds.Length > 0)
|
||||||
|
{
|
||||||
|
string adSourceIdsString = JsonMapper.ToJson(adSourceIds);
|
||||||
|
Debug.Log("setExcludeAdSourceIdArrayForPlacementID, adSourceIdsString === " + adSourceIdsString);
|
||||||
|
|
||||||
|
client.setExcludeAdSourceIdArrayForPlacementID(placementID, adSourceIdsString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("setExcludeAdSourceIdArrayForPlacementID, adSourceIdsString = null");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setSDKArea(int area)
|
||||||
|
{
|
||||||
|
client.setSDKArea(area);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void getArea(ATGetAreaListener listener)
|
||||||
|
{
|
||||||
|
client.getArea(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setWXStatus(bool install)
|
||||||
|
{
|
||||||
|
client.setWXStatus(install);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setLocation(double longitude, double latitude)
|
||||||
|
{
|
||||||
|
client.setLocation(longitude, latitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 19984fc5417044ecfa86ae3b181eb6f7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 083fcd51a2324455fb259c1ec03c91c4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Reflection;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using AnyThinkAds.Common;
|
||||||
|
using AnyThinkAds.ThirdParty.LitJson;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public class ATSplashAdLocalExtra
|
||||||
|
{
|
||||||
|
//Only for GDT (true: open download dialog, false: download directly)
|
||||||
|
public static readonly string kATSplashAdClickConfirmStatus = "ad_click_confirm_status";
|
||||||
|
}
|
||||||
|
public class ATSplashAd
|
||||||
|
{
|
||||||
|
private static readonly ATSplashAd instance = new ATSplashAd();
|
||||||
|
public IATSplashAdClient client;
|
||||||
|
|
||||||
|
private ATSplashAd()
|
||||||
|
{
|
||||||
|
client = AnyThinkAds.ATAdsClientFactory.BuildSplashAdClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ATSplashAd Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadSplashAd(string placementId, Dictionary<string, object> pairs, int fetchAdTimeout = 5000, string defaultAdSourceConfig = "")
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
client.loadSplashAd(placementId, fetchAdTimeout, defaultAdSourceConfig, JsonMapper.ToJson(pairs));
|
||||||
|
#elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
|
||||||
|
//TODO iOS的开屏加载
|
||||||
|
pairs.Add("tolerate_timeout", fetchAdTimeout);
|
||||||
|
pairs.Add("default_adSource_config", defaultAdSourceConfig);
|
||||||
|
|
||||||
|
client.loadSplashAd(placementId, fetchAdTimeout, defaultAdSourceConfig, JsonMapper.ToJson(pairs));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showSplashAd(string placementId, Dictionary<string, object> pairs)
|
||||||
|
{
|
||||||
|
client.showSplashAd(placementId, JsonMapper.ToJson(pairs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool hasSplashAdReady(string placementId)
|
||||||
|
{
|
||||||
|
return client.hasSplashAdReady(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string checkAdStatus(string placementId)
|
||||||
|
{
|
||||||
|
return client.checkAdStatus(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string getValidAdCaches(string placementId)
|
||||||
|
{
|
||||||
|
return client.getValidAdCaches(placementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void entryScenarioWithPlacementID(string placementId, string scenarioID)
|
||||||
|
{
|
||||||
|
client.entryScenarioWithPlacementID(placementId, scenarioID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0d9c30e7d78e94fa5b00d69206cf5e6d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
///summary
|
||||||
|
///(注意:对于Android来说,所有回调方法均不在Unity的主线程)
|
||||||
|
///sumary
|
||||||
|
namespace AnyThinkAds.Api
|
||||||
|
{
|
||||||
|
public interface ATSplashAdListener
|
||||||
|
{
|
||||||
|
void onSplashAdLoad(string unitId, bool isTimeout);
|
||||||
|
|
||||||
|
void onSplashAdLoadTimeOut(string unitId);
|
||||||
|
|
||||||
|
void onSplashAdLoadFailed(string unitId, string code, string msg);
|
||||||
|
|
||||||
|
void onSplashAdShow(string unitId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void onSplashAdClick(string unitId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void onSplashAdDismiss(string unitId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void onSplashAdDeeplinkCallback(string unitId, ATCallbackInfo callbackInfo, bool isSuccess);
|
||||||
|
|
||||||
|
void onSplashAdDownloadConfirm(string unitId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void startLoadingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
|
||||||
|
void finishLoadingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void failToLoadADSource(string placementId,ATCallbackInfo callbackInfo,string code, string message);
|
||||||
|
|
||||||
|
void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void finishBiddingADSource(string placementId, ATCallbackInfo callbackInfo);
|
||||||
|
|
||||||
|
void failBiddingADSource(string placementId,ATCallbackInfo callbackInfo,string code, string message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1b57c158761e14a938991e5eee8042b2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b4096c701283c46fa994f76d51e947a0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,32 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b2cf80647e05e47b284324f0d41fcdae
|
||||||
|
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:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1f5acd92290394659966a736c0edae24
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Common
|
||||||
|
{
|
||||||
|
public class ATLogger
|
||||||
|
{
|
||||||
|
private static bool isDebug = false;
|
||||||
|
public static bool IsDebug
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
return isDebug;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
isDebug = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void Log(string msg)
|
||||||
|
// {
|
||||||
|
// Log(msg, null);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public static void Log(string format, object obj)
|
||||||
|
// {
|
||||||
|
// Log(format, obj, null);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static void Log(string format, object obj1 = null, object obj2 = null)
|
||||||
|
{
|
||||||
|
if (!isDebug) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (obj1 == null && obj2 == null)
|
||||||
|
{
|
||||||
|
Debug.Log(format);
|
||||||
|
}
|
||||||
|
else if (obj1 != null && obj2 == null)
|
||||||
|
{
|
||||||
|
Debug.Log(String.Format(format, obj1));
|
||||||
|
}
|
||||||
|
else if (obj1 == null && obj2 != null)
|
||||||
|
{
|
||||||
|
Debug.Log(String.Format(format, obj2));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Debug.Log(String.Format(format, obj1, obj2));
|
||||||
|
}
|
||||||
|
} catch(Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError("Log error: " + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public static void LogError(string msg)
|
||||||
|
// {
|
||||||
|
// LogError(msg, null);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public static void LogError(string format, object obj)
|
||||||
|
// {
|
||||||
|
// LogError(format, obj, null);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static void LogError(string format, object obj1 = null, object obj2 = null)
|
||||||
|
{
|
||||||
|
if (!isDebug) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (obj1 == null && obj2 == null)
|
||||||
|
{
|
||||||
|
Debug.LogError(format);
|
||||||
|
}
|
||||||
|
else if (obj1 != null && obj2 == null)
|
||||||
|
{
|
||||||
|
Debug.LogError(String.Format(format, obj1));
|
||||||
|
}
|
||||||
|
else if (obj1 == null && obj2 != null)
|
||||||
|
{
|
||||||
|
Debug.LogError(String.Format(format, obj2));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Debug.LogError(String.Format(format, obj1, obj2));
|
||||||
|
}
|
||||||
|
} catch(Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError("Log error: " + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 45d2ba570cbd740db8eaf1d145007f77
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d36adfb982bfc463f9ffb4b30ceede5c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
using AnyThinkAds.Api;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Common
|
||||||
|
{
|
||||||
|
public interface IATDownloadClient
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
void setListener(ATDownloadAdListener listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0615492f4518b488590a3688f063873e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 29aeb78d58bc140fa97ee8acc8403bd1
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8e60de0648af644da95a888d0ddb83f6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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<string, string> pairs);
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* 移除广告
|
||||||
|
* @param placementId
|
||||||
|
*/
|
||||||
|
void removeAd(string placementId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d20c708125d9743b2af7163dfd4b54b7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9dc52b7fdd47842a3aaae5c4b8fa95de
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
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 showDebuggerUI();
|
||||||
|
void showDebuggerUI(string debugKey);
|
||||||
|
void getUserLocation(ATGetUserLocationListener listener);
|
||||||
|
void setGDPRLevel(int level);
|
||||||
|
void showGDPRAuth();
|
||||||
|
void showGDPRConsentDialog(ATConsentDismissListener listener);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fccdac04e450f4b6f8bf324cca2ad647
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using AnyThinkAds.Api;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Common
|
||||||
|
{
|
||||||
|
public interface IATSplashAdClient : IATSplashEvents
|
||||||
|
{
|
||||||
|
// void loadSplashAd(string placementId, string mapJson);
|
||||||
|
void loadSplashAd(string placementId, int fetchAdTimeout, string defaultAdSourceConfig, string mapJson);
|
||||||
|
void setListener(ATSplashAdListener listener);
|
||||||
|
|
||||||
|
bool hasSplashAdReady(string placementId);
|
||||||
|
|
||||||
|
string checkAdStatus(string placementId);
|
||||||
|
|
||||||
|
void showSplashAd(string placementId, string mapJson);
|
||||||
|
|
||||||
|
string getValidAdCaches(string placementId);
|
||||||
|
|
||||||
|
void entryScenarioWithPlacementID(string placementId, string scenarioID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f2826cdfe64c14dcca1ffaf4e5a5cb7a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8c5eb205b9d4a4032867f42f8345ae85
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,493 @@
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IATSplashAdClient BuildSplashAdClient()
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
// Testing UNITY_EDITOR first because the editor also responds to the currently
|
||||||
|
// selected platform.
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
return new AnyThinkAds.Android.ATSplashAdClient();
|
||||||
|
#elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
|
||||||
|
//TODO iOS返回开屏client
|
||||||
|
return new AnyThinkAds.iOS.ATSplashAdClient();
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
return new UnitySplashClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnitySDKAPIClient:IATSDKAPIClient
|
||||||
|
{
|
||||||
|
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 showGDPRConsentDialog(ATConsentDismissListener listener){ }
|
||||||
|
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) { }
|
||||||
|
public void showDebuggerUI() {}
|
||||||
|
public void showDebuggerUI(string debugKey) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnityBannerClient:IATBannerAdClient
|
||||||
|
{
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdAutoRefreshEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdAutoRefreshFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseButtonTappedEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
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<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdShowEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdShowFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdVideoFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
|
||||||
|
public 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<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
public event EventHandler<ATAdProgressEventArgs> onAdVideoProgressEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
|
||||||
|
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<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
public event EventHandler<ATAdProgressEventArgs> onAdVideoProgressEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
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<string, string> pairs){}
|
||||||
|
|
||||||
|
public void removeAd(string unitId){}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnityRewardedVideoAdClient : IATRewardedVideoAdClient
|
||||||
|
{
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdVideoFailureEvent;
|
||||||
|
public event EventHandler<ATAdRewardEventArgs> onAdVideoCloseEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onRewardEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainStart;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainEnd;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onPlayAgainFailure;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainClick;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainReward;
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnitySplashClient : IATSplashAdClient
|
||||||
|
{
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdLoadTimeoutEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onDeeplinkEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onDownloadConfirmEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdShowEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
// called if the ad has failed to be shown
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdShowFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onRewardEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainStart;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainEnd;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onPlayAgainFailure;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainClick;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainReward;
|
||||||
|
// public void loadSplashAd(string placementId, string mapJson) {}
|
||||||
|
public void loadSplashAd(string placementId, int fetchAdTimeout, string defaultAdSourceConfig, string mapJson) {}
|
||||||
|
public void setListener(ATSplashAdListener listener) {}
|
||||||
|
|
||||||
|
public bool hasSplashAdReady(string placementId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string checkAdStatus(string placementId) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showSplashAd(string placementId, string mapJson) {}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 获取所有可用缓存广告
|
||||||
|
*/
|
||||||
|
public string getValidAdCaches(string placementId) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void entryScenarioWithPlacementID(string placementId, string scenarioID) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6c8a4f3522d7148ee9c8a9ead3279202
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: da19b2447f2434d0b83899d1751efc3a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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.thinkup.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 34e0bea6b21914047977e0bb6fc80d08
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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<string, AndroidJavaObject> bannerHelperMap = new Dictionary<string, AndroidJavaObject>();
|
||||||
|
|
||||||
|
|
||||||
|
private ATBannerAdListener anyThinkListener;
|
||||||
|
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
|
||||||
|
// triggers when a banner ad has failed to load
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
|
||||||
|
// triggers when a banner ad generates an impression
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||||
|
|
||||||
|
// triggers when the user clicks a banner ad
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
|
||||||
|
// triggers when the ad refreshes
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdAutoRefreshEvent;
|
||||||
|
|
||||||
|
// triggers when the ad fails to auto refresh
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdAutoRefreshFailureEvent;
|
||||||
|
|
||||||
|
// triggers when the banner ad is closed
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
|
||||||
|
// triggers when the users closes the ad via the button
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseButtonTappedEvent;
|
||||||
|
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
|
||||||
|
public ATBannerAdClient() : base("com.thinkup.unitybridge.banner.BannerListener")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void loadBannerAd(string placementId, string mapJson)
|
||||||
|
{
|
||||||
|
|
||||||
|
//如果不存在则直接创建对应广告位的helper
|
||||||
|
if(!bannerHelperMap.ContainsKey(placementId))
|
||||||
|
{
|
||||||
|
AndroidJavaObject bannerHelper = new AndroidJavaObject(
|
||||||
|
"com.thinkup.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<string>("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<string>("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, rect.usesPixel);
|
||||||
|
}
|
||||||
|
}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, code, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
//广告点击
|
||||||
|
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, 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c7bec7d500e74ca995affc2bd45de2c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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.thinkup.unitybridge.download.DownloadListener")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListener(ATDownloadAdListener listener)
|
||||||
|
{
|
||||||
|
Debug.Log("ATDownloadClient : setListener");
|
||||||
|
anyThinkListener = listener;
|
||||||
|
|
||||||
|
if (downloadHelper == null)
|
||||||
|
{
|
||||||
|
downloadHelper = new AndroidJavaObject(
|
||||||
|
"com.thinkup.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c15069ef3f95a4e899d4a8d36931a17c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using AnyThinkAds.Api;
|
||||||
|
|
||||||
|
namespace AnyThinkAds.Android
|
||||||
|
{
|
||||||
|
public class ATGDPRConsentDismissListener : AndroidJavaProxy
|
||||||
|
{
|
||||||
|
ATConsentDismissListener mListener;
|
||||||
|
public ATGDPRConsentDismissListener(ATConsentDismissListener listener): base("com.thinkup.unitybridge.sdkinit.SDKConsentDismissListener")
|
||||||
|
{
|
||||||
|
mListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onConsentDismiss()
|
||||||
|
{
|
||||||
|
if (mListener != null)
|
||||||
|
{
|
||||||
|
mListener.onConsentDismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 01aabe528bcb74cac9ab3e883dbbcae6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdShowEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdShowFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdVideoFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
|
||||||
|
private Dictionary<string, AndroidJavaObject> interstitialHelperMap = new Dictionary<string, AndroidJavaObject>();
|
||||||
|
|
||||||
|
//private AndroidJavaObject videoHelper;
|
||||||
|
private ATInterstitialAdListener anyThinkListener;
|
||||||
|
|
||||||
|
private AndroidJavaObject interstitialAutoAdHelper;
|
||||||
|
|
||||||
|
public ATInterstitialAdClient() : base("com.thinkup.unitybridge.interstitial.InterstitialListener")
|
||||||
|
{
|
||||||
|
interstitialAutoAdHelper = new AndroidJavaObject("com.thinkup.unitybridge.interstitial.InterstitialAutoAdHelper", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void loadInterstitialAd(string placementId, string mapJson)
|
||||||
|
{
|
||||||
|
|
||||||
|
//如果不存在则直接创建对应广告位的helper
|
||||||
|
if(!interstitialHelperMap.ContainsKey(placementId))
|
||||||
|
{
|
||||||
|
AndroidJavaObject videoHelper = new AndroidJavaObject(
|
||||||
|
"com.thinkup.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<bool> ("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<string>("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<string>("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, code, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
//开始播放
|
||||||
|
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, code, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
//展示失败
|
||||||
|
public void OnInterstitialAdFailedToShow(string placementID) {
|
||||||
|
Debug.Log("Unity: ATInterstitialAdClient::OnInterstitialAdFailedToShow()");
|
||||||
|
onAdShowFailureEvent?.Invoke(this, new ATAdErrorEventArgs(placementID, "-1", "Failed to show video ad"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//广告关闭
|
||||||
|
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<bool>("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<string>("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<string>("checkAdStatus", placementId);
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Exception caught: {0}", e);
|
||||||
|
Debug.Log("Unity: ATInterstitialAdClient:checkAutoAdStatus() : error." + e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return adStatusJsonString;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2974fada499ca461fb812844f898b961
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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.thinkup.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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c7c6efa7c8667421bad3af1671dd777d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
public event EventHandler<ATAdProgressEventArgs> onAdVideoProgressEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
|
||||||
|
private Dictionary<string, AndroidJavaObject> nativeAdHelperMap = new Dictionary<string, AndroidJavaObject>();
|
||||||
|
private ATNativeAdListener mlistener;
|
||||||
|
|
||||||
|
public ATNativeAdClient(): base("com.thinkup.unitybridge.nativead.NativeListener")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadNativeAd(string placementId, string mapJson)
|
||||||
|
{
|
||||||
|
Debug.Log ("loadNativeAd....jsonmap:"+mapJson);
|
||||||
|
if(!nativeAdHelperMap.ContainsKey(placementId)){
|
||||||
|
AndroidJavaObject nativeHelper = new AndroidJavaObject(
|
||||||
|
"com.thinkup.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<bool> ("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<string>("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<string>("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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 073dd039f9983464080e9cee9b8b81ab
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdImpressEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
public event EventHandler<ATAdProgressEventArgs> onAdVideoProgressEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdCloseEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
public 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<string, string> 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));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bc1750da0babf40ce9f9986778b3def4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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.thinkup.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8870deba0682c40ed9c907af5aab5b96
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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<ATAdEventArgs> onAdLoadEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoStartEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdVideoEndEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdVideoFailureEvent;
|
||||||
|
public event EventHandler<ATAdRewardEventArgs> onAdVideoCloseEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdClickEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onRewardEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceLoadFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingAttemptEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onAdSourceBiddingFilledEvent;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onAdSourceBiddingFailureEvent;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainStart;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainEnd;
|
||||||
|
public event EventHandler<ATAdErrorEventArgs> onPlayAgainFailure;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainClick;
|
||||||
|
public event EventHandler<ATAdEventArgs> onPlayAgainReward;
|
||||||
|
|
||||||
|
|
||||||
|
private Dictionary<string, AndroidJavaObject> videoHelperMap = new Dictionary<string, AndroidJavaObject>();
|
||||||
|
|
||||||
|
private AndroidJavaObject videoAutoAdHelper;
|
||||||
|
|
||||||
|
//private AndroidJavaObject videoHelper;
|
||||||
|
private ATRewardedVideoListener anyThinkListener;
|
||||||
|
|
||||||
|
public ATRewardedVideoAdClient() : base("com.thinkup.unitybridge.videoad.VideoListener")
|
||||||
|
{
|
||||||
|
videoAutoAdHelper = new AndroidJavaObject("com.thinkup.unitybridge.videoad.VideoAutoAdHelper", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void loadVideoAd(string placementId, string mapJson)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!videoHelperMap.ContainsKey(placementId))
|
||||||
|
{
|
||||||
|
AndroidJavaObject videoHelper = new AndroidJavaObject(
|
||||||
|
"com.thinkup.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<bool> ("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<string>("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<string>("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, code, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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, code, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
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, code, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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, 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, code, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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<bool>("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<string>("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<string>("checkAdStatus", placementId);
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Exception caught: {0}", e);
|
||||||
|
Debug.Log("Unity: ATRewardedVideoAdClient:checkAutoAdStatus() : error." + e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return adStatusJsonString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b67705314096943b09a0f14eafff6a62
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,394 @@
|
||||||
|
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.thinkup.unitybridge.sdkinit.SDKInitListener")
|
||||||
|
{
|
||||||
|
this.sdkInitHelper = new AndroidJavaObject(
|
||||||
|
"com.thinkup.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 showGDPRConsentDialog(ATConsentDismissListener listener)
|
||||||
|
{
|
||||||
|
Debug.Log ("showGDPRConsentDialog....");
|
||||||
|
ATGDPRConsentDismissListener gdprConsentDismissListener = new ATGDPRConsentDismissListener(listener);
|
||||||
|
try{
|
||||||
|
if (this.sdkInitHelper != null) {
|
||||||
|
this.sdkInitHelper.Call ("showGDPRConsentDialog", gdprConsentDismissListener);
|
||||||
|
}
|
||||||
|
}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<int>("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<bool>("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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showDebuggerUI() {
|
||||||
|
showDebuggerUI("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showDebuggerUI(string debugKey) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (this.sdkInitHelper != null)
|
||||||
|
{
|
||||||
|
this.sdkInitHelper.Call("showDebuggerUI", debugKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Exception caught: {0}", e);
|
||||||
|
Debug.Log("ATSDKAPIClient : error." + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue