diff --git a/Assets/Plugins/Android/Heyzap/AndroidManifest.xml b/Assets/Plugins/Android/Heyzap/AndroidManifest.xml index 6d2b2cc8..4165f251 100644 --- a/Assets/Plugins/Android/Heyzap/AndroidManifest.xml +++ b/Assets/Plugins/Android/Heyzap/AndroidManifest.xml @@ -1,20 +1,22 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/Assets/Plugins/Heyzap/HZBannerAd.cs b/Assets/Plugins/Heyzap/HZBannerAd.cs index f65f6d9d..21824442 100644 --- a/Assets/Plugins/Heyzap/HZBannerAd.cs +++ b/Assets/Plugins/Heyzap/HZBannerAd.cs @@ -39,7 +39,7 @@ public class HZBannerAd : MonoBehaviour { public delegate void AdDisplayListener(string state, string tag); 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 /// 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/HZIncentivizedAd.cs b/Assets/Plugins/Heyzap/HZIncentivizedAd.cs index 1cc8ed2e..86dab1aa 100644 --- a/Assets/Plugins/Heyzap/HZIncentivizedAd.cs +++ b/Assets/Plugins/Heyzap/HZIncentivizedAd.cs @@ -38,7 +38,7 @@ public class HZIncentivizedAd : MonoBehaviour { public delegate void AdDisplayListener(string state, string tag); private static AdDisplayListener adDisplayListener; - private static HZIncentivizedAd _instance = null; + private static HZIncentivizedAd _instance; //provided since JS can't use default parameters /// @@ -52,8 +52,6 @@ public static void Fetch() { /// /// 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 HZIncentivizedAdAndroid.Fetch(tag); @@ -107,8 +105,6 @@ public static bool IsAvailable() { /// /// 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 HZIncentivizedAdAndroid.IsAvailable(tag); diff --git a/Assets/Plugins/Heyzap/HZInterstitialAd.cs b/Assets/Plugins/Heyzap/HZInterstitialAd.cs index e50c9e58..727eba60 100644 --- a/Assets/Plugins/Heyzap/HZInterstitialAd.cs +++ b/Assets/Plugins/Heyzap/HZInterstitialAd.cs @@ -37,7 +37,7 @@ public class HZInterstitialAd : MonoBehaviour { public delegate void AdDisplayListener(string state, string tag); private static AdDisplayListener adDisplayListener; - private static HZInterstitialAd _instance = null; + private static HZInterstitialAd _instance; //provided since JS can't use default parameters /// @@ -80,8 +80,6 @@ public static void Fetch() { /// /// 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 HZInterstitialAdAndroid.Fetch(tag); @@ -107,8 +105,6 @@ public static bool IsAvailable() { /// /// 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 HZInterstitialAdAndroid.IsAvailable(tag); diff --git a/Assets/Plugins/Heyzap/HZOfferwallAd.cs b/Assets/Plugins/Heyzap/HZOfferwallAd.cs index 5614d855..539531e4 100644 --- a/Assets/Plugins/Heyzap/HZOfferwallAd.cs +++ b/Assets/Plugins/Heyzap/HZOfferwallAd.cs @@ -46,7 +46,7 @@ public class HZOfferWallAd : MonoBehaviour { public delegate void VirtualCurrencyErrorListener(string errorMsg); private static VirtualCurrencyErrorListener virtualCurrencyErrorListener; - private static HZOfferWallAd _instance = null; + private static HZOfferWallAd _instance; //provided since JS can't use default parameters /// @@ -88,8 +88,6 @@ public static void Fetch() { /// /// 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); @@ -115,8 +113,6 @@ public static bool IsAvailable() { /// /// 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); diff --git a/Assets/Plugins/Heyzap/HZShowOptions.cs b/Assets/Plugins/Heyzap/HZShowOptions.cs index 482e90d8..9d9abd78 100644 --- a/Assets/Plugins/Heyzap/HZShowOptions.cs +++ b/Assets/Plugins/Heyzap/HZShowOptions.cs @@ -17,14 +17,10 @@ public string Tag { return tag; } set { - if (value != null) { - tag = value; - } else { - tag = HeyzapAds.DEFAULT_TAG; - } + tag = value; } } - private string tag = HeyzapAds.DEFAULT_TAG; + private string tag; } /// @@ -108,4 +104,4 @@ public bool ShouldCloseAfterFirstClick { } private bool shouldCloseAfterFirstClick = HZOfferWallShowOptions.DEFAULT_SHOULD_CLOSE_AFTER_FIRST_CLICK; } -} \ No newline at end of file +} diff --git a/Assets/Plugins/Heyzap/HZVideoAd.cs b/Assets/Plugins/Heyzap/HZVideoAd.cs index 560c7bbd..8b1d22cf 100644 --- a/Assets/Plugins/Heyzap/HZVideoAd.cs +++ b/Assets/Plugins/Heyzap/HZVideoAd.cs @@ -39,7 +39,7 @@ public class HZVideoAd : MonoBehaviour { public delegate void AdDisplayListener(string state, string tag); private static AdDisplayListener adDisplayListener; - private static HZVideoAd _instance = null; + private static HZVideoAd _instance; //provided since JS can't use default parameters /// @@ -81,8 +81,6 @@ public static void Fetch() { /// /// 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); @@ -108,8 +106,6 @@ public static bool IsAvailable() { /// /// 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); diff --git a/Assets/Plugins/Heyzap/HeyzapAds.cs b/Assets/Plugins/Heyzap/HeyzapAds.cs index c18b07ba..fc458e59 100644 --- a/Assets/Plugins/Heyzap/HeyzapAds.cs +++ b/Assets/Plugins/Heyzap/HeyzapAds.cs @@ -38,7 +38,7 @@ public class HeyzapAds : MonoBehaviour { 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() /// @@ -76,8 +76,6 @@ public class HeyzapAds : MonoBehaviour { /// 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. @@ -300,7 +298,7 @@ public static void HideDebugLogs() { /// public static void ShowThirdPartyDebugLogs() { #if UNITY_IPHONE && !UNITY_EDITOR - HeyzapAdsIOS.ShowThirdPartyDebugLogs(); + HeyzapAdsIOS.ShowThirdPartyDebugLogs(); #endif } @@ -310,7 +308,7 @@ public static void ShowThirdPartyDebugLogs() { /// public static void HideThirdPartyDebugLogs() { #if UNITY_IPHONE && !UNITY_EDITOR - HeyzapAdsIOS.HideThirdPartyDebugLogs(); + HeyzapAdsIOS.HideThirdPartyDebugLogs(); #endif } @@ -337,7 +335,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 @@ -354,21 +352,13 @@ 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); _instance = receiverObject.AddComponent(); } } - - public static string TagForString(string tag) { - if (tag == null) { - tag = HeyzapAds.DEFAULT_TAG; - } - - return tag; - } #endregion } diff --git a/Assets/Scripts/AdManager.cs b/Assets/Scripts/AdManager.cs index 6dfd7d32..f9b5c4ba 100644 --- a/Assets/Scripts/AdManager.cs +++ b/Assets/Scripts/AdManager.cs @@ -1,10 +1,9 @@ using UnityEngine; using UnityEngine.UI; -using UnityEngine.Assertions.Must; using Heyzap; -public class AdManager : MonoBehaviour { - +public class AdManager : MonoBehaviour +{ [SerializeField] private Text adTagTextField; [SerializeField] @@ -18,9 +17,10 @@ public class AdManager : MonoBehaviour { [SerializeField] private Toggle offerwallCloseOnFirstClickToggle; [SerializeField] - private Text offerwallCurrencyIdTextField; + private readonly Text offerwallCurrencyIdTextField; - private enum AdType { + private enum AdType + { Interstitial, Video, Incentivized, @@ -29,32 +29,38 @@ private enum AdType { } private AdType _selectedAdType; - private AdType SelectedAdType { + private AdType SelectedAdType + { get { return _selectedAdType; } - set { + set + { _selectedAdType = value; - this.console.Append("AdType: " + value.ToString()); + console.Append("AdType: " + value.ToString()); ShowAdTypeControls(); } } private string bannerPosition; - public void UpdateLocation(float latitude, float longitude, float horizAcc, float vertAcc, float alt, double timestamp) { + public void UpdateLocation(float latitude, float longitude, float horizAcc, float vertAcc, float alt, double timestamp) + { //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() + { + UnityEngine.Assertions.Assert.IsNotNull(adTagTextField); + UnityEngine.Assertions.Assert.IsNotNull(bannerControls); + UnityEngine.Assertions.Assert.IsNotNull(standardControls); + UnityEngine.Assertions.Assert.IsNotNull(offerwallControls); + UnityEngine.Assertions.Assert.IsNotNull(console); } - void Start () { - HeyzapAds.NetworkCallbackListener networkCallbackListener = delegate(string network, string callback) { - this.console.Append("[" + network + "]: " + callback); + void Start() + { + HeyzapAds.NetworkCallbackListener networkCallbackListener = delegate (string network, string callback) + { + console.Append("[" + network + "]: " + callback); }; // HZDemographics.SetUserGender(HZDemographics.Gender.MALE); @@ -66,128 +72,158 @@ void Start () { // UnityEngine.Debug.Log ("calling loc service"); // TestLocationService locServ = new TestLocationService(); - // locServ.Start(this.console); + // locServ.Start(console); - HeyzapAds.SetNetworkCallbackListener(networkCallbackListener); - HeyzapAds.ShowDebugLogs(); - HeyzapAds.Start("ENTER_YOUR_PUBLISHER_ID_HERE", HeyzapAds.FLAG_NO_OPTIONS); + HeyzapAds.SetNetworkCallbackListener(networkCallbackListener); + 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); - if (adState == "loaded") { + HZBannerAd.SetDisplayListener(delegate (string adState, string adTag) + { + console.Append("BANNER: " + adState + " Tag : " + adTag); + if (adState == "loaded") + { Rect dimensions = new Rect(); HZBannerAd.GetCurrentBannerDimensions(out dimensions); - this.console.Append(string.Format(" (x,y): ({0},{1}) - WxH: {2}x{3}", dimensions.x, dimensions.y, dimensions.width, dimensions.height)); + console.Append(string.Format(" (x,y): ({0},{1}) - WxH: {2}x{3}", dimensions.x, dimensions.y, dimensions.width, dimensions.height)); } }); - HZInterstitialAd.SetDisplayListener(delegate(string adState, string adTag) { - this.console.Append("INTERSTITIAL: " + adState + " Tag : " + adTag); + HZInterstitialAd.SetDisplayListener(delegate (string adState, string adTag) + { + console.Append("INTERSTITIAL: " + adState + " Tag : " + adTag); }); - HZIncentivizedAd.SetDisplayListener(delegate(string adState, string adTag) { - this.console.Append("INCENTIVIZED: " + adState + " Tag : " + adTag); + HZIncentivizedAd.SetDisplayListener(delegate (string adState, string adTag) + { + console.Append("INCENTIVIZED: " + adState + " Tag : " + adTag); }); - HZVideoAd.SetDisplayListener(delegate(string adState, string adTag) { - this.console.Append("VIDEO: " + adState + " Tag : " + adTag); + HZVideoAd.SetDisplayListener(delegate (string adState, string adTag) + { + console.Append("VIDEO: " + adState + " Tag : " + adTag); }); - HZOfferWallAd.SetDisplayListener(delegate(string adState, string adTag) { - this.console.Append("OFFERWALL: " + adState + " Tag : " + adTag); + HZOfferWallAd.SetDisplayListener(delegate (string adState, string adTag) + { + 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.SetVirtualCurrencyResponseListener(delegate (VirtualCurrencyResponse response) + { + 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); + HZOfferWallAd.SetVirtualCurrencyErrorListener(delegate (string errorMsg) + { + console.Append("OFFERWALL VCS Error: " + errorMsg); }); // UI defaults - this.bannerPosition = HZBannerShowOptions.POSITION_TOP; - this.SelectedAdType = AdType.Interstitial; + bannerPosition = HZBannerShowOptions.POSITION_TOP; + SelectedAdType = AdType.Interstitial; - this.ShowAdTypeControls(); + ShowAdTypeControls(); } - public void InterstitialSelected(bool selected) { - if (selected) { - this.SelectedAdType = AdType.Interstitial; + public void InterstitialSelected(bool selected) + { + if (selected) + { + SelectedAdType = AdType.Interstitial; } } - public void VideoSelected(bool selected) { - if (selected) { - this.SelectedAdType = AdType.Video; + public void VideoSelected(bool selected) + { + if (selected) + { + SelectedAdType = AdType.Video; } } - public void IncentivizedSelected(bool selected) { - if (selected) { - this.SelectedAdType = AdType.Incentivized; + public void IncentivizedSelected(bool selected) + { + if (selected) + { + SelectedAdType = AdType.Incentivized; } } - public void BannerSelected(bool selected) { - if (selected) { - this.SelectedAdType = AdType.Banner; + public void BannerSelected(bool selected) + { + if (selected) + { + SelectedAdType = AdType.Banner; } } - public void OfferwallSelected(bool selected) { - if (selected) { - this.SelectedAdType = AdType.Offerwall; + public void OfferwallSelected(bool selected) + { + if (selected) + { + SelectedAdType = AdType.Offerwall; } } - public void IsAvailableButton() { - string tag = this.adTag(); + public void IsAvailableButton() + { + string tagText = adTagTextField.text; 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; + switch (SelectedAdType) + { + case AdType.Interstitial: + available = HZInterstitialAd.IsAvailable(tagText); + break; + case AdType.Video: + available = HZVideoAd.IsAvailable(tagText); + break; + case AdType.Incentivized: + available = HZIncentivizedAd.IsAvailable(tagText); + break; + case AdType.Banner: + // Not applicable + break; + case AdType.Offerwall: + available = HZOfferWallAd.IsAvailable(tagText); + break; } string availabilityMessage = available ? "available" : "not available"; - this.console.Append(this.SelectedAdType.ToString() + " with tag: " + tag + " is " + availabilityMessage); + console.Append(SelectedAdType.ToString() + " with tag: " + tagText + " is " + availabilityMessage); } - public void ShowButton() { - string tag = this.adTag(); + public void ShowButton() + { + string tagText = adTagTextField.text; - HZShowOptions showOptions = new HZShowOptions(); - showOptions.Tag = tag; + HZShowOptions showOptions = new HZShowOptions + { + Tag = tagText + }; - HZIncentivizedShowOptions incentivizedOptions = new HZIncentivizedShowOptions(); - incentivizedOptions.Tag = tag; - incentivizedOptions.IncentivizedInfo = "test app incentivized info!"; + HZIncentivizedShowOptions incentivizedOptions = new HZIncentivizedShowOptions + { + Tag = tagText, + IncentivizedInfo = "test app incentivized info!" + }; - HZBannerShowOptions bannerOptions = new HZBannerShowOptions(); - bannerOptions.Tag = tag; - bannerOptions.Position = this.bannerPosition; + HZBannerShowOptions bannerOptions = new HZBannerShowOptions + { + Tag = tagText, + Position = bannerPosition + }; - HZOfferWallShowOptions offerwallOptions = new HZOfferWallShowOptions(); - offerwallOptions.ShouldCloseAfterFirstClick = offerwallCloseOnFirstClickToggle.isOn; - offerwallOptions.Tag = tag; + HZOfferWallShowOptions offerwallOptions = new HZOfferWallShowOptions + { + ShouldCloseAfterFirstClick = offerwallCloseOnFirstClickToggle.isOn + Tag = tag + }; - this.console.Append("Showing " + this.SelectedAdType.ToString() + " with tag: " + tag); - switch (this.SelectedAdType) { + console.Append("Showing " + SelectedAdType.ToString() + " with tag: " + tagText); + switch (SelectedAdType) + { case AdType.Interstitial: HZInterstitialAd.ShowWithOptions(showOptions); break; @@ -206,117 +242,132 @@ public void ShowButton() { } } - public void FetchButton() { - string tag = this.adTag(); - this.console.Append("Fetching " + this.SelectedAdType.ToString() + " with tag: " + tag); - switch(this.SelectedAdType) { + public void FetchButton() + { + string tagText = adTagTextField.text; + console.Append("Fetching " + SelectedAdType.ToString() + " with tag: " + tagText); + switch (SelectedAdType) + { case AdType.Interstitial: - HZInterstitialAd.Fetch(tag); + HZInterstitialAd.Fetch(tagText); break; case AdType.Video: - HZVideoAd.Fetch(tag); + HZVideoAd.Fetch(tagText); break; case AdType.Incentivized: - HZIncentivizedAd.Fetch(tag); + HZIncentivizedAd.Fetch(tagText); break; case AdType.Offerwall: - HZOfferWallAd.Fetch(tag); + HZOfferWallAd.Fetch(tagText); break; } } - public void HideButton() { - if (this.SelectedAdType == AdType.Banner) { - this.console.Append("Hiding Banner"); + public void HideButton() + { + if (SelectedAdType == AdType.Banner) + { + console.Append("Hiding Banner"); HZBannerAd.Hide(); } } - public void DestroyButton() { - if (this.SelectedAdType == AdType.Banner) { - this.console.Append("Destroying Banner"); + public void DestroyButton() + { + if (SelectedAdType == AdType.Banner) + { + console.Append("Destroying Banner"); HZBannerAd.Destroy(); } } - public void RemoteDataButton() { - this.console.Append("Remote data: " + HeyzapAds.GetRemoteData()); + public void RemoteDataButton() + { + console.Append("Remote data: " + HeyzapAds.GetRemoteData()); } - public void DebugLogSwitch(bool on) { - if (on) { - this.console.Append("Enabling debug logging"); + public void DebugLogSwitch(bool on) + { + if (on) + { + console.Append("Enabling debug logging"); HeyzapAds.ShowDebugLogs(); - } else { - this.console.Append("Disabling debug logging"); + } + else + { + console.Append("Disabling debug logging"); HeyzapAds.HideDebugLogs(); } - } + } public void AcceptGdprButton() - { - this.console.Append("Accepting GDPR"); - HeyzapAds.SetGdprConsent(true); - } + { + console.Append("Accepting GDPR"); + HeyzapAds.SetGdprConsent(true); + } public void RejectGdprButton() { - this.console.Append("Rejecting GDPR"); + console.Append("Rejecting GDPR"); HeyzapAds.SetGdprConsent(false); } - public void BannerPositionTop(bool selected) { - if (selected) { - this.bannerPosition = HZBannerShowOptions.POSITION_TOP; + public void BannerPositionTop(bool selected) + { + if (selected) + { + bannerPosition = HZBannerShowOptions.POSITION_TOP; } } - public void BannerPositionBottom(bool selected) { - if (selected) { - this.bannerPosition = HZBannerShowOptions.POSITION_BOTTOM; + public void BannerPositionBottom(bool selected) + { + if (selected) + { + bannerPosition = HZBannerShowOptions.POSITION_BOTTOM; } } - public void VCSRequestButton() { - HZOfferWallAd.RequestDeltaOfCurrency(this.currencyId()); + public void VCSRequestButton() + { + HZOfferWallAd.RequestDeltaOfCurrency(CurrencyId()); } - public void ShowMediationTest() { - this.console.Append("Showing mediation test suite"); + public void ShowMediationTest() + { + console.Append("Showing mediation test suite"); HeyzapAds.ShowMediationTestSuite(); } - 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 void ShowAdTypeControls() + { + if (SelectedAdType == AdType.Banner) + { + bannerControls.SetActive(true); + standardControls.SetActive(false); + offerwallControls.SetActive(false); } - } - - private string adTag() { - string tag = this.adTagTextField.text; - if (tag == null || tag.Trim().Length == 0) { - return "default"; - } else { - return tag; + else if (SelectedAdType == AdType.Offerwall) + { + bannerControls.SetActive(false); + offerwallControls.SetActive(true); + standardControls.SetActive(false); + } + else + { + bannerControls.SetActive(false); + offerwallControls.SetActive(false); + standardControls.SetActive(true); } } - private string currencyId() { - string currencyId = this.offerwallCurrencyIdTextField.text; - if (currencyId == null || tag.Trim().Length == 0) { + private string CurrencyId() + { + string currencyId = offerwallCurrencyIdTextField.text; + if (currencyId == null || tag.Trim().Length == 0) + { return null; - } else { - return currencyId; } + return currencyId; } } diff --git a/Assets/Scripts/ScrollingTextArea.cs b/Assets/Scripts/ScrollingTextArea.cs index 7505e1cf..5fcb120f 100644 --- a/Assets/Scripts/ScrollingTextArea.cs +++ b/Assets/Scripts/ScrollingTextArea.cs @@ -1,8 +1,7 @@ using UnityEngine; -using System.Collections; -using UnityEngine.UI; -public class ScrollingTextArea : MonoBehaviour { +public class ScrollingTextArea : MonoBehaviour +{ public Vector2 scrollPosition; private string text = ""; @@ -14,24 +13,29 @@ public class ScrollingTextArea : MonoBehaviour { private Texture2D consoleBackgroundTexture; private GUIStyle consoleTextStyle; private GUIStyle consoleBackgroundStyle; - void Start () { - consoleBackgroundTexture = new Texture2D(1,1); - for(var i = 0; i < consoleBackgroundTexture.width; i++) + + void Start() + { + consoleBackgroundTexture = new Texture2D(1, 1); + for (var i = 0; i < consoleBackgroundTexture.width; i++) { - for(var j = 0; j < consoleBackgroundTexture.height; j++) + for (var j = 0; j < consoleBackgroundTexture.height; j++) { 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(); consoleBackgroundStyle.normal.background = consoleBackgroundTexture; } - void OnGUI() { + void OnGUI() + { GUI.skin.verticalScrollbar.fixedWidth = Screen.width * 0.05f; GUI.skin.verticalScrollbarThumb.fixedWidth = Screen.width * 0.05f; @@ -39,15 +43,16 @@ void OnGUI() { GUI.skin.horizontalScrollbarThumb.fixedHeight = Screen.width * 0.035f; - GUI.BeginGroup(new Rect (xPadding, Screen.height - height - yPadding, Screen.width-xPadding*2, height), consoleBackgroundStyle); - scrollPosition = GUILayout.BeginScrollView(scrollPosition, false/*horizontal scroll bar*/, true/*vertical scroll bar*/, GUILayout.Width(Screen.width-xPadding*2), GUILayout.Height(height)); + GUI.BeginGroup(new Rect(xPadding, Screen.height - height - yPadding, Screen.width - xPadding * 2, height), consoleBackgroundStyle); + scrollPosition = GUILayout.BeginScrollView(scrollPosition, false/*horizontal scroll bar*/, true/*vertical scroll bar*/, GUILayout.Width(Screen.width - xPadding * 2), GUILayout.Height(height)); GUILayout.Label(text, consoleTextStyle); GUILayout.EndScrollView(); - + GUI.EndGroup(); } - public void Append(string append, bool newline=true) { + public void Append(string append, bool newline = true) + { if (newline && this.text.Length > 0) this.text += "\n"; this.text += "[" + System.DateTime.UtcNow.ToString("HH:mm:ss") + "] "; diff --git a/Assets/Scripts/TestLocationService.cs b/Assets/Scripts/TestLocationService.cs index 8c6078fe..82ca06fe 100644 --- a/Assets/Scripts/TestLocationService.cs +++ b/Assets/Scripts/TestLocationService.cs @@ -1,19 +1,17 @@ using UnityEngine; -using UnityEngine.UI; using System.Collections; -using Heyzap; public class TestLocationService : MonoBehaviour { [SerializeField] - private ScrollingTextArea console; + private readonly ScrollingTextArea console; [SerializeField] - private AdManager adManager; + private readonly AdManager adManager; public IEnumerator Start() { - UnityEngine.Debug.Log ("location service start"); + UnityEngine.Debug.Log("location service start"); // First, check if user has location service enabled // if (!Input.location.isEnabledByUser){ // console.Append("Location disabled by user... quitting"); diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 257173ed..a903310a 100644 Binary files a/ProjectSettings/GraphicsSettings.asset and b/ProjectSettings/GraphicsSettings.asset differ diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 42a312fd..659666f4 100644 Binary files a/ProjectSettings/ProjectSettings.asset and b/ProjectSettings/ProjectSettings.asset differ