init
This commit is contained in:
8
Assets/AdManager.meta
Normal file
8
Assets/AdManager.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80cd5affbda994619a39702722c9733c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/AdManager/Ad Break-Portrait.png
Normal file
BIN
Assets/AdManager/Ad Break-Portrait.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
132
Assets/AdManager/Ad Break-Portrait.png.meta
Normal file
132
Assets/AdManager/Ad Break-Portrait.png.meta
Normal file
@@ -0,0 +1,132 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ef5109b2fcba47899d4f2b311da9340
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 29
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 1
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: db9c1cfaf5e844b4b95de665ca9c13db
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
47
Assets/AdManager/AdInitialize.prefab
Normal file
47
Assets/AdManager/AdInitialize.prefab
Normal file
@@ -0,0 +1,47 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &6809933845309457802
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2929833845123913221}
|
||||
- component: {fileID: 2784282074210547776}
|
||||
m_Layer: 0
|
||||
m_Name: AdInitialize
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2929833845123913221
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6809933845309457802}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2784282074210547776
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6809933845309457802}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5510446fff21946f7a51cf3f88d7035c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
AdManagerPrefb: {fileID: 1824684813513001599, guid: 35a705b02bb1a43fb880f76f97132163,
|
||||
type: 3}
|
||||
7
Assets/AdManager/AdInitialize.prefab.meta
Normal file
7
Assets/AdManager/AdInitialize.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 923183203185a42088acdd719386583a
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
546
Assets/AdManager/AdManager.cs
Normal file
546
Assets/AdManager/AdManager.cs
Normal file
@@ -0,0 +1,546 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Advertisements;
|
||||
|
||||
public enum BannerPosition
|
||||
{
|
||||
TopLeft,
|
||||
TopCenter,
|
||||
TopRight,
|
||||
Centered,
|
||||
CenterLeft,
|
||||
CenterRight,
|
||||
BottomLeft,
|
||||
BottomCenter,
|
||||
BottomRight
|
||||
}
|
||||
|
||||
public enum MBRPosition
|
||||
{
|
||||
TopLeft,
|
||||
TopCenter,
|
||||
TopRight,
|
||||
Centered,
|
||||
CenterLeft,
|
||||
CenterRight,
|
||||
BottomLeft,
|
||||
BottomCenter,
|
||||
BottomRight
|
||||
}
|
||||
|
||||
public class AdManager : MonoBehaviour
|
||||
|
||||
{
|
||||
public string MaxSdkKey = "Enter_SDK_Key_HERE";
|
||||
public string InterstitialAdUnitId = "ENTER_INTER_AD_UNIT_ID_HERE";
|
||||
public string RewardedAdUnitId = "ENTER_REWARD_AD_UNIT_ID_HERE";
|
||||
public string RewardedInterstitialAdUnitId = "ENTER_REWARD_INTER_AD_UNIT_ID_HERE";
|
||||
public string BannerAdUnitId = "ENTER_BANNER_AD_UNIT_ID_HERE";
|
||||
public string MRecAdUnitId = "ENTER_MBR_AD_UNIT_ID_HERE";
|
||||
|
||||
|
||||
|
||||
[Header("Banner & MBR Settings")]
|
||||
|
||||
|
||||
public BannerPosition BannerPosition = BannerPosition.TopCenter;
|
||||
MaxSdkBase.BannerPosition position;
|
||||
public MBRPosition MBRPosition = MBRPosition.BottomCenter;
|
||||
MaxSdkBase.AdViewPosition MBRposition;
|
||||
|
||||
public bool AutoShowBanner=true;
|
||||
|
||||
|
||||
private bool isBannerShowing;
|
||||
private bool isMRecShowing;
|
||||
|
||||
private int interstitialRetryAttempt;
|
||||
private int rewardedRetryAttempt;
|
||||
private int rewardedInterstitialRetryAttempt;
|
||||
|
||||
public float IntestetailAdbreakDelay;
|
||||
|
||||
private bool ShowIntestetial=false;
|
||||
|
||||
private float timecounter;
|
||||
|
||||
public static AdManager _Instance;
|
||||
|
||||
private static bool IsAdUnitArrayNullOrEmpty (ICollection<string> adUnitArray)
|
||||
{
|
||||
return (adUnitArray == null || adUnitArray.Count == 0);
|
||||
}
|
||||
|
||||
void Awake ()
|
||||
{
|
||||
MakeSingleton ();
|
||||
}
|
||||
|
||||
void MakeSingleton ()
|
||||
{
|
||||
if (_Instance != null) {
|
||||
Destroy (this.gameObject);
|
||||
} else {
|
||||
_Instance = this;
|
||||
DontDestroyOnLoad (this.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
MaxSdkCallbacks.OnSdkInitializedEvent += sdkConfiguration =>
|
||||
{
|
||||
// AppLovin SDK is initialized, configure and start loading ads.
|
||||
UnityEngine.Debug.Log("MAX SDK Initialized");
|
||||
position = (MaxSdkBase.BannerPosition)BannerPosition;
|
||||
MBRposition = (MaxSdkBase.AdViewPosition)MBRPosition;
|
||||
InitializeInterstitialAds();
|
||||
InitializeRewardedAds();
|
||||
InitializeRewardedInterstitialAds();
|
||||
InitializeBannerAds();
|
||||
InitializeMRecAds();
|
||||
};
|
||||
MaxSdk.SetSdkKey(MaxSdkKey);
|
||||
MaxSdk.InitializeSdk();
|
||||
}
|
||||
|
||||
void Update(){
|
||||
if(ShowIntestetial){
|
||||
timecounter+=Time.unscaledDeltaTime;
|
||||
if(timecounter>=IntestetailAdbreakDelay){
|
||||
ShowIntestetial=false;
|
||||
timecounter=0;
|
||||
ShowIntestetialafterdelay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Interstitial Ad Methods
|
||||
|
||||
private void InitializeInterstitialAds()
|
||||
{
|
||||
// Attach callbacks
|
||||
MaxSdkCallbacks.Interstitial.OnAdLoadedEvent += OnInterstitialLoadedEvent;
|
||||
MaxSdkCallbacks.Interstitial.OnAdLoadFailedEvent += OnInterstitialFailedEvent;
|
||||
MaxSdkCallbacks.Interstitial.OnAdDisplayFailedEvent += InterstitialFailedToDisplayEvent;
|
||||
MaxSdkCallbacks.Interstitial.OnAdHiddenEvent += OnInterstitialDismissedEvent;
|
||||
MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent += OnInterstitialRevenuePaidEvent;
|
||||
|
||||
// Load the first interstitial
|
||||
LoadInterstitial();
|
||||
}
|
||||
|
||||
void LoadInterstitial()
|
||||
{
|
||||
MaxSdk.LoadInterstitial(InterstitialAdUnitId);
|
||||
}
|
||||
|
||||
public void ShowInterstitial()
|
||||
{
|
||||
if (MaxSdk.IsInterstitialReady(InterstitialAdUnitId))
|
||||
{
|
||||
this.gameObject.transform.GetChild(0).gameObject.SetActive(true);
|
||||
ShowIntestetial=true;
|
||||
}
|
||||
}
|
||||
|
||||
void ShowIntestetialafterdelay(){
|
||||
this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
|
||||
MaxSdk.ShowInterstitial(InterstitialAdUnitId);
|
||||
|
||||
}
|
||||
|
||||
private void OnInterstitialLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Interstitial ad is ready to be shown. MaxSdk.IsInterstitialReady(interstitialAdUnitId) will now return 'true'
|
||||
|
||||
|
||||
// Reset retry attempt
|
||||
interstitialRetryAttempt = 0;
|
||||
}
|
||||
|
||||
private void OnInterstitialFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||
{
|
||||
// Interstitial ad failed to load. We recommend retrying with exponentially higher delays up to a maximum delay (in this case 64 seconds).
|
||||
interstitialRetryAttempt++;
|
||||
double retryDelay = Math.Pow(2, Math.Min(6, interstitialRetryAttempt));
|
||||
|
||||
UnityEngine.Debug.Log("Interstitial failed to load with error code: " + errorInfo.Code);
|
||||
|
||||
Invoke("LoadInterstitial", (float) retryDelay);
|
||||
}
|
||||
|
||||
private void InterstitialFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Interstitial ad failed to display. We recommend loading the next ad
|
||||
UnityEngine.Debug.Log("Interstitial failed to display with error code: " + errorInfo.Code);
|
||||
LoadInterstitial();
|
||||
}
|
||||
|
||||
private void OnInterstitialDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Interstitial ad is hidden. Pre-load the next ad
|
||||
UnityEngine.Debug.Log("Interstitial dismissed");
|
||||
LoadInterstitial();
|
||||
}
|
||||
|
||||
private void OnInterstitialRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Interstitial ad revenue paid. Use this callback to track user revenue.
|
||||
UnityEngine.Debug.Log("Interstitial revenue paid");
|
||||
|
||||
// Ad revenue
|
||||
double revenue = adInfo.Revenue;
|
||||
|
||||
// Miscellaneous data
|
||||
string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD" in most cases!
|
||||
string networkName = adInfo.NetworkName; // Display name of the network that showed the ad (e.g. "AdColony")
|
||||
string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
|
||||
string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Rewarded Ad Methods
|
||||
|
||||
private void InitializeRewardedAds()
|
||||
{
|
||||
// Attach callbacks
|
||||
MaxSdkCallbacks.Rewarded.OnAdLoadedEvent += OnRewardedAdLoadedEvent;
|
||||
MaxSdkCallbacks.Rewarded.OnAdLoadFailedEvent += OnRewardedAdFailedEvent;
|
||||
MaxSdkCallbacks.Rewarded.OnAdDisplayFailedEvent += OnRewardedAdFailedToDisplayEvent;
|
||||
MaxSdkCallbacks.Rewarded.OnAdDisplayedEvent += OnRewardedAdDisplayedEvent;
|
||||
MaxSdkCallbacks.Rewarded.OnAdClickedEvent += OnRewardedAdClickedEvent;
|
||||
MaxSdkCallbacks.Rewarded.OnAdHiddenEvent += OnRewardedAdDismissedEvent;
|
||||
MaxSdkCallbacks.Rewarded.OnAdReceivedRewardEvent += OnRewardedAdReceivedRewardEvent;
|
||||
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent += OnRewardedAdRevenuePaidEvent;
|
||||
|
||||
// Load the first RewardedAd
|
||||
LoadRewardedAd();
|
||||
}
|
||||
|
||||
private void LoadRewardedAd()
|
||||
{
|
||||
MaxSdk.LoadRewardedAd(RewardedAdUnitId);
|
||||
}
|
||||
|
||||
public void showRewardedVideo()
|
||||
{
|
||||
if (MaxSdk.IsRewardedAdReady(RewardedAdUnitId))
|
||||
{
|
||||
MaxSdk.ShowRewardedAd(RewardedAdUnitId);
|
||||
}else if (MaxSdk.IsRewardedInterstitialAdReady(RewardedInterstitialAdUnitId))
|
||||
{
|
||||
MaxSdk.ShowRewardedInterstitialAd(RewardedInterstitialAdUnitId);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRewardedAdLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Rewarded ad is ready to be shown. MaxSdk.IsRewardedAdReady(rewardedAdUnitId) will now return 'true'
|
||||
UnityEngine.Debug.Log("Rewarded ad loaded");
|
||||
|
||||
// Reset retry attempt
|
||||
rewardedRetryAttempt = 0;
|
||||
}
|
||||
|
||||
private void OnRewardedAdFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||
{
|
||||
// Rewarded ad failed to load. We recommend retrying with exponentially higher delays up to a maximum delay (in this case 64 seconds).
|
||||
rewardedRetryAttempt++;
|
||||
double retryDelay = Math.Pow(2, Math.Min(6, rewardedRetryAttempt));
|
||||
PlayerPrefs.SetInt ("reward", 2);
|
||||
UnityEngine.Debug.Log("Rewarded ad failed to load with error code: " + errorInfo.Code);
|
||||
|
||||
Invoke("LoadRewardedAd", (float) retryDelay);
|
||||
}
|
||||
|
||||
private void OnRewardedAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Rewarded ad failed to display. We recommend loading the next ad
|
||||
PlayerPrefs.SetInt ("reward", 2);
|
||||
UnityEngine.Debug.Log("Rewarded ad failed to display with error code: " + errorInfo.Code);
|
||||
LoadRewardedAd();
|
||||
}
|
||||
|
||||
private void OnRewardedAdDisplayedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
UnityEngine.Debug.Log("Rewarded ad displayed");
|
||||
}
|
||||
|
||||
private void OnRewardedAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
UnityEngine.Debug.Log("Rewarded ad clicked");
|
||||
}
|
||||
|
||||
private void OnRewardedAdDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Rewarded ad is hidden. Pre-load the next ad
|
||||
UnityEngine.Debug.Log("Rewarded ad dismissed");
|
||||
LoadRewardedAd();
|
||||
}
|
||||
|
||||
private void OnRewardedAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
|
||||
PlayerPrefs.SetInt ("reward", 1);
|
||||
// Rewarded ad was displayed and user should receive the reward
|
||||
UnityEngine.Debug.Log("Rewarded ad received reward");
|
||||
|
||||
}
|
||||
|
||||
private void OnRewardedAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Rewarded ad revenue paid. Use this callback to track user revenue.
|
||||
UnityEngine.Debug.Log("Rewarded ad revenue paid");
|
||||
|
||||
// Ad revenue
|
||||
double revenue = adInfo.Revenue;
|
||||
|
||||
// Miscellaneous data
|
||||
string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD" in most cases!
|
||||
string networkName = adInfo.NetworkName; // Display name of the network that showed the ad (e.g. "AdColony")
|
||||
string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
|
||||
string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Rewarded Interstitial Ad Methods
|
||||
|
||||
private void InitializeRewardedInterstitialAds()
|
||||
{
|
||||
// Attach callbacks
|
||||
MaxSdkCallbacks.RewardedInterstitial.OnAdLoadedEvent += OnRewardedInterstitialAdLoadedEvent;
|
||||
MaxSdkCallbacks.RewardedInterstitial.OnAdLoadFailedEvent += OnRewardedInterstitialAdFailedEvent;
|
||||
MaxSdkCallbacks.RewardedInterstitial.OnAdDisplayFailedEvent += OnRewardedInterstitialAdFailedToDisplayEvent;
|
||||
MaxSdkCallbacks.RewardedInterstitial.OnAdDisplayedEvent += OnRewardedInterstitialAdDisplayedEvent;
|
||||
MaxSdkCallbacks.RewardedInterstitial.OnAdClickedEvent += OnRewardedInterstitialAdClickedEvent;
|
||||
MaxSdkCallbacks.RewardedInterstitial.OnAdHiddenEvent += OnRewardedInterstitialAdDismissedEvent;
|
||||
MaxSdkCallbacks.RewardedInterstitial.OnAdReceivedRewardEvent += OnRewardedInterstitialAdReceivedRewardEvent;
|
||||
MaxSdkCallbacks.RewardedInterstitial.OnAdRevenuePaidEvent += OnRewardedInterstitialAdRevenuePaidEvent;
|
||||
|
||||
// Load the first RewardedInterstitialAd
|
||||
LoadRewardedInterstitialAd();
|
||||
}
|
||||
|
||||
private void LoadRewardedInterstitialAd()
|
||||
{
|
||||
MaxSdk.LoadRewardedInterstitialAd(RewardedInterstitialAdUnitId);
|
||||
}
|
||||
|
||||
private void ShowRewardedInterstitialAd()
|
||||
{
|
||||
if (MaxSdk.IsRewardedInterstitialAdReady(RewardedInterstitialAdUnitId))
|
||||
{
|
||||
MaxSdk.ShowRewardedInterstitialAd(RewardedInterstitialAdUnitId);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRewardedInterstitialAdLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Rewarded interstitial ad is ready to be shown. MaxSdk.IsRewardedInterstitialAdReady(rewardedInterstitialAdUnitId) will now return 'true'
|
||||
UnityEngine.Debug.Log("Rewarded interstitial ad loaded");
|
||||
|
||||
// Reset retry attempt
|
||||
rewardedInterstitialRetryAttempt = 0;
|
||||
}
|
||||
|
||||
private void OnRewardedInterstitialAdFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||
{
|
||||
PlayerPrefs.SetInt ("reward", 2);
|
||||
// Rewarded interstitial ad failed to load. We recommend retrying with exponentially higher delays up to a maximum delay (in this case 64 seconds).
|
||||
rewardedInterstitialRetryAttempt++;
|
||||
double retryDelay = Math.Pow(2, Math.Min(6, rewardedInterstitialRetryAttempt));
|
||||
|
||||
UnityEngine.Debug.Log("Rewarded interstitial ad failed to load with error code: " + errorInfo.Code);
|
||||
|
||||
Invoke("LoadRewardedInterstitialAd", (float) retryDelay);
|
||||
}
|
||||
|
||||
private void OnRewardedInterstitialAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
PlayerPrefs.SetInt ("reward", 2);
|
||||
// Rewarded interstitial ad failed to display. We recommend loading the next ad
|
||||
UnityEngine.Debug.Log("Rewarded interstitial ad failed to display with error code: " + errorInfo.Code);
|
||||
LoadRewardedInterstitialAd();
|
||||
}
|
||||
|
||||
private void OnRewardedInterstitialAdDisplayedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
UnityEngine.Debug.Log("Rewarded interstitial ad displayed");
|
||||
}
|
||||
|
||||
private void OnRewardedInterstitialAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
UnityEngine.Debug.Log("Rewarded interstitial ad clicked");
|
||||
}
|
||||
|
||||
private void OnRewardedInterstitialAdDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Rewarded interstitial ad is hidden. Pre-load the next ad
|
||||
UnityEngine.Debug.Log("Rewarded interstitial ad dismissed");
|
||||
LoadRewardedInterstitialAd();
|
||||
}
|
||||
|
||||
private void OnRewardedInterstitialAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
|
||||
PlayerPrefs.SetInt ("reward", 1);
|
||||
// Rewarded interstitial ad was displayed and user should receive the reward
|
||||
UnityEngine.Debug.Log("Rewarded interstitial ad received reward");
|
||||
}
|
||||
|
||||
private void OnRewardedInterstitialAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Rewarded interstitial ad revenue paid. Use this callback to track user revenue.
|
||||
UnityEngine.Debug.Log("Rewarded interstitial ad revenue paid");
|
||||
|
||||
// Ad revenue
|
||||
double revenue = adInfo.Revenue;
|
||||
|
||||
// Miscellaneous data
|
||||
string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD" in most cases!
|
||||
string networkName = adInfo.NetworkName; // Display name of the network that showed the ad (e.g. "AdColony")
|
||||
string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
|
||||
string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Banner Ad Methods
|
||||
|
||||
private void InitializeBannerAds()
|
||||
{
|
||||
// Attach Callbacks
|
||||
MaxSdkCallbacks.Banner.OnAdLoadedEvent += OnBannerAdLoadedEvent;
|
||||
MaxSdkCallbacks.Banner.OnAdLoadFailedEvent += OnBannerAdFailedEvent;
|
||||
MaxSdkCallbacks.Banner.OnAdClickedEvent += OnBannerAdClickedEvent;
|
||||
MaxSdkCallbacks.Banner.OnAdRevenuePaidEvent += OnBannerAdRevenuePaidEvent;
|
||||
|
||||
// Banners are automatically sized to 320x50 on phones and 728x90 on tablets.
|
||||
// You may use the utility method `MaxSdkUtils.isTablet()` to help with view sizing adjustments.
|
||||
MaxSdk.CreateBanner(BannerAdUnitId, position);
|
||||
|
||||
// Set background or background color for banners to be fully functional.
|
||||
MaxSdk.SetBannerBackgroundColor(BannerAdUnitId, Color.black);
|
||||
}
|
||||
|
||||
public void ShowBanner ()
|
||||
{
|
||||
MaxSdk.ShowBanner(BannerAdUnitId);
|
||||
}
|
||||
|
||||
public void HideBanner (){
|
||||
MaxSdk.HideBanner(BannerAdUnitId);
|
||||
}
|
||||
|
||||
private void OnBannerAdLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
if(AutoShowBanner)
|
||||
ShowBanner();
|
||||
// Banner ad is ready to be shown.
|
||||
// If you have already called MaxSdk.ShowBanner(BannerAdUnitId) it will automatically be shown on the next ad refresh.
|
||||
UnityEngine.Debug.Log("Banner ad loaded");
|
||||
}
|
||||
|
||||
private void OnBannerAdFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||
{
|
||||
// Banner ad failed to load. MAX will automatically try loading a new ad internally.
|
||||
UnityEngine.Debug.Log("Banner ad failed to load with error code: " + errorInfo.Code);
|
||||
}
|
||||
|
||||
private void OnBannerAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
UnityEngine.Debug.Log("Banner ad clicked");
|
||||
}
|
||||
|
||||
private void OnBannerAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Banner ad revenue paid. Use this callback to track user revenue.
|
||||
UnityEngine.Debug.Log("Banner ad revenue paid");
|
||||
|
||||
// Ad revenue
|
||||
double revenue = adInfo.Revenue;
|
||||
|
||||
// Miscellaneous data
|
||||
string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD" in most cases!
|
||||
string networkName = adInfo.NetworkName; // Display name of the network that showed the ad (e.g. "AdColony")
|
||||
string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
|
||||
string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MREC Ad Methods
|
||||
|
||||
private void InitializeMRecAds()
|
||||
{
|
||||
// Attach Callbacks
|
||||
MaxSdkCallbacks.MRec.OnAdLoadedEvent += OnMRecAdLoadedEvent;
|
||||
MaxSdkCallbacks.MRec.OnAdLoadFailedEvent += OnMRecAdFailedEvent;
|
||||
MaxSdkCallbacks.MRec.OnAdClickedEvent += OnMRecAdClickedEvent;
|
||||
MaxSdkCallbacks.MRec.OnAdRevenuePaidEvent += OnMRecAdRevenuePaidEvent;
|
||||
|
||||
// MRECs are automatically sized to 300x250.
|
||||
MaxSdk.CreateMRec(MRecAdUnitId, MBRposition);
|
||||
}
|
||||
|
||||
public void ShowMRec()
|
||||
{
|
||||
MaxSdk.ShowMRec(MRecAdUnitId);;
|
||||
|
||||
}
|
||||
|
||||
public void HideMRec(){
|
||||
MaxSdk.HideMRec(MRecAdUnitId);
|
||||
}
|
||||
|
||||
private void OnMRecAdLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// MRec ad is ready to be shown.
|
||||
// If you have already called MaxSdk.ShowMRec(MRecAdUnitId) it will automatically be shown on the next MRec refresh.
|
||||
UnityEngine.Debug.Log("MRec ad loaded");
|
||||
}
|
||||
|
||||
private void OnMRecAdFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||
{
|
||||
// MRec ad failed to load. MAX will automatically try loading a new ad internally.
|
||||
UnityEngine.Debug.Log("MRec ad failed to load with error code: " + errorInfo.Code);
|
||||
}
|
||||
|
||||
private void OnMRecAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
UnityEngine.Debug.Log("MRec ad clicked");
|
||||
}
|
||||
|
||||
private void OnMRecAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// MRec ad revenue paid. Use this callback to track user revenue.
|
||||
UnityEngine.Debug.Log("MRec ad revenue paid");
|
||||
|
||||
// Ad revenue
|
||||
double revenue = adInfo.Revenue;
|
||||
|
||||
// Miscellaneous data
|
||||
string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD" in most cases!
|
||||
string networkName = adInfo.NetworkName; // Display name of the network that showed the ad (e.g. "AdColony")
|
||||
string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
|
||||
string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
public void MediationDebugger()
|
||||
{
|
||||
MaxSdk.ShowMediationDebugger();
|
||||
}
|
||||
}
|
||||
11
Assets/AdManager/AdManager.cs.meta
Normal file
11
Assets/AdManager/AdManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19268e4ffbdff4dcba6cd9fbca2d477e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
320
Assets/AdManager/AdManager.prefab
Normal file
320
Assets/AdManager/AdManager.prefab
Normal file
@@ -0,0 +1,320 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1824684813513001599
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1824684813513001593}
|
||||
- component: {fileID: 1824684813513001592}
|
||||
m_Layer: 0
|
||||
m_Name: AdManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1824684813513001593
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684813513001599}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1824684814513231900}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1824684813513001592
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684813513001599}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 19268e4ffbdff4dcba6cd9fbca2d477e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
MaxSdkKey: psZVEAMEWH5iW2zGUnOMSoVUytal0OxRPslmW0QNaDaGKuAZIVm2LaAfwCMoEA89NZS7TgPWdXFxEygQDpWgpD
|
||||
InterstitialAdUnitId: 28eaf3e8376363fc
|
||||
RewardedAdUnitId: 11
|
||||
RewardedInterstitialAdUnitId: 11
|
||||
BannerAdUnitId: 7df3d4278b1f559a
|
||||
MRecAdUnitId: 11
|
||||
BannerPosition: 7
|
||||
MBRPosition: 6
|
||||
AutoShowBanner: 1
|
||||
IntestetailAdbreakDelay: 1.5
|
||||
--- !u!1 &1824684813823497392
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1824684813823497393}
|
||||
- component: {fileID: 1824684813823497395}
|
||||
- component: {fileID: 1824684813823497394}
|
||||
m_Layer: 0
|
||||
m_Name: AdScreenLandScape
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1824684813823497393
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684813823497392}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1824684814513231900}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1824684813823497395
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684813823497392}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &1824684813823497394
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684813823497392}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: a6dd9436829aa43ecb6408b08cb898fd, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &1824684814513231891
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1824684814513231900}
|
||||
- component: {fileID: 1824684814513231896}
|
||||
- component: {fileID: 1824684814513231903}
|
||||
- component: {fileID: 1824684814513231902}
|
||||
- component: {fileID: 1824684814513231901}
|
||||
m_Layer: 0
|
||||
m_Name: Canvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1824684814513231900
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684814513231891}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 1824684814686399103}
|
||||
- {fileID: 1824684813823497393}
|
||||
m_Father: {fileID: 1824684813513001593}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!223 &1824684814513231896
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684814513231891}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &1824684814513231903
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684814513231891}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &1824684814513231902
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684814513231891}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!114 &1824684814513231901
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684814513231891}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8edac5a1785d6478f9686aa5c11af342, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1824684814686399102
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1824684814686399103}
|
||||
- component: {fileID: 1824684814686399097}
|
||||
- component: {fileID: 1824684814686399096}
|
||||
m_Layer: 0
|
||||
m_Name: AdScreenPortrait
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1824684814686399103
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684814686399102}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1824684814513231900}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1824684814686399097
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684814686399102}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &1824684814686399096
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824684814686399102}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 3ef5109b2fcba47899d4f2b311da9340, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
7
Assets/AdManager/AdManager.prefab.meta
Normal file
7
Assets/AdManager/AdManager.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35a705b02bb1a43fb880f76f97132163
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2868
Assets/AdManager/AppLovin Mediation.unity
Normal file
2868
Assets/AdManager/AppLovin Mediation.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/AdManager/AppLovin Mediation.unity.meta
Normal file
7
Assets/AdManager/AppLovin Mediation.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96fae1cfbbe8041c79ad65ccdcd807c9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/AdManager/GotoSampleScene.cs
Executable file
16
Assets/AdManager/GotoSampleScene.cs
Executable file
@@ -0,0 +1,16 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class GotoSampleScene : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
IEnumerator Start () {
|
||||
yield return new WaitForSeconds (3f);
|
||||
Application.LoadLevel(1);
|
||||
// SceneManager.LoadScene ("TW_AdsSampleScene");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
11
Assets/AdManager/GotoSampleScene.cs.meta
Normal file
11
Assets/AdManager/GotoSampleScene.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3bd691842e0004402add1276136e5c91
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
27
Assets/AdManager/MBREnableDisable.cs
Normal file
27
Assets/AdManager/MBREnableDisable.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MBREnableDisable : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnEnable(){
|
||||
AdManager._Instance.ShowMRec();
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
AdManager._Instance.HideMRec();
|
||||
}
|
||||
}
|
||||
11
Assets/AdManager/MBREnableDisable.cs.meta
Normal file
11
Assets/AdManager/MBREnableDisable.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9566f093f8f6a46589f9df9dcce2d0d7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
Assets/AdManager/OrientationChecker.cs
Normal file
60
Assets/AdManager/OrientationChecker.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OrientationChecker : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
|
||||
if(Screen.orientation == ScreenOrientation.Portrait)
|
||||
{
|
||||
this.gameObject.transform.GetChild(0).gameObject.SetActive(true);
|
||||
}
|
||||
if(Screen.orientation == ScreenOrientation.PortraitUpsideDown)
|
||||
{
|
||||
this.gameObject.transform.GetChild(0).gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if(Screen.orientation == ScreenOrientation.LandscapeLeft)
|
||||
{
|
||||
this.gameObject.transform.GetChild(1).gameObject.SetActive(true);
|
||||
}
|
||||
if(Screen.orientation == ScreenOrientation.LandscapeRight)
|
||||
{
|
||||
this.gameObject.transform.GetChild(1).gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable() {
|
||||
|
||||
if(Screen.orientation == ScreenOrientation.Portrait)
|
||||
{
|
||||
this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
|
||||
}
|
||||
if(Screen.orientation == ScreenOrientation.PortraitUpsideDown)
|
||||
{
|
||||
this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
if(Screen.orientation == ScreenOrientation.LandscapeLeft)
|
||||
{
|
||||
this.gameObject.transform.GetChild(1).gameObject.SetActive(false);
|
||||
}
|
||||
if(Screen.orientation == ScreenOrientation.LandscapeRight)
|
||||
{
|
||||
this.gameObject.transform.GetChild(1).gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/AdManager/OrientationChecker.cs.meta
Normal file
11
Assets/AdManager/OrientationChecker.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8edac5a1785d6478f9686aa5c11af342
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1512
Assets/AdManager/SampleSplash.unity
Normal file
1512
Assets/AdManager/SampleSplash.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/AdManager/SampleSplash.unity.meta
Normal file
7
Assets/AdManager/SampleSplash.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44e6fb8e196634fd9811bc2b99afe80e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Assets/AdManager/SampleSplashSettings.lighting
Normal file
63
Assets/AdManager/SampleSplashSettings.lighting
Normal file
@@ -0,0 +1,63 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!850595691 &4890085278179872738
|
||||
LightingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SampleSplashSettings
|
||||
serializedVersion: 3
|
||||
m_GIWorkflowMode: 1
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_RealtimeEnvironmentLighting: 1
|
||||
m_BounceScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_UsingShadowmask: 0
|
||||
m_BakeBackend: 0
|
||||
m_LightmapMaxSize: 1024
|
||||
m_BakeResolution: 50
|
||||
m_Padding: 2
|
||||
m_TextureCompression: 0
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 0
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAO: 0
|
||||
m_MixedBakeMode: 1
|
||||
m_LightmapsBakeMode: 1
|
||||
m_FilterMode: 1
|
||||
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_RealtimeResolution: 1
|
||||
m_ForceWhiteAlbedo: 0
|
||||
m_ForceUpdates: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherRayCount: 1024
|
||||
m_FinalGatherFiltering: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_PVRBounces: 2
|
||||
m_PVRMinBounces: 2
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
8
Assets/AdManager/SampleSplashSettings.lighting.meta
Normal file
8
Assets/AdManager/SampleSplashSettings.lighting.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9344c1d5e5b343df9fa109013107463
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 4890085278179872738
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
37
Assets/AdManager/ShowReward.cs
Normal file
37
Assets/AdManager/ShowReward.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ShowReward : MonoBehaviour
|
||||
{
|
||||
public Text Result;
|
||||
bool sdkinitialize;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
Result.text="Loaded";
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(PlayerPrefs.GetInt ("reward", 0)==1){
|
||||
Result.text="Congratulation you got your reward";
|
||||
PlayerPrefs.SetInt ("reward", 0);
|
||||
Invoke("ClearText",10f);
|
||||
}else if(PlayerPrefs.GetInt ("reward", 0)==2){
|
||||
Result.text="Sorry! Video failed to load";
|
||||
PlayerPrefs.SetInt ("reward", 0);
|
||||
Invoke("ClearText",10f);
|
||||
}
|
||||
// if(AdManager._Instance.intestetialloaded){
|
||||
// Result.text="Intestetial Loaded";
|
||||
// }
|
||||
}
|
||||
|
||||
void ClearText(){
|
||||
// Result.text=" ";
|
||||
}
|
||||
}
|
||||
11
Assets/AdManager/ShowReward.cs.meta
Normal file
11
Assets/AdManager/ShowReward.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c981a36da6f6462eb7864282dec856e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
83
Assets/AdManager/TW_AdsManager.cs
Executable file
83
Assets/AdManager/TW_AdsManager.cs
Executable file
@@ -0,0 +1,83 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TW_AdsManager : MonoBehaviour
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
public void RequestBanner()
|
||||
{
|
||||
// AdManager._Instance.RequestBanner();
|
||||
}
|
||||
|
||||
public void DestroyBanner()
|
||||
{
|
||||
// AdManager._Instance.DestroyBanner();
|
||||
}
|
||||
|
||||
public void ShowBanner()
|
||||
{
|
||||
AdManager._Instance.ShowBanner();
|
||||
}
|
||||
|
||||
public void HideBanner()
|
||||
{
|
||||
AdManager._Instance.HideBanner();
|
||||
}
|
||||
//End of Banner
|
||||
|
||||
public void RequestNative()
|
||||
{
|
||||
// AdManager._Instance.RequestNative();
|
||||
}
|
||||
|
||||
public void DestroyNative()
|
||||
{
|
||||
// AdManager._Instance.DestroyNative();
|
||||
}
|
||||
|
||||
public void ShowNative()
|
||||
{
|
||||
AdManager._Instance.ShowMRec();
|
||||
}
|
||||
|
||||
public void HideNative()
|
||||
{
|
||||
AdManager._Instance.HideMRec();
|
||||
}
|
||||
//End of Banner
|
||||
|
||||
//Everything about Interstitial
|
||||
public void RequestInterstitial()
|
||||
{
|
||||
// AdManager._Instance.RequestInterstitial();
|
||||
}
|
||||
|
||||
public void ShowInterstitial()
|
||||
{
|
||||
AdManager._Instance.ShowInterstitial();
|
||||
}
|
||||
//End of Interstitial
|
||||
|
||||
public void RequestRewarded()
|
||||
{
|
||||
// AdManager._Instance.RequestRewarded();
|
||||
}
|
||||
|
||||
public void ShowRewardedVideo(){
|
||||
AdManager._Instance.showRewardedVideo();
|
||||
}
|
||||
|
||||
public void MediationDebugger(){
|
||||
AdManager._Instance.MediationDebugger();
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/AdManager/TW_AdsManager.cs.meta
Normal file
11
Assets/AdManager/TW_AdsManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5370aa0cd3afb4528976248123f8912a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/AdManager/ad break-LandScape.png
Normal file
BIN
Assets/AdManager/ad break-LandScape.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
132
Assets/AdManager/ad break-LandScape.png.meta
Normal file
132
Assets/AdManager/ad break-LandScape.png.meta
Normal file
@@ -0,0 +1,132 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6dd9436829aa43ecb6408b08cb898fd
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 29
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 1
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: c30341c17555d4b6080759d23634dfd0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
21
Assets/AdManager/adInitialize.cs
Normal file
21
Assets/AdManager/adInitialize.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class adInitialize : MonoBehaviour
|
||||
{
|
||||
public Object AdManagerPrefb;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
GameObject Ads=GameObject.Find("AdManager(Clone)");
|
||||
if(Ads==null)
|
||||
Ads=Instantiate(AdManagerPrefb) as GameObject;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/AdManager/adInitialize.cs.meta
Normal file
11
Assets/AdManager/adInitialize.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5510446fff21946f7a51cf3f88d7035c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/AdManager/iOS 14 Advertising Support.meta
Normal file
8
Assets/AdManager/iOS 14 Advertising Support.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13d079021a7144bce9309ba248e6fede
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/AdManager/iOS 14 Advertising Support/1.2.0.meta
Normal file
8
Assets/AdManager/iOS 14 Advertising Support/1.2.0.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d21ad7137932e47db91cc3279290245b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 720c9fb658ad34be19118f5c027401a0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,307 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.3731193, g: 0.38073996, b: 0.3587269, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 0
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 1
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 10
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ShowResolutionOverlay: 1
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 1
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &1246526937
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1246526939}
|
||||
- component: {fileID: 1246526938}
|
||||
m_Layer: 0
|
||||
m_Name: Context Screen Sample
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1246526938
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1246526937}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f0c6ccc637064b31981616bfc724dcb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
contextScreenPrefab: {fileID: 114597661633457500, guid: fa79c615e83e14e2fbc0f083dee317e0,
|
||||
type: 3}
|
||||
--- !u!4 &1246526939
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1246526937}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1438000399
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1438000402}
|
||||
- component: {fileID: 1438000401}
|
||||
- component: {fileID: 1438000400}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &1438000400
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1438000399}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1438000401
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1438000399}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 2
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_GateFitMode: 2
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &1438000402
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1438000399}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1719777655
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1719777658}
|
||||
- component: {fileID: 1719777657}
|
||||
- component: {fileID: 1719777656}
|
||||
m_Layer: 0
|
||||
m_Name: EventSystem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1719777656
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1719777655}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
m_CancelButton: Cancel
|
||||
m_InputActionsPerSecond: 10
|
||||
m_RepeatDelay: 0.5
|
||||
m_ForceModuleActive: 0
|
||||
--- !u!114 &1719777657
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1719777655}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_FirstSelected: {fileID: 0}
|
||||
m_sendNavigationEvents: 1
|
||||
m_DragThreshold: 10
|
||||
--- !u!4 &1719777658
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1719777655}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2154acf9dc1c46e5a8df649580ad6b9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b456238a0d67d4fe7a23ceab3419966b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa79c615e83e14e2fbc0f083dee317e0
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 896c313e1acc747f5a75a4e2b2aabe33
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,36 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.Advertisement.IosSupport.Samples
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
public class AutoSwitchLayout : MonoBehaviour
|
||||
{
|
||||
public Transform portraitModeLayoutTransform;
|
||||
public Transform landscapeModeLayoutTransform;
|
||||
|
||||
float m_PreviousAspectRatio;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var aspectRatio = 1f * Screen.width / Screen.height;
|
||||
|
||||
if (!Mathf.Approximately(aspectRatio, m_PreviousAspectRatio)
|
||||
&& portraitModeLayoutTransform
|
||||
&& landscapeModeLayoutTransform)
|
||||
{
|
||||
m_PreviousAspectRatio = aspectRatio;
|
||||
|
||||
if (aspectRatio > 1f)
|
||||
{
|
||||
landscapeModeLayoutTransform.gameObject.SetActive(true);
|
||||
portraitModeLayoutTransform.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
portraitModeLayoutTransform.gameObject.SetActive(true);
|
||||
landscapeModeLayoutTransform.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c9a84136181c491fa22c727d7e4831a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
using Unity.Advertisement.IosSupport.Components;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine.iOS;
|
||||
|
||||
namespace Unity.Advertisement.IosSupport.Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// This component will trigger the context screen to appear when the scene starts,
|
||||
/// if the user hasn't already responded to the iOS tracking dialog.
|
||||
/// </summary>
|
||||
public class ContextScreenManager : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// The prefab that will be instantiated by this component.
|
||||
/// The prefab has to have an ContextScreenView component on its root GameObject.
|
||||
/// </summary>
|
||||
public ContextScreenView contextScreenPrefab;
|
||||
|
||||
void Start()
|
||||
{
|
||||
#if UNITY_IOS
|
||||
// check with iOS to see if the user has accepted or declined tracking
|
||||
// var status = ATTrackingStatusBinding.GetAuthorizationTrackingStatus();
|
||||
Version currentVersion = new Version(Device.systemVersion);
|
||||
Version ios14 = new Version("14.5");
|
||||
|
||||
// if (status == ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED && currentVersion >= ios14)
|
||||
{
|
||||
var contextScreen = Instantiate(contextScreenPrefab).GetComponent<ContextScreenView>();
|
||||
|
||||
// after the Continue button is pressed, and the tracking request
|
||||
// has been sent, automatically destroy the popup to conserve memory
|
||||
contextScreen.sentTrackingAuthorizationRequest += () => Destroy(contextScreen.gameObject);
|
||||
}
|
||||
#else
|
||||
Debug.Log("Unity iOS Support: App Tracking Transparency status not checked, because the platform is not iOS.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f0c6ccc637064b31981616bfc724dcb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.Advertisement.IosSupport.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// This component controls an iOS App Tracking Transparency context screen.
|
||||
/// You should only have one of these in your app.
|
||||
/// </summary>
|
||||
public sealed class ContextScreenView : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// This event will be invoked after the ContinueButton is clicked
|
||||
/// and after the tracking authorization request has been sent.
|
||||
/// It's a good idea to subscribe to this event so you can destroy
|
||||
/// this GameObject to free up memory after it's no longer needed.
|
||||
/// Once the tracking authorization request has been sent, there's no
|
||||
/// need for this popup again until the app is uninstalled and reinstalled.
|
||||
/// </summary>
|
||||
public event Action sentTrackingAuthorizationRequest;
|
||||
|
||||
public void RequestAuthorizationTracking()
|
||||
{
|
||||
#if UNITY_IOS
|
||||
Debug.Log("Unity iOS Support: Requesting iOS App Tracking Transparency native dialog.");
|
||||
|
||||
// ATTrackingStatusBinding.RequestAuthorizationTracking(AuthorizationTrackingReceived);
|
||||
|
||||
sentTrackingAuthorizationRequest?.Invoke();
|
||||
#else
|
||||
Debug.LogWarning("Unity iOS Support: Tried to request iOS App Tracking Transparency native dialog, " +
|
||||
"but the current platform is not iOS.");
|
||||
#endif
|
||||
}
|
||||
|
||||
private void AuthorizationTrackingReceived(int status) {
|
||||
Debug.LogFormat("Tracking status received: {0}", status);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43c0833ba503546f1906839450d99850
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b74174c3c3f684ed78e93999053406ff
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,121 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f30a9623bbb145b9b7b5d7b407fa074
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 0
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 9, y: 9, z: 9, w: 9}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 1627ea3b75cce4b52859e9f762c0729f
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,88 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee2dff451a6a94136a1bc2034d68cb1b
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 57f1d745d132f4e848cc9acdcf95e3bd
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Adjust.meta
Normal file
8
Assets/Adjust.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a34b7202c127433db0d218348b119de
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Adjust/3rd Party.meta
Normal file
9
Assets/Adjust/3rd Party.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48d72eaa514ffd0449362a759c8e9a86
|
||||
folderAsset: yes
|
||||
timeCreated: 1578652520
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1038
Assets/Adjust/3rd Party/SimpleJSON.cs
Normal file
1038
Assets/Adjust/3rd Party/SimpleJSON.cs
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/Adjust/3rd Party/SimpleJSON.cs.meta
Normal file
8
Assets/Adjust/3rd Party/SimpleJSON.cs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c780c17852614618be5ffd9cc43a75f
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
9
Assets/Adjust/Android.meta
Normal file
9
Assets/Adjust/Android.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64b3fa260fe5b3c4e9215ec9b42c90da
|
||||
folderAsset: yes
|
||||
timeCreated: 1578652520
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
961
Assets/Adjust/Android/AdjustAndroid.cs
Normal file
961
Assets/Adjust/Android/AdjustAndroid.cs
Normal file
@@ -0,0 +1,961 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
public class AdjustAndroid
|
||||
{
|
||||
private const string sdkPrefix = "unity4.32.2";
|
||||
private static bool launchDeferredDeeplink = true;
|
||||
private static AndroidJavaClass ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
|
||||
private static AndroidJavaObject ajoCurrentActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
|
||||
private static DeferredDeeplinkListener onDeferredDeeplinkListener;
|
||||
private static AttributionChangeListener onAttributionChangedListener;
|
||||
private static EventTrackingFailedListener onEventTrackingFailedListener;
|
||||
private static EventTrackingSucceededListener onEventTrackingSucceededListener;
|
||||
private static SessionTrackingFailedListener onSessionTrackingFailedListener;
|
||||
private static SessionTrackingSucceededListener onSessionTrackingSucceededListener;
|
||||
|
||||
public static void Start(AdjustConfig adjustConfig)
|
||||
{
|
||||
// Thank you, Unity 2019.2.0, for breaking this.
|
||||
// AndroidJavaObject ajoEnvironment = adjustConfig.environment == AdjustEnvironment.Sandbox ?
|
||||
// new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("ENVIRONMENT_SANDBOX") :
|
||||
// new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("ENVIRONMENT_PRODUCTION");
|
||||
|
||||
// Get environment variable.
|
||||
string ajoEnvironment = adjustConfig.environment == AdjustEnvironment.Production ? "production" : "sandbox";
|
||||
|
||||
// Create adjust config object.
|
||||
AndroidJavaObject ajoAdjustConfig;
|
||||
|
||||
// Check if suppress log leve is supported.
|
||||
if (adjustConfig.allowSuppressLogLevel != null)
|
||||
{
|
||||
ajoAdjustConfig = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment, adjustConfig.allowSuppressLogLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
ajoAdjustConfig = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment);
|
||||
}
|
||||
|
||||
// Check if deferred deeplink should be launched by SDK.
|
||||
launchDeferredDeeplink = adjustConfig.launchDeferredDeeplink;
|
||||
|
||||
// Check log level.
|
||||
if (adjustConfig.logLevel != null)
|
||||
{
|
||||
AndroidJavaObject ajoLogLevel;
|
||||
if (adjustConfig.logLevel.Value.ToUppercaseString().Equals("SUPPRESS"))
|
||||
{
|
||||
ajoLogLevel = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic<AndroidJavaObject>("SUPRESS");
|
||||
}
|
||||
else
|
||||
{
|
||||
ajoLogLevel = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic<AndroidJavaObject>(adjustConfig.logLevel.Value.ToUppercaseString());
|
||||
}
|
||||
|
||||
if (ajoLogLevel != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setLogLevel", ajoLogLevel);
|
||||
}
|
||||
}
|
||||
|
||||
// Set unity SDK prefix.
|
||||
ajoAdjustConfig.Call("setSdkPrefix", sdkPrefix);
|
||||
|
||||
// Check if user has configured the delayed start option.
|
||||
if (adjustConfig.delayStart != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setDelayStart", adjustConfig.delayStart);
|
||||
}
|
||||
|
||||
// Check event buffering setting.
|
||||
if (adjustConfig.eventBufferingEnabled != null)
|
||||
{
|
||||
AndroidJavaObject ajoIsEnabled = new AndroidJavaObject("java.lang.Boolean", adjustConfig.eventBufferingEnabled.Value);
|
||||
ajoAdjustConfig.Call("setEventBufferingEnabled", ajoIsEnabled);
|
||||
}
|
||||
|
||||
// Check COPPA setting.
|
||||
if (adjustConfig.coppaCompliantEnabled != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setCoppaCompliantEnabled", adjustConfig.coppaCompliantEnabled.Value);
|
||||
}
|
||||
|
||||
// Check Play Store Kids Apps setting.
|
||||
if (adjustConfig.playStoreKidsAppEnabled != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setPlayStoreKidsAppEnabled", adjustConfig.playStoreKidsAppEnabled.Value);
|
||||
}
|
||||
|
||||
// Check if user enabled tracking in the background.
|
||||
if (adjustConfig.sendInBackground != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setSendInBackground", adjustConfig.sendInBackground.Value);
|
||||
}
|
||||
|
||||
// Check if user wants to get cost data in attribution callback.
|
||||
if (adjustConfig.needsCost != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setNeedsCost", adjustConfig.needsCost.Value);
|
||||
}
|
||||
|
||||
// Check if user wants to run preinstall campaigns.
|
||||
if (adjustConfig.preinstallTrackingEnabled != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setPreinstallTrackingEnabled", adjustConfig.preinstallTrackingEnabled.Value);
|
||||
}
|
||||
|
||||
// Check if user has set custom preinstall file path.
|
||||
if (adjustConfig.preinstallFilePath != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setPreinstallFilePath", adjustConfig.preinstallFilePath);
|
||||
}
|
||||
|
||||
// Check if user has set user agent value.
|
||||
if (adjustConfig.userAgent != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setUserAgent", adjustConfig.userAgent);
|
||||
}
|
||||
|
||||
// Check if user has set default process name.
|
||||
if (!String.IsNullOrEmpty(adjustConfig.processName))
|
||||
{
|
||||
ajoAdjustConfig.Call("setProcessName", adjustConfig.processName);
|
||||
}
|
||||
|
||||
// Check if user has set default tracker token.
|
||||
if (adjustConfig.defaultTracker != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setDefaultTracker", adjustConfig.defaultTracker);
|
||||
}
|
||||
|
||||
// Check if user has set external device identifier.
|
||||
if (adjustConfig.externalDeviceId != null)
|
||||
{
|
||||
ajoAdjustConfig.Call("setExternalDeviceId", adjustConfig.externalDeviceId);
|
||||
}
|
||||
|
||||
// Check if user has set custom URL strategy.
|
||||
if (adjustConfig.urlStrategy != null)
|
||||
{
|
||||
if (adjustConfig.urlStrategy == AdjustConfig.AdjustUrlStrategyChina)
|
||||
{
|
||||
AndroidJavaObject ajoUrlStrategyChina = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("URL_STRATEGY_CHINA");
|
||||
ajoAdjustConfig.Call("setUrlStrategy", ajoUrlStrategyChina);
|
||||
}
|
||||
else if (adjustConfig.urlStrategy == AdjustConfig.AdjustUrlStrategyIndia)
|
||||
{
|
||||
AndroidJavaObject ajoUrlStrategyIndia = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("URL_STRATEGY_INDIA");
|
||||
ajoAdjustConfig.Call("setUrlStrategy", ajoUrlStrategyIndia);
|
||||
}
|
||||
else if (adjustConfig.urlStrategy == AdjustConfig.AdjustDataResidencyEU)
|
||||
{
|
||||
AndroidJavaObject ajoDataResidencyEU = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("DATA_RESIDENCY_EU");
|
||||
ajoAdjustConfig.Call("setUrlStrategy", ajoDataResidencyEU);
|
||||
}
|
||||
else if (adjustConfig.urlStrategy == AdjustConfig.AdjustDataResidencyTR)
|
||||
{
|
||||
AndroidJavaObject ajoDataResidencyTR = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("DATA_RESIDENCY_TR");
|
||||
ajoAdjustConfig.Call("setUrlStrategy", ajoDataResidencyTR);
|
||||
}
|
||||
else if (adjustConfig.urlStrategy == AdjustConfig.AdjustDataResidencyUS)
|
||||
{
|
||||
AndroidJavaObject ajoDataResidencyUS = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("DATA_RESIDENCY_US");
|
||||
ajoAdjustConfig.Call("setUrlStrategy", ajoDataResidencyUS);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if user has set app secret.
|
||||
if (IsAppSecretSet(adjustConfig))
|
||||
{
|
||||
ajoAdjustConfig.Call("setAppSecret",
|
||||
adjustConfig.secretId.Value,
|
||||
adjustConfig.info1.Value,
|
||||
adjustConfig.info2.Value,
|
||||
adjustConfig.info3.Value,
|
||||
adjustConfig.info4.Value);
|
||||
}
|
||||
|
||||
// Check if user has set device as known.
|
||||
if (adjustConfig.isDeviceKnown.HasValue)
|
||||
{
|
||||
ajoAdjustConfig.Call("setDeviceKnown", adjustConfig.isDeviceKnown.Value);
|
||||
}
|
||||
|
||||
// Check if user has enabled reading of IMEI and MEID.
|
||||
// Obsolete method.
|
||||
if (adjustConfig.readImei.HasValue)
|
||||
{
|
||||
// ajoAdjustConfig.Call("setReadMobileEquipmentIdentity", adjustConfig.readImei.Value);
|
||||
}
|
||||
|
||||
// Check attribution changed delagate setting.
|
||||
if (adjustConfig.attributionChangedDelegate != null)
|
||||
{
|
||||
onAttributionChangedListener = new AttributionChangeListener(adjustConfig.attributionChangedDelegate);
|
||||
ajoAdjustConfig.Call("setOnAttributionChangedListener", onAttributionChangedListener);
|
||||
}
|
||||
|
||||
// Check event success delegate setting.
|
||||
if (adjustConfig.eventSuccessDelegate != null)
|
||||
{
|
||||
onEventTrackingSucceededListener = new EventTrackingSucceededListener(adjustConfig.eventSuccessDelegate);
|
||||
ajoAdjustConfig.Call("setOnEventTrackingSucceededListener", onEventTrackingSucceededListener);
|
||||
}
|
||||
|
||||
// Check event failure delagate setting.
|
||||
if (adjustConfig.eventFailureDelegate != null)
|
||||
{
|
||||
onEventTrackingFailedListener = new EventTrackingFailedListener(adjustConfig.eventFailureDelegate);
|
||||
ajoAdjustConfig.Call("setOnEventTrackingFailedListener", onEventTrackingFailedListener);
|
||||
}
|
||||
|
||||
// Check session success delegate setting.
|
||||
if (adjustConfig.sessionSuccessDelegate != null)
|
||||
{
|
||||
onSessionTrackingSucceededListener = new SessionTrackingSucceededListener(adjustConfig.sessionSuccessDelegate);
|
||||
ajoAdjustConfig.Call("setOnSessionTrackingSucceededListener", onSessionTrackingSucceededListener);
|
||||
}
|
||||
|
||||
// Check session failure delegate setting.
|
||||
if (adjustConfig.sessionFailureDelegate != null)
|
||||
{
|
||||
onSessionTrackingFailedListener = new SessionTrackingFailedListener(adjustConfig.sessionFailureDelegate);
|
||||
ajoAdjustConfig.Call("setOnSessionTrackingFailedListener", onSessionTrackingFailedListener);
|
||||
}
|
||||
|
||||
// Check deferred deeplink delegate setting.
|
||||
if (adjustConfig.deferredDeeplinkDelegate != null)
|
||||
{
|
||||
onDeferredDeeplinkListener = new DeferredDeeplinkListener(adjustConfig.deferredDeeplinkDelegate);
|
||||
ajoAdjustConfig.Call("setOnDeeplinkResponseListener", onDeferredDeeplinkListener);
|
||||
}
|
||||
|
||||
// Initialise and start the SDK.
|
||||
ajcAdjust.CallStatic("onCreate", ajoAdjustConfig);
|
||||
ajcAdjust.CallStatic("onResume");
|
||||
}
|
||||
|
||||
public static void TrackEvent(AdjustEvent adjustEvent)
|
||||
{
|
||||
AndroidJavaObject ajoAdjustEvent = new AndroidJavaObject("com.adjust.sdk.AdjustEvent", adjustEvent.eventToken);
|
||||
|
||||
// Check if user has set revenue for the event.
|
||||
if (adjustEvent.revenue != null)
|
||||
{
|
||||
ajoAdjustEvent.Call("setRevenue", (double)adjustEvent.revenue, adjustEvent.currency);
|
||||
}
|
||||
|
||||
// Check if user has added any callback parameters to the event.
|
||||
if (adjustEvent.callbackList != null)
|
||||
{
|
||||
for (int i = 0; i < adjustEvent.callbackList.Count; i += 2)
|
||||
{
|
||||
string key = adjustEvent.callbackList[i];
|
||||
string value = adjustEvent.callbackList[i + 1];
|
||||
ajoAdjustEvent.Call("addCallbackParameter", key, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if user has added any partner parameters to the event.
|
||||
if (adjustEvent.partnerList != null)
|
||||
{
|
||||
for (int i = 0; i < adjustEvent.partnerList.Count; i += 2)
|
||||
{
|
||||
string key = adjustEvent.partnerList[i];
|
||||
string value = adjustEvent.partnerList[i + 1];
|
||||
ajoAdjustEvent.Call("addPartnerParameter", key, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if user has added transaction ID to the event.
|
||||
if (adjustEvent.transactionId != null)
|
||||
{
|
||||
ajoAdjustEvent.Call("setOrderId", adjustEvent.transactionId);
|
||||
}
|
||||
|
||||
// Check if user has added callback ID to the event.
|
||||
if (adjustEvent.callbackId != null)
|
||||
{
|
||||
ajoAdjustEvent.Call("setCallbackId", adjustEvent.callbackId);
|
||||
}
|
||||
|
||||
// Track the event.
|
||||
ajcAdjust.CallStatic("trackEvent", ajoAdjustEvent);
|
||||
}
|
||||
|
||||
public static bool IsEnabled()
|
||||
{
|
||||
return ajcAdjust.CallStatic<bool>("isEnabled");
|
||||
}
|
||||
|
||||
public static void SetEnabled(bool enabled)
|
||||
{
|
||||
ajcAdjust.CallStatic("setEnabled", enabled);
|
||||
}
|
||||
|
||||
public static void SetOfflineMode(bool enabled)
|
||||
{
|
||||
ajcAdjust.CallStatic("setOfflineMode", enabled);
|
||||
}
|
||||
|
||||
public static void SendFirstPackages()
|
||||
{
|
||||
ajcAdjust.CallStatic("sendFirstPackages");
|
||||
}
|
||||
|
||||
public static void SetDeviceToken(string deviceToken)
|
||||
{
|
||||
ajcAdjust.CallStatic("setPushToken", deviceToken, ajoCurrentActivity);
|
||||
}
|
||||
|
||||
public static string GetAdid()
|
||||
{
|
||||
return ajcAdjust.CallStatic<string>("getAdid");
|
||||
}
|
||||
|
||||
public static void GdprForgetMe()
|
||||
{
|
||||
ajcAdjust.CallStatic("gdprForgetMe", ajoCurrentActivity);
|
||||
}
|
||||
|
||||
public static void DisableThirdPartySharing()
|
||||
{
|
||||
ajcAdjust.CallStatic("disableThirdPartySharing", ajoCurrentActivity);
|
||||
}
|
||||
|
||||
public static AdjustAttribution GetAttribution()
|
||||
{
|
||||
try
|
||||
{
|
||||
AndroidJavaObject ajoAttribution = ajcAdjust.CallStatic<AndroidJavaObject>("getAttribution");
|
||||
if (null == ajoAttribution)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
AdjustAttribution adjustAttribution = new AdjustAttribution();
|
||||
adjustAttribution.trackerName = ajoAttribution.Get<string>(AdjustUtils.KeyTrackerName) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyTrackerName);
|
||||
adjustAttribution.trackerToken = ajoAttribution.Get<string>(AdjustUtils.KeyTrackerToken) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyTrackerToken);
|
||||
adjustAttribution.network = ajoAttribution.Get<string>(AdjustUtils.KeyNetwork) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyNetwork);
|
||||
adjustAttribution.campaign = ajoAttribution.Get<string>(AdjustUtils.KeyCampaign) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyCampaign);
|
||||
adjustAttribution.adgroup = ajoAttribution.Get<string>(AdjustUtils.KeyAdgroup) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyAdgroup);
|
||||
adjustAttribution.creative = ajoAttribution.Get<string>(AdjustUtils.KeyCreative) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyCreative);
|
||||
adjustAttribution.clickLabel = ajoAttribution.Get<string>(AdjustUtils.KeyClickLabel) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyClickLabel);
|
||||
adjustAttribution.adid = ajoAttribution.Get<string>(AdjustUtils.KeyAdid) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyAdid);
|
||||
adjustAttribution.costType = ajoAttribution.Get<string>(AdjustUtils.KeyCostType) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyCostType);
|
||||
AndroidJavaObject ajoCostAmount = ajoAttribution.Get<AndroidJavaObject>(AdjustUtils.KeyCostAmount) == null ?
|
||||
null : ajoAttribution.Get<AndroidJavaObject>(AdjustUtils.KeyCostAmount);
|
||||
if (ajoCostAmount == null)
|
||||
{
|
||||
adjustAttribution.costAmount = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
double costAmount = ajoCostAmount.Call<double>("doubleValue");
|
||||
adjustAttribution.costAmount = costAmount;
|
||||
}
|
||||
adjustAttribution.costCurrency = ajoAttribution.Get<string>(AdjustUtils.KeyCostCurrency) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyCostCurrency);
|
||||
adjustAttribution.fbInstallReferrer = ajoAttribution.Get<string>(AdjustUtils.KeyFbInstallReferrer) == "" ?
|
||||
null : ajoAttribution.Get<string>(AdjustUtils.KeyFbInstallReferrer);
|
||||
return adjustAttribution;
|
||||
}
|
||||
catch (Exception) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void AddSessionPartnerParameter(string key, string value)
|
||||
{
|
||||
if (ajcAdjust == null)
|
||||
{
|
||||
ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
|
||||
}
|
||||
ajcAdjust.CallStatic("addSessionPartnerParameter", key, value);
|
||||
}
|
||||
|
||||
public static void AddSessionCallbackParameter(string key, string value)
|
||||
{
|
||||
if (ajcAdjust == null)
|
||||
{
|
||||
ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
|
||||
}
|
||||
ajcAdjust.CallStatic("addSessionCallbackParameter", key, value);
|
||||
}
|
||||
|
||||
public static void RemoveSessionPartnerParameter(string key)
|
||||
{
|
||||
if (ajcAdjust == null)
|
||||
{
|
||||
ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
|
||||
}
|
||||
ajcAdjust.CallStatic("removeSessionPartnerParameter", key);
|
||||
}
|
||||
|
||||
public static void RemoveSessionCallbackParameter(string key)
|
||||
{
|
||||
if (ajcAdjust == null)
|
||||
{
|
||||
ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
|
||||
}
|
||||
ajcAdjust.CallStatic("removeSessionCallbackParameter", key);
|
||||
}
|
||||
|
||||
public static void ResetSessionPartnerParameters()
|
||||
{
|
||||
if (ajcAdjust == null)
|
||||
{
|
||||
ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
|
||||
}
|
||||
ajcAdjust.CallStatic("resetSessionPartnerParameters");
|
||||
}
|
||||
|
||||
public static void ResetSessionCallbackParameters()
|
||||
{
|
||||
if (ajcAdjust == null)
|
||||
{
|
||||
ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
|
||||
}
|
||||
ajcAdjust.CallStatic("resetSessionCallbackParameters");
|
||||
}
|
||||
|
||||
public static void AppWillOpenUrl(string url)
|
||||
{
|
||||
AndroidJavaClass ajcUri = new AndroidJavaClass("android.net.Uri");
|
||||
AndroidJavaObject ajoUri = ajcUri.CallStatic<AndroidJavaObject>("parse", url);
|
||||
ajcAdjust.CallStatic("appWillOpenUrl", ajoUri, ajoCurrentActivity);
|
||||
}
|
||||
|
||||
public static void TrackAdRevenue(string source, string payload)
|
||||
{
|
||||
if (ajcAdjust == null)
|
||||
{
|
||||
ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
|
||||
}
|
||||
AndroidJavaObject jsonPayload = new AndroidJavaObject("org.json.JSONObject", payload);
|
||||
ajcAdjust.CallStatic("trackAdRevenue", source, jsonPayload);
|
||||
}
|
||||
|
||||
public static void TrackAdRevenue(AdjustAdRevenue adRevenue)
|
||||
{
|
||||
AndroidJavaObject ajoAdjustAdRevenue = new AndroidJavaObject("com.adjust.sdk.AdjustAdRevenue", adRevenue.source);
|
||||
|
||||
// Check if user has set revenue.
|
||||
if (adRevenue.revenue != null)
|
||||
{
|
||||
AndroidJavaObject ajoRevenue = new AndroidJavaObject("java.lang.Double", adRevenue.revenue);
|
||||
ajoAdjustAdRevenue.Call("setRevenue", ajoRevenue, adRevenue.currency);
|
||||
}
|
||||
|
||||
// Check if user has set ad impressions count.
|
||||
if (adRevenue.adImpressionsCount != null)
|
||||
{
|
||||
AndroidJavaObject ajoAdImpressionsCount = new AndroidJavaObject("java.lang.Integer", adRevenue.adImpressionsCount);
|
||||
ajoAdjustAdRevenue.Call("setAdImpressionsCount", ajoAdImpressionsCount);
|
||||
}
|
||||
|
||||
// Check if user has set ad revenue network.
|
||||
if (adRevenue.adRevenueNetwork != null)
|
||||
{
|
||||
ajoAdjustAdRevenue.Call("setAdRevenueNetwork", adRevenue.adRevenueNetwork);
|
||||
}
|
||||
|
||||
// Check if user has set ad revenue unit.
|
||||
if (adRevenue.adRevenueUnit != null)
|
||||
{
|
||||
ajoAdjustAdRevenue.Call("setAdRevenueUnit", adRevenue.adRevenueUnit);
|
||||
}
|
||||
|
||||
// Check if user has set ad revenue placement.
|
||||
if (adRevenue.adRevenuePlacement != null)
|
||||
{
|
||||
ajoAdjustAdRevenue.Call("setAdRevenuePlacement", adRevenue.adRevenuePlacement);
|
||||
}
|
||||
|
||||
// Check if user has added any callback parameters.
|
||||
if (adRevenue.callbackList != null)
|
||||
{
|
||||
for (int i = 0; i < adRevenue.callbackList.Count; i += 2)
|
||||
{
|
||||
string key = adRevenue.callbackList[i];
|
||||
string value = adRevenue.callbackList[i + 1];
|
||||
ajoAdjustAdRevenue.Call("addCallbackParameter", key, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if user has added any partner parameters.
|
||||
if (adRevenue.partnerList != null)
|
||||
{
|
||||
for (int i = 0; i < adRevenue.partnerList.Count; i += 2)
|
||||
{
|
||||
string key = adRevenue.partnerList[i];
|
||||
string value = adRevenue.partnerList[i + 1];
|
||||
ajoAdjustAdRevenue.Call("addPartnerParameter", key, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Track ad revenue.
|
||||
ajcAdjust.CallStatic("trackAdRevenue", ajoAdjustAdRevenue);
|
||||
}
|
||||
|
||||
public static void TrackPlayStoreSubscription(AdjustPlayStoreSubscription subscription)
|
||||
{
|
||||
AndroidJavaObject ajoSubscription = new AndroidJavaObject("com.adjust.sdk.AdjustPlayStoreSubscription",
|
||||
Convert.ToInt64(subscription.price),
|
||||
subscription.currency,
|
||||
subscription.sku,
|
||||
subscription.orderId,
|
||||
subscription.signature,
|
||||
subscription.purchaseToken);
|
||||
|
||||
// Check if user has set purchase time for subscription.
|
||||
if (subscription.purchaseTime != null)
|
||||
{
|
||||
ajoSubscription.Call("setPurchaseTime", Convert.ToInt64(subscription.purchaseTime));
|
||||
}
|
||||
|
||||
// Check if user has added any callback parameters to the subscription.
|
||||
if (subscription.callbackList != null)
|
||||
{
|
||||
for (int i = 0; i < subscription.callbackList.Count; i += 2)
|
||||
{
|
||||
string key = subscription.callbackList[i];
|
||||
string value = subscription.callbackList[i + 1];
|
||||
ajoSubscription.Call("addCallbackParameter", key, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if user has added any partner parameters to the subscription.
|
||||
if (subscription.partnerList != null)
|
||||
{
|
||||
for (int i = 0; i < subscription.partnerList.Count; i += 2)
|
||||
{
|
||||
string key = subscription.partnerList[i];
|
||||
string value = subscription.partnerList[i + 1];
|
||||
ajoSubscription.Call("addPartnerParameter", key, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Track the subscription.
|
||||
ajcAdjust.CallStatic("trackPlayStoreSubscription", ajoSubscription);
|
||||
}
|
||||
|
||||
public static void TrackThirdPartySharing(AdjustThirdPartySharing thirdPartySharing)
|
||||
{
|
||||
AndroidJavaObject ajoIsEnabled;
|
||||
AndroidJavaObject ajoAdjustThirdPartySharing;
|
||||
if (thirdPartySharing.isEnabled != null)
|
||||
{
|
||||
ajoIsEnabled = new AndroidJavaObject("java.lang.Boolean", thirdPartySharing.isEnabled.Value);
|
||||
ajoAdjustThirdPartySharing = new AndroidJavaObject("com.adjust.sdk.AdjustThirdPartySharing", ajoIsEnabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] parameters = null;
|
||||
ajoAdjustThirdPartySharing = new AndroidJavaObject("com.adjust.sdk.AdjustThirdPartySharing", parameters);
|
||||
}
|
||||
|
||||
if (thirdPartySharing.granularOptions != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, List<string>> entry in thirdPartySharing.granularOptions)
|
||||
{
|
||||
for (int i = 0; i < entry.Value.Count;)
|
||||
{
|
||||
ajoAdjustThirdPartySharing.Call("addGranularOption", entry.Key, entry.Value[i++], entry.Value[i++]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (thirdPartySharing.partnerSharingSettings != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, List<string>> entry in thirdPartySharing.partnerSharingSettings)
|
||||
{
|
||||
for (int i = 0; i < entry.Value.Count;)
|
||||
{
|
||||
ajoAdjustThirdPartySharing.Call("addPartnerSharingSetting", entry.Key, entry.Value[i++], bool.Parse(entry.Value[i++]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ajcAdjust.CallStatic("trackThirdPartySharing", ajoAdjustThirdPartySharing);
|
||||
}
|
||||
|
||||
public static void TrackMeasurementConsent(bool measurementConsent)
|
||||
{
|
||||
ajcAdjust.CallStatic("trackMeasurementConsent", measurementConsent);
|
||||
}
|
||||
|
||||
// Android specific methods.
|
||||
public static void OnPause()
|
||||
{
|
||||
ajcAdjust.CallStatic("onPause");
|
||||
}
|
||||
|
||||
public static void OnResume()
|
||||
{
|
||||
ajcAdjust.CallStatic("onResume");
|
||||
}
|
||||
|
||||
public static void SetReferrer(string referrer)
|
||||
{
|
||||
ajcAdjust.CallStatic("setReferrer", referrer, ajoCurrentActivity);
|
||||
}
|
||||
|
||||
public static void GetGoogleAdId(Action<string> onDeviceIdsRead)
|
||||
{
|
||||
DeviceIdsReadListener onDeviceIdsReadProxy = new DeviceIdsReadListener(onDeviceIdsRead);
|
||||
ajcAdjust.CallStatic("getGoogleAdId", ajoCurrentActivity, onDeviceIdsReadProxy);
|
||||
}
|
||||
|
||||
public static string GetAmazonAdId()
|
||||
{
|
||||
return ajcAdjust.CallStatic<string>("getAmazonAdId", ajoCurrentActivity);
|
||||
}
|
||||
|
||||
public static string GetSdkVersion()
|
||||
{
|
||||
string nativeSdkVersion = ajcAdjust.CallStatic<string>("getSdkVersion");
|
||||
return sdkPrefix + "@" + nativeSdkVersion;
|
||||
}
|
||||
|
||||
// Used for testing only.
|
||||
public static void SetTestOptions(Dictionary<string, string> testOptions)
|
||||
{
|
||||
AndroidJavaObject ajoTestOptions = AdjustUtils.TestOptionsMap2AndroidJavaObject(testOptions, ajoCurrentActivity);
|
||||
ajcAdjust.CallStatic("setTestOptions", ajoTestOptions);
|
||||
}
|
||||
|
||||
// Private & helper classes.
|
||||
private class AttributionChangeListener : AndroidJavaProxy
|
||||
{
|
||||
private Action<AdjustAttribution> callback;
|
||||
|
||||
public AttributionChangeListener(Action<AdjustAttribution> pCallback) : base("com.adjust.sdk.OnAttributionChangedListener")
|
||||
{
|
||||
this.callback = pCallback;
|
||||
}
|
||||
|
||||
// Method must be lowercase to match Android method signature.
|
||||
public void onAttributionChanged(AndroidJavaObject attribution)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AdjustAttribution adjustAttribution = new AdjustAttribution();
|
||||
adjustAttribution.trackerName = attribution.Get<string>(AdjustUtils.KeyTrackerName) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyTrackerName);
|
||||
adjustAttribution.trackerToken = attribution.Get<string>(AdjustUtils.KeyTrackerToken) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyTrackerToken);
|
||||
adjustAttribution.network = attribution.Get<string>(AdjustUtils.KeyNetwork) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyNetwork);
|
||||
adjustAttribution.campaign = attribution.Get<string>(AdjustUtils.KeyCampaign) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyCampaign);
|
||||
adjustAttribution.adgroup = attribution.Get<string>(AdjustUtils.KeyAdgroup) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyAdgroup);
|
||||
adjustAttribution.creative = attribution.Get<string>(AdjustUtils.KeyCreative) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyCreative);
|
||||
adjustAttribution.clickLabel = attribution.Get<string>(AdjustUtils.KeyClickLabel) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyClickLabel);
|
||||
adjustAttribution.adid = attribution.Get<string>(AdjustUtils.KeyAdid) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyAdid);
|
||||
adjustAttribution.costType = attribution.Get<string>(AdjustUtils.KeyCostType) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyCostType);
|
||||
AndroidJavaObject ajoCostAmount = attribution.Get<AndroidJavaObject>(AdjustUtils.KeyCostAmount) == null ?
|
||||
null : attribution.Get<AndroidJavaObject>(AdjustUtils.KeyCostAmount);
|
||||
if (ajoCostAmount == null)
|
||||
{
|
||||
adjustAttribution.costAmount = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
double costAmount = ajoCostAmount.Call<double>("doubleValue");
|
||||
adjustAttribution.costAmount = costAmount;
|
||||
}
|
||||
adjustAttribution.costCurrency = attribution.Get<string>(AdjustUtils.KeyCostCurrency) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyCostCurrency);
|
||||
adjustAttribution.fbInstallReferrer = attribution.Get<string>(AdjustUtils.KeyFbInstallReferrer) == "" ?
|
||||
null : attribution.Get<string>(AdjustUtils.KeyFbInstallReferrer);
|
||||
callback(adjustAttribution);
|
||||
}
|
||||
}
|
||||
|
||||
private class DeferredDeeplinkListener : AndroidJavaProxy
|
||||
{
|
||||
private Action<string> callback;
|
||||
|
||||
public DeferredDeeplinkListener(Action<string> pCallback) : base("com.adjust.sdk.OnDeeplinkResponseListener")
|
||||
{
|
||||
this.callback = pCallback;
|
||||
}
|
||||
|
||||
// Method must be lowercase to match Android method signature.
|
||||
public bool launchReceivedDeeplink(AndroidJavaObject deeplink)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
return launchDeferredDeeplink;
|
||||
}
|
||||
|
||||
string deeplinkURL = deeplink.Call<string>("toString");
|
||||
callback(deeplinkURL);
|
||||
return launchDeferredDeeplink;
|
||||
}
|
||||
}
|
||||
|
||||
private class EventTrackingSucceededListener : AndroidJavaProxy
|
||||
{
|
||||
private Action<AdjustEventSuccess> callback;
|
||||
|
||||
public EventTrackingSucceededListener(Action<AdjustEventSuccess> pCallback) : base("com.adjust.sdk.OnEventTrackingSucceededListener")
|
||||
{
|
||||
this.callback = pCallback;
|
||||
}
|
||||
|
||||
// Method must be lowercase to match Android method signature.
|
||||
public void onFinishedEventTrackingSucceeded(AndroidJavaObject eventSuccessData)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (eventSuccessData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AdjustEventSuccess adjustEventSuccess = new AdjustEventSuccess();
|
||||
adjustEventSuccess.Adid = eventSuccessData.Get<string>(AdjustUtils.KeyAdid) == "" ?
|
||||
null : eventSuccessData.Get<string>(AdjustUtils.KeyAdid);
|
||||
adjustEventSuccess.Message = eventSuccessData.Get<string>(AdjustUtils.KeyMessage) == "" ?
|
||||
null : eventSuccessData.Get<string>(AdjustUtils.KeyMessage);
|
||||
adjustEventSuccess.Timestamp = eventSuccessData.Get<string>(AdjustUtils.KeyTimestamp) == "" ?
|
||||
null : eventSuccessData.Get<string>(AdjustUtils.KeyTimestamp);
|
||||
adjustEventSuccess.EventToken = eventSuccessData.Get<string>(AdjustUtils.KeyEventToken) == "" ?
|
||||
null : eventSuccessData.Get<string>(AdjustUtils.KeyEventToken);
|
||||
adjustEventSuccess.CallbackId = eventSuccessData.Get<string>(AdjustUtils.KeyCallbackId) == "" ?
|
||||
null : eventSuccessData.Get<string>(AdjustUtils.KeyCallbackId);
|
||||
|
||||
try
|
||||
{
|
||||
AndroidJavaObject ajoJsonResponse = eventSuccessData.Get<AndroidJavaObject>(AdjustUtils.KeyJsonResponse);
|
||||
string jsonResponseString = ajoJsonResponse.Call<string>("toString");
|
||||
adjustEventSuccess.BuildJsonResponseFromString(jsonResponseString);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// JSON response reading failed.
|
||||
// Native Android SDK should send empty JSON object if none available as of v4.12.5.
|
||||
// Native Android SDK added special logic to send Unity friendly values as of v4.15.0.
|
||||
}
|
||||
|
||||
callback(adjustEventSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
private class EventTrackingFailedListener : AndroidJavaProxy
|
||||
{
|
||||
private Action<AdjustEventFailure> callback;
|
||||
|
||||
public EventTrackingFailedListener(Action<AdjustEventFailure> pCallback) : base("com.adjust.sdk.OnEventTrackingFailedListener")
|
||||
{
|
||||
this.callback = pCallback;
|
||||
}
|
||||
|
||||
// Method must be lowercase to match Android method signature.
|
||||
public void onFinishedEventTrackingFailed(AndroidJavaObject eventFailureData)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (eventFailureData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AdjustEventFailure adjustEventFailure = new AdjustEventFailure();
|
||||
adjustEventFailure.Adid = eventFailureData.Get<string>(AdjustUtils.KeyAdid) == "" ?
|
||||
null : eventFailureData.Get<string>(AdjustUtils.KeyAdid);
|
||||
adjustEventFailure.Message = eventFailureData.Get<string>(AdjustUtils.KeyMessage) == "" ?
|
||||
null : eventFailureData.Get<string>(AdjustUtils.KeyMessage);
|
||||
adjustEventFailure.WillRetry = eventFailureData.Get<bool>(AdjustUtils.KeyWillRetry);
|
||||
adjustEventFailure.Timestamp = eventFailureData.Get<string>(AdjustUtils.KeyTimestamp) == "" ?
|
||||
null : eventFailureData.Get<string>(AdjustUtils.KeyTimestamp);
|
||||
adjustEventFailure.EventToken = eventFailureData.Get<string>(AdjustUtils.KeyEventToken) == "" ?
|
||||
null : eventFailureData.Get<string>(AdjustUtils.KeyEventToken);
|
||||
adjustEventFailure.CallbackId = eventFailureData.Get<string>(AdjustUtils.KeyCallbackId) == "" ?
|
||||
null : eventFailureData.Get<string>(AdjustUtils.KeyCallbackId);
|
||||
|
||||
try
|
||||
{
|
||||
AndroidJavaObject ajoJsonResponse = eventFailureData.Get<AndroidJavaObject>(AdjustUtils.KeyJsonResponse);
|
||||
string jsonResponseString = ajoJsonResponse.Call<string>("toString");
|
||||
adjustEventFailure.BuildJsonResponseFromString(jsonResponseString);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// JSON response reading failed.
|
||||
// Native Android SDK should send empty JSON object if none available as of v4.12.5.
|
||||
// Native Android SDK added special logic to send Unity friendly values as of v4.15.0.
|
||||
}
|
||||
|
||||
callback(adjustEventFailure);
|
||||
}
|
||||
}
|
||||
|
||||
private class SessionTrackingSucceededListener : AndroidJavaProxy
|
||||
{
|
||||
private Action<AdjustSessionSuccess> callback;
|
||||
|
||||
public SessionTrackingSucceededListener(Action<AdjustSessionSuccess> pCallback) : base("com.adjust.sdk.OnSessionTrackingSucceededListener")
|
||||
{
|
||||
this.callback = pCallback;
|
||||
}
|
||||
|
||||
// Method must be lowercase to match Android method signature.
|
||||
public void onFinishedSessionTrackingSucceeded(AndroidJavaObject sessionSuccessData)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (sessionSuccessData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AdjustSessionSuccess adjustSessionSuccess = new AdjustSessionSuccess();
|
||||
adjustSessionSuccess.Adid = sessionSuccessData.Get<string>(AdjustUtils.KeyAdid) == "" ?
|
||||
null : sessionSuccessData.Get<string>(AdjustUtils.KeyAdid);
|
||||
adjustSessionSuccess.Message = sessionSuccessData.Get<string>(AdjustUtils.KeyMessage) == "" ?
|
||||
null : sessionSuccessData.Get<string>(AdjustUtils.KeyMessage);
|
||||
adjustSessionSuccess.Timestamp = sessionSuccessData.Get<string>(AdjustUtils.KeyTimestamp) == "" ?
|
||||
null : sessionSuccessData.Get<string>(AdjustUtils.KeyTimestamp);
|
||||
|
||||
try
|
||||
{
|
||||
AndroidJavaObject ajoJsonResponse = sessionSuccessData.Get<AndroidJavaObject>(AdjustUtils.KeyJsonResponse);
|
||||
string jsonResponseString = ajoJsonResponse.Call<string>("toString");
|
||||
adjustSessionSuccess.BuildJsonResponseFromString(jsonResponseString);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// JSON response reading failed.
|
||||
// Native Android SDK should send empty JSON object if none available as of v4.12.5.
|
||||
// Native Android SDK added special logic to send Unity friendly values as of v4.15.0.
|
||||
}
|
||||
|
||||
callback(adjustSessionSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
private class SessionTrackingFailedListener : AndroidJavaProxy
|
||||
{
|
||||
private Action<AdjustSessionFailure> callback;
|
||||
|
||||
public SessionTrackingFailedListener(Action<AdjustSessionFailure> pCallback) : base("com.adjust.sdk.OnSessionTrackingFailedListener")
|
||||
{
|
||||
this.callback = pCallback;
|
||||
}
|
||||
|
||||
// Method must be lowercase to match Android method signature.
|
||||
public void onFinishedSessionTrackingFailed(AndroidJavaObject sessionFailureData)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (sessionFailureData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AdjustSessionFailure adjustSessionFailure = new AdjustSessionFailure();
|
||||
adjustSessionFailure.Adid = sessionFailureData.Get<string>(AdjustUtils.KeyAdid) == "" ?
|
||||
null : sessionFailureData.Get<string>(AdjustUtils.KeyAdid);
|
||||
adjustSessionFailure.Message = sessionFailureData.Get<string>(AdjustUtils.KeyMessage) == "" ?
|
||||
null : sessionFailureData.Get<string>(AdjustUtils.KeyMessage);
|
||||
adjustSessionFailure.WillRetry = sessionFailureData.Get<bool>(AdjustUtils.KeyWillRetry);
|
||||
adjustSessionFailure.Timestamp = sessionFailureData.Get<string>(AdjustUtils.KeyTimestamp) == "" ?
|
||||
null : sessionFailureData.Get<string>(AdjustUtils.KeyTimestamp);
|
||||
|
||||
try
|
||||
{
|
||||
AndroidJavaObject ajoJsonResponse = sessionFailureData.Get<AndroidJavaObject>(AdjustUtils.KeyJsonResponse);
|
||||
string jsonResponseString = ajoJsonResponse.Call<string>("toString");
|
||||
adjustSessionFailure.BuildJsonResponseFromString(jsonResponseString);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// JSON response reading failed.
|
||||
// Native Android SDK should send empty JSON object if none available as of v4.12.5.
|
||||
// Native Android SDK added special logic to send Unity friendly values as of v4.15.0.
|
||||
}
|
||||
|
||||
callback(adjustSessionFailure);
|
||||
}
|
||||
}
|
||||
|
||||
private class DeviceIdsReadListener : AndroidJavaProxy
|
||||
{
|
||||
private Action<string> onPlayAdIdReadCallback;
|
||||
|
||||
public DeviceIdsReadListener(Action<string> pCallback) : base("com.adjust.sdk.OnDeviceIdsRead")
|
||||
{
|
||||
this.onPlayAdIdReadCallback = pCallback;
|
||||
}
|
||||
|
||||
// Method must be lowercase to match Android method signature.
|
||||
public void onGoogleAdIdRead(string playAdId)
|
||||
{
|
||||
if (onPlayAdIdReadCallback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.onPlayAdIdReadCallback(playAdId);
|
||||
}
|
||||
|
||||
// Handling of null object.
|
||||
public void onGoogleAdIdRead(AndroidJavaObject ajoAdId)
|
||||
{
|
||||
if (ajoAdId == null)
|
||||
{
|
||||
string adId = null;
|
||||
this.onGoogleAdIdRead(adId);
|
||||
return;
|
||||
}
|
||||
|
||||
this.onGoogleAdIdRead(ajoAdId.Call<string>("toString"));
|
||||
}
|
||||
}
|
||||
|
||||
// Private & helper methods.
|
||||
private static bool IsAppSecretSet(AdjustConfig adjustConfig)
|
||||
{
|
||||
return adjustConfig.secretId.HasValue
|
||||
&& adjustConfig.info1.HasValue
|
||||
&& adjustConfig.info2.HasValue
|
||||
&& adjustConfig.info3.HasValue
|
||||
&& adjustConfig.info4.HasValue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
8
Assets/Adjust/Android/AdjustAndroid.cs.meta
Normal file
8
Assets/Adjust/Android/AdjustAndroid.cs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b21499aaf10a42e8b6377af71a35ba5
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
49
Assets/Adjust/Android/AdjustAndroidManifest.xml
Normal file
49
Assets/Adjust/Android/AdjustAndroidManifest.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.unity3d.player"
|
||||
android:installLocation="preferExternal"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<supports-screens
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"
|
||||
android:anyDensity="true"/>
|
||||
|
||||
<!-- Permissions needed by the Adjust SDK. -->
|
||||
<!-- For more information, check: https://github.com/adjust/unity_sdk#post-build-android -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />
|
||||
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
|
||||
|
||||
<application
|
||||
android:theme="@style/UnityThemeSelector"
|
||||
android:icon="@drawable/app_icon"
|
||||
android:label="@string/app_name"
|
||||
android:debuggable="true">
|
||||
|
||||
<!-- Adjust broadcast receiver used to capture referrer content from INSTALL_REFERRER intent. -->
|
||||
<receiver
|
||||
android:name="com.adjust.sdk.AdjustReferrerReceiver"
|
||||
android:permission="android.permission.INSTALL_PACKAGES"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="com.android.vending.INSTALL_REFERRER" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name="com.unity3d.player.UnityPlayerActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
4
Assets/Adjust/Android/AdjustAndroidManifest.xml.meta
Normal file
4
Assets/Adjust/Android/AdjustAndroidManifest.xml.meta
Normal file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a13ef442648c346a79f9ff24875c037a
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
BIN
Assets/Adjust/Android/adjust-android.jar
Normal file
BIN
Assets/Adjust/Android/adjust-android.jar
Normal file
Binary file not shown.
33
Assets/Adjust/Android/adjust-android.jar.meta
Normal file
33
Assets/Adjust/Android/adjust-android.jar.meta
Normal file
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de7cd4cf0359345f487233fc82a1d892
|
||||
timeCreated: 1526341612
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
'': data
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Adjust/Editor.meta
Normal file
9
Assets/Adjust/Editor.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b51771bcccf507e45b2db8213466a010
|
||||
folderAsset: yes
|
||||
timeCreated: 1578652520
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
85
Assets/Adjust/Editor/AdjustCustomEditor.cs
Normal file
85
Assets/Adjust/Editor/AdjustCustomEditor.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEditor;
|
||||
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
[CustomEditor(typeof(Adjust))]
|
||||
public class AdjustCustomEditor : Editor
|
||||
{
|
||||
private Editor settingsEditor;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
var adjust = target as Adjust;
|
||||
GUIStyle darkerCyanTextFieldStyles = new GUIStyle(EditorStyles.boldLabel);
|
||||
darkerCyanTextFieldStyles.normal.textColor = new Color(0f/255f, 190f/255f, 190f/255f);
|
||||
|
||||
// Not gonna ask: http://answers.unity.com/answers/1244650/view.html
|
||||
EditorGUILayout.Space();
|
||||
var origFontStyle = EditorStyles.label.fontStyle;
|
||||
EditorStyles.label.fontStyle = FontStyle.Bold;
|
||||
adjust.startManually = EditorGUILayout.Toggle("START SDK MANUALLY", adjust.startManually, EditorStyles.toggle);
|
||||
EditorStyles.label.fontStyle = origFontStyle;
|
||||
|
||||
using (new EditorGUI.DisabledScope(adjust.startManually))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("MULTIPLATFORM SETTINGS:", darkerCyanTextFieldStyles);
|
||||
EditorGUI.indentLevel += 1;
|
||||
adjust.appToken = EditorGUILayout.TextField("App Token", adjust.appToken);
|
||||
adjust.environment = (AdjustEnvironment)EditorGUILayout.EnumPopup("Environment", adjust.environment);
|
||||
adjust.logLevel = (AdjustLogLevel)EditorGUILayout.EnumPopup("Log Level", adjust.logLevel);
|
||||
adjust.urlStrategy = (AdjustUrlStrategy)EditorGUILayout.EnumPopup("URL Strategy", adjust.urlStrategy);
|
||||
adjust.eventBuffering = EditorGUILayout.Toggle("Event Buffering", adjust.eventBuffering);
|
||||
adjust.sendInBackground = EditorGUILayout.Toggle("Send In Background", adjust.sendInBackground);
|
||||
adjust.launchDeferredDeeplink = EditorGUILayout.Toggle("Launch Deferred Deep Link", adjust.launchDeferredDeeplink);
|
||||
adjust.needsCost = EditorGUILayout.Toggle("Cost Data In Attribution Callback", adjust.needsCost);
|
||||
adjust.coppaCompliant = EditorGUILayout.Toggle("COPPA Compliant", adjust.coppaCompliant);
|
||||
adjust.linkMe = EditorGUILayout.Toggle("LinkMe", adjust.linkMe);
|
||||
adjust.defaultTracker = EditorGUILayout.TextField("Default Tracker", adjust.defaultTracker);
|
||||
adjust.startDelay = EditorGUILayout.DoubleField("Start Delay", adjust.startDelay);
|
||||
EditorGUILayout.LabelField("App Secret:", EditorStyles.label);
|
||||
EditorGUI.indentLevel += 1;
|
||||
adjust.secretId = EditorGUILayout.LongField("Secret ID", adjust.secretId);
|
||||
adjust.info1 = EditorGUILayout.LongField("Info 1", adjust.info1);
|
||||
adjust.info2 = EditorGUILayout.LongField("Info 2", adjust.info2);
|
||||
adjust.info3 = EditorGUILayout.LongField("Info 3", adjust.info3);
|
||||
adjust.info4 = EditorGUILayout.LongField("Info 4", adjust.info4);
|
||||
EditorGUI.indentLevel -= 2;
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("ANDROID SETTINGS:", darkerCyanTextFieldStyles);
|
||||
EditorGUI.indentLevel += 1;
|
||||
adjust.preinstallTracking = EditorGUILayout.Toggle("Preinstall Tracking", adjust.preinstallTracking);
|
||||
adjust.preinstallFilePath = EditorGUILayout.TextField("Preinstall File Path", adjust.preinstallFilePath);
|
||||
adjust.playStoreKidsApp = EditorGUILayout.Toggle("Play Store Kids App", adjust.playStoreKidsApp);
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("IOS SETTINGS:", darkerCyanTextFieldStyles);
|
||||
EditorGUI.indentLevel += 1;
|
||||
adjust.iadInfoReading = EditorGUILayout.Toggle("iAd Info Reading", adjust.iadInfoReading);
|
||||
adjust.adServicesInfoReading = EditorGUILayout.Toggle("AdServices Info Reading", adjust.adServicesInfoReading);
|
||||
adjust.idfaInfoReading = EditorGUILayout.Toggle("IDFA Info Reading", adjust.idfaInfoReading);
|
||||
adjust.skAdNetworkHandling = EditorGUILayout.Toggle("SKAdNetwork Handling", adjust.skAdNetworkHandling);
|
||||
EditorGUI.indentLevel -= 1;
|
||||
}
|
||||
|
||||
if (settingsEditor == null)
|
||||
{
|
||||
settingsEditor = CreateEditor(AdjustSettings.Instance);
|
||||
}
|
||||
|
||||
settingsEditor.OnInspectorGUI();
|
||||
|
||||
if (GUI.changed)
|
||||
{
|
||||
EditorUtility.SetDirty(adjust);
|
||||
EditorSceneManager.MarkSceneDirty(adjust.gameObject.scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/Adjust/Editor/AdjustCustomEditor.cs.meta
Normal file
13
Assets/Adjust/Editor/AdjustCustomEditor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1772b9461c24c4df0ad55f51f81c7345
|
||||
timeCreated: 1617868100
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
348
Assets/Adjust/Editor/AdjustEditor.cs
Normal file
348
Assets/Adjust/Editor/AdjustEditor.cs
Normal file
@@ -0,0 +1,348 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
#if UNITY_IOS
|
||||
using UnityEditor.iOS.Xcode;
|
||||
#endif
|
||||
|
||||
public class AdjustEditor : AssetPostprocessor
|
||||
{
|
||||
[MenuItem("Assets/Adjust/Export Unity Package")]
|
||||
public static void ExportAdjustUnityPackage()
|
||||
{
|
||||
string exportedFileName = "Adjust.unitypackage";
|
||||
string assetsPath = "Assets/Adjust";
|
||||
List<string> assetsToExport = new List<string>();
|
||||
|
||||
// Adjust Assets.
|
||||
assetsToExport.Add(assetsPath + "/3rd Party/SimpleJSON.cs");
|
||||
|
||||
assetsToExport.Add(assetsPath + "/Android/adjust-android.jar");
|
||||
assetsToExport.Add(assetsPath + "/Android/AdjustAndroid.cs");
|
||||
assetsToExport.Add(assetsPath + "/Android/AdjustAndroidManifest.xml");
|
||||
|
||||
assetsToExport.Add(assetsPath + "/Editor/AdjustEditor.cs");
|
||||
assetsToExport.Add(assetsPath + "/Editor/AdjustSettings.cs");
|
||||
assetsToExport.Add(assetsPath + "/Editor/AdjustSettingsEditor.cs");
|
||||
assetsToExport.Add(assetsPath + "/Editor/AdjustCustomEditor.cs");
|
||||
assetsToExport.Add(assetsPath + "/Editor/AdjustEditorPreprocessor.cs");
|
||||
|
||||
assetsToExport.Add(assetsPath + "/ExampleGUI/ExampleGUI.cs");
|
||||
assetsToExport.Add(assetsPath + "/ExampleGUI/ExampleGUI.prefab");
|
||||
assetsToExport.Add(assetsPath + "/ExampleGUI/ExampleGUI.unity");
|
||||
|
||||
assetsToExport.Add(assetsPath + "/iOS/ADJAttribution.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/ADJConfig.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/ADJEvent.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/ADJEventFailure.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/ADJEventSuccess.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/ADJLogger.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/ADJSessionFailure.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/ADJSessionSuccess.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/ADJSubscription.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/Adjust.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/AdjustiOS.cs");
|
||||
assetsToExport.Add(assetsPath + "/iOS/AdjustSdk.a");
|
||||
assetsToExport.Add(assetsPath + "/iOS/AdjustUnity.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/AdjustUnity.mm");
|
||||
assetsToExport.Add(assetsPath + "/iOS/AdjustUnityDelegate.h");
|
||||
assetsToExport.Add(assetsPath + "/iOS/AdjustUnityDelegate.mm");
|
||||
|
||||
assetsToExport.Add(assetsPath + "/Prefab/Adjust.prefab");
|
||||
|
||||
assetsToExport.Add(assetsPath + "/Unity/Adjust.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustAppStoreSubscription.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustAttribution.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustConfig.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustEnvironment.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustEvent.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustEventFailure.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustEventSuccess.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustLogLevel.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustPlayStoreSubscription.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustSessionFailure.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustSessionSuccess.cs");
|
||||
assetsToExport.Add(assetsPath + "/Unity/AdjustUtils.cs");
|
||||
|
||||
assetsToExport.Add(assetsPath + "/Windows/AdjustWindows.cs");
|
||||
assetsToExport.Add(assetsPath + "/Windows/WindowsPcl.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/WindowsUap.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/Stubs/Win10Interface.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/Stubs/Win81Interface.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/Stubs/WinWsInterface.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/W81/AdjustWP81.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/W81/Win81Interface.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/WS/AdjustWS.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/WS/WinWsInterface.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/WU10/AdjustUAP10.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/WU10/Win10Interface.dll");
|
||||
assetsToExport.Add(assetsPath + "/Windows/Newtonsoft.Json.dll");
|
||||
|
||||
AssetDatabase.ExportPackage(
|
||||
assetsToExport.ToArray(),
|
||||
exportedFileName,
|
||||
ExportPackageOptions.IncludeDependencies | ExportPackageOptions.Interactive);
|
||||
}
|
||||
|
||||
[PostProcessBuild]
|
||||
public static void OnPostprocessBuild(BuildTarget target, string projectPath)
|
||||
{
|
||||
RunPostBuildScript(target: target, projectPath: projectPath);
|
||||
}
|
||||
|
||||
private static void RunPostBuildScript(BuildTarget target, string projectPath = "")
|
||||
{
|
||||
if (target == BuildTarget.iOS)
|
||||
{
|
||||
#if UNITY_IOS
|
||||
Debug.Log("[Adjust]: Starting to perform post build tasks for iOS platform.");
|
||||
|
||||
string xcodeProjectPath = projectPath + "/Unity-iPhone.xcodeproj/project.pbxproj";
|
||||
|
||||
PBXProject xcodeProject = new PBXProject();
|
||||
xcodeProject.ReadFromFile(xcodeProjectPath);
|
||||
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
string xcodeTarget = xcodeProject.GetUnityMainTargetGuid();
|
||||
#else
|
||||
string xcodeTarget = xcodeProject.TargetGuidByName("Unity-iPhone");
|
||||
#endif
|
||||
HandlePlistIosChanges(projectPath);
|
||||
|
||||
if (AdjustSettings.iOSUniversalLinksDomains.Length > 0)
|
||||
{
|
||||
AddUniversalLinkDomains(xcodeProject, xcodeProjectPath, xcodeTarget);
|
||||
}
|
||||
|
||||
// If enabled by the user, Adjust SDK will try to add following frameworks to your project:
|
||||
// - AdSupport.framework (needed for access to IDFA value)
|
||||
// - iAd.framework (needed in case you are running ASA campaigns)
|
||||
// - AdServices.framework (needed in case you are running ASA campaigns)
|
||||
// - StoreKit.framework (needed for communication with SKAdNetwork framework)
|
||||
// - AppTrackingTransparency.framework (needed for information about user's consent to be tracked)
|
||||
// In case you don't need any of these, feel free to remove them from your app.
|
||||
|
||||
if (AdjustSettings.iOSFrameworkAdSupport)
|
||||
{
|
||||
Debug.Log("[Adjust]: Adding AdSupport.framework to Xcode project.");
|
||||
xcodeProject.AddFrameworkToProject(xcodeTarget, "AdSupport.framework", true);
|
||||
Debug.Log("[Adjust]: AdSupport.framework added successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[Adjust]: Skipping AdSupport.framework linking.");
|
||||
}
|
||||
if (AdjustSettings.iOSFrameworkiAd)
|
||||
{
|
||||
Debug.Log("[Adjust]: Adding iAd.framework to Xcode project.");
|
||||
xcodeProject.AddFrameworkToProject(xcodeTarget, "iAd.framework", true);
|
||||
Debug.Log("[Adjust]: iAd.framework added successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[Adjust]: Skipping iAd.framework linking.");
|
||||
}
|
||||
if (AdjustSettings.iOSFrameworkAdServices)
|
||||
{
|
||||
Debug.Log("[Adjust]: Adding AdServices.framework to Xcode project.");
|
||||
xcodeProject.AddFrameworkToProject(xcodeTarget, "AdServices.framework", true);
|
||||
Debug.Log("[Adjust]: AdServices.framework added successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[Adjust]: Skipping AdServices.framework linking.");
|
||||
}
|
||||
if (AdjustSettings.iOSFrameworkStoreKit)
|
||||
{
|
||||
Debug.Log("[Adjust]: Adding StoreKit.framework to Xcode project.");
|
||||
xcodeProject.AddFrameworkToProject(xcodeTarget, "StoreKit.framework", true);
|
||||
Debug.Log("[Adjust]: StoreKit.framework added successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[Adjust]: Skipping StoreKit.framework linking.");
|
||||
}
|
||||
if (AdjustSettings.iOSFrameworkAppTrackingTransparency)
|
||||
{
|
||||
Debug.Log("[Adjust]: Adding AppTrackingTransparency.framework to Xcode project.");
|
||||
xcodeProject.AddFrameworkToProject(xcodeTarget, "AppTrackingTransparency.framework", true);
|
||||
Debug.Log("[Adjust]: AppTrackingTransparency.framework added successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[Adjust]: Skipping AppTrackingTransparency.framework linking.");
|
||||
}
|
||||
|
||||
// The Adjust SDK needs to have Obj-C exceptions enabled.
|
||||
// GCC_ENABLE_OBJC_EXCEPTIONS=YES
|
||||
Debug.Log("[Adjust]: Enabling Obj-C exceptions by setting GCC_ENABLE_OBJC_EXCEPTIONS value to YES.");
|
||||
xcodeProject.AddBuildProperty(xcodeTarget, "GCC_ENABLE_OBJC_EXCEPTIONS", "YES");
|
||||
Debug.Log("[Adjust]: Obj-C exceptions enabled successfully.");
|
||||
|
||||
// The Adjust SDK needs to have -ObjC flag set in other linker flags section because of it's categories.
|
||||
// OTHER_LDFLAGS -ObjC
|
||||
//
|
||||
// Seems that in newer Unity IDE versions adding -ObjC flag to Unity-iPhone target doesn't do the trick.
|
||||
// Adding -ObjC to UnityFramework target however does make things work nicely again.
|
||||
// This happens because Unity is linking SDK's static library into UnityFramework target.
|
||||
// Check for presence of UnityFramework target and if there, include -ObjC flag inside of it.
|
||||
|
||||
Debug.Log("[Adjust]: Adding -ObjC flag to other linker flags (OTHER_LDFLAGS) of Unity-iPhone target.");
|
||||
xcodeProject.AddBuildProperty(xcodeTarget, "OTHER_LDFLAGS", "-ObjC");
|
||||
Debug.Log("[Adjust]: -ObjC successfully added to other linker flags.");
|
||||
string xcodeTargetUnityFramework = xcodeProject.TargetGuidByName("UnityFramework");
|
||||
if (!string.IsNullOrEmpty(xcodeTargetUnityFramework))
|
||||
{
|
||||
Debug.Log("[Adjust]: Adding -ObjC flag to other linker flags (OTHER_LDFLAGS) of UnityFramework target.");
|
||||
xcodeProject.AddBuildProperty(xcodeTargetUnityFramework, "OTHER_LDFLAGS", "-ObjC");
|
||||
Debug.Log("[Adjust]: -ObjC successfully added to other linker flags.");
|
||||
}
|
||||
|
||||
if (xcodeProject.ContainsFileByProjectPath("Libraries/Adjust/iOS/AdjustSigSdk.a"))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(xcodeTargetUnityFramework))
|
||||
{
|
||||
xcodeProject.AddBuildProperty(xcodeTargetUnityFramework, "OTHER_LDFLAGS", "-force_load $(PROJECT_DIR)/Libraries/Adjust/iOS/AdjustSigSdk.a");
|
||||
}
|
||||
else
|
||||
{
|
||||
xcodeProject.AddBuildProperty(xcodeTarget, "OTHER_LDFLAGS", "-force_load $(PROJECT_DIR)/Libraries/Adjust/iOS/AdjustSigSdk.a");
|
||||
}
|
||||
}
|
||||
|
||||
// Save the changes to Xcode project file.
|
||||
xcodeProject.WriteToFile(xcodeProjectPath);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_IOS
|
||||
private static void HandlePlistIosChanges(string projectPath)
|
||||
{
|
||||
const string UserTrackingUsageDescriptionKey = "NSUserTrackingUsageDescription";
|
||||
|
||||
// Check if needs to do any info plist change.
|
||||
bool hasUserTrackingDescription =
|
||||
!string.IsNullOrEmpty(AdjustSettings.iOSUserTrackingUsageDescription);
|
||||
bool hasUrlSchemesDeepLinksEnabled = AdjustSettings.iOSUrlSchemes.Length > 0;
|
||||
|
||||
if (!hasUserTrackingDescription && !hasUrlSchemesDeepLinksEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get and read info plist.
|
||||
var plistPath = Path.Combine(projectPath, "Info.plist");
|
||||
var plist = new PlistDocument();
|
||||
plist.ReadFromFile(plistPath);
|
||||
var plistRoot = plist.root;
|
||||
|
||||
// Do the info plist changes.
|
||||
if (hasUserTrackingDescription)
|
||||
{
|
||||
if (plistRoot[UserTrackingUsageDescriptionKey] != null)
|
||||
{
|
||||
Debug.Log("[Adjust]: Overwritting User Tracking Usage Description.");
|
||||
}
|
||||
plistRoot.SetString(UserTrackingUsageDescriptionKey,
|
||||
AdjustSettings.iOSUserTrackingUsageDescription);
|
||||
}
|
||||
|
||||
if (hasUrlSchemesDeepLinksEnabled)
|
||||
{
|
||||
AddUrlSchemesIOS(plistRoot, AdjustSettings.iOSUrlIdentifier, AdjustSettings.iOSUrlSchemes);
|
||||
}
|
||||
|
||||
// Write any info plist change.
|
||||
File.WriteAllText(plistPath, plist.WriteToString());
|
||||
}
|
||||
|
||||
private static void AddUrlSchemesIOS(PlistElementDict plistRoot, string urlIdentifier, string[] urlSchemes)
|
||||
{
|
||||
// Set Array for futher deeplink values.
|
||||
var urlTypesArray = CreatePlistElementArray(plistRoot, "CFBundleURLTypes");
|
||||
|
||||
// Array will contain just one deeplink dictionary
|
||||
var urlSchemesItems = CreatePlistElementDict(urlTypesArray);
|
||||
urlSchemesItems.SetString("CFBundleURLName", urlIdentifier);
|
||||
var urlSchemesArray = CreatePlistElementArray(urlSchemesItems, "CFBundleURLSchemes");
|
||||
|
||||
// Delete old deferred deeplinks URIs
|
||||
Debug.Log("[Adjust]: Removing deeplinks that already exist in the array to avoid duplicates.");
|
||||
foreach (var link in urlSchemes)
|
||||
{
|
||||
urlSchemesArray.values.RemoveAll(
|
||||
element => element != null && element.AsString().Equals(link));
|
||||
}
|
||||
|
||||
Debug.Log("[Adjust]: Adding new deep links.");
|
||||
foreach (var link in urlSchemes.Distinct())
|
||||
{
|
||||
urlSchemesArray.AddString(link);
|
||||
}
|
||||
}
|
||||
|
||||
private static PlistElementArray CreatePlistElementArray(PlistElementDict root, string key)
|
||||
{
|
||||
if (!root.values.ContainsKey(key))
|
||||
{
|
||||
Debug.Log(string.Format("[Adjust]: {0} not found in Info.plist. Creating a new one.", key));
|
||||
return root.CreateArray(key);
|
||||
}
|
||||
var result = root.values[key].AsArray();
|
||||
return result != null ? result : root.CreateArray(key);
|
||||
}
|
||||
|
||||
private static PlistElementDict CreatePlistElementDict(PlistElementArray rootArray)
|
||||
{
|
||||
if (rootArray.values.Count == 0)
|
||||
{
|
||||
Debug.Log("[Adjust]: Deeplinks array doesn't contain dictionary for deeplinks. Creating a new one.");
|
||||
return rootArray.AddDict();
|
||||
}
|
||||
|
||||
var urlSchemesItems = rootArray.values[0].AsDict();
|
||||
Debug.Log("[Adjust]: Reading deeplinks array");
|
||||
if (urlSchemesItems == null)
|
||||
{
|
||||
Debug.Log("[Adjust]: Deeplinks array doesn't contain dictionary for deeplinks. Creating a new one.");
|
||||
urlSchemesItems = rootArray.AddDict();
|
||||
}
|
||||
|
||||
return urlSchemesItems;
|
||||
}
|
||||
|
||||
private static void AddUniversalLinkDomains(PBXProject project, string xCodeProjectPath, string xCodeTarget)
|
||||
{
|
||||
string entitlementsFileName = "Unity-iPhone.entitlements";
|
||||
|
||||
Debug.Log("[Adjust]: Adding associated domains to entitlements file.");
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
var projectCapabilityManager = new ProjectCapabilityManager(xCodeProjectPath, entitlementsFileName, null, project.GetUnityMainTargetGuid());
|
||||
#else
|
||||
var projectCapabilityManager = new ProjectCapabilityManager(xCodeProjectPath, entitlementsFileName, PBXProject.GetUnityTargetName());
|
||||
#endif
|
||||
var uniqueDomains = AdjustSettings.iOSUniversalLinksDomains.Distinct().ToArray();
|
||||
const string applinksPrefix = "applinks:";
|
||||
for (int i = 0; i < uniqueDomains.Length; i++)
|
||||
{
|
||||
if (!uniqueDomains[i].StartsWith(applinksPrefix))
|
||||
{
|
||||
uniqueDomains[i] = applinksPrefix + uniqueDomains[i];
|
||||
}
|
||||
}
|
||||
|
||||
projectCapabilityManager.AddAssociatedDomains(uniqueDomains);
|
||||
projectCapabilityManager.WriteToFile();
|
||||
|
||||
Debug.Log("[Adjust]: Enabling Associated Domains capability with created entitlements file.");
|
||||
project.AddCapability(xCodeTarget, PBXCapabilityType.AssociatedDomains, entitlementsFileName);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
8
Assets/Adjust/Editor/AdjustEditor.cs.meta
Normal file
8
Assets/Adjust/Editor/AdjustEditor.cs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc5962e0096e9495bbad76934c842619
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
365
Assets/Adjust/Editor/AdjustEditorPreprocessor.cs
Normal file
365
Assets/Adjust/Editor/AdjustEditorPreprocessor.cs
Normal file
@@ -0,0 +1,365 @@
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor.Build;
|
||||
using UnityEditor;
|
||||
using System.Xml;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Linq;
|
||||
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
public class AdjustEditorPreprocessor : IPreprocessBuildWithReport
|
||||
#else
|
||||
public class AdjustEditorPreprocessor : IPreprocessBuild
|
||||
#endif
|
||||
{
|
||||
public int callbackOrder
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
|
||||
{
|
||||
OnPreprocessBuild(report.summary.platform, string.Empty);
|
||||
}
|
||||
#endif
|
||||
|
||||
public void OnPreprocessBuild(BuildTarget target, string path)
|
||||
{
|
||||
if (target == BuildTarget.Android)
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
RunPostProcessTasksAndroid();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_ANDROID
|
||||
private static void RunPostProcessTasksAndroid()
|
||||
{
|
||||
var isAdjustManifestUsed = false;
|
||||
var androidPluginsPath = Path.Combine(Application.dataPath, "Plugins/Android");
|
||||
var adjustManifestPath = Path.Combine(Application.dataPath, "Adjust/Android/AdjustAndroidManifest.xml");
|
||||
var appManifestPath = Path.Combine(Application.dataPath, "Plugins/Android/AndroidManifest.xml");
|
||||
|
||||
// Check if user has already created AndroidManifest.xml file in its location.
|
||||
// If not, use already predefined AdjustAndroidManifest.xml as default one.
|
||||
if (!File.Exists(appManifestPath))
|
||||
{
|
||||
if (!Directory.Exists(androidPluginsPath))
|
||||
{
|
||||
Directory.CreateDirectory(androidPluginsPath);
|
||||
}
|
||||
|
||||
isAdjustManifestUsed = true;
|
||||
File.Copy(adjustManifestPath, appManifestPath);
|
||||
|
||||
Debug.Log("[Adjust]: User defined AndroidManifest.xml file not found in Plugins/Android folder.");
|
||||
Debug.Log("[Adjust]: Creating default app's AndroidManifest.xml from AdjustAndroidManifest.xml file.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[Adjust]: User defined AndroidManifest.xml file located in Plugins/Android folder.");
|
||||
}
|
||||
|
||||
// Let's open the app's AndroidManifest.xml file.
|
||||
var manifestFile = new XmlDocument();
|
||||
manifestFile.Load(appManifestPath);
|
||||
|
||||
var manifestHasChanged = false;
|
||||
|
||||
// If Adjust manifest is used, we have already set up everything in it so that
|
||||
// our native Android SDK can be used properly.
|
||||
if (!isAdjustManifestUsed)
|
||||
{
|
||||
// However, if you already had your own AndroidManifest.xml, we'll now run
|
||||
// some checks on it and tweak it a bit if needed to add some stuff which
|
||||
// our native Android SDK needs so that it can run properly.
|
||||
|
||||
// Add needed permissions if they are missing.
|
||||
manifestHasChanged |= AddPermissions(manifestFile);
|
||||
|
||||
// Add intent filter to main activity if it is missing.
|
||||
manifestHasChanged |= AddBroadcastReceiver(manifestFile);
|
||||
}
|
||||
|
||||
// Add intent filter to URL schemes for deeplinking
|
||||
manifestHasChanged |= AddURISchemes(manifestFile);
|
||||
|
||||
if (manifestHasChanged)
|
||||
{
|
||||
// Save the changes.
|
||||
manifestFile.Save(appManifestPath);
|
||||
|
||||
Debug.Log("[Adjust]: App's AndroidManifest.xml file check and potential modification completed.");
|
||||
Debug.Log("[Adjust]: Please check if any error message was displayed during this process "
|
||||
+ "and make sure to fix all issues in order to properly use the Adjust SDK in your app.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[Adjust]: App's AndroidManifest.xml file check completed.");
|
||||
Debug.Log("[Adjust]: No modifications performed due to app's AndroidManifest.xml file compatibility.");
|
||||
}
|
||||
}
|
||||
|
||||
private static bool AddURISchemes(XmlDocument manifest)
|
||||
{
|
||||
if (AdjustSettings.AndroidUriSchemes.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Debug.Log("[Adjust]: Start addition of URI schemes");
|
||||
|
||||
var intentRoot = manifest.DocumentElement.SelectSingleNode("/manifest/application/activity[@android:name='com.unity3d.player.UnityPlayerActivity']", GetNamespaceManager(manifest));
|
||||
var usedIntentFiltersChanged = false;
|
||||
var usedIntentFilters = GetIntentFilter(manifest);
|
||||
foreach (var uriScheme in AdjustSettings.AndroidUriSchemes)
|
||||
{
|
||||
Uri uri;
|
||||
try
|
||||
{
|
||||
// The first element is android:scheme and the second one is android:host.
|
||||
uri = new Uri(uriScheme);
|
||||
|
||||
// Uri class converts implicit file paths to explicit file paths with the file:// scheme.
|
||||
if (!uriScheme.StartsWith(uri.Scheme))
|
||||
{
|
||||
throw new UriFormatException();
|
||||
}
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
Debug.LogError(string.Format("[Adjust]: Android deeplink URI scheme \"{0}\" is invalid and will be ignored.", uriScheme));
|
||||
Debug.LogWarning(string.Format("[Adjust]: Make sure that your URI scheme entry ends with ://"));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsIntentFilterAlreadyExist(manifest, uri))
|
||||
{
|
||||
Debug.Log("[Adjust]: Adding new URI with scheme: " + uri.Scheme + ", and host: " + uri.Host);
|
||||
var androidSchemeNode = manifest.CreateElement("data");
|
||||
AddAndroidNamespaceAttribute(manifest, "scheme", uri.Scheme, androidSchemeNode);
|
||||
AddAndroidNamespaceAttribute(manifest, "host", uri.Host, androidSchemeNode);
|
||||
usedIntentFilters.AppendChild(androidSchemeNode);
|
||||
usedIntentFiltersChanged = true;
|
||||
|
||||
Debug.Log(string.Format("[Adjust]: Android deeplink URI scheme \"{0}\" successfully added to your app's AndroidManifest.xml file.", uriScheme));
|
||||
}
|
||||
}
|
||||
|
||||
if (usedIntentFiltersChanged && usedIntentFilters.ParentNode == null)
|
||||
{
|
||||
intentRoot.AppendChild(usedIntentFilters);
|
||||
}
|
||||
|
||||
return usedIntentFiltersChanged;
|
||||
}
|
||||
|
||||
private static XmlElement GetIntentFilter(XmlDocument manifest)
|
||||
{
|
||||
var xpath = "/manifest/application/activity/intent-filter[data/@android:scheme and data/@android:host]";
|
||||
var intentFilter = manifest.DocumentElement.SelectSingleNode(xpath, GetNamespaceManager(manifest)) as XmlElement;
|
||||
if (intentFilter == null)
|
||||
{
|
||||
const string androidName = "name";
|
||||
const string category = "category";
|
||||
|
||||
intentFilter = manifest.CreateElement("intent-filter");
|
||||
|
||||
var actionElement = manifest.CreateElement("action");
|
||||
AddAndroidNamespaceAttribute(manifest, androidName, "android.intent.action.VIEW", actionElement);
|
||||
intentFilter.AppendChild(actionElement);
|
||||
|
||||
var defaultCategory = manifest.CreateElement(category);
|
||||
AddAndroidNamespaceAttribute(manifest, androidName, "android.intent.category.DEFAULT", defaultCategory);
|
||||
intentFilter.AppendChild(defaultCategory);
|
||||
|
||||
var browsableCategory = manifest.CreateElement(category);
|
||||
AddAndroidNamespaceAttribute(manifest, androidName, "android.intent.category.BROWSABLE", browsableCategory);
|
||||
intentFilter.AppendChild(browsableCategory);
|
||||
}
|
||||
return intentFilter;
|
||||
}
|
||||
|
||||
private static bool IsIntentFilterAlreadyExist(XmlDocument manifest, Uri link)
|
||||
{
|
||||
var xpath = string.Format("/manifest/application/activity/intent-filter/data[@android:scheme='{0}' and @android:host='{1}']", link.Scheme, link.Host);
|
||||
return manifest.DocumentElement.SelectSingleNode(xpath, GetNamespaceManager(manifest)) != null;
|
||||
}
|
||||
|
||||
private static bool AddPermissions(XmlDocument manifest)
|
||||
{
|
||||
// The Adjust SDK needs two permissions to be added to you app's manifest file:
|
||||
// <uses-permission android:name="android.permission.INTERNET" />
|
||||
// <uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />
|
||||
// <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
|
||||
// <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
Debug.Log("[Adjust]: Checking if all permissions needed for the Adjust SDK are present in the app's AndroidManifest.xml file.");
|
||||
|
||||
var manifestHasChanged = false;
|
||||
|
||||
// If enabled by the user && android.permission.INTERNET permission is missing, add it.
|
||||
if (AdjustSettings.androidPermissionInternet == true)
|
||||
{
|
||||
manifestHasChanged |= AddPermission(manifest, "android.permission.INTERNET");
|
||||
}
|
||||
// If enabled by the user && com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE permission is missing, add it.
|
||||
if (AdjustSettings.androidPermissionInstallReferrerService == true)
|
||||
{
|
||||
manifestHasChanged |= AddPermission(manifest, "com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE");
|
||||
}
|
||||
// If enabled by the user && com.google.android.gms.permission.AD_ID permission is missing, add it.
|
||||
if (AdjustSettings.androidPermissionAdId == true)
|
||||
{
|
||||
manifestHasChanged |= AddPermission(manifest, "com.google.android.gms.permission.AD_ID");
|
||||
}
|
||||
// If enabled by the user && android.permission.ACCESS_NETWORK_STATE permission is missing, add it.
|
||||
if (AdjustSettings.androidPermissionAccessNetworkState == true)
|
||||
{
|
||||
manifestHasChanged |= AddPermission(manifest, "android.permission.ACCESS_NETWORK_STATE");
|
||||
}
|
||||
|
||||
return manifestHasChanged;
|
||||
}
|
||||
|
||||
private static bool AddPermission(XmlDocument manifest, string permissionValue)
|
||||
{
|
||||
if (DoesPermissionExist(manifest, permissionValue))
|
||||
{
|
||||
Debug.Log(string.Format("[Adjust]: Your app's AndroidManifest.xml file already contains {0} permission.", permissionValue));
|
||||
return false;
|
||||
}
|
||||
|
||||
var element = manifest.CreateElement("uses-permission");
|
||||
AddAndroidNamespaceAttribute(manifest, "name", permissionValue, element);
|
||||
manifest.DocumentElement.AppendChild(element);
|
||||
Debug.Log(string.Format("[Adjust]: {0} permission successfully added to your app's AndroidManifest.xml file.", permissionValue));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool DoesPermissionExist(XmlDocument manifest, string permissionValue)
|
||||
{
|
||||
var xpath = string.Format("/manifest/uses-permission[@android:name='{0}']", permissionValue);
|
||||
return manifest.DocumentElement.SelectSingleNode(xpath, GetNamespaceManager(manifest)) != null;
|
||||
}
|
||||
|
||||
private static bool AddBroadcastReceiver(XmlDocument manifest)
|
||||
{
|
||||
// We're looking for existence of broadcast receiver in the AndroidManifest.xml
|
||||
// Check out the example below how that usually looks like:
|
||||
|
||||
// <manifest
|
||||
// <!-- ... -->>
|
||||
//
|
||||
// <supports-screens
|
||||
// <!-- ... -->/>
|
||||
//
|
||||
// <application
|
||||
// <!-- ... -->>
|
||||
// <receiver
|
||||
// android:name="com.adjust.sdk.AdjustReferrerReceiver"
|
||||
// android:permission="android.permission.INSTALL_PACKAGES"
|
||||
// android:exported="true" >
|
||||
//
|
||||
// <intent-filter>
|
||||
// <action android:name="com.android.vending.INSTALL_REFERRER" />
|
||||
// </intent-filter>
|
||||
// </receiver>
|
||||
//
|
||||
// <activity android:name="com.unity3d.player.UnityPlayerActivity"
|
||||
// <!-- ... -->
|
||||
// </activity>
|
||||
// </application>
|
||||
//
|
||||
// <!-- ... -->>
|
||||
//
|
||||
// </manifest>
|
||||
|
||||
Debug.Log("[Adjust]: Checking if app's AndroidManifest.xml file contains receiver for INSTALL_REFERRER intent.");
|
||||
|
||||
// Find the application node
|
||||
var applicationNodeXpath = "/manifest/application";
|
||||
var applicationNode = manifest.DocumentElement.SelectSingleNode(applicationNodeXpath);
|
||||
|
||||
// If there's no application node, something is really wrong with your AndroidManifest.xml.
|
||||
if (applicationNode == null)
|
||||
{
|
||||
Debug.LogError("[Adjust]: Your app's AndroidManifest.xml file does not contain \"<application>\" node.");
|
||||
Debug.LogError("[Adjust]: Unable to add the Adjust broadcast receiver to AndroidManifest.xml.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Okay, there's an application node in the AndroidManifest.xml file.
|
||||
// Let's now check if user has already defined a receiver which is listening to INSTALL_REFERRER intent.
|
||||
// If that is already defined, don't force the Adjust broadcast receiver to the manifest file.
|
||||
// If not, add the Adjust broadcast receiver to the manifest file.
|
||||
|
||||
var customBroadcastReceiversNodes = GetCustomRecieverNodes(manifest);
|
||||
if (customBroadcastReceiversNodes.Count > 0)
|
||||
{
|
||||
if (DoesAdjustBroadcastReceiverExist(manifest))
|
||||
{
|
||||
Debug.Log("[Adjust]: It seems like you are already using Adjust broadcast receiver. Yay.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[Adjust]: It seems like you are using your own broadcast receiver.");
|
||||
Debug.Log("[Adjust]: Please, add the calls to the Adjust broadcast receiver like described in here: https://github.com/adjust/android_sdk/blob/master/doc/english/referrer.md");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Generate Adjust broadcast receiver entry and add it to the application node.
|
||||
var receiverElement = manifest.CreateElement("receiver");
|
||||
AddAndroidNamespaceAttribute(manifest, "name", "com.adjust.sdk.AdjustReferrerReceiver", receiverElement);
|
||||
AddAndroidNamespaceAttribute(manifest, "permission", "android.permission.INSTALL_PACKAGES", receiverElement);
|
||||
AddAndroidNamespaceAttribute(manifest, "exported", "true", receiverElement);
|
||||
|
||||
var intentFilterElement = manifest.CreateElement("intent-filter");
|
||||
var actionElement = manifest.CreateElement("action");
|
||||
AddAndroidNamespaceAttribute(manifest, "name", "com.android.vending.INSTALL_REFERRER", actionElement);
|
||||
|
||||
intentFilterElement.AppendChild(actionElement);
|
||||
receiverElement.AppendChild(intentFilterElement);
|
||||
applicationNode.AppendChild(receiverElement);
|
||||
|
||||
Debug.Log("[Adjust]: Adjust broadcast receiver successfully added to your app's AndroidManifest.xml file.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool DoesAdjustBroadcastReceiverExist(XmlDocument manifest)
|
||||
{
|
||||
var xpath = "/manifest/application/receiver[@android:name='com.adjust.sdk.AdjustReferrerReceiver']";
|
||||
return manifest.SelectSingleNode(xpath, GetNamespaceManager(manifest)) != null;
|
||||
}
|
||||
|
||||
private static List<XmlNode> GetCustomRecieverNodes(XmlDocument manifest)
|
||||
{
|
||||
var xpath = "/manifest/application/receiver[intent-filter/action[@android:name='com.android.vending.INSTALL_REFERRER']]";
|
||||
return new List<XmlNode>(manifest.DocumentElement.SelectNodes(xpath, GetNamespaceManager(manifest)).OfType<XmlNode>());
|
||||
}
|
||||
|
||||
private static void AddAndroidNamespaceAttribute(XmlDocument manifest, string key, string value, XmlElement node)
|
||||
{
|
||||
var androidSchemeAttribute = manifest.CreateAttribute("android", key, "http://schemas.android.com/apk/res/android");
|
||||
androidSchemeAttribute.InnerText = value;
|
||||
node.SetAttributeNode(androidSchemeAttribute);
|
||||
}
|
||||
|
||||
private static XmlNamespaceManager GetNamespaceManager(XmlDocument manifest)
|
||||
{
|
||||
var namespaceManager = new XmlNamespaceManager(manifest.NameTable);
|
||||
namespaceManager.AddNamespace("android", "http://schemas.android.com/apk/res/android");
|
||||
return namespaceManager;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
13
Assets/Adjust/Editor/AdjustEditorPreprocessor.cs.meta
Normal file
13
Assets/Adjust/Editor/AdjustEditorPreprocessor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c88a79442bb9342b6956c7d59705f982
|
||||
timeCreated: 1621599616
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
Assets/Adjust/Editor/AdjustSettings.asset
Normal file
28
Assets/Adjust/Editor/AdjustSettings.asset
Normal file
@@ -0,0 +1,28 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ea4d495dc6d5ba64b90db7afda6a48a4, type: 3}
|
||||
m_Name: AdjustSettings
|
||||
m_EditorClassIdentifier:
|
||||
_iOSFrameworkAdSupport: 1
|
||||
_iOSFrameworkiAd: 0
|
||||
_iOSFrameworkAdServices: 0
|
||||
_iOSFrameworkAppTrackingTransparency: 0
|
||||
_iOSFrameworkStoreKit: 0
|
||||
_androidPermissionInternet: 1
|
||||
_androidPermissionInstallReferrerService: 1
|
||||
_androidPermissionAdId: 1
|
||||
_androidPermissionAccessNetworkState: 0
|
||||
_iOSUserTrackingUsageDescription:
|
||||
_iOSUrlIdentifier:
|
||||
_iOSUrlSchemes: []
|
||||
_iOSUniversalLinksDomains: []
|
||||
androidUriSchemes: []
|
||||
8
Assets/Adjust/Editor/AdjustSettings.asset.meta
Normal file
8
Assets/Adjust/Editor/AdjustSettings.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a31d99032792e3c408acc58e27146961
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
165
Assets/Adjust/Editor/AdjustSettings.cs
Normal file
165
Assets/Adjust/Editor/AdjustSettings.cs
Normal file
@@ -0,0 +1,165 @@
|
||||
// Inspired by: https://github.com/facebook/facebook-sdk-for-unity/blob/master/Facebook.Unity.Settings/FacebookSettings.cs
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public class AdjustSettings : ScriptableObject
|
||||
{
|
||||
private static AdjustSettings instance;
|
||||
|
||||
[SerializeField]
|
||||
private bool _iOSFrameworkAdSupport = true;
|
||||
[SerializeField]
|
||||
private bool _iOSFrameworkiAd = false;
|
||||
[SerializeField]
|
||||
private bool _iOSFrameworkAdServices = false;
|
||||
[SerializeField]
|
||||
private bool _iOSFrameworkAppTrackingTransparency = false;
|
||||
[SerializeField]
|
||||
private bool _iOSFrameworkStoreKit = false;
|
||||
[SerializeField]
|
||||
private bool _androidPermissionInternet = true;
|
||||
[SerializeField]
|
||||
private bool _androidPermissionInstallReferrerService = true;
|
||||
[SerializeField]
|
||||
private bool _androidPermissionAdId = true;
|
||||
[SerializeField]
|
||||
private bool _androidPermissionAccessNetworkState = false;
|
||||
[SerializeField]
|
||||
private string _iOSUserTrackingUsageDescription;
|
||||
[SerializeField]
|
||||
private string _iOSUrlIdentifier;
|
||||
[SerializeField]
|
||||
private string[] _iOSUrlSchemes = new string[0];
|
||||
[SerializeField]
|
||||
private string[] _iOSUniversalLinksDomains = new string[0];
|
||||
[SerializeField]
|
||||
private string[] androidUriSchemes = new string[0];
|
||||
|
||||
public static AdjustSettings Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
instance = NullableInstance;
|
||||
|
||||
if (instance == null)
|
||||
{
|
||||
// Create AdjustSettings.asset inside the folder in which AdjustSettings.cs reside.
|
||||
instance = ScriptableObject.CreateInstance<AdjustSettings>();
|
||||
var guids = AssetDatabase.FindAssets(string.Format("{0} t:script", "AdjustSettings"));
|
||||
if (guids == null || guids.Length <= 0)
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
var assetPath = AssetDatabase.GUIDToAssetPath(guids[0]).Replace("AdjustSettings.cs", "AdjustSettings.asset");
|
||||
AssetDatabase.CreateAsset(instance, assetPath);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static AdjustSettings NullableInstance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
var guids = AssetDatabase.FindAssets(string.Format("{0} t:ScriptableObject", "AdjustSettings"));
|
||||
if (guids == null || guids.Length <= 0)
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
var assetPath = AssetDatabase.GUIDToAssetPath(guids[0]);
|
||||
instance = (AdjustSettings)AssetDatabase.LoadAssetAtPath(assetPath, typeof(AdjustSettings));
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool iOSFrameworkAdSupport
|
||||
{
|
||||
get { return Instance._iOSFrameworkAdSupport; }
|
||||
set { Instance._iOSFrameworkAdSupport = value; }
|
||||
}
|
||||
|
||||
public static bool iOSFrameworkiAd
|
||||
{
|
||||
get { return Instance._iOSFrameworkiAd; }
|
||||
set { Instance._iOSFrameworkiAd = value; }
|
||||
}
|
||||
|
||||
public static bool iOSFrameworkAdServices
|
||||
{
|
||||
get { return Instance._iOSFrameworkAdServices; }
|
||||
set { Instance._iOSFrameworkAdServices = value; }
|
||||
}
|
||||
|
||||
public static bool iOSFrameworkAppTrackingTransparency
|
||||
{
|
||||
get { return Instance._iOSFrameworkAppTrackingTransparency; }
|
||||
set { Instance._iOSFrameworkAppTrackingTransparency = value; }
|
||||
}
|
||||
|
||||
public static bool iOSFrameworkStoreKit
|
||||
{
|
||||
get { return Instance._iOSFrameworkStoreKit; }
|
||||
set { Instance._iOSFrameworkStoreKit = value; }
|
||||
}
|
||||
|
||||
public static bool androidPermissionInternet
|
||||
{
|
||||
get { return Instance._androidPermissionInternet; }
|
||||
set { Instance._androidPermissionInternet = value; }
|
||||
}
|
||||
|
||||
public static bool androidPermissionInstallReferrerService
|
||||
{
|
||||
get { return Instance._androidPermissionInstallReferrerService; }
|
||||
set { Instance._androidPermissionInstallReferrerService = value; }
|
||||
}
|
||||
|
||||
public static bool androidPermissionAdId
|
||||
{
|
||||
get { return Instance._androidPermissionAdId; }
|
||||
set { Instance._androidPermissionAdId = value; }
|
||||
}
|
||||
|
||||
public static bool androidPermissionAccessNetworkState
|
||||
{
|
||||
get { return Instance._androidPermissionAccessNetworkState; }
|
||||
set { Instance._androidPermissionAccessNetworkState = value; }
|
||||
}
|
||||
|
||||
public static string iOSUserTrackingUsageDescription
|
||||
{
|
||||
get { return Instance._iOSUserTrackingUsageDescription; }
|
||||
set { Instance._iOSUserTrackingUsageDescription = value; }
|
||||
}
|
||||
|
||||
public static string iOSUrlIdentifier
|
||||
{
|
||||
get { return Instance._iOSUrlIdentifier; }
|
||||
set { Instance._iOSUrlIdentifier = value; }
|
||||
}
|
||||
|
||||
public static string[] iOSUrlSchemes
|
||||
{
|
||||
get { return Instance._iOSUrlSchemes; }
|
||||
set { Instance._iOSUrlSchemes = value; }
|
||||
}
|
||||
|
||||
public static string[] iOSUniversalLinksDomains
|
||||
{
|
||||
get { return Instance._iOSUniversalLinksDomains; }
|
||||
set { Instance._iOSUniversalLinksDomains = value; }
|
||||
}
|
||||
|
||||
public static string[] AndroidUriSchemes
|
||||
{
|
||||
get { return Instance.androidUriSchemes; }
|
||||
set { Instance.androidUriSchemes = value; }
|
||||
}
|
||||
}
|
||||
13
Assets/Adjust/Editor/AdjustSettings.cs.meta
Normal file
13
Assets/Adjust/Editor/AdjustSettings.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea4d495dc6d5ba64b90db7afda6a48a4
|
||||
timeCreated: 1601333126
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
132
Assets/Adjust/Editor/AdjustSettingsEditor.cs
Normal file
132
Assets/Adjust/Editor/AdjustSettingsEditor.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
[CustomEditor(typeof(AdjustSettings))]
|
||||
public class AdjustSettingsEditor : Editor
|
||||
{
|
||||
SerializedProperty iOSFrameworkAdSupport;
|
||||
SerializedProperty iOSFrameworkiAd;
|
||||
SerializedProperty iOSFrameworkAdServices;
|
||||
SerializedProperty iOSFrameworkAppTrackingTransparency;
|
||||
SerializedProperty iOSFrameworkStoreKit;
|
||||
SerializedProperty androidPermissionInternet;
|
||||
SerializedProperty androidPermissionInstallReferrerService;
|
||||
SerializedProperty androidPermissionAdId;
|
||||
SerializedProperty androidPermissionAccessNetworkState;
|
||||
SerializedProperty iOSUserTrackingUsageDescription;
|
||||
SerializedProperty iOSUrlIdentifier;
|
||||
SerializedProperty iOSUrlSchemes;
|
||||
SerializedProperty iOSUniversalLinksDomains;
|
||||
SerializedProperty androidUriSchemes;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
iOSFrameworkAdSupport = serializedObject.FindProperty("_iOSFrameworkAdSupport");
|
||||
iOSFrameworkiAd = serializedObject.FindProperty("_iOSFrameworkiAd");
|
||||
iOSFrameworkAdServices = serializedObject.FindProperty("_iOSFrameworkAdServices");
|
||||
iOSFrameworkAppTrackingTransparency = serializedObject.FindProperty("_iOSFrameworkAppTrackingTransparency");
|
||||
iOSFrameworkStoreKit = serializedObject.FindProperty("_iOSFrameworkStoreKit");
|
||||
androidPermissionInternet = serializedObject.FindProperty("_androidPermissionInternet");
|
||||
androidPermissionInstallReferrerService = serializedObject.FindProperty("_androidPermissionInstallReferrerService");
|
||||
androidPermissionAdId = serializedObject.FindProperty("_androidPermissionAdId");
|
||||
androidPermissionAccessNetworkState = serializedObject.FindProperty("_androidPermissionAccessNetworkState");
|
||||
iOSUserTrackingUsageDescription = serializedObject.FindProperty("_iOSUserTrackingUsageDescription");
|
||||
iOSUrlIdentifier = serializedObject.FindProperty("_iOSUrlIdentifier");
|
||||
iOSUrlSchemes = serializedObject.FindProperty("_iOSUrlSchemes");
|
||||
iOSUniversalLinksDomains = serializedObject.FindProperty("_iOSUniversalLinksDomains");
|
||||
androidUriSchemes = serializedObject.FindProperty("androidUriSchemes");
|
||||
}
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
GUIStyle darkerCyanTextFieldStyles = new GUIStyle(EditorStyles.boldLabel);
|
||||
darkerCyanTextFieldStyles.normal.textColor = new Color(0f/255f, 190f/255f, 190f/255f);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("LINK IOS FRAMEWORKS:", darkerCyanTextFieldStyles);
|
||||
EditorGUI.indentLevel += 1;
|
||||
EditorGUILayout.PropertyField(iOSFrameworkAdSupport,
|
||||
new GUIContent("AdSupport.framework",
|
||||
"iOS framework needed to access IDFA value"),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(iOSFrameworkiAd,
|
||||
new GUIContent("iAd.framework",
|
||||
"iOS framework needed to support iAd based Apple Search Ads attribution"),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(iOSFrameworkAdServices,
|
||||
new GUIContent("AdServices.framework",
|
||||
"iOS framework needed to support AdServices based Apple Search Ads attribution"),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(iOSFrameworkAppTrackingTransparency,
|
||||
new GUIContent("AppTrackingTransparency.framework",
|
||||
"iOS framework needed to display tracking consent dialog"),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(iOSFrameworkStoreKit,
|
||||
new GUIContent("StoreKit.framework",
|
||||
"iOS framework needed to use SKAdNetwork capabilities"),
|
||||
true);
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("ADD ANDROID PERMISSIONS:", darkerCyanTextFieldStyles);
|
||||
EditorGUI.indentLevel += 1;
|
||||
EditorGUILayout.PropertyField(androidPermissionInternet,
|
||||
new GUIContent("android.permission.INTERNET",
|
||||
"Android permission needed to send data to Adjust backend"),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(androidPermissionInstallReferrerService,
|
||||
new GUIContent("com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE",
|
||||
"Android permission needed to read install referrer"),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(androidPermissionAdId,
|
||||
new GUIContent("com.google.android.gms.permission.AD_ID",
|
||||
"Android permission needed to read Google Advertising ID if you target API 33 or later"),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(androidPermissionAccessNetworkState,
|
||||
new GUIContent("android.permission.ACCESS_NETWORK_STATE",
|
||||
"Android permission needed to determine type of network device is connected to"),
|
||||
true);
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("IOS PRIVACY:", darkerCyanTextFieldStyles);
|
||||
EditorGUI.indentLevel += 1;
|
||||
EditorGUILayout.PropertyField(iOSUserTrackingUsageDescription,
|
||||
new GUIContent("User Tracking Description",
|
||||
"String you would like to display to your users describing the reason " +
|
||||
"behind asking for tracking permission."),
|
||||
true);
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("DEEP LINKING:", darkerCyanTextFieldStyles);
|
||||
EditorGUI.indentLevel += 1;
|
||||
EditorGUILayout.PropertyField(iOSUrlIdentifier,
|
||||
new GUIContent("iOS URL Identifier",
|
||||
"Value of CFBundleURLName property of the root CFBundleURLTypes element. " +
|
||||
"If not needed otherwise, value should be your bundle ID."),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(iOSUrlSchemes,
|
||||
new GUIContent("iOS URL Schemes",
|
||||
"URL schemes handled by your app. " +
|
||||
"Make sure to enter just the scheme name without :// part at the end."),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(iOSUniversalLinksDomains,
|
||||
new GUIContent("iOS Universal Links Domains",
|
||||
"Associated domains handled by your app. State just the domain part without applinks: part in front."),
|
||||
true);
|
||||
EditorGUILayout.PropertyField(androidUriSchemes,
|
||||
new GUIContent("Android URI Schemes",
|
||||
"URI schemes handled by your app. " +
|
||||
"Make sure to enter just the scheme name with :// part at the end."),
|
||||
true);
|
||||
EditorGUILayout.HelpBox(
|
||||
"Please note that Adjust SDK doesn't remove existing URI Schemes, " +
|
||||
"so if you need to clean previously added entries, " +
|
||||
"you need to do it manually from \"Assets/Plugins/Android/AndroidManifest.xml\"",
|
||||
MessageType.Info,
|
||||
true);
|
||||
EditorGUI.indentLevel -= 1;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Adjust/Editor/AdjustSettingsEditor.cs.meta
Normal file
11
Assets/Adjust/Editor/AdjustSettingsEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e957ffb3938e94bcaab247e46bd9804c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Adjust/ExampleGUI.meta
Normal file
9
Assets/Adjust/ExampleGUI.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c173c46523b75714d945d694e8b89742
|
||||
folderAsset: yes
|
||||
timeCreated: 1578652520
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
290
Assets/Adjust/ExampleGUI/ExampleGUI.cs
Normal file
290
Assets/Adjust/ExampleGUI/ExampleGUI.cs
Normal file
@@ -0,0 +1,290 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using com.adjust.sdk;
|
||||
|
||||
public class ExampleGUI : MonoBehaviour
|
||||
{
|
||||
private int numberOfButtons = 8;
|
||||
private bool isEnabled;
|
||||
private bool showPopUp = false;
|
||||
private string txtSetEnabled = "Disable SDK";
|
||||
private string txtManualLaunch = "Manual Launch";
|
||||
private string txtSetOfflineMode = "Turn Offline Mode ON";
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
if (showPopUp)
|
||||
{
|
||||
GUI.Window(0, new Rect((Screen.width / 2) - 150, (Screen.height / 2) - 65, 300, 130), ShowGUI, "Is SDK enabled?");
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(0, Screen.height * 0 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), txtManualLaunch))
|
||||
{
|
||||
if (!string.Equals(txtManualLaunch, "SDK Launched", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AdjustConfig adjustConfig = new AdjustConfig("2fm9gkqubvpc", AdjustEnvironment.Sandbox);
|
||||
adjustConfig.setLogLevel(AdjustLogLevel.Verbose);
|
||||
adjustConfig.setLogDelegate(msg => Debug.Log(msg));
|
||||
adjustConfig.setEventSuccessDelegate(EventSuccessCallback);
|
||||
adjustConfig.setEventFailureDelegate(EventFailureCallback);
|
||||
adjustConfig.setSessionSuccessDelegate(SessionSuccessCallback);
|
||||
adjustConfig.setSessionFailureDelegate(SessionFailureCallback);
|
||||
adjustConfig.setDeferredDeeplinkDelegate(DeferredDeeplinkCallback);
|
||||
adjustConfig.setAttributionChangedDelegate(AttributionChangedCallback);
|
||||
Adjust.start(adjustConfig);
|
||||
|
||||
isEnabled = true;
|
||||
txtManualLaunch = "SDK Launched";
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(0, Screen.height * 1 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Track Simple Event"))
|
||||
{
|
||||
AdjustEvent adjustEvent = new AdjustEvent("g3mfiw");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(0, Screen.height * 2 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Track Revenue Event"))
|
||||
{
|
||||
AdjustEvent adjustEvent = new AdjustEvent("a4fd35");
|
||||
adjustEvent.setRevenue(0.25, "EUR");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(0, Screen.height * 3 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Track Callback Event"))
|
||||
{
|
||||
AdjustEvent adjustEvent = new AdjustEvent("34vgg9");
|
||||
adjustEvent.addCallbackParameter("key", "value");
|
||||
adjustEvent.addCallbackParameter("foo", "bar");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(0, Screen.height * 4 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Track Partner Event"))
|
||||
{
|
||||
AdjustEvent adjustEvent = new AdjustEvent("w788qs");
|
||||
adjustEvent.addPartnerParameter("key", "value");
|
||||
adjustEvent.addPartnerParameter("foo", "bar");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(0, Screen.height * 5 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), txtSetOfflineMode))
|
||||
{
|
||||
if (string.Equals(txtSetOfflineMode, "Turn Offline Mode ON", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Adjust.setOfflineMode(true);
|
||||
txtSetOfflineMode = "Turn Offline Mode OFF";
|
||||
}
|
||||
else
|
||||
{
|
||||
Adjust.setOfflineMode(false);
|
||||
txtSetOfflineMode = "Turn Offline Mode ON";
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(0, Screen.height * 6 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), txtSetEnabled))
|
||||
{
|
||||
if (string.Equals(txtSetEnabled, "Disable SDK", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Adjust.setEnabled(false);
|
||||
txtSetEnabled = "Enable SDK";
|
||||
}
|
||||
else
|
||||
{
|
||||
Adjust.setEnabled(true);
|
||||
txtSetEnabled = "Disable SDK";
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(0, Screen.height * 7 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Is SDK Enabled?"))
|
||||
{
|
||||
isEnabled = Adjust.isEnabled();
|
||||
showPopUp = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ShowGUI(int windowID)
|
||||
{
|
||||
if (isEnabled)
|
||||
{
|
||||
GUI.Label(new Rect(65, 40, 200, 30), "Adjust SDK is ENABLED!");
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(new Rect(65, 40, 200, 30), "Adjust SDK is DISABLED!");
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(90, 75, 120, 40), "OK"))
|
||||
{
|
||||
showPopUp = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleGooglePlayId(String adId)
|
||||
{
|
||||
Debug.Log("Google Play Ad ID = " + adId);
|
||||
}
|
||||
|
||||
public void AttributionChangedCallback(AdjustAttribution attributionData)
|
||||
{
|
||||
Debug.Log("Attribution changed!");
|
||||
|
||||
if (attributionData.trackerName != null)
|
||||
{
|
||||
Debug.Log("Tracker name: " + attributionData.trackerName);
|
||||
}
|
||||
if (attributionData.trackerToken != null)
|
||||
{
|
||||
Debug.Log("Tracker token: " + attributionData.trackerToken);
|
||||
}
|
||||
if (attributionData.network != null)
|
||||
{
|
||||
Debug.Log("Network: " + attributionData.network);
|
||||
}
|
||||
if (attributionData.campaign != null)
|
||||
{
|
||||
Debug.Log("Campaign: " + attributionData.campaign);
|
||||
}
|
||||
if (attributionData.adgroup != null)
|
||||
{
|
||||
Debug.Log("Adgroup: " + attributionData.adgroup);
|
||||
}
|
||||
if (attributionData.creative != null)
|
||||
{
|
||||
Debug.Log("Creative: " + attributionData.creative);
|
||||
}
|
||||
if (attributionData.clickLabel != null)
|
||||
{
|
||||
Debug.Log("Click label: " + attributionData.clickLabel);
|
||||
}
|
||||
if (attributionData.adid != null)
|
||||
{
|
||||
Debug.Log("ADID: " + attributionData.adid);
|
||||
}
|
||||
}
|
||||
|
||||
public void EventSuccessCallback(AdjustEventSuccess eventSuccessData)
|
||||
{
|
||||
Debug.Log("Event tracked successfully!");
|
||||
|
||||
if (eventSuccessData.Message != null)
|
||||
{
|
||||
Debug.Log("Message: " + eventSuccessData.Message);
|
||||
}
|
||||
if (eventSuccessData.Timestamp != null)
|
||||
{
|
||||
Debug.Log("Timestamp: " + eventSuccessData.Timestamp);
|
||||
}
|
||||
if (eventSuccessData.Adid != null)
|
||||
{
|
||||
Debug.Log("Adid: " + eventSuccessData.Adid);
|
||||
}
|
||||
if (eventSuccessData.EventToken != null)
|
||||
{
|
||||
Debug.Log("EventToken: " + eventSuccessData.EventToken);
|
||||
}
|
||||
if (eventSuccessData.CallbackId != null)
|
||||
{
|
||||
Debug.Log("CallbackId: " + eventSuccessData.CallbackId);
|
||||
}
|
||||
if (eventSuccessData.JsonResponse != null)
|
||||
{
|
||||
Debug.Log("JsonResponse: " + eventSuccessData.GetJsonResponse());
|
||||
}
|
||||
}
|
||||
|
||||
public void EventFailureCallback(AdjustEventFailure eventFailureData)
|
||||
{
|
||||
Debug.Log("Event tracking failed!");
|
||||
|
||||
if (eventFailureData.Message != null)
|
||||
{
|
||||
Debug.Log("Message: " + eventFailureData.Message);
|
||||
}
|
||||
if (eventFailureData.Timestamp != null)
|
||||
{
|
||||
Debug.Log("Timestamp: " + eventFailureData.Timestamp);
|
||||
}
|
||||
if (eventFailureData.Adid != null)
|
||||
{
|
||||
Debug.Log("Adid: " + eventFailureData.Adid);
|
||||
}
|
||||
if (eventFailureData.EventToken != null)
|
||||
{
|
||||
Debug.Log("EventToken: " + eventFailureData.EventToken);
|
||||
}
|
||||
if (eventFailureData.CallbackId != null)
|
||||
{
|
||||
Debug.Log("CallbackId: " + eventFailureData.CallbackId);
|
||||
}
|
||||
if (eventFailureData.JsonResponse != null)
|
||||
{
|
||||
Debug.Log("JsonResponse: " + eventFailureData.GetJsonResponse());
|
||||
}
|
||||
|
||||
Debug.Log("WillRetry: " + eventFailureData.WillRetry.ToString());
|
||||
}
|
||||
|
||||
public void SessionSuccessCallback(AdjustSessionSuccess sessionSuccessData)
|
||||
{
|
||||
Debug.Log("Session tracked successfully!");
|
||||
|
||||
if (sessionSuccessData.Message != null)
|
||||
{
|
||||
Debug.Log("Message: " + sessionSuccessData.Message);
|
||||
}
|
||||
if (sessionSuccessData.Timestamp != null)
|
||||
{
|
||||
Debug.Log("Timestamp: " + sessionSuccessData.Timestamp);
|
||||
}
|
||||
if (sessionSuccessData.Adid != null)
|
||||
{
|
||||
Debug.Log("Adid: " + sessionSuccessData.Adid);
|
||||
}
|
||||
if (sessionSuccessData.JsonResponse != null)
|
||||
{
|
||||
Debug.Log("JsonResponse: " + sessionSuccessData.GetJsonResponse());
|
||||
}
|
||||
}
|
||||
|
||||
public void SessionFailureCallback(AdjustSessionFailure sessionFailureData)
|
||||
{
|
||||
Debug.Log("Session tracking failed!");
|
||||
|
||||
if (sessionFailureData.Message != null)
|
||||
{
|
||||
Debug.Log("Message: " + sessionFailureData.Message);
|
||||
}
|
||||
if (sessionFailureData.Timestamp != null)
|
||||
{
|
||||
Debug.Log("Timestamp: " + sessionFailureData.Timestamp);
|
||||
}
|
||||
if (sessionFailureData.Adid != null)
|
||||
{
|
||||
Debug.Log("Adid: " + sessionFailureData.Adid);
|
||||
}
|
||||
if (sessionFailureData.JsonResponse != null)
|
||||
{
|
||||
Debug.Log("JsonResponse: " + sessionFailureData.GetJsonResponse());
|
||||
}
|
||||
|
||||
Debug.Log("WillRetry: " + sessionFailureData.WillRetry.ToString());
|
||||
}
|
||||
|
||||
private void DeferredDeeplinkCallback(string deeplinkURL)
|
||||
{
|
||||
Debug.Log("Deferred deeplink reported!");
|
||||
|
||||
if (deeplinkURL != null)
|
||||
{
|
||||
Debug.Log("Deeplink URL: " + deeplinkURL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Deeplink URL is null!");
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Assets/Adjust/ExampleGUI/ExampleGUI.cs.meta
Normal file
8
Assets/Adjust/ExampleGUI/ExampleGUI.cs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 196c5c89d4b1e46dfbf423ae77d31a68
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
53
Assets/Adjust/ExampleGUI/ExampleGUI.prefab
Normal file
53
Assets/Adjust/ExampleGUI/ExampleGUI.prefab
Normal file
@@ -0,0 +1,53 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &100000
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 400000}
|
||||
- component: {fileID: 11400000}
|
||||
m_Layer: 0
|
||||
m_Name: ExampleGUI
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &400000
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 196c5c89d4b1e46dfbf423ae77d31a68, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 100000}
|
||||
m_IsPrefabParent: 1
|
||||
4
Assets/Adjust/ExampleGUI/ExampleGUI.prefab.meta
Normal file
4
Assets/Adjust/ExampleGUI/ExampleGUI.prefab.meta
Normal file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50b53da2a7a154d63a33a49ad08c24a8
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
292
Assets/Adjust/ExampleGUI/ExampleGUI.unity
Normal file
292
Assets/Adjust/ExampleGUI/ExampleGUI.unity
Normal file
@@ -0,0 +1,292 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 8
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 3
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
--- !u!157 &4
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_TemporalCoherenceThreshold: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 9
|
||||
m_Resolution: 1
|
||||
m_BakeResolution: 50
|
||||
m_TextureWidth: 1024
|
||||
m_TextureHeight: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 0
|
||||
m_CompAOExponentDirect: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 1024
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 1
|
||||
m_BakeBackend: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ShowResolutionOverlay: 1
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 0
|
||||
--- !u!196 &5
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666666
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1001 &7284787
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 415478, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 415478, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 415478, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 415478, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 415478, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 415478, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 415478, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 415478, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11482148, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: startManually
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11482148, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: logLevel
|
||||
value: 3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11482148, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
propertyPath: appToken
|
||||
value: '{YourAppToken}'
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: a3267720e82aa41c1a05ab29824902b4, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
--- !u!1 &231489158
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 231489162}
|
||||
- component: {fileID: 231489161}
|
||||
- component: {fileID: 231489160}
|
||||
- component: {fileID: 231489159}
|
||||
m_Layer: 0
|
||||
m_Name: Camera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &231489159
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 231489158}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &231489160
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 231489158}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &231489161
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 231489158}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &231489162
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 231489158}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1861285553
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 400000, guid: 50b53da2a7a154d63a33a49ad08c24a8, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 50b53da2a7a154d63a33a49ad08c24a8, type: 2}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 50b53da2a7a154d63a33a49ad08c24a8, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -10
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 50b53da2a7a154d63a33a49ad08c24a8, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 50b53da2a7a154d63a33a49ad08c24a8, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 50b53da2a7a154d63a33a49ad08c24a8, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 50b53da2a7a154d63a33a49ad08c24a8, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 50b53da2a7a154d63a33a49ad08c24a8, type: 2}
|
||||
propertyPath: m_RootOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 50b53da2a7a154d63a33a49ad08c24a8, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
8
Assets/Adjust/ExampleGUI/ExampleGUI.unity.meta
Normal file
8
Assets/Adjust/ExampleGUI/ExampleGUI.unity.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6aa8afcd558084586bce9f8efd3eb5d6
|
||||
timeCreated: 1447689503
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Adjust/Prefab.meta
Normal file
9
Assets/Adjust/Prefab.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0acdd227ad1b8d147ade044242671e15
|
||||
folderAsset: yes
|
||||
timeCreated: 1578652549
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
78
Assets/Adjust/Prefab/Adjust.prefab
Normal file
78
Assets/Adjust/Prefab/Adjust.prefab
Normal file
@@ -0,0 +1,78 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &115478
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 415478}
|
||||
- component: {fileID: 114179903453641630}
|
||||
m_Layer: 0
|
||||
m_Name: Adjust
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &415478
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 115478}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 115478}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!114 &114179903453641630
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 115478}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 525ece82a472e4dea837e1ef938fd15d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
startManually: 1
|
||||
appToken:
|
||||
environment: 0
|
||||
logLevel: 3
|
||||
eventBuffering: 0
|
||||
sendInBackground: 0
|
||||
launchDeferredDeeplink: 1
|
||||
needsCost: 0
|
||||
coppaCompliant: 0
|
||||
linkMe: 0
|
||||
defaultTracker:
|
||||
urlStrategy: 0
|
||||
startDelay: 0
|
||||
secretId: 0
|
||||
info1: 0
|
||||
info2: 0
|
||||
info3: 0
|
||||
info4: 0
|
||||
preinstallTracking: 0
|
||||
preinstallFilePath:
|
||||
playStoreKidsApp: 0
|
||||
iadInfoReading: 1
|
||||
adServicesInfoReading: 1
|
||||
idfaInfoReading: 1
|
||||
skAdNetworkHandling: 1
|
||||
7
Assets/Adjust/Prefab/Adjust.prefab.meta
Normal file
7
Assets/Adjust/Prefab/Adjust.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3267720e82aa41c1a05ab29824902b4
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: -1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Adjust/Unity.meta
Normal file
9
Assets/Adjust/Unity.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ac00d53de34e29419cae749db3f6528
|
||||
folderAsset: yes
|
||||
timeCreated: 1578652520
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1016
Assets/Adjust/Unity/Adjust.cs
Normal file
1016
Assets/Adjust/Unity/Adjust.cs
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/Adjust/Unity/Adjust.cs.meta
Normal file
8
Assets/Adjust/Unity/Adjust.cs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 525ece82a472e4dea837e1ef938fd15d
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
69
Assets/Adjust/Unity/AdjustAdRevenue.cs
Normal file
69
Assets/Adjust/Unity/AdjustAdRevenue.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
public class AdjustAdRevenue
|
||||
{
|
||||
internal string source;
|
||||
internal double? revenue;
|
||||
internal string currency;
|
||||
internal int? adImpressionsCount;
|
||||
internal string adRevenueNetwork;
|
||||
internal string adRevenueUnit;
|
||||
internal string adRevenuePlacement;
|
||||
internal List<string> partnerList;
|
||||
internal List<string> callbackList;
|
||||
|
||||
public AdjustAdRevenue(string source)
|
||||
{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public void setRevenue(double amount, string currency)
|
||||
{
|
||||
this.revenue = amount;
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
public void setAdImpressionsCount(int adImpressionsCount)
|
||||
{
|
||||
this.adImpressionsCount = adImpressionsCount;
|
||||
}
|
||||
|
||||
public void setAdRevenueNetwork(string adRevenueNetwork)
|
||||
{
|
||||
this.adRevenueNetwork = adRevenueNetwork;
|
||||
}
|
||||
|
||||
public void setAdRevenueUnit(string adRevenueUnit)
|
||||
{
|
||||
this.adRevenueUnit = adRevenueUnit;
|
||||
}
|
||||
|
||||
public void setAdRevenuePlacement(string adRevenuePlacement)
|
||||
{
|
||||
this.adRevenuePlacement = adRevenuePlacement;
|
||||
}
|
||||
|
||||
public void addCallbackParameter(string key, string value)
|
||||
{
|
||||
if (callbackList == null)
|
||||
{
|
||||
callbackList = new List<string>();
|
||||
}
|
||||
callbackList.Add(key);
|
||||
callbackList.Add(value);
|
||||
}
|
||||
|
||||
public void addPartnerParameter(string key, string value)
|
||||
{
|
||||
if (partnerList == null)
|
||||
{
|
||||
partnerList = new List<string>();
|
||||
}
|
||||
partnerList.Add(key);
|
||||
partnerList.Add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Adjust/Unity/AdjustAdRevenue.cs.meta
Normal file
11
Assets/Adjust/Unity/AdjustAdRevenue.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 776a9d4b715bc44c68724248a5a75cb9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Assets/Adjust/Unity/AdjustAppStoreSubscription.cs
Normal file
56
Assets/Adjust/Unity/AdjustAppStoreSubscription.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
public class AdjustAppStoreSubscription
|
||||
{
|
||||
internal string price;
|
||||
internal string currency;
|
||||
internal string transactionId;
|
||||
internal string receipt;
|
||||
internal string billingStore;
|
||||
internal string transactionDate;
|
||||
internal string salesRegion;
|
||||
internal List<string> partnerList;
|
||||
internal List<string> callbackList;
|
||||
|
||||
public AdjustAppStoreSubscription(string price, string currency, string transactionId, string receipt)
|
||||
{
|
||||
this.price = price;
|
||||
this.currency = currency;
|
||||
this.transactionId = transactionId;
|
||||
this.receipt = receipt;
|
||||
}
|
||||
|
||||
public void setTransactionDate(string transactionDate)
|
||||
{
|
||||
this.transactionDate = transactionDate;
|
||||
}
|
||||
|
||||
public void setSalesRegion(string salesRegion)
|
||||
{
|
||||
this.salesRegion = salesRegion;
|
||||
}
|
||||
|
||||
public void addCallbackParameter(string key, string value)
|
||||
{
|
||||
if (callbackList == null)
|
||||
{
|
||||
callbackList = new List<string>();
|
||||
}
|
||||
callbackList.Add(key);
|
||||
callbackList.Add(value);
|
||||
}
|
||||
|
||||
public void addPartnerParameter(string key, string value)
|
||||
{
|
||||
if (partnerList == null)
|
||||
{
|
||||
partnerList = new List<string>();
|
||||
}
|
||||
partnerList.Add(key);
|
||||
partnerList.Add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Adjust/Unity/AdjustAppStoreSubscription.cs.meta
Normal file
11
Assets/Adjust/Unity/AdjustAppStoreSubscription.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e2d69221b1124370a4c016edce5a95a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
85
Assets/Adjust/Unity/AdjustAttribution.cs
Normal file
85
Assets/Adjust/Unity/AdjustAttribution.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
public class AdjustAttribution
|
||||
{
|
||||
public string adid { get; set; }
|
||||
public string network { get; set; }
|
||||
public string adgroup { get; set; }
|
||||
public string campaign { get; set; }
|
||||
public string creative { get; set; }
|
||||
public string clickLabel { get; set; }
|
||||
public string trackerName { get; set; }
|
||||
public string trackerToken { get; set; }
|
||||
public string costType { get; set; }
|
||||
public double? costAmount { get; set; }
|
||||
public string costCurrency { get; set; }
|
||||
// Android only
|
||||
public string fbInstallReferrer {get; set;}
|
||||
|
||||
public AdjustAttribution() {}
|
||||
|
||||
public AdjustAttribution(string jsonString)
|
||||
{
|
||||
var jsonNode = JSON.Parse(jsonString);
|
||||
if (jsonNode == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
trackerName = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyTrackerName);
|
||||
trackerToken = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyTrackerToken);
|
||||
network = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyNetwork);
|
||||
campaign = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCampaign);
|
||||
adgroup = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyAdgroup);
|
||||
creative = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCreative);
|
||||
clickLabel = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyClickLabel);
|
||||
adid = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyAdid);
|
||||
costType = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCostType);
|
||||
try
|
||||
{
|
||||
costAmount = double.Parse(AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCostAmount),
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// attribution response doesn't contain cost amount attached
|
||||
// value will default to null
|
||||
}
|
||||
costCurrency = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCostCurrency);
|
||||
fbInstallReferrer = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyFbInstallReferrer);
|
||||
}
|
||||
|
||||
public AdjustAttribution(Dictionary<string, string> dicAttributionData)
|
||||
{
|
||||
if (dicAttributionData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
trackerName = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyTrackerName);
|
||||
trackerToken = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyTrackerToken);
|
||||
network = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyNetwork);
|
||||
campaign = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyCampaign);
|
||||
adgroup = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyAdgroup);
|
||||
creative = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyCreative);
|
||||
clickLabel = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyClickLabel);
|
||||
adid = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyAdid);
|
||||
costType = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyCostType);
|
||||
try
|
||||
{
|
||||
costAmount = double.Parse(AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyCostAmount),
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// attribution response doesn't contain cost amount attached
|
||||
// value will default to null
|
||||
}
|
||||
costCurrency = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyCostCurrency);
|
||||
fbInstallReferrer = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyFbInstallReferrer);
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Assets/Adjust/Unity/AdjustAttribution.cs.meta
Normal file
8
Assets/Adjust/Unity/AdjustAttribution.cs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc46748ad0e664f6d839a4f1a23d9f47
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
289
Assets/Adjust/Unity/AdjustConfig.cs
Normal file
289
Assets/Adjust/Unity/AdjustConfig.cs
Normal file
@@ -0,0 +1,289 @@
|
||||
using System;
|
||||
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
public class AdjustConfig
|
||||
{
|
||||
public const string AdjustUrlStrategyChina = "china";
|
||||
public const string AdjustUrlStrategyIndia = "india";
|
||||
|
||||
public const string AdjustDataResidencyEU = "data-residency-eu";
|
||||
public const string AdjustDataResidencyTR = "data-residency-tr";
|
||||
public const string AdjustDataResidencyUS = "data-residency-us";
|
||||
|
||||
public const string AdjustAdRevenueSourceAppLovinMAX = "applovin_max_sdk";
|
||||
public const string AdjustAdRevenueSourceMopub = "mopub";
|
||||
public const string AdjustAdRevenueSourceAdMob = "admob_sdk";
|
||||
public const string AdjustAdRevenueSourceIronSource = "ironsource_sdk";
|
||||
public const string AdjustAdRevenueSourceAdmost = "admost_sdk";
|
||||
public const string AdjustAdRevenueSourceUnity = "unity_sdk";
|
||||
public const string AdjustAdRevenueSourceHeliumChartboost = "helium_chartboost_sdk";
|
||||
public const string AdjustAdRevenueSourcePublisher = "publisher_sdk";
|
||||
|
||||
internal string appToken;
|
||||
internal string sceneName;
|
||||
internal string userAgent;
|
||||
internal string defaultTracker;
|
||||
internal string externalDeviceId;
|
||||
internal string urlStrategy;
|
||||
internal long? info1;
|
||||
internal long? info2;
|
||||
internal long? info3;
|
||||
internal long? info4;
|
||||
internal long? secretId;
|
||||
internal double? delayStart;
|
||||
internal bool? isDeviceKnown;
|
||||
internal bool? sendInBackground;
|
||||
internal bool? eventBufferingEnabled;
|
||||
internal bool? coppaCompliantEnabled;
|
||||
internal bool? playStoreKidsAppEnabled;
|
||||
internal bool? allowSuppressLogLevel;
|
||||
internal bool? needsCost;
|
||||
internal bool launchDeferredDeeplink;
|
||||
internal AdjustLogLevel? logLevel;
|
||||
internal AdjustEnvironment environment;
|
||||
internal Action<string> deferredDeeplinkDelegate;
|
||||
internal Action<AdjustEventSuccess> eventSuccessDelegate;
|
||||
internal Action<AdjustEventFailure> eventFailureDelegate;
|
||||
internal Action<AdjustSessionSuccess> sessionSuccessDelegate;
|
||||
internal Action<AdjustSessionFailure> sessionFailureDelegate;
|
||||
internal Action<AdjustAttribution> attributionChangedDelegate;
|
||||
internal Action<int> conversionValueUpdatedDelegate;
|
||||
|
||||
// Android specific members
|
||||
internal string processName;
|
||||
internal bool? readImei;
|
||||
internal bool? preinstallTrackingEnabled;
|
||||
internal string preinstallFilePath;
|
||||
// iOS specific members
|
||||
internal bool? allowiAdInfoReading;
|
||||
internal bool? allowAdServicesInfoReading;
|
||||
internal bool? allowIdfaReading;
|
||||
internal bool? skAdNetworkHandling;
|
||||
internal bool? linkMeEnabled;
|
||||
// Windows specific members
|
||||
internal Action<String> logDelegate;
|
||||
|
||||
public AdjustConfig(string appToken, AdjustEnvironment environment)
|
||||
{
|
||||
this.sceneName = "";
|
||||
this.processName = "";
|
||||
this.appToken = appToken;
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
public AdjustConfig(string appToken, AdjustEnvironment environment, bool allowSuppressLogLevel)
|
||||
{
|
||||
this.sceneName = "";
|
||||
this.processName = "";
|
||||
this.appToken = appToken;
|
||||
this.environment = environment;
|
||||
this.allowSuppressLogLevel = allowSuppressLogLevel;
|
||||
}
|
||||
|
||||
public void setLogLevel(AdjustLogLevel logLevel)
|
||||
{
|
||||
this.logLevel = logLevel;
|
||||
}
|
||||
|
||||
public void setDefaultTracker(string defaultTracker)
|
||||
{
|
||||
this.defaultTracker = defaultTracker;
|
||||
}
|
||||
|
||||
public void setExternalDeviceId(string externalDeviceId)
|
||||
{
|
||||
this.externalDeviceId = externalDeviceId;
|
||||
}
|
||||
|
||||
public void setLaunchDeferredDeeplink(bool launchDeferredDeeplink)
|
||||
{
|
||||
this.launchDeferredDeeplink = launchDeferredDeeplink;
|
||||
}
|
||||
|
||||
public void setSendInBackground(bool sendInBackground)
|
||||
{
|
||||
this.sendInBackground = sendInBackground;
|
||||
}
|
||||
|
||||
public void setEventBufferingEnabled(bool eventBufferingEnabled)
|
||||
{
|
||||
this.eventBufferingEnabled = eventBufferingEnabled;
|
||||
}
|
||||
|
||||
public void setCoppaCompliantEnabled(bool coppaCompliantEnabled)
|
||||
{
|
||||
this.coppaCompliantEnabled = coppaCompliantEnabled;
|
||||
}
|
||||
|
||||
public void setPlayStoreKidsAppEnabled(bool playStoreKidsAppEnabled)
|
||||
{
|
||||
this.playStoreKidsAppEnabled = playStoreKidsAppEnabled;
|
||||
}
|
||||
|
||||
public void setNeedsCost(bool needsCost)
|
||||
{
|
||||
this.needsCost = needsCost;
|
||||
}
|
||||
|
||||
public void setDelayStart(double delayStart)
|
||||
{
|
||||
this.delayStart = delayStart;
|
||||
}
|
||||
|
||||
public void setUserAgent(string userAgent)
|
||||
{
|
||||
this.userAgent = userAgent;
|
||||
}
|
||||
|
||||
public void setIsDeviceKnown(bool isDeviceKnown)
|
||||
{
|
||||
this.isDeviceKnown = isDeviceKnown;
|
||||
}
|
||||
|
||||
public void setUrlStrategy(String urlStrategy)
|
||||
{
|
||||
this.urlStrategy = urlStrategy;
|
||||
}
|
||||
|
||||
public void deactivateSKAdNetworkHandling()
|
||||
{
|
||||
this.skAdNetworkHandling = true;
|
||||
}
|
||||
|
||||
public void setLinkMeEnabled(bool linkMeEnabled)
|
||||
{
|
||||
this.linkMeEnabled = linkMeEnabled;
|
||||
}
|
||||
|
||||
public void setDeferredDeeplinkDelegate(Action<string> deferredDeeplinkDelegate, string sceneName = "Adjust")
|
||||
{
|
||||
this.deferredDeeplinkDelegate = deferredDeeplinkDelegate;
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public Action<string> getDeferredDeeplinkDelegate()
|
||||
{
|
||||
return this.deferredDeeplinkDelegate;
|
||||
}
|
||||
|
||||
public void setAttributionChangedDelegate(Action<AdjustAttribution> attributionChangedDelegate, string sceneName = "Adjust")
|
||||
{
|
||||
this.attributionChangedDelegate = attributionChangedDelegate;
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public Action<AdjustAttribution> getAttributionChangedDelegate()
|
||||
{
|
||||
return this.attributionChangedDelegate;
|
||||
}
|
||||
|
||||
public void setEventSuccessDelegate(Action<AdjustEventSuccess> eventSuccessDelegate, string sceneName = "Adjust")
|
||||
{
|
||||
this.eventSuccessDelegate = eventSuccessDelegate;
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public Action<AdjustEventSuccess> getEventSuccessDelegate()
|
||||
{
|
||||
return this.eventSuccessDelegate;
|
||||
}
|
||||
|
||||
public void setEventFailureDelegate(Action<AdjustEventFailure> eventFailureDelegate, string sceneName = "Adjust")
|
||||
{
|
||||
this.eventFailureDelegate = eventFailureDelegate;
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public Action<AdjustEventFailure> getEventFailureDelegate()
|
||||
{
|
||||
return this.eventFailureDelegate;
|
||||
}
|
||||
|
||||
public void setSessionSuccessDelegate(Action<AdjustSessionSuccess> sessionSuccessDelegate, string sceneName = "Adjust")
|
||||
{
|
||||
this.sessionSuccessDelegate = sessionSuccessDelegate;
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public Action<AdjustSessionSuccess> getSessionSuccessDelegate()
|
||||
{
|
||||
return this.sessionSuccessDelegate;
|
||||
}
|
||||
|
||||
public void setSessionFailureDelegate(Action<AdjustSessionFailure> sessionFailureDelegate, string sceneName = "Adjust")
|
||||
{
|
||||
this.sessionFailureDelegate = sessionFailureDelegate;
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public Action<AdjustSessionFailure> getSessionFailureDelegate()
|
||||
{
|
||||
return this.sessionFailureDelegate;
|
||||
}
|
||||
|
||||
public void setConversionValueUpdatedDelegate(Action<int> conversionValueUpdatedDelegate, string sceneName = "Adjust")
|
||||
{
|
||||
this.conversionValueUpdatedDelegate = conversionValueUpdatedDelegate;
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public Action<int> getConversionValueUpdatedDelegate()
|
||||
{
|
||||
return this.conversionValueUpdatedDelegate;
|
||||
}
|
||||
|
||||
public void setAppSecret(long secretId, long info1, long info2, long info3, long info4)
|
||||
{
|
||||
this.secretId = secretId;
|
||||
this.info1 = info1;
|
||||
this.info2 = info2;
|
||||
this.info3 = info3;
|
||||
this.info4 = info4;
|
||||
}
|
||||
|
||||
// iOS specific methods.
|
||||
public void setAllowiAdInfoReading(bool allowiAdInfoReading)
|
||||
{
|
||||
this.allowiAdInfoReading = allowiAdInfoReading;
|
||||
}
|
||||
|
||||
public void setAllowAdServicesInfoReading(bool allowAdServicesInfoReading)
|
||||
{
|
||||
this.allowAdServicesInfoReading = allowAdServicesInfoReading;
|
||||
}
|
||||
|
||||
public void setAllowIdfaReading(bool allowIdfaReading)
|
||||
{
|
||||
this.allowIdfaReading = allowIdfaReading;
|
||||
}
|
||||
|
||||
// Android specific methods.
|
||||
public void setProcessName(string processName)
|
||||
{
|
||||
this.processName = processName;
|
||||
}
|
||||
|
||||
[Obsolete("This is an obsolete method.")]
|
||||
public void setReadMobileEquipmentIdentity(bool readMobileEquipmentIdentity)
|
||||
{
|
||||
// this.readImei = readMobileEquipmentIdentity;
|
||||
}
|
||||
|
||||
public void setPreinstallTrackingEnabled(bool preinstallTrackingEnabled)
|
||||
{
|
||||
this.preinstallTrackingEnabled = preinstallTrackingEnabled;
|
||||
}
|
||||
|
||||
public void setPreinstallFilePath(string preinstallFilePath)
|
||||
{
|
||||
this.preinstallFilePath = preinstallFilePath;
|
||||
}
|
||||
|
||||
// Windows specific methods.
|
||||
public void setLogDelegate(Action<String> logDelegate)
|
||||
{
|
||||
this.logDelegate = logDelegate;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Assets/Adjust/Unity/AdjustConfig.cs.meta
Normal file
8
Assets/Adjust/Unity/AdjustConfig.cs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02d4cad14fc094b17afde3b685897e5e
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
25
Assets/Adjust/Unity/AdjustEnvironment.cs
Normal file
25
Assets/Adjust/Unity/AdjustEnvironment.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
[System.Serializable]
|
||||
public enum AdjustEnvironment
|
||||
{
|
||||
Sandbox,
|
||||
Production
|
||||
}
|
||||
|
||||
public static class AdjustEnvironmentExtension
|
||||
{
|
||||
public static string ToLowercaseString(this AdjustEnvironment adjustEnvironment)
|
||||
{
|
||||
switch (adjustEnvironment)
|
||||
{
|
||||
case AdjustEnvironment.Sandbox:
|
||||
return "sandbox";
|
||||
case AdjustEnvironment.Production:
|
||||
return "production";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Assets/Adjust/Unity/AdjustEnvironment.cs.meta
Normal file
8
Assets/Adjust/Unity/AdjustEnvironment.cs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 633f6fa279b2244fdb999db0441f9aac
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
70
Assets/Adjust/Unity/AdjustEvent.cs
Normal file
70
Assets/Adjust/Unity/AdjustEvent.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
public class AdjustEvent
|
||||
{
|
||||
internal string currency;
|
||||
internal string eventToken;
|
||||
internal string callbackId;
|
||||
internal string transactionId;
|
||||
internal double? revenue;
|
||||
internal List<string> partnerList;
|
||||
internal List<string> callbackList;
|
||||
// iOS specific members
|
||||
internal string receipt;
|
||||
internal bool isReceiptSet;
|
||||
|
||||
public AdjustEvent(string eventToken)
|
||||
{
|
||||
this.eventToken = eventToken;
|
||||
this.isReceiptSet = false;
|
||||
}
|
||||
|
||||
public void setRevenue(double amount, string currency)
|
||||
{
|
||||
this.revenue = amount;
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
public void addCallbackParameter(string key, string value)
|
||||
{
|
||||
if (callbackList == null)
|
||||
{
|
||||
callbackList = new List<string>();
|
||||
}
|
||||
callbackList.Add(key);
|
||||
callbackList.Add(value);
|
||||
}
|
||||
|
||||
public void addPartnerParameter(string key, string value)
|
||||
{
|
||||
if (partnerList == null)
|
||||
{
|
||||
partnerList = new List<string>();
|
||||
}
|
||||
partnerList.Add(key);
|
||||
partnerList.Add(value);
|
||||
}
|
||||
|
||||
public void setTransactionId(string transactionId)
|
||||
{
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
public void setCallbackId(string callbackId)
|
||||
{
|
||||
this.callbackId = callbackId;
|
||||
}
|
||||
|
||||
// iOS specific methods
|
||||
[Obsolete("This is an obsolete method. Please use the adjust purchase SDK for purchase verification (https://github.com/adjust/unity_purchase_sdk)")]
|
||||
public void setReceipt(string receipt, string transactionId)
|
||||
{
|
||||
this.receipt = receipt;
|
||||
this.transactionId = transactionId;
|
||||
this.isReceiptSet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Assets/Adjust/Unity/AdjustEvent.cs.meta
Normal file
8
Assets/Adjust/Unity/AdjustEvent.cs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd89f7713977f497a862f1a1b6f60933
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
92
Assets/Adjust/Unity/AdjustEventFailure.cs
Normal file
92
Assets/Adjust/Unity/AdjustEventFailure.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace com.adjust.sdk
|
||||
{
|
||||
public class AdjustEventFailure
|
||||
{
|
||||
public string Adid { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string Timestamp { get; set; }
|
||||
public string EventToken { get; set; }
|
||||
public string CallbackId { get; set; }
|
||||
public bool WillRetry { get; set; }
|
||||
public Dictionary<string, object> JsonResponse { get; set; }
|
||||
|
||||
public AdjustEventFailure() {}
|
||||
|
||||
public AdjustEventFailure(Dictionary<string, string> eventFailureDataMap)
|
||||
{
|
||||
if (eventFailureDataMap == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Adid = AdjustUtils.TryGetValue(eventFailureDataMap, AdjustUtils.KeyAdid);
|
||||
Message = AdjustUtils.TryGetValue(eventFailureDataMap, AdjustUtils.KeyMessage);
|
||||
Timestamp = AdjustUtils.TryGetValue(eventFailureDataMap, AdjustUtils.KeyTimestamp);
|
||||
EventToken = AdjustUtils.TryGetValue(eventFailureDataMap, AdjustUtils.KeyEventToken);
|
||||
CallbackId = AdjustUtils.TryGetValue(eventFailureDataMap, AdjustUtils.KeyCallbackId);
|
||||
|
||||
bool willRetry;
|
||||
if (bool.TryParse(AdjustUtils.TryGetValue(eventFailureDataMap, AdjustUtils.KeyWillRetry), out willRetry))
|
||||
{
|
||||
WillRetry = willRetry;
|
||||
}
|
||||
|
||||
string jsonResponseString = AdjustUtils.TryGetValue(eventFailureDataMap, AdjustUtils.KeyJsonResponse);
|
||||
var jsonResponseNode = JSON.Parse(jsonResponseString);
|
||||
if (jsonResponseNode != null && jsonResponseNode.AsObject != null)
|
||||
{
|
||||
JsonResponse = new Dictionary<string, object>();
|
||||
AdjustUtils.WriteJsonResponseDictionary(jsonResponseNode.AsObject, JsonResponse);
|
||||
}
|
||||
}
|
||||
|
||||
public AdjustEventFailure(string jsonString)
|
||||
{
|
||||
var jsonNode = JSON.Parse(jsonString);
|
||||
if (jsonNode == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Adid = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyAdid);
|
||||
Message = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyMessage);
|
||||
Timestamp = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyTimestamp);
|
||||
EventToken = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyEventToken);
|
||||
CallbackId = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCallbackId);
|
||||
WillRetry = Convert.ToBoolean(AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyWillRetry));
|
||||
|
||||
var jsonResponseNode = jsonNode[AdjustUtils.KeyJsonResponse];
|
||||
if (jsonResponseNode == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (jsonResponseNode.AsObject == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JsonResponse = new Dictionary<string, object>();
|
||||
AdjustUtils.WriteJsonResponseDictionary(jsonResponseNode.AsObject, JsonResponse);
|
||||
}
|
||||
|
||||
public void BuildJsonResponseFromString(string jsonResponseString)
|
||||
{
|
||||
var jsonNode = JSON.Parse(jsonResponseString);
|
||||
if (jsonNode == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JsonResponse = new Dictionary<string, object>();
|
||||
AdjustUtils.WriteJsonResponseDictionary(jsonNode.AsObject, JsonResponse);
|
||||
}
|
||||
|
||||
public string GetJsonResponse()
|
||||
{
|
||||
return AdjustUtils.GetJsonResponseCompact(JsonResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Adjust/Unity/AdjustEventFailure.cs.meta
Normal file
12
Assets/Adjust/Unity/AdjustEventFailure.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea86cd4e1c6d0496397920902d0f0b5f
|
||||
timeCreated: 1458128791
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user