diff --git a/Assets/Fyber/Editor/Resources/FyberEditorSettings.asset b/Assets/Fyber/Editor/Resources/FyberEditorSettings.asset index da6a5b6a..854a50ae 100644 Binary files a/Assets/Fyber/Editor/Resources/FyberEditorSettings.asset and b/Assets/Fyber/Editor/Resources/FyberEditorSettings.asset differ diff --git a/Assets/Plugins/Android/AndroidManifest.xml b/Assets/Plugins/Android/AndroidManifest.xml index b7fc823b..46ff9fac 100644 --- a/Assets/Plugins/Android/AndroidManifest.xml +++ b/Assets/Plugins/Android/AndroidManifest.xml @@ -1,15 +1,13 @@ - + - - + - @@ -20,192 +18,64 @@ - - - + - + - + - - - + - - + + - - + - - - - - - + + - - - - + + + - - + - - - - - - - + + - - - - - + + + + - - + + - - + - - - - + + + - - - + + - - - - - + + + + + + + + + - \ No newline at end of file diff --git a/Assets/Plugins/Heyzap/HZBannerAd.cs b/Assets/Plugins/Heyzap/HZBannerAd.cs index f65f6d9d..a95fc302 100644 --- a/Assets/Plugins/Heyzap/HZBannerAd.cs +++ b/Assets/Plugins/Heyzap/HZBannerAd.cs @@ -36,10 +36,10 @@ namespace Heyzap { /// Use this class to show banner ads. /// public class HZBannerAd : MonoBehaviour { - public delegate void AdDisplayListener(string state, string tag); + public delegate void AdDisplayListener(string state, string placement); private static AdDisplayListener adDisplayListener; - private static HZBannerAd _instance = null; + private static HZBannerAd _instance; // these are reproduced here for convenience since they were here in old SDK versions /// @@ -70,7 +70,7 @@ public static void ShowWithOptions(HZBannerShowOptions showOptions) { #endif #else UnityEngine.Debug.LogWarning("Call received to show an HZBannerAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); - _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.SHOW_FAILED, showOptions.Tag)); + _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.SHOW_FAILED, showOptions.Placement)); #endif } @@ -138,18 +138,18 @@ public static void InitReceiver(){ public void SetCallback(string message) { string[] displayStateParams = message.Split(','); - HZBannerAd.SetCallbackStateAndTag(displayStateParams[0], displayStateParams[1]); + HZBannerAd.SetCallbackStateAndPlacement(displayStateParams[0], displayStateParams[1]); } - protected static void SetCallbackStateAndTag(string state, string tag) { + protected static void SetCallbackStateAndPlacement(string state, string placement) { if (HZBannerAd.adDisplayListener != null) { - HZBannerAd.adDisplayListener(state, tag); + HZBannerAd.adDisplayListener(state, placement); } } - protected static IEnumerator InvokeCallbackNextFrame(string state, string tag) { + protected static IEnumerator InvokeCallbackNextFrame(string state, string placement) { yield return null; // wait a frame - HZBannerAd.SetCallbackStateAndTag(state, tag); + HZBannerAd.SetCallbackStateAndPlacement(state, placement); } #endregion } @@ -158,7 +158,7 @@ protected static IEnumerator InvokeCallbackNextFrame(string state, string tag) { #if UNITY_IPHONE && !UNITY_EDITOR public class HZBannerAdIOS : MonoBehaviour { [DllImport ("__Internal")] - private static extern void hz_ads_show_banner(string position, string tag); + private static extern void hz_ads_show_banner(string position, string placement); [DllImport ("__Internal")] private static extern bool hz_ads_hide_banner(); [DllImport ("__Internal")] @@ -168,7 +168,7 @@ public class HZBannerAdIOS : MonoBehaviour { public static void ShowWithOptions(HZBannerShowOptions showOptions) { - hz_ads_show_banner(showOptions.Position, showOptions.Tag); + hz_ads_show_banner(showOptions.Position, showOptions.Placement); } public static bool Hide() { @@ -230,7 +230,7 @@ public static void ShowWithOptions(HZBannerShowOptions showOptions) { AndroidJNIHelper.debug = false; using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("showBanner", showOptions.Tag, showOptions.Position); + jc.CallStatic("showBanner", showOptions.Placement, showOptions.Position); } } diff --git a/Assets/Plugins/Heyzap/HZBannerAd.cs.meta b/Assets/Plugins/Heyzap/HZBannerAd.cs.meta index d59aa90f..78d1089b 100644 --- a/Assets/Plugins/Heyzap/HZBannerAd.cs.meta +++ b/Assets/Plugins/Heyzap/HZBannerAd.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 25a1dc327650847528640f0265582837 -timeCreated: 1536245015 +guid: 827cff1babcbf45f1b7c6600fb062a97 +timeCreated: 1535874635 licenseType: Free MonoImporter: externalObjects: {} diff --git a/Assets/Plugins/Heyzap/HZDemographics.cs b/Assets/Plugins/Heyzap/HZDemographics.cs index 1c96bbcb..c8706444 100644 --- a/Assets/Plugins/Heyzap/HZDemographics.cs +++ b/Assets/Plugins/Heyzap/HZDemographics.cs @@ -37,7 +37,7 @@ namespace Heyzap { /// public class HZDemographics : MonoBehaviour { - private static HZDemographics _instance = null; + private static HZDemographics _instance; public enum Gender { UNKNOWN, diff --git a/Assets/Plugins/Heyzap/HZDemographics.cs.meta b/Assets/Plugins/Heyzap/HZDemographics.cs.meta index c9ae2f67..41883a38 100644 --- a/Assets/Plugins/Heyzap/HZDemographics.cs.meta +++ b/Assets/Plugins/Heyzap/HZDemographics.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 28bae634cde55462aa4bea2b67992b86 -timeCreated: 1536245015 +guid: 5ce66c985128c464aba340efbbfca3e2 +timeCreated: 1535874635 licenseType: Free MonoImporter: externalObjects: {} diff --git a/Assets/Plugins/Heyzap/HZIncentivizedAd.cs.meta b/Assets/Plugins/Heyzap/HZIncentivizedAd.cs.meta deleted file mode 100644 index 30fc11be..00000000 --- a/Assets/Plugins/Heyzap/HZIncentivizedAd.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 37b6818a823c348b6a2d204e5ee0a83b -timeCreated: 1536245015 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Heyzap/HZInterstitialAd.cs b/Assets/Plugins/Heyzap/HZInterstitialAd.cs index e50c9e58..a1ce0946 100644 --- a/Assets/Plugins/Heyzap/HZInterstitialAd.cs +++ b/Assets/Plugins/Heyzap/HZInterstitialAd.cs @@ -35,9 +35,9 @@ namespace Heyzap { /// public class HZInterstitialAd : MonoBehaviour { - public delegate void AdDisplayListener(string state, string tag); + public delegate void AdDisplayListener(string state, string placement); private static AdDisplayListener adDisplayListener; - private static HZInterstitialAd _instance = null; + private static HZInterstitialAd _instance; //provided since JS can't use default parameters /// @@ -63,57 +63,53 @@ public static void ShowWithOptions(HZShowOptions showOptions) { HZInterstitialAdIOS.ShowWithOptions(showOptions); #endif #else - UnityEngine.Debug.LogWarning("Call received to show an HZInterstitalAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); - _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.SHOW_FAILED, showOptions.Tag)); + UnityEngine.Debug.LogWarning("Call received to show an HZInterstitialAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); + _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.SHOW_FAILED, showOptions.Placement)); #endif } //provided since JS can't use default parameters /// - /// Fetches an ad for the default ad tag. + /// Fetches an ad for the default placement name. /// public static void Fetch() { HZInterstitialAd.Fetch(null); } /// - /// Fetches an ad for the given ad tag. + /// Fetches an ad for the given placement name. /// - /// The ad tag to fetch an ad for. - public static void Fetch(string tag) { - tag = HeyzapAds.TagForString(tag); - + /// The placement name to fetch an ad for. + public static void Fetch(string placement) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) #if UNITY_ANDROID - HZInterstitialAdAndroid.Fetch(tag); + HZInterstitialAdAndroid.Fetch(placement); #elif UNITY_IPHONE - HZInterstitialAdIOS.Fetch(tag); + HZInterstitialAdIOS.Fetch(placement); #endif #else UnityEngine.Debug.LogWarning("Call received to fetch an HZInterstitialAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); - _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.FETCH_FAILED, tag)); + _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.FETCH_FAILED, placement)); #endif } - + //provided since JS can't use default parameters /// - /// Returns whether or not an ad is available for the default ad tag. + /// Returns whether or not an ad is available for the default placement name. /// /// true, if an ad is available, false otherwise. public static bool IsAvailable() { return HZInterstitialAd.IsAvailable(null); } /// - /// Returns whether or not an ad is available for the given ad tag. + /// Returns whether or not an ad is available for the given placement name. /// /// true, if an ad is available, false otherwise. - public static bool IsAvailable(string tag) { - tag = HeyzapAds.TagForString(tag); - + public static bool IsAvailable(string placement) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) #if UNITY_ANDROID - return HZInterstitialAdAndroid.IsAvailable(tag); + return HZInterstitialAdAndroid.IsAvailable(placement); #elif UNITY_IPHONE - return HZInterstitialAdIOS.IsAvailable(tag); + return HZInterstitialAdIOS.IsAvailable(placement); #endif #else return false; @@ -183,18 +179,18 @@ public static void InitReceiver(){ public void SetCallback(string message) { string[] displayStateParams = message.Split(','); - HZInterstitialAd.SetCallbackStateAndTag(displayStateParams[0], displayStateParams[1]); + HZInterstitialAd.SetCallbackStateAndPlacement(displayStateParams[0], displayStateParams[1]); } - protected static void SetCallbackStateAndTag(string state, string tag) { + protected static void SetCallbackStateAndPlacement(string state, string placement) { if (HZInterstitialAd.adDisplayListener != null) { - HZInterstitialAd.adDisplayListener(state, tag); + HZInterstitialAd.adDisplayListener(state, placement); } } - protected static IEnumerator InvokeCallbackNextFrame(string state, string tag) { + protected static IEnumerator InvokeCallbackNextFrame(string state, string placement) { yield return null; // wait a frame - HZInterstitialAd.SetCallbackStateAndTag(state, tag); + HZInterstitialAd.SetCallbackStateAndPlacement(state, placement); } #endregion } @@ -203,11 +199,11 @@ protected static IEnumerator InvokeCallbackNextFrame(string state, string tag) { #if UNITY_IPHONE && !UNITY_EDITOR public class HZInterstitialAdIOS { [DllImport ("__Internal")] - private static extern void hz_ads_show_interstitial(string tag); + private static extern void hz_ads_show_interstitial(string placement); [DllImport ("__Internal")] - private static extern void hz_ads_fetch_interstitial(string tag); + private static extern void hz_ads_fetch_interstitial(string placement); [DllImport ("__Internal")] - private static extern bool hz_ads_interstitial_is_available(string tag); + private static extern bool hz_ads_interstitial_is_available(string placement); [DllImport ("__Internal")] private static extern void hz_fetch_chartboost_for_location(string location); [DllImport ("__Internal")] @@ -217,15 +213,15 @@ public class HZInterstitialAdIOS { public static void ShowWithOptions(HZShowOptions showOptions) { - hz_ads_show_interstitial(showOptions.Tag); + hz_ads_show_interstitial(showOptions.Placement); } - public static void Fetch(string tag) { - hz_ads_fetch_interstitial(tag); + public static void Fetch(string placement) { + hz_ads_fetch_interstitial(placement); } - public static bool IsAvailable(string tag) { - return hz_ads_interstitial_is_available(tag); + public static bool IsAvailable(string placement) { + return hz_ads_interstitial_is_available(placement); } @@ -253,25 +249,25 @@ public static void ShowWithOptions(HZShowOptions showOptions) { AndroidJNIHelper.debug = false; using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("showInterstitial", showOptions.Tag); + jc.CallStatic("showInterstitial", showOptions.Placement); } } - public static void Fetch(string tag="default") { + public static void Fetch(string placement) { if(Application.platform != RuntimePlatform.Android) return; AndroidJNIHelper.debug = false; using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("fetchInterstitial", tag); + jc.CallStatic("fetchInterstitial", placement); } } - public static Boolean IsAvailable(string tag="default") { + public static Boolean IsAvailable(string placement) { if(Application.platform != RuntimePlatform.Android) return false; AndroidJNIHelper.debug = false; using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - return jc.CallStatic("isInterstitialAvailable", tag); + return jc.CallStatic("isInterstitialAvailable", placement); } } diff --git a/Assets/Plugins/Heyzap/HZInterstitialAd.cs.meta b/Assets/Plugins/Heyzap/HZInterstitialAd.cs.meta index ff67e22d..9160ea9b 100644 --- a/Assets/Plugins/Heyzap/HZInterstitialAd.cs.meta +++ b/Assets/Plugins/Heyzap/HZInterstitialAd.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 64959f833348d4e4ea972aa0919fb0cd -timeCreated: 1536245015 +guid: 562df0be3393744a5aa789fdaf832e61 +timeCreated: 1535874635 licenseType: Free MonoImporter: externalObjects: {} diff --git a/Assets/Plugins/Heyzap/HZOfferwallAd.cs b/Assets/Plugins/Heyzap/HZOfferwallAd.cs deleted file mode 100644 index 5614d855..00000000 --- a/Assets/Plugins/Heyzap/HZOfferwallAd.cs +++ /dev/null @@ -1,305 +0,0 @@ -// -// HZOfferWallAd.cs -// -// Copyright 2017 Heyzap, Inc. All Rights Reserved -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System; - -namespace Heyzap { - /// - /// Use this class to show offerwall ads. - /// - public class HZOfferWallAd : MonoBehaviour { - - public delegate void AdDisplayListener(string state, string tag); - private static AdDisplayListener adDisplayListener; - - public delegate void VirtualCurrencyResponseListener(VirtualCurrencyResponse response); - private static VirtualCurrencyResponseListener virtualCurrencyResponseListener; - - public delegate void VirtualCurrencyErrorListener(string errorMsg); - private static VirtualCurrencyErrorListener virtualCurrencyErrorListener; - - private static HZOfferWallAd _instance = null; - - //provided since JS can't use default parameters - /// - /// Shows an ad with the default options. - /// - public static void Show() { - HZOfferWallAd.ShowWithOptions(null); - } - /// - /// Shows an ad with the given options. - /// - /// The options to show the ad with, or the default options if null - public static void ShowWithOptions(HZOfferWallShowOptions showOptions) { - if (showOptions == null) { - showOptions = new HZOfferWallShowOptions(); - } - - #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) - #if UNITY_ANDROID - HZOfferWallAdAndroid.ShowWithOptions(showOptions); - #elif UNITY_IPHONE - HZOfferWallAdIOS.ShowWithOptions(showOptions); - #endif - #else - UnityEngine.Debug.LogWarning("Call received to show an HZOfferWallAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); - _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.SHOW_FAILED, showOptions.Tag)); - #endif - } - - //provided since JS can't use default parameters - /// - /// Fetches an ad for the default ad tag. - /// - public static void Fetch() { - HZOfferWallAd.Fetch(null); - } - /// - /// Fetches an ad for the given ad tag. - /// - /// The ad tag to fetch an ad for. - public static void Fetch(string tag) { - tag = HeyzapAds.TagForString(tag); - - #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) - #if UNITY_ANDROID - HZOfferWallAdAndroid.Fetch(tag); - #elif UNITY_IPHONE - HZOfferWallAdIOS.Fetch(tag); - #endif - #else - UnityEngine.Debug.LogWarning("Call received to fetch an HZOfferWallAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); - _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.FETCH_FAILED, tag)); - #endif - } - - //provided since JS can't use default parameters - /// - /// Returns whether or not an ad is available for the default ad tag. - /// - /// true, if an ad is available, false otherwise. - public static bool IsAvailable() { - return HZOfferWallAd.IsAvailable(null); - } - /// - /// Returns whether or not an ad is available for the given ad tag. - /// - /// true, if an ad is available, false otherwise. - public static bool IsAvailable(string tag) { - tag = HeyzapAds.TagForString(tag); - - #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) - #if UNITY_ANDROID - return HZOfferWallAdAndroid.IsAvailable(tag); - #elif UNITY_IPHONE - return HZOfferWallAdIOS.IsAvailable(tag); - #endif - #else - return false; - #endif - } - - /// - /// Sends a request to the Virtual Currency Server to see if the user has earned virtual currency since the last request. - /// The `VirtualCurrencyResponseListener` or the `VirtualCurrencyErrorListener` will receive the response once received. - /// - /// The ID of the currency to request information about. Setting this to NULL will request the default currency. - public static void RequestDeltaOfCurrency(string currencyId) { - #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) - #if UNITY_ANDROID - HZOfferWallAdAndroid.RequestDeltaOfCurrency(currencyId); - #elif UNITY_IPHONE - HZOfferWallAdIOS.RequestDeltaOfCurrency(currencyId); - #endif - #else - UnityEngine.Debug.LogWarning("Call received to request a VCS update on HZOfferWallAd, but the SDK does not function in the editor. You must use a device/emulator to do this."); - _instance.StartCoroutine(InvokeVCSErrorNextFrame("only_works_on_device")); - #endif - } - - /// - /// Sets the AdDisplayListener for offerwall ads, which will receive callbacks regarding the state of offerwall ads. - /// - public static void SetDisplayListener(AdDisplayListener listener) { - HZOfferWallAd.adDisplayListener = listener; - } - - /// - /// Sets the VirtualCurrencyResponseListener for offerwall ads, which will receive callbacks in response to a request for a VCS update. - /// - public static void SetVirtualCurrencyResponseListener(VirtualCurrencyResponseListener listener) { - HZOfferWallAd.virtualCurrencyResponseListener = listener; - } - - /// - /// Sets the VirtualCurrencyErrorListener for offerwall ads, which will receive callbacks regarding errors received after requesting virtual currency updates from the server. - /// - public static void SetVirtualCurrencyErrorListener(VirtualCurrencyErrorListener listener) { - HZOfferWallAd.virtualCurrencyErrorListener = listener; - } - - #region Internal methods - public static void InitReceiver(){ - if (_instance == null) { - GameObject receiverObject = new GameObject("HZOfferWallAd"); - DontDestroyOnLoad(receiverObject); - _instance = receiverObject.AddComponent(); - } - } - - // received from native SDK - public void SetCallback(string message) { - string[] displayStateParams = message.Split(','); - HZOfferWallAd.SetCallbackStateAndTag(displayStateParams[0], displayStateParams[1]); - } - protected static void SetCallbackStateAndTag(string state, string tag) { - if (HZOfferWallAd.adDisplayListener != null) { - HZOfferWallAd.adDisplayListener(state, tag); - } - } - - // used for in-editor functionality - protected static IEnumerator InvokeCallbackNextFrame(string state, string tag) { - yield return null; // wait a frame - HZOfferWallAd.SetCallbackStateAndTag(state, tag); - } - - // received from native SDK - public void VCSResponse(string jsonString) { - HZOfferWallAd.SendVCSResponse(jsonString); - } - protected static void SendVCSResponse(string jsonString) { - if (HZOfferWallAd.virtualCurrencyResponseListener != null) { - VirtualCurrencyResponse response = (VirtualCurrencyResponse)JsonUtility.FromJson(jsonString); - HZOfferWallAd.virtualCurrencyResponseListener(response); - } - } - - // received from native SDK - public void VCSError(string errorMsg) { - HZOfferWallAd.SendVCSError(errorMsg); - } - protected static void SendVCSError(string errorMsg) { - if (HZOfferWallAd.virtualCurrencyErrorListener != null) { - HZOfferWallAd.virtualCurrencyErrorListener(errorMsg); - } - } - - // used for in-editor functionality - protected static IEnumerator InvokeVCSErrorNextFrame(string errorMsg) { - yield return null; // wait a frame - HZOfferWallAd.SendVCSError(errorMsg); - } - #endregion - } - - #region Platform-specific translations - #if UNITY_IPHONE && !UNITY_EDITOR - public class HZOfferWallAdIOS : MonoBehaviour { - [DllImport ("__Internal")] - private static extern void hz_ads_show_offerwall(string tag, bool shouldCloseAfterFirstClick); - [DllImport ("__Internal")] - private static extern void hz_ads_fetch_offerwall(string tag); - [DllImport ("__Internal")] - private static extern bool hz_ads_offerwall_is_available(string tag); - [DllImport ("__Internal")] - private static extern bool hz_ads_virtual_currency_request(string currencyId); - - - public static void ShowWithOptions(HZOfferWallShowOptions showOptions) { - hz_ads_show_offerwall(showOptions.Tag, showOptions.ShouldCloseAfterFirstClick); - } - - public static void Fetch(string tag) { - hz_ads_fetch_offerwall(tag); - } - - public static bool IsAvailable(string tag) { - return hz_ads_offerwall_is_available(tag); - } - - public static void RequestDeltaOfCurrency(string currencyId) { - hz_ads_virtual_currency_request(currencyId); - } - } - #endif - - #if UNITY_ANDROID && !UNITY_EDITOR - public class HZOfferWallAdAndroid : MonoBehaviour { - - public static void ShowWithOptions(HZOfferWallShowOptions showOptions) { - if(Application.platform != RuntimePlatform.Android) return; - - AndroidJNIHelper.debug = false; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("showOfferWall", showOptions.Tag, showOptions.ShouldCloseAfterFirstClick); - } - } - - public static void Fetch(string tag) { - if(Application.platform != RuntimePlatform.Android) return; - - AndroidJNIHelper.debug = false; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("fetchOfferWall", tag); - } - } - - public static Boolean IsAvailable(string tag) { - if(Application.platform != RuntimePlatform.Android) return false; - - AndroidJNIHelper.debug = false; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - return jc.CallStatic("isOfferWallAvailable", tag); - } - } - - public static void RequestDeltaOfCurrency(string currencyId) { - if(Application.platform != RuntimePlatform.Android) return; - - AndroidJNIHelper.debug = false; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("virtualCurrencyRequest", currencyId); - } - } - } - #endif - #endregion - - [Serializable] - public class VirtualCurrencyResponse { - public string LatestTransactionID; - public string CurrencyID; - public string CurrencyName; - public float DeltaOfCurrency; - } -} diff --git a/Assets/Plugins/Heyzap/HZOfferwallAd.cs.meta b/Assets/Plugins/Heyzap/HZOfferwallAd.cs.meta deleted file mode 100644 index add5d212..00000000 --- a/Assets/Plugins/Heyzap/HZOfferwallAd.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 69fcf5bc050d94853a6b8e3d7c2608a1 -timeCreated: 1536245015 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Heyzap/HZIncentivizedAd.cs b/Assets/Plugins/Heyzap/HZRewardedAd.cs similarity index 59% rename from Assets/Plugins/Heyzap/HZIncentivizedAd.cs rename to Assets/Plugins/Heyzap/HZRewardedAd.cs index 1cc8ed2e..ec6234c5 100644 --- a/Assets/Plugins/Heyzap/HZIncentivizedAd.cs +++ b/Assets/Plugins/Heyzap/HZRewardedAd.cs @@ -1,4 +1,4 @@ -// HZIncentivizedAd.cs +// HZRewardedAd.cs // // Copyright 2015 Heyzap, Inc. All Rights Reserved // @@ -32,37 +32,35 @@ namespace Heyzap { /// - /// Use this class to show incentivized (rewarded) video ads. + /// Use this class to show rewarded ads. /// - public class HZIncentivizedAd : MonoBehaviour { + public class HZRewardedAd : MonoBehaviour { - public delegate void AdDisplayListener(string state, string tag); + public delegate void AdDisplayListener(string state, string placement); private static AdDisplayListener adDisplayListener; - private static HZIncentivizedAd _instance = null; + private static HZRewardedAd _instance; //provided since JS can't use default parameters /// - /// Fetches an ad for the default ad tag. + /// Requests an ad for the default placement name. /// - public static void Fetch() { - HZIncentivizedAd.Fetch(null); + public static void Request() { + HZRewardedAd.Request(null); } /// - /// Fetches an ad for the given ad tag. + /// Fetches an ad for the given placement name. /// - /// The ad tag to fetch an ad for. - public static void Fetch(string tag) { - tag = HeyzapAds.TagForString(tag); - + /// The placement name to request an ad for. + public static void Request(string placement) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) #if UNITY_ANDROID - HZIncentivizedAdAndroid.Fetch(tag); + HZRewardedAdAndroid.Fetch(placement); #elif UNITY_IPHONE - HZIncentivizedAdIOS.Fetch(tag); + HZRewardedAdIOS.Fetch(placement); #endif #else - UnityEngine.Debug.LogWarning("Call received to fetch an HZIncentivizedAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); - _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.FETCH_FAILED, tag)); + UnityEngine.Debug.LogWarning("Call received to fetch an HZRewardedAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); + _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.FETCH_FAILED, placement)); #endif } @@ -71,49 +69,47 @@ public static void Fetch(string tag) { /// Shows an ad with the default options. /// public static void Show() { - HZIncentivizedAd.ShowWithOptions(null); + HZRewardedAd.ShowWithOptions(null); } /// /// Shows an ad with the given options. /// /// The options to show the ad with, or the default options if null - public static void ShowWithOptions(HZIncentivizedShowOptions showOptions) { + public static void ShowWithOptions(HZRewardedShowOptions showOptions) { if (showOptions == null) { - showOptions = new HZIncentivizedShowOptions(); + showOptions = new HZRewardedShowOptions(); } #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) #if UNITY_ANDROID - HZIncentivizedAdAndroid.ShowWithOptions(showOptions); + HZRewardedAdAndroid.ShowWithOptions(showOptions); #elif UNITY_IPHONE - HZIncentivizedAdIOS.ShowWithOptions(showOptions); + HZRewardedAdIOS.ShowWithOptions(showOptions); #endif #else - UnityEngine.Debug.LogWarning("Call received to show an HZIncentivizedAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); - _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.SHOW_FAILED, showOptions.Tag)); + UnityEngine.Debug.LogWarning("Call received to show an HZRewardedAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); + _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.SHOW_FAILED, showOptions.Placement)); #endif } //provided since JS can't use default parameters /// - /// Returns whether or not an ad is available for the default ad tag. + /// Returns whether or not an ad is available for the default placement name. /// /// true, if an ad is available, false otherwise. public static bool IsAvailable() { - return HZIncentivizedAd.IsAvailable(null); + return HZRewardedAd.IsAvailable(null); } /// - /// Returns whether or not an ad is available for the given ad tag. + /// Returns whether or not an ad is available for the given placement name. /// /// true, if an ad is available, false otherwise. - public static bool IsAvailable(string tag) { - tag = HeyzapAds.TagForString(tag); - + public static bool IsAvailable(string placement) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) #if UNITY_ANDROID - return HZIncentivizedAdAndroid.IsAvailable(tag); + return HZRewardedAdAndroid.IsAvailable(placement); #elif UNITY_IPHONE - return HZIncentivizedAdIOS.IsAvailable(tag); + return HZRewardedAdIOS.IsAvailable(placement); #endif #else return false; @@ -121,91 +117,91 @@ public static bool IsAvailable(string tag) { } /// - /// Sets the AdDisplayListener for incentivized ads, which will receive callbacks regarding the state of incentivized ads. + /// Sets the AdDisplayListener for rewarded ads, which will receive callbacks regarding the state of rewarded ads. /// public static void SetDisplayListener(AdDisplayListener listener) { - HZIncentivizedAd.adDisplayListener = listener; + HZRewardedAd.adDisplayListener = listener; } #region Internal methods public static void InitReceiver(){ if (_instance == null) { - GameObject receiverObject = new GameObject("HZIncentivizedAd"); + GameObject receiverObject = new GameObject("HZRewardedAd"); DontDestroyOnLoad(receiverObject); - _instance = receiverObject.AddComponent(); + _instance = receiverObject.AddComponent(); } } public void SetCallback(string message) { string[] displayStateParams = message.Split(','); - HZIncentivizedAd.SetCallbackStateAndTag(displayStateParams[0], displayStateParams[1]); + HZRewardedAd.SetCallbackStateAndPlacement(displayStateParams[0], displayStateParams[1]); } - protected static void SetCallbackStateAndTag(string state, string tag) { - if (HZIncentivizedAd.adDisplayListener != null) { - HZIncentivizedAd.adDisplayListener(state, tag); + protected static void SetCallbackStateAndPlacement(string state, string placement) { + if (HZRewardedAd.adDisplayListener != null) { + HZRewardedAd.adDisplayListener(state, placement); } } - protected static IEnumerator InvokeCallbackNextFrame(string state, string tag) { + protected static IEnumerator InvokeCallbackNextFrame(string state, string placement) { yield return null; // wait a frame - HZIncentivizedAd.SetCallbackStateAndTag(state, tag); + HZRewardedAd.SetCallbackStateAndPlacement(state, placement); } #endregion } #region Platform-specific translations #if UNITY_IPHONE && !UNITY_EDITOR - public class HZIncentivizedAdIOS : MonoBehaviour { + public class HZRewardedAdIOS : MonoBehaviour { [DllImport ("__Internal")] - private static extern void hz_ads_show_incentivized_with_custom_info(string tag, string incentivizedInfo); + private static extern void hz_ads_show_rewarded_with_custom_info(string placement, string rewardedInfo); [DllImport ("__Internal")] - private static extern void hz_ads_fetch_incentivized(string tag); + private static extern void hz_ads_fetch_rewarded(string placement); [DllImport ("__Internal")] - private static extern bool hz_ads_incentivized_is_available(string tag); + private static extern bool hz_ads_rewarded_is_available(string placement); - public static void ShowWithOptions(HZIncentivizedShowOptions showOptions) { - hz_ads_show_incentivized_with_custom_info(showOptions.Tag, showOptions.IncentivizedInfo); + public static void ShowWithOptions(HZRewardedShowOptions showOptions) { + hz_ads_show_rewarded_with_custom_info(showOptions.Placement, showOptions.RewardedInfo); } - public static void Fetch(string tag) { - hz_ads_fetch_incentivized(tag); + public static void Fetch(string placement) { + hz_ads_fetch_rewarded(placement); } - public static bool IsAvailable(string tag) { - return hz_ads_incentivized_is_available(tag); + public static bool IsAvailable(string placement) { + return hz_ads_rewarded_is_available(placement); } } #endif #if UNITY_ANDROID && !UNITY_EDITOR - public class HZIncentivizedAdAndroid : MonoBehaviour { + public class HZRewardedAdAndroid : MonoBehaviour { - public static void ShowWithOptions(HZIncentivizedShowOptions showOptions) { + public static void ShowWithOptions(HZRewardedShowOptions showOptions) { if(Application.platform != RuntimePlatform.Android) return; AndroidJNIHelper.debug = false; using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("showIncentivized", showOptions.Tag, showOptions.IncentivizedInfo); + jc.CallStatic("showRewarded", showOptions.Placement, showOptions.RewardedInfo); } } - public static void Fetch(string tag) { + public static void Fetch(string placement) { if(Application.platform != RuntimePlatform.Android) return; AndroidJNIHelper.debug = false; using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("fetchIncentivized", tag); + jc.CallStatic("fetchRewarded", placement); } } - public static Boolean IsAvailable(string tag) { + public static Boolean IsAvailable(string placement) { if(Application.platform != RuntimePlatform.Android) return false; AndroidJNIHelper.debug = false; using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - return jc.CallStatic("isIncentivizedAvailable", tag); + return jc.CallStatic("isRewardedAvailable", placement); } } } diff --git a/Assets/Plugins/Heyzap/HZVideoAd.cs.meta b/Assets/Plugins/Heyzap/HZRewardedAd.cs.meta similarity index 77% rename from Assets/Plugins/Heyzap/HZVideoAd.cs.meta rename to Assets/Plugins/Heyzap/HZRewardedAd.cs.meta index 595b6e97..6290777d 100644 --- a/Assets/Plugins/Heyzap/HZVideoAd.cs.meta +++ b/Assets/Plugins/Heyzap/HZRewardedAd.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: b3fd6984a505949a2a9cb6552a21c45d -timeCreated: 1536245015 +guid: 8b10443bf619e4c6bb752b212115a36d +timeCreated: 1535874635 licenseType: Free MonoImporter: externalObjects: {} diff --git a/Assets/Plugins/Heyzap/HZShowOptions.cs b/Assets/Plugins/Heyzap/HZShowOptions.cs index 482e90d8..bf76b1d2 100644 --- a/Assets/Plugins/Heyzap/HZShowOptions.cs +++ b/Assets/Plugins/Heyzap/HZShowOptions.cs @@ -8,49 +8,43 @@ namespace Heyzap { public class HZShowOptions { /// - /// An identifier for the location of the ad, which you can use to disable the ad from your dashboard. If not specified the tag "default" is always used. - /// Guaranteed to be non-null - will be set to the default value if the setter is called with `null`. + /// An identifier for the location of the ad, which you can use to disable the ad from your dashboard. /// - /// The tag. - public string Tag { + /// The placement name. + public string Placement { get { - return tag; + return placement; } set { - if (value != null) { - tag = value; - } else { - tag = HeyzapAds.DEFAULT_TAG; - } + placement = value; } } - private string tag = HeyzapAds.DEFAULT_TAG; + private string placement; } /// - /// A set of options that describes how to show an incentivized ad. + /// A set of options that describes how to show an rewarded ad. /// - public class HZIncentivizedShowOptions : HZShowOptions { - private const string DEFAULT_INCENTIVIZED_INFO = ""; + public class HZRewardedShowOptions : HZShowOptions { + private const string DEFAULT_REWARDED_INFO = ""; /// - /// When an incentivized video is completed, this string will be sent to your server via our server-to-server callbacks. Set it to anything you want to pass to your server regarding this incentivized video view (i.e.: a username, user ID, level name, etc.), or leave it empty if you don't need to use it / aren't using server callbacks for incentivized video. + /// When an rewarded video is completed, this string will be sent to your server via our server-to-server callbacks. Set it to anything you want to pass to your server regarding this rewarded video view (i.e.: a username, user ID, level name, etc.), or leave it empty if you don't need to use it / aren't using server callbacks for rewarded video. /// More information about using this feature can be found at https://developers.heyzap.com/docs/advanced-publishing . - /// Guaranteed to be non-null - will be set to the default value if the setter is called with `null`. /// - public string IncentivizedInfo { + public string RewardedInfo { get { - return incentivizedInfo; + return rewardedInfo; } set { if (value != null) { - incentivizedInfo = value; + rewardedInfo = value; } else { - incentivizedInfo = HZIncentivizedShowOptions.DEFAULT_INCENTIVIZED_INFO; + rewardedInfo = HZRewardedShowOptions.DEFAULT_REWARDED_INFO; } } } - private string incentivizedInfo = HZIncentivizedShowOptions.DEFAULT_INCENTIVIZED_INFO; + private string rewardedInfo = HZRewardedShowOptions.DEFAULT_REWARDED_INFO; } /// @@ -86,26 +80,4 @@ public string Position { } private string position = HZBannerShowOptions.DEFAULT_POSITION; } - - /// - /// A set of options that describes how to show an offerwall ad. - /// - public class HZOfferWallShowOptions : HZShowOptions { - private const bool DEFAULT_SHOULD_CLOSE_AFTER_FIRST_CLICK = true; - - /// - /// When an incentivized video is completed, this string will be sent to your server via our server-to-server callbacks. Set it to anything you want to pass to your server regarding this incentivized video view (i.e.: a username, user ID, level name, etc.), or leave it empty if you don't need to use it / aren't using server callbacks for incentivized video. - /// More information about using this feature can be found at https://developers.heyzap.com/docs/advanced-publishing . - /// Guaranteed to be non-null - will be set to the default value if the setter is called with `null`. - /// - public bool ShouldCloseAfterFirstClick { - get { - return shouldCloseAfterFirstClick; - } - set { - shouldCloseAfterFirstClick = value; - } - } - private bool shouldCloseAfterFirstClick = HZOfferWallShowOptions.DEFAULT_SHOULD_CLOSE_AFTER_FIRST_CLICK; - } -} \ No newline at end of file +} diff --git a/Assets/Plugins/Heyzap/HZShowOptions.cs.meta b/Assets/Plugins/Heyzap/HZShowOptions.cs.meta index 9c0b131b..6b9c8e12 100644 --- a/Assets/Plugins/Heyzap/HZShowOptions.cs.meta +++ b/Assets/Plugins/Heyzap/HZShowOptions.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 827013d160de44f5b9d253fb672a122f -timeCreated: 1536245015 +guid: bbc60f2f830064cad9122ee278796335 +timeCreated: 1535874635 licenseType: Free MonoImporter: externalObjects: {} diff --git a/Assets/Plugins/Heyzap/HZVideoAd.cs b/Assets/Plugins/Heyzap/HZVideoAd.cs deleted file mode 100644 index 560c7bbd..00000000 --- a/Assets/Plugins/Heyzap/HZVideoAd.cs +++ /dev/null @@ -1,215 +0,0 @@ -// -// HZVideoAd.cs -// -// Copyright 2015 Heyzap, Inc. All Rights Reserved -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System; - -namespace Heyzap { - /// - /// Use this class to show video ads. - /// - public class HZVideoAd : MonoBehaviour { - - public delegate void AdDisplayListener(string state, string tag); - private static AdDisplayListener adDisplayListener; - private static HZVideoAd _instance = null; - - //provided since JS can't use default parameters - /// - /// Shows an ad with the default options. - /// - public static void Show() { - HZVideoAd.ShowWithOptions(null); - } - /// - /// Shows an ad with the given options. - /// - /// The options to show the ad with, or the default options if null - public static void ShowWithOptions(HZShowOptions showOptions) { - if (showOptions == null) { - showOptions = new HZShowOptions(); - } - - #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) - #if UNITY_ANDROID - HZVideoAdAndroid.ShowWithOptions(showOptions); - #elif UNITY_IPHONE - HZVideoAdIOS.ShowWithOptions(showOptions); - #endif - #else - UnityEngine.Debug.LogWarning("Call received to show an HZVideoAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); - _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.SHOW_FAILED, showOptions.Tag)); - #endif - } - - //provided since JS can't use default parameters - /// - /// Fetches an ad for the default ad tag. - /// - public static void Fetch() { - HZVideoAd.Fetch(null); - } - /// - /// Fetches an ad for the given ad tag. - /// - /// The ad tag to fetch an ad for. - public static void Fetch(string tag) { - tag = HeyzapAds.TagForString(tag); - - #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) - #if UNITY_ANDROID - HZVideoAdAndroid.Fetch(tag); - #elif UNITY_IPHONE - HZVideoAdIOS.Fetch(tag); - #endif - #else - UnityEngine.Debug.LogWarning("Call received to fetch an HZVideoAd, but the SDK does not function in the editor. You must use a device/emulator to fetch/show ads."); - _instance.StartCoroutine(InvokeCallbackNextFrame(HeyzapAds.NetworkCallback.FETCH_FAILED, tag)); - #endif - } - - //provided since JS can't use default parameters - /// - /// Returns whether or not an ad is available for the default ad tag. - /// - /// true, if an ad is available, false otherwise. - public static bool IsAvailable() { - return HZVideoAd.IsAvailable(null); - } - /// - /// Returns whether or not an ad is available for the given ad tag. - /// - /// true, if an ad is available, false otherwise. - public static bool IsAvailable(string tag) { - tag = HeyzapAds.TagForString(tag); - - #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) - #if UNITY_ANDROID - return HZVideoAdAndroid.IsAvailable(tag); - #elif UNITY_IPHONE - return HZVideoAdIOS.IsAvailable(tag); - #endif - #else - return false; - #endif - } - - /// - /// Sets the AdDisplayListener for video ads, which will receive callbacks regarding the state of video ads. - /// - public static void SetDisplayListener(AdDisplayListener listener) { - HZVideoAd.adDisplayListener = listener; - } - - #region Internal methods - public static void InitReceiver(){ - if (_instance == null) { - GameObject receiverObject = new GameObject("HZVideoAd"); - DontDestroyOnLoad(receiverObject); - _instance = receiverObject.AddComponent(); - } - } - - public void SetCallback(string message) { - string[] displayStateParams = message.Split(','); - HZVideoAd.SetCallbackStateAndTag(displayStateParams[0], displayStateParams[1]); - } - - protected static void SetCallbackStateAndTag(string state, string tag) { - if (HZVideoAd.adDisplayListener != null) { - HZVideoAd.adDisplayListener(state, tag); - } - } - - protected static IEnumerator InvokeCallbackNextFrame(string state, string tag) { - yield return null; // wait a frame - HZVideoAd.SetCallbackStateAndTag(state, tag); - } - #endregion - } - - #region Platform-specific translations - #if UNITY_IPHONE && !UNITY_EDITOR - public class HZVideoAdIOS : MonoBehaviour { - [DllImport ("__Internal")] - private static extern void hz_ads_show_video(string tag); - [DllImport ("__Internal")] - private static extern void hz_ads_fetch_video(string tag); - [DllImport ("__Internal")] - private static extern bool hz_ads_video_is_available(string tag); - - - public static void ShowWithOptions(HZShowOptions showOptions) { - hz_ads_show_video(showOptions.Tag); - } - - public static void Fetch(string tag) { - hz_ads_fetch_video(tag); - } - - public static bool IsAvailable(string tag) { - return hz_ads_video_is_available(tag); - } - } - #endif - - #if UNITY_ANDROID && !UNITY_EDITOR - public class HZVideoAdAndroid : MonoBehaviour { - - public static void ShowWithOptions(HZShowOptions showOptions) { - if(Application.platform != RuntimePlatform.Android) return; - - AndroidJNIHelper.debug = false; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("showVideo", showOptions.Tag); - } - } - - public static void Fetch(string tag) { - if(Application.platform != RuntimePlatform.Android) return; - - AndroidJNIHelper.debug = false; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("fetchVideo", tag); - } - } - - public static Boolean IsAvailable(string tag) { - if(Application.platform != RuntimePlatform.Android) return false; - - AndroidJNIHelper.debug = false; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - return jc.CallStatic("isVideoAvailable", tag); - } - } - } - #endif - #endregion -} diff --git a/Assets/Plugins/Heyzap/HeyzapAds.cs b/Assets/Plugins/Heyzap/HeyzapAds.cs index 7f180e3d..5c48f4cb 100644 --- a/Assets/Plugins/Heyzap/HeyzapAds.cs +++ b/Assets/Plugins/Heyzap/HeyzapAds.cs @@ -36,10 +36,11 @@ namespace Heyzap { /// Heyzap wrapper for iOS and Android via Unity. For more information, see https://developers.heyzap.com/docs/unity_sdk_setup_and_requirements . /// public class HeyzapAds : MonoBehaviour { + public const string Version = "2.0.0"; public delegate void NetworkCallbackListener(string network, string callback); private static NetworkCallbackListener networkCallbackListener; - private static HeyzapAds _instance = null; + private static HeyzapAds _instance; #region Flags for the call to HeyzapAds.StartWithOptions() /// @@ -47,38 +48,24 @@ public class HeyzapAds : MonoBehaviour { /// public const int FLAG_NO_OPTIONS = 0 << 0; // 0 /// - /// Use this flag to disable automatic prefetching of ads. You must call a `Fetch` method for every ad unit before a matching call to a `Show` method. + /// Use this flag to disable automatic prefetching of ads. You must call a `Request` method for every ad type before a matching call to a `Show` method. /// public const int FLAG_DISABLE_AUTOMATIC_FETCHING = 1 << 0; // 1 /// - /// Use this flag to disable all advertising functionality of the Heyzap SDK. This should only be used if you're integrating the SDK solely as an install tracker. + /// Use this flag to disable all advertising functionality of the FairBid SDK. This should only be used if you're integrating the SDK solely as an install tracker. /// public const int FLAG_INSTALL_TRACKING_ONLY = 1 << 1; // 2 /// - /// (Android only) Use this flag to tell the Heyzap SDK that this app is being distributed on the Amazon App Store. - /// - public const int FLAG_AMAZON = 1 << 2; // 4 - /// /// Use this flag to disable the mediation features of the Heyzap SDK. Only Heyzap ads will be available. /// You should set this flag if you are using Heyzap through another mediation tool to avoid potential conflicts. /// public const int FLAG_DISABLE_MEDIATION = 1 << 3; // 8 /// - /// (iOS only) Use this flag to stop the Heyzap SDK from automatically recording in-app purchases. - /// - public const int FLAG_DISABLE_AUTOMATIC_IAP_RECORDING = 1 << 4; // 16 - /// - /// (Android only) Use this flag to disable all non-native ads & ad networks that don't support native ads. - /// - public const int FLAG_NATIVE_ADS_ONLY = 1 << 5; // 32 - /// /// Use this flag to to mark mediated ads as "child-directed". This value will be passed on to networks that support sending such an option (for purposes of the Children's Online Privacy Protection Act (COPPA)). /// Currently, only AdMob, FAN, and Heyzap Exchange use this option's value. This value will be `OR`ed with the per-network server-side setting we provide on your Mediation Settings dashboard. /// public const int FLAG_CHILD_DIRECTED_ADS = 1 << 6; // 64 #endregion - - public const string DEFAULT_TAG = "default"; #region String constants to expect in Ad Listener & network callbacks // `NetworkCallback` is a bit of a misnomer. The callback constants here are both for "network callbacks" and for ad listener callbacks. We should refactor these into two classes in the next major SDK. @@ -91,8 +78,8 @@ public static class NetworkCallback { public const string FETCH_FAILED = "fetch_failed"; public const string CLICK = "click"; public const string DISMISS = "dismiss"; - public const string INCENTIVIZED_RESULT_COMPLETE = "incentivized_result_complete"; - public const string INCENTIVIZED_RESULT_INCOMPLETE = "incentivized_result_incomplete"; + public const string REWARDED_RESULT_COMPLETE = "rewarded_result_complete"; + public const string REWARDED_RESULT_INCOMPLETE = "rewarded_result_incomplete"; public const string AUDIO_STARTING = "audio_starting"; public const string AUDIO_FINISHED = "audio_finished"; @@ -112,22 +99,18 @@ public static class NetworkCallback { #region Network names public static class Network { - public const string HEYZAP = "heyzap"; - public const string HEYZAP_CROSS_PROMO = "heyzap_cross_promo"; - public const string HEYZAP_EXCHANGE = "heyzap_exchange"; - public const string FACEBOOK = "facebook"; - public const string UNITYADS = "unityads"; - public const string APPLOVIN = "applovin"; - public const string VUNGLE = "vungle"; - public const string CHARTBOOST = "chartboost"; public const string ADCOLONY = "adcolony"; public const string ADMOB = "admob"; - public const string IAD = "iad"; - public const string LEADBOLT = "leadbolt"; + public const string APPLOVIN = "applovin"; + public const string CHARTBOOST = "chartboost"; + public const string FACEBOOK = "facebook"; + public const string HYPRMX = "hyprmx"; public const string INMOBI = "inmobi"; - public const string DOMOB = "domob"; + public const string IRONSOURCE = "iron_source"; public const string MOPUB = "mopub"; - public const string FYBER_EXCHANGE = "fyber_exchange"; + public const string TAPJOY = "tapjoy"; + public const string UNITYADS = "unityads"; + public const string VUNGLE = "vungle"; } #endregion @@ -140,8 +123,10 @@ public static class Network { public static void Start(string publisher_id, int options) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) #if UNITY_ANDROID + HeyzapAdsAndroid.SetPluginVersion(Version); HeyzapAdsAndroid.Start(publisher_id, options); #elif UNITY_IPHONE + HeyzapAdsIOS.SetPluginVersion(Version); HeyzapAdsIOS.Start(publisher_id, options); #endif #else @@ -150,28 +135,10 @@ public static void Start(string publisher_id, int options) { HeyzapAds.InitReceiver(); HZInterstitialAd.InitReceiver(); - HZVideoAd.InitReceiver(); - HZIncentivizedAd.InitReceiver(); + HZRewardedAd.InitReceiver(); HZBannerAd.InitReceiver(); - HZOfferWallAd.InitReceiver(); HZDemographics.InitReceiver(); } - - /// - /// Returns the remote data you've set on the Heyzap Dashboards, which will be a JSON dictionary in string format. - /// - public static string GetRemoteData(){ - #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) - #if UNITY_ANDROID - return HeyzapAdsAndroid.GetRemoteData(); - #elif UNITY_IPHONE - return HeyzapAdsIOS.GetRemoteData(); - #endif - #else - UnityEngine.Debug.LogWarning("Call received to retrieve remote data from the Heyzap SDK, but the SDK does not function in the editor. You must use a device/emulator to use the remote data feature."); - return "{}"; - #endif - } /// /// Sets User's consent under GDPR. Fyber will only be able to show targeted advertising if the user consented. Only call this method if the user explicitly gave or denied consent. @@ -193,7 +160,7 @@ public static void SetGdprConsent(Boolean isGdprConsentGiven) /// /// Sets User's consent data under GDPR. Heyzap SDK will use this information to provide optimal targeted advertising without infringing GDPR. /// - /// xA Dictionary of key-value pairs containing GDPR related information + /// A Dictionary of key-value pairs containing GDPR related information static public void SetGdprConsentData(Dictionary gdprConsentData) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) @@ -240,7 +207,7 @@ static public void ClearGdprConsentData() /// /// Shows the mediation test suite. /// - public static void ShowMediationTestSuite() { + public static void ShowTestSuite() { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) #if UNITY_ANDROID HeyzapAdsAndroid.ShowMediationTestSuite(); @@ -291,28 +258,6 @@ public static Boolean IsNetworkInitialized(string network) { public static void SetNetworkCallbackListener(NetworkCallbackListener listener) { networkCallbackListener = listener; } - - /// - /// Pauses expensive work, like ad fetches, until ResumeExpensiveWork() is called. Note that calling this method will affect ad availability. - /// - public static void PauseExpensiveWork() { - #if UNITY_IPHONE && !UNITY_EDITOR - HeyzapAdsIOS.PauseExpensiveWork(); - #elif UNITY_ANDROID && !UNITY_EDITOR - HeyzapAdsAndroid.PauseExpensiveWork(); - #endif - } - - /// - /// Unpauses expensive work, like ad fetches. Only relevant after a call to PauseExpensiveWork(). - /// - public static void ResumeExpensiveWork() { - #if UNITY_IPHONE && !UNITY_EDITOR - HeyzapAdsIOS.ResumeExpensiveWork(); - #elif UNITY_ANDROID && !UNITY_EDITOR - HeyzapAdsAndroid.ResumeExpensiveWork(); - #endif - } /// /// Enables verbose debug logging for the Heyzap SDK. For third party logging, . @@ -348,7 +293,7 @@ public static void HideDebugLogs() { /// public static void ShowThirdPartyDebugLogs() { #if UNITY_IPHONE && !UNITY_EDITOR - HeyzapAdsIOS.ShowThirdPartyDebugLogs(); + HeyzapAdsIOS.ShowThirdPartyDebugLogs(); #endif } @@ -358,24 +303,7 @@ public static void ShowThirdPartyDebugLogs() { /// public static void HideThirdPartyDebugLogs() { #if UNITY_IPHONE && !UNITY_EDITOR - HeyzapAdsIOS.HideThirdPartyDebugLogs(); - #endif - } - - /// - /// Set the bundle ID (i.e.: `com.name.of.company.and.app`) on Android and iOS to something other than what you have set in the Unity Editor's Player Settings menu. - /// Note: This method MUST be called BEFORE calling `Start` on the SDK. - /// This method is mostly useful for debugging purposes; for instance, you might use this to use a test account & bundle ID on debug builds. - /// - /// The new bundle ID you want to use. This is how we link this app to your dashboard account on developers.heyzap.com . - public static void SetBundleIdentifier(string bundleID) { - #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) - #if UNITY_ANDROID - HeyzapAdsAndroid.SetBundleIdentifier(bundleID); - #elif UNITY_IPHONE - HeyzapAdsIOS.SetBundleIdentifier(bundleID); - #endif - #else + HeyzapAdsIOS.HideThirdPartyDebugLogs(); #endif } @@ -385,7 +313,7 @@ public static void SetBundleIdentifier(string bundleID) { /// The Device ID that FAN prints to the iOS console public static void AddFacebookTestDevice(string device_id) { #if UNITY_IPHONE && !UNITY_EDITOR - HeyzapAdsIOS.AddFacebookTestDevice(device_id); + HeyzapAdsIOS.AddFacebookTestDevice(device_id); #endif } #endregion @@ -402,7 +330,7 @@ protected static void SetNetworkCallback(string network, string callback) { } } - public static void InitReceiver(){ + public static void InitReceiver() { if (_instance == null) { GameObject receiverObject = new GameObject("HeyzapAds"); DontDestroyOnLoad(receiverObject); @@ -410,14 +338,6 @@ public static void InitReceiver(){ } } - public static string TagForString(string tag) { - if (tag == null) { - tag = HeyzapAds.DEFAULT_TAG; - } - - return tag; - } - // Within Unity's .NET framework we don't have a stock solution for converting objets to Json so we need to implement a custom solution static private string GetGdprConsentDataAsJsonString(Dictionary gdprConsentData) { @@ -433,6 +353,8 @@ static private string GetGdprConsentDataAsJsonString(Dictionary #if UNITY_IPHONE && !UNITY_EDITOR public class HeyzapAdsIOS : MonoBehaviour { + [DllImport ("__Internal")] + private static extern void hz_ads_set_plugin_version(string pluginVersion); [DllImport ("__Internal")] private static extern void hz_ads_start_app(string publisher_id, int flags); @@ -440,9 +362,6 @@ public class HeyzapAdsIOS : MonoBehaviour [DllImport ("__Internal")] private static extern void hz_ads_show_mediation_debug_view_controller(); - [DllImport ("__Internal")] - private static extern string hz_ads_get_remote_data(); - [DllImport ("__Internal")] private static extern void hz_ads_set_gdpr_consent(Boolean isGdprConsentGiven); @@ -455,12 +374,6 @@ public class HeyzapAdsIOS : MonoBehaviour [DllImport ("__Internal")] private static extern bool hz_ads_is_network_initialized(string network); - [DllImport ("__Internal")] - private static extern void hz_pause_expensive_work(); - - [DllImport ("__Internal")] - private static extern void hz_resume_expensive_work(); - [DllImport ("__Internal")] private static extern void hz_ads_hide_debug_logs(); @@ -473,12 +386,13 @@ public class HeyzapAdsIOS : MonoBehaviour [DllImport ("__Internal")] private static extern void hz_ads_show_third_party_debug_logs(); - [DllImport ("__Internal")] - private static extern void hz_ads_set_bundle_identifier(string bundleID); - [DllImport ("__Internal")] private static extern void hz_add_facebook_test_device(string device_id); + public static void SetPluginVersion(string pluginVersion) { + hz_ads_set_plugin_version(pluginVersion); + } + public static void Start(string publisher_id, int options=0) { hz_ads_start_app(publisher_id, options); } @@ -495,10 +409,6 @@ public static bool IsNetworkInitialized(string network) { return hz_ads_is_network_initialized(network); } - public static string GetRemoteData(){ - return hz_ads_get_remote_data(); - } - public static void SetGdprConsent(Boolean isGdprConsentGiven) { hz_ads_set_gdpr_consent(isGdprConsentGiven); } @@ -511,14 +421,6 @@ public static void ClearGdprConsentData() { hz_ads_clear_gdpr_consent_data(); } - public static void PauseExpensiveWork() { - hz_pause_expensive_work(); - } - - public static void ResumeExpensiveWork() { - hz_resume_expensive_work(); - } - public static void ShowDebugLogs() { hz_ads_show_debug_logs(); } @@ -535,10 +437,6 @@ public static void HideThirdPartyDebugLogs() { hz_ads_hide_third_party_debug_logs(); } - public static void SetBundleIdentifier(string bundleID) { - hz_ads_set_bundle_identifier(bundleID); - } - public static void AddFacebookTestDevice(string device_id) { hz_add_facebook_test_device(device_id); } @@ -548,6 +446,14 @@ public static void AddFacebookTestDevice(string device_id) { #if UNITY_ANDROID && !UNITY_EDITOR public class HeyzapAdsAndroid : MonoBehaviour { + public static void SetPluginVersion(string pluginVersion) { + if (Application.platform != RuntimePlatform.Android) return; + AndroidJNIHelper.debug = false; + using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { + jc.CallStatic("addCustomParameter", "plugin_version", pluginVersion); + } + } + public static void Start(string publisher_id, int options=0) { if(Application.platform != RuntimePlatform.Android) return; @@ -584,15 +490,6 @@ public static void ShowMediationTestSuite() { } } - public static string GetRemoteData() { - if(Application.platform != RuntimePlatform.Android) return "{}"; - AndroidJNIHelper.debug = false; - - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - return jc.CallStatic("getCustomPublisherData"); - } - } - public static void SetGdprConsent(Boolean isGdprConsentGiven) { if (Application.platform != RuntimePlatform.Android) return; @@ -633,27 +530,6 @@ public static void HideDebugLogs() { jc.CallStatic("hideDebugLogs"); } } - - public static void ResumeExpensiveWork() { - if(Application.platform != RuntimePlatform.Android) return; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("resumeExpensiveWork"); - } - } - - public static void PauseExpensiveWork() { - if(Application.platform != RuntimePlatform.Android) return; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.extensions.unity3d.UnityHelper")) { - jc.CallStatic("pauseExpensiveWork"); - } - } - - public static void SetBundleIdentifier(string bundleID) { - if(Application.platform != RuntimePlatform.Android) return; - using (AndroidJavaClass jc = new AndroidJavaClass("com.heyzap.sdk.ads.HeyzapAds")) { - jc.CallStatic("setBundleId", bundleID); - } - } } #endif #endregion diff --git a/Assets/Scripts/AdManager.cs b/Assets/Scripts/AdManager.cs index b2f84a5e..8b6c39a4 100644 --- a/Assets/Scripts/AdManager.cs +++ b/Assets/Scripts/AdManager.cs @@ -1,40 +1,31 @@ using UnityEngine; using UnityEngine.UI; -using UnityEngine.Assertions.Must; +using UnityEngine.Assertions; using Heyzap; -using System.Collections; using System.Collections.Generic; public class AdManager : MonoBehaviour { [SerializeField] - private Text adTagTextField; + private Text placementTextField; [SerializeField] private GameObject bannerControls; [SerializeField] - private GameObject offerwallControls; - [SerializeField] private GameObject standardControls; [SerializeField] private ScrollingTextArea console; - [SerializeField] - private Toggle offerwallCloseOnFirstClickToggle; - [SerializeField] - private Text offerwallCurrencyIdTextField; private enum AdType { Interstitial, - Video, - Incentivized, - Banner, - Offerwall + Rewarded, + Banner } - private AdType _selectedAdType; + private AdType selectedAdType; private AdType SelectedAdType { - get { return _selectedAdType; } + get { return selectedAdType; } set { - _selectedAdType = value; + selectedAdType = value; this.console.Append("AdType: " + value.ToString()); ShowAdTypeControls(); } @@ -46,12 +37,12 @@ public void UpdateLocation(float latitude, float longitude, float horizAcc, floa //HZDemographics.SetUserLocation(latitude, longitude, horizAcc, vertAcc, alt, timestamp); } - void Awake() { - this.adTagTextField.MustNotBeNull(); - this.bannerControls.MustNotBeNull(); - this.standardControls.MustNotBeNull(); - this.offerwallControls.MustNotBeNull(); - this.console.MustNotBeNull(); + void Awake() + { + Assert.IsNotNull(placementTextField); + Assert.IsNotNull(bannerControls); + Assert.IsNotNull(standardControls); + Assert.IsNotNull(console); } void Start () { @@ -74,8 +65,8 @@ void Start () { HeyzapAds.ShowDebugLogs(); HeyzapAds.Start("ENTER_YOUR_PUBLISHER_ID_HERE", HeyzapAds.FLAG_NO_OPTIONS); - HZBannerAd.SetDisplayListener(delegate(string adState, string adTag) { - this.console.Append("BANNER: " + adState + " Tag : " + adTag); + HZBannerAd.SetDisplayListener(delegate(string adState, string placement) { + this.console.Append("BANNER: " + adState + " Placement : " + placement); if (adState == "loaded") { Rect dimensions = new Rect(); HZBannerAd.GetCurrentBannerDimensions(out dimensions); @@ -83,28 +74,12 @@ void Start () { } }); - HZInterstitialAd.SetDisplayListener(delegate(string adState, string adTag) { - this.console.Append("INTERSTITIAL: " + adState + " Tag : " + adTag); - }); - - HZIncentivizedAd.SetDisplayListener(delegate(string adState, string adTag) { - this.console.Append("INCENTIVIZED: " + adState + " Tag : " + adTag); - }); - - HZVideoAd.SetDisplayListener(delegate(string adState, string adTag) { - this.console.Append("VIDEO: " + adState + " Tag : " + adTag); + HZInterstitialAd.SetDisplayListener(delegate(string adState, string placement) { + this.console.Append("INTERSTITIAL: " + adState + " Placement : " + placement); }); - HZOfferWallAd.SetDisplayListener(delegate(string adState, string adTag) { - this.console.Append("OFFERWALL: " + adState + " Tag : " + adTag); - }); - - HZOfferWallAd.SetVirtualCurrencyResponseListener(delegate(VirtualCurrencyResponse response) { - this.console.Append("OFFERWALL VCS Response: id:" + response.CurrencyID + " name: '" + response.CurrencyName + "' amount : " + response.DeltaOfCurrency + " trans: " + response.LatestTransactionID); - }); - - HZOfferWallAd.SetVirtualCurrencyErrorListener(delegate(string errorMsg) { - this.console.Append("OFFERWALL VCS Error: " + errorMsg); + HZRewardedAd.SetDisplayListener(delegate(string adState, string placement) { + this.console.Append("REWARDED: " + adState + " Placement : " + placement); }); // UI defaults @@ -120,15 +95,9 @@ public void InterstitialSelected(bool selected) { } } - public void VideoSelected(bool selected) { - if (selected) { - this.SelectedAdType = AdType.Video; - } - } - - public void IncentivizedSelected(bool selected) { + public void RewardedSelected(bool selected) { if (selected) { - this.SelectedAdType = AdType.Incentivized; + this.SelectedAdType = AdType.Rewarded; } } @@ -138,92 +107,78 @@ public void BannerSelected(bool selected) { } } - public void OfferwallSelected(bool selected) { - if (selected) { - this.SelectedAdType = AdType.Offerwall; - } - } - public void IsAvailableButton() { - string tag = this.adTag(); + string placementName = this.GetPlacementName(); bool available = false; switch (this.SelectedAdType) { - case AdType.Interstitial: - available = HZInterstitialAd.IsAvailable(tag); - break; - case AdType.Video: - available = HZVideoAd.IsAvailable(tag); - break; - case AdType.Incentivized: - available = HZIncentivizedAd.IsAvailable(tag); - break; - case AdType.Banner: - // Not applicable - break; - case AdType.Offerwall: - available = HZOfferWallAd.IsAvailable(tag); - break; + case AdType.Interstitial: + available = HZInterstitialAd.IsAvailable(placementName); + break; + case AdType.Rewarded: + available = HZRewardedAd.IsAvailable(placementName); + break; + case AdType.Banner: + // Not applicable + break; } string availabilityMessage = available ? "available" : "not available"; - this.console.Append(this.SelectedAdType.ToString() + " with tag: " + tag + " is " + availabilityMessage); + console.Append(this.SelectedAdType.ToString() + " with placement: " + placementName + " is " + availabilityMessage); } public void ShowButton() { - string tag = this.adTag(); - - HZShowOptions showOptions = new HZShowOptions(); - showOptions.Tag = tag; - - HZIncentivizedShowOptions incentivizedOptions = new HZIncentivizedShowOptions(); - incentivizedOptions.Tag = tag; - incentivizedOptions.IncentivizedInfo = "test app incentivized info!"; - - HZBannerShowOptions bannerOptions = new HZBannerShowOptions(); - bannerOptions.Tag = tag; - bannerOptions.Position = this.bannerPosition; - - HZOfferWallShowOptions offerwallOptions = new HZOfferWallShowOptions(); - offerwallOptions.ShouldCloseAfterFirstClick = offerwallCloseOnFirstClickToggle.isOn; - offerwallOptions.Tag = tag; - - this.console.Append("Showing " + this.SelectedAdType.ToString() + " with tag: " + tag); - switch (this.SelectedAdType) { - case AdType.Interstitial: - HZInterstitialAd.ShowWithOptions(showOptions); - break; - case AdType.Video: - HZVideoAd.ShowWithOptions(showOptions); - break; - case AdType.Incentivized: - HZIncentivizedAd.ShowWithOptions(incentivizedOptions); - break; - case AdType.Banner: - HZBannerAd.ShowWithOptions(bannerOptions); - break; - case AdType.Offerwall: - HZOfferWallAd.ShowWithOptions(offerwallOptions); - break; + string placementName = this.GetPlacementName(); + if (placementName == "") { + console.Append("Cannot show without providing a valid placement name"); + } else { + HZShowOptions showOptions = new HZShowOptions + { + Placement = placementName + }; + + HZRewardedShowOptions rewardedOptions = new HZRewardedShowOptions + { + Placement = placementName, + RewardedInfo = "test app rewarded info!" + }; + + HZBannerShowOptions bannerOptions = new HZBannerShowOptions + { + Placement = placementName, + Position = this.bannerPosition + }; + + console.Append("Showing " + this.SelectedAdType.ToString() + " with placement: " + placementName); + switch (this.SelectedAdType) + { + case AdType.Interstitial: + HZInterstitialAd.ShowWithOptions(showOptions); + break; + case AdType.Rewarded: + HZRewardedAd.ShowWithOptions(rewardedOptions); + break; + case AdType.Banner: + HZBannerAd.ShowWithOptions(bannerOptions); + break; + } } } - public void FetchButton() { - string tag = this.adTag(); - this.console.Append("Fetching " + this.SelectedAdType.ToString() + " with tag: " + tag); - switch(this.SelectedAdType) { - case AdType.Interstitial: - HZInterstitialAd.Fetch(tag); - break; - case AdType.Video: - HZVideoAd.Fetch(tag); - break; - case AdType.Incentivized: - HZIncentivizedAd.Fetch(tag); - break; - case AdType.Offerwall: - HZOfferWallAd.Fetch(tag); - break; + public void RequestButton() { + string placementName = this.GetPlacementName(); + if (placementName == "") { + console.Append("Cannot request without providing a valid placement name"); + } else { + console.Append("Requesting " + this.SelectedAdType.ToString() + " with placement : " + placementName); + switch (this.SelectedAdType) { + case AdType.Interstitial: + HZInterstitialAd.Fetch(placementName); + break; + case AdType.Rewarded: + HZRewardedAd.Request(placementName); + break; + } } } @@ -241,10 +196,6 @@ public void DestroyButton() { } } - public void RemoteDataButton() { - this.console.Append("Remote data: " + HeyzapAds.GetRemoteData()); - } - public void DebugLogSwitch(bool on) { if (on) { this.console.Append("Enabling debug logging"); @@ -294,7 +245,6 @@ private void SetGdprData(Dictionary gdprConsentData) private Dictionary GetGdprConsentDataA() { - // return default data a dicitonary var data = new Dictionary(); @@ -306,7 +256,6 @@ private Dictionary GetGdprConsentDataA() private Dictionary GetGdprConsentDataB() { - // return default data a dicitonary var data = new Dictionary(); data["key_B1"] = "value_B1"; @@ -325,46 +274,36 @@ public void BannerPositionBottom(bool selected) { } } - public void VCSRequestButton() { - HZOfferWallAd.RequestDeltaOfCurrency(this.currencyId()); - } - - public void ShowMediationTest() { - this.console.Append("Showing mediation test suite"); - HeyzapAds.ShowMediationTestSuite(); + public void ShowTestSuite() { + this.console.Append("Showing Test Suite"); + HeyzapAds.ShowTestSuite(); } private void ShowAdTypeControls() { if (this.SelectedAdType == AdType.Banner) { this.bannerControls.SetActive(true); this.standardControls.SetActive(false); - this.offerwallControls.SetActive(false); - } else if (this.SelectedAdType == AdType.Offerwall) { - this.bannerControls.SetActive(false); - this.offerwallControls.SetActive(true); - this.standardControls.SetActive(false); } else { this.bannerControls.SetActive(false); - this.offerwallControls.SetActive(false); this.standardControls.SetActive(true); } } - private string adTag() { - string tag = this.adTagTextField.text; - if (tag == null || tag.Trim().Length == 0) { - return "default"; - } else { - return tag; - } - } - - private string currencyId() { - string currencyId = this.offerwallCurrencyIdTextField.text; - if (currencyId == null || tag.Trim().Length == 0) { - return null; + private string GetPlacementName() { + string placementName = this.placementTextField.text; + if (placementName == null || placementName.Trim().Length == 0) { + switch (this.SelectedAdType) + { + case AdType.Interstitial: + return "interstitial"; + case AdType.Rewarded: + return "rewarded"; + case AdType.Banner: + return "banner"; + } + return ""; } else { - return currencyId; + return placementName; } } } diff --git a/Assets/Scripts/ScrollingTextArea.cs b/Assets/Scripts/ScrollingTextArea.cs index 7505e1cf..20266754 100644 --- a/Assets/Scripts/ScrollingTextArea.cs +++ b/Assets/Scripts/ScrollingTextArea.cs @@ -15,7 +15,7 @@ public class ScrollingTextArea : MonoBehaviour { private GUIStyle consoleTextStyle; private GUIStyle consoleBackgroundStyle; void Start () { - consoleBackgroundTexture = new Texture2D(1,1); + consoleBackgroundTexture = new Texture2D(1, 1); for(var i = 0; i < consoleBackgroundTexture.width; i++) { for(var j = 0; j < consoleBackgroundTexture.height; j++) @@ -23,8 +23,10 @@ void Start () { consoleBackgroundTexture.SetPixel(i, j, new Color(0f, 0f, 0f, 0.7f)); } } - consoleTextStyle = new GUIStyle(); - consoleTextStyle.fontSize = 28; + consoleTextStyle = new GUIStyle + { + fontSize = 28 + }; consoleTextStyle.normal.textColor = Color.white; consoleTextStyle.richText = true; consoleBackgroundStyle = new GUIStyle(); diff --git a/Assets/TestScene.unity b/Assets/TestScene.unity index c52dc4d6..98e801c0 100644 Binary files a/Assets/TestScene.unity and b/Assets/TestScene.unity differ diff --git a/Packages/manifest.json b/Packages/manifest.json index 1342d0a7..16819bf7 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,10 +1,11 @@ { "dependencies": { - "com.unity.ads": "2.0.8", - "com.unity.analytics": "2.0.16", - "com.unity.package-manager-ui": "1.9.11", + "com.unity.ads": "2.3.1", + "com.unity.analytics": "3.2.2", + "com.unity.collab-proxy": "1.2.15", + "com.unity.package-manager-ui": "2.0.3", "com.unity.purchasing": "2.0.3", - "com.unity.textmeshpro": "1.2.4", + "com.unity.textmeshpro": "1.3.0", "com.unity.modules.ai": "1.0.0", "com.unity.modules.animation": "1.0.0", "com.unity.modules.assetbundle": "1.0.0", diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index d94561e3..c9e0d496 100644 Binary files a/ProjectSettings/GraphicsSettings.asset and b/ProjectSettings/GraphicsSettings.asset differ diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index d2b73bfc..21b7a028 100644 Binary files a/ProjectSettings/ProjectSettings.asset and b/ProjectSettings/ProjectSettings.asset differ diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 75a11587..1b2cd94c 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2018.2.6f1 +m_EditorVersion: 2018.3.6f1 diff --git a/ProjectSettings/UnityConnectSettings.asset b/ProjectSettings/UnityConnectSettings.asset index a33c1346..51f2389c 100644 Binary files a/ProjectSettings/UnityConnectSettings.asset and b/ProjectSettings/UnityConnectSettings.asset differ diff --git a/ProjectSettings/VFXManager.asset b/ProjectSettings/VFXManager.asset new file mode 100644 index 00000000..99af3a01 Binary files /dev/null and b/ProjectSettings/VFXManager.asset differ