com.azerion.bluestack 3.0.3 → 3.1.0-preview2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/Editor/Android/AndroidBuildPostProcess.cs +0 -1
  2. package/Editor/Android/AndroidDependency.cs +1 -2
  3. package/Editor/Android/AndroidDependencyModifier.cs +55 -0
  4. package/Editor/Android/AndroidDependencyModifier.cs.meta +3 -0
  5. package/Editor/Android/AndroidDependencyParser.cs +26 -1
  6. package/Editor/Android/ManifestProcessor.cs +2 -1
  7. package/Editor/Azerion.BlueStack.Editor.asmdef +14 -14
  8. package/Editor/BlueStackDependencies.xml +1 -1
  9. package/Editor/BlueStackMediationDependencies.xml +11 -0
  10. package/Editor/BlueStackMediationDependencies.xml.meta +7 -0
  11. package/Editor/BlueStackSettings.cs +21 -18
  12. package/Editor/BlueStackSettingsEditor.cs +64 -1
  13. package/Editor/DebugHelper.cs +2 -2
  14. package/Editor/Dependency.cs +1 -1
  15. package/Editor/DependencyProvider.cs +213 -2
  16. package/Editor/IDependencyModifier.cs +12 -0
  17. package/Editor/IDependencyModifier.cs.meta +11 -0
  18. package/Editor/IDependencyParser.cs +1 -0
  19. package/Editor/MediationNetworkDependency.cs +34 -0
  20. package/Editor/MediationNetworkDependency.cs.meta +3 -0
  21. package/Editor/iOS/IOSDependency.cs +12 -0
  22. package/Editor/iOS/IOSDependency.cs.meta +11 -0
  23. package/Editor/iOS/IOSDependencyModifier.cs +105 -0
  24. package/Editor/iOS/IOSDependencyModifier.cs.meta +3 -0
  25. package/Editor/iOS/IOSDependencyParser.cs +32 -0
  26. package/Editor/iOS/PodDependency/PodDependencyUtils.cs +5 -1
  27. package/Example/Azerion.BlueStack.Example.asmdef +14 -14
  28. package/Example/Scripts/NativeAdManager.cs +5 -7
  29. package/Example/Scripts/SmallNativeAdManager.cs +4 -6
  30. package/README.md +4 -1
  31. package/Runtime/API/AdSize.cs +2 -2
  32. package/Runtime/API/Banner/BannerAd.cs +1 -1
  33. package/Runtime/API/BlueStackAds.cs +7 -3
  34. package/Runtime/API/InterstitialAd.cs +20 -5
  35. package/Runtime/API/NativeAd/NativeAd.cs +20 -26
  36. package/Runtime/API/NativeAd/NativeAdEventArgs.cs +1 -5
  37. package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +176 -173
  38. package/Runtime/API/NativeAd/NativeAdLoader.cs +10 -14
  39. package/Runtime/API/NativeAd/NativeAdObject.cs +563 -547
  40. package/Runtime/API/NativeAd/NativeAdType.cs +6 -6
  41. package/Runtime/API/NativeAd/NativeAssetInfo.cs +28 -28
  42. package/Runtime/Azerion.BlueStack.asmdef +14 -14
  43. package/Runtime/Common/NativeAd/AdLoaderClientArgs.cs +8 -8
  44. package/Runtime/Common/NativeAd/AdsEventExecutor.cs +69 -68
  45. package/Runtime/Common/NativeAd/DummyNativeClient.cs +52 -52
  46. package/Runtime/Common/NativeAd/NativeClientEventArgs.cs +5 -5
  47. package/Runtime/Common/NativeAd/NativeUtils.cs +111 -107
  48. package/Runtime/Internal/IBannerAdClient.cs +1 -1
  49. package/Runtime/Internal/IBlueStackClient.cs +2 -1
  50. package/Runtime/Internal/NativeAd/IAdLoaderClient.cs +12 -12
  51. package/Runtime/Internal/NativeAd/INativeAdClient.cs +1 -1
  52. package/Runtime/Internal/NativeAd/INativeClientFactory.cs +5 -5
  53. package/Runtime/Platforms/Android/BlueStackClient.cs +2 -1
  54. package/Runtime/Platforms/Android/BlueStackNativeClassNames.cs +2 -1
  55. package/Runtime/Platforms/Unity/AdvertisementManager.cs +5 -4
  56. package/Runtime/Platforms/Unity/BannerAdClient.cs +16 -9
  57. package/Runtime/Platforms/Unity/BaseAdClient.cs +7 -5
  58. package/Runtime/Platforms/Unity/BlueStackClient.cs +4 -3
  59. package/Runtime/Platforms/Unity/ClientsFactory.cs +0 -1
  60. package/Runtime/Platforms/Unity/InitializationStatusClient.cs +1 -0
  61. package/Runtime/Platforms/Unity/InterstitialAdClient.cs +12 -6
  62. package/Runtime/Platforms/Unity/NativeAdClient.cs +16 -10
  63. package/Runtime/Platforms/Unity/RewardedVideoAdClient.cs +9 -3
  64. package/Runtime/Platforms/Unity/Utils.cs +7 -3
  65. package/Runtime/Platforms/iOS/BannerAdClient.cs +33 -24
  66. package/Runtime/Platforms/iOS/BlueStackClient.cs +14 -10
  67. package/Runtime/Platforms/iOS/ClientsFactory.cs +0 -2
  68. package/Runtime/Platforms/iOS/Externs.cs +72 -65
  69. package/Runtime/Platforms/iOS/InitializationStatusClient.cs +6 -5
  70. package/Runtime/Platforms/iOS/InterstitialAdClient.cs +27 -21
  71. package/Runtime/Platforms/iOS/NativeAdClient.cs +27 -22
  72. package/Runtime/Platforms/iOS/PreferenceClient.cs +1 -1
  73. package/Runtime/Platforms/iOS/RewardedVideoAdClient.cs +27 -20
  74. package/Runtime/Platforms/iOS/Utils.cs +6 -3
  75. package/Runtime/Utilities/MiniJSON.cs +12 -12
  76. package/package.json +1 -1
  77. package/Editor/iOS/Dependency.cs +0 -0
  78. package/Editor/iOS/Dependency.cs.meta +0 -3
@@ -4,21 +4,21 @@ using Azerion.BlueStack.Common;
4
4
 
5
5
  namespace Azerion.BlueStack.Internal
6
6
  {
7
- public interface IAdLoaderClient
8
- {
9
- event EventHandler<BlueStackError> OnAdFailedToLoad;
7
+ public interface IAdLoaderClient
8
+ {
9
+ event EventHandler<BlueStackError> OnAdFailedToLoad;
10
10
 
11
- event EventHandler<NativeClientEventArgs> OnNativeAdLoaded; //NativeClientEventArgs
11
+ event EventHandler<NativeClientEventArgs> OnNativeAdLoaded; //NativeClientEventArgs
12
12
 
13
- event EventHandler<EventArgs> OnNativeAdImpression;
13
+ event EventHandler<EventArgs> OnNativeAdImpression;
14
14
 
15
- event EventHandler<EventArgs> OnNativeAdClicked;
15
+ event EventHandler<EventArgs> OnNativeAdClicked;
16
16
 
17
- event EventHandler<EventArgs> OnNativeAdOpening;
17
+ event EventHandler<EventArgs> OnNativeAdOpening;
18
18
 
19
- event EventHandler<EventArgs> OnNativeAdClosed;
19
+ event EventHandler<EventArgs> OnNativeAdClosed;
20
20
 
21
- // void LoadAd(AdRequest request);
22
- void LoadAd();
23
- }
24
- }
21
+ // void LoadAd(AdRequest request);
22
+ void LoadAd();
23
+ }
24
+ }
@@ -12,7 +12,7 @@ namespace Azerion.BlueStack.Internal
12
12
  event EventHandler<EventArgs> OnNativeAdClicked;
13
13
  event EventHandler<EventArgs> OnNativeAdOpening;
14
14
  event EventHandler<EventArgs> OnNativeAdClosed;
15
-
15
+
16
16
  void Create(string placementId);
17
17
  void Load();
18
18
  void Load(IPreferenceClient iPreferenceClient);
@@ -2,8 +2,8 @@ using Azerion.BlueStack.Common;
2
2
 
3
3
  namespace Azerion.BlueStack.Internal
4
4
  {
5
- public interface INativeClientFactory
6
- {
7
- IAdLoaderClient BuildAdLoaderClient(AdLoaderClientArgs args);
8
- }
9
- }
5
+ public interface INativeClientFactory
6
+ {
7
+ IAdLoaderClient BuildAdLoaderClient(AdLoaderClientArgs args);
8
+ }
9
+ }
@@ -23,7 +23,8 @@ namespace Azerion.BlueStack.Platforms.Android
23
23
  var status = new SDKInitializationStatus(true, "BlueStack is successfully initialized");
24
24
 
25
25
  // Set pref as cross platform client
26
- var crossPlatformClientSetup = AndroidJavaObjectFactory.Instance.CreateCrossPlatformClientSetupAndroidJavaObject();
26
+ var crossPlatformClientSetup =
27
+ AndroidJavaObjectFactory.Instance.CreateCrossPlatformClientSetupAndroidJavaObject();
27
28
  crossPlatformClientSetup.Call("setPlatformPref");
28
29
 
29
30
  sdkInitCompleteAction?.Invoke(status);
@@ -23,7 +23,8 @@ namespace Azerion.BlueStack.Platforms.Android
23
23
  public const string UnityRewardedAdListener = "com.azerion.bluestack.unity.rewarded.UnityRewardedAdListener";
24
24
 
25
25
  public const string UnityInterstitialAd = "com.azerion.bluestack.unity.interstitial.UnityInterstitialAd";
26
- public const string UnityInterstitialAdListener = "com.azerion.bluestack.unity.interstitial.UnityInterstitialAdListener";
26
+ public const string UnityInterstitialAdListener =
27
+ "com.azerion.bluestack.unity.interstitial.UnityInterstitialAdListener";
27
28
 
28
29
  public const string UnityBannerAdClassName = "com.azerion.bluestack.unity.banner.UnityBannerAd";
29
30
  public const string UnityBannerAdListenerClassName = "com.azerion.bluestack.unity.banner.UnityBannerAdListener";
@@ -49,7 +49,7 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
49
49
  return;
50
50
  #else
51
51
  AdBannerOverlay =
52
- (GameObject) Instantiate(
52
+ (GameObject)Instantiate(
53
53
  AssetDatabase.LoadAssetAtPath<GameObject>(
54
54
  _assetsDirPrefix + "/AdBannerOverlay.prefab"));
55
55
  #endif
@@ -93,7 +93,7 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
93
93
  Debug.LogWarning("BlueStack doesn't support WegGL or PC ads at the moment.");
94
94
  return;
95
95
  #else
96
- AdOverlay = (GameObject) Instantiate(
96
+ AdOverlay = (GameObject)Instantiate(
97
97
  AssetDatabase.LoadAssetAtPath<GameObject>(_assetsDirPrefix + "/AdOverlay.prefab"));
98
98
  #endif
99
99
  AdOverlay.SetActive(true);
@@ -101,14 +101,14 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
101
101
  adType = "InterstitialAd";
102
102
  adInfoText = provider + " " + adType + " is playing!";
103
103
  }
104
-
104
+
105
105
  public static void ShowRewardedAd()
106
106
  {
107
107
  #if UNITY_WEBGL || UNITY_STANDALONE
108
108
  Debug.LogWarning("AzerionAds doesn't support WegGL or PC ads at the moment.");
109
109
  return;
110
110
  #else
111
- AdOverlay = (GameObject) Instantiate(
111
+ AdOverlay = (GameObject)Instantiate(
112
112
  AssetDatabase.LoadAssetAtPath<GameObject>(_assetsDirPrefix + "/AdOverlay.prefab"));
113
113
  #endif
114
114
  AdOverlay.SetActive(true);
@@ -125,6 +125,7 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
125
125
  var rewardItem = new RewardedItem(10);
126
126
  OnUserRewardEarned?.Invoke(this, rewardItem);
127
127
  }
128
+
128
129
  provider = null;
129
130
  adType = null;
130
131
  Destroy(gameObject);
@@ -17,28 +17,35 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
17
17
 
18
18
  // Fires when the banner ad is loaded
19
19
  public event EventHandler<EventArgs> OnBannerDidLoad;
20
+
20
21
  // Fires when the banner ad has failed to load
21
22
  public event EventHandler<BlueStackError> OnBannerDidFailed;
23
+
22
24
  // Fires when the banner ad is clicked
23
25
  public event EventHandler<EventArgs> OnAdClicked;
26
+
24
27
  // Fires when the banner ad is refreshed
25
28
  public event EventHandler<EventArgs> OnBannerDidRefresh;
29
+
26
30
  // Fires when the banner ad has failed to refresh
27
31
  public event EventHandler<BlueStackError> OnBannerDidFailToRefresh;
32
+
28
33
  // Fires when the banner ad has been hidden
29
34
  public event EventHandler<EventArgs> OnBannerHide;
35
+
30
36
  // Fires when the banner ad is displayed
31
37
  public event EventHandler<EventArgs> OnBannerDisplay;
32
38
 
33
39
  private static readonly string _adPrefabsDir = "Packages/com.azerion.bluestack/Resources/AdPrefabs/";
40
+
34
41
  private Dictionary<AdSize, string> _prefabAds = new Dictionary<AdSize, string>()
35
42
  {
36
- {AdSize.Banner, _adPrefabsDir + "Banners/Banner.prefab"},
37
- {AdSize.DynamicBanner, _adPrefabsDir + "Banners/DynamicBanner.prefab"},
38
- {AdSize.MediumRectangle, _adPrefabsDir + "Banners/MediumRectangle.prefab"},
39
- {AdSize.FullBanner, _adPrefabsDir + "Banners/FullBanner.prefab"},
40
- {AdSize.Leaderboard, _adPrefabsDir + "Banners/Leaderboard.prefab"},
41
- {AdSize.LargeBanner, _adPrefabsDir + "Banners/LargeBanner.prefab"},
43
+ { AdSize.Banner, _adPrefabsDir + "Banners/Banner.prefab" },
44
+ { AdSize.DynamicBanner, _adPrefabsDir + "Banners/DynamicBanner.prefab" },
45
+ { AdSize.MediumRectangle, _adPrefabsDir + "Banners/MediumRectangle.prefab" },
46
+ { AdSize.FullBanner, _adPrefabsDir + "Banners/FullBanner.prefab" },
47
+ { AdSize.Leaderboard, _adPrefabsDir + "Banners/Leaderboard.prefab" },
48
+ { AdSize.LargeBanner, _adPrefabsDir + "Banners/LargeBanner.prefab" },
42
49
  };
43
50
 
44
51
  // Creates a banner with a custom position.
@@ -55,7 +62,7 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
55
62
  this._adSize = adSize;
56
63
 
57
64
  LoadAndSetAdPrefab(_prefabAds[adSize]);
58
-
65
+
59
66
  if (adPrefab != null)
60
67
  {
61
68
  if (adSize == AdSize.DynamicBanner)
@@ -73,7 +80,6 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
73
80
  {
74
81
  OnBannerDidFailed?.Invoke(this, new BlueStackError(-1, "Ad could not be loaded"));
75
82
  }
76
-
77
83
  }
78
84
 
79
85
  // Loads a banner with preference. NOT implemented for the editor
@@ -195,7 +201,8 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
195
201
  {
196
202
  Image myImage = dummyAd.GetComponentInChildren<Image>();
197
203
  Button button = myImage.GetComponentInChildren<Button>();
198
- button.onClick.AddListener(() => {
204
+ button.onClick.AddListener(() =>
205
+ {
199
206
  OnAdClicked?.Invoke(this, EventArgs.Empty);
200
207
  AdBehaviour.OpenURL();
201
208
  });
@@ -11,24 +11,26 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
11
11
  protected static AdBehaviour AdBehaviour = new GameObject("AdBehaviour").AddComponent<AdBehaviour>();
12
12
 
13
13
  protected GameObject adPrefab, dummyAd = null;
14
- public void LoadAndSetAdPrefab(string prefabName) {
15
14
 
15
+ public void LoadAndSetAdPrefab(string prefabName)
16
+ {
16
17
  #if UNITY_WEBGL || UNITY_STANDALONE
17
18
  Debug.LogWarning("BlueStack doesn't support WegGL or PC ads at the moment.");
18
19
  return;
19
20
  #else
20
21
  adPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(prefabName);
21
22
  #endif
22
- if (adPrefab == null) {
23
- Debug.Log ("No Prefab found: " + prefabName);
23
+ if (adPrefab == null)
24
+ {
25
+ Debug.Log("No Prefab found: " + prefabName);
24
26
  }
25
27
  }
26
28
 
27
- public RectTransform getRectTransform(GameObject prefabAd) {
29
+ public RectTransform getRectTransform(GameObject prefabAd)
30
+ {
28
31
  Image myImage = prefabAd.GetComponentInChildren<Image>();
29
32
  return myImage.GetComponent<RectTransform>();
30
33
  }
31
-
32
34
  }
33
35
  }
34
36
  #endif
@@ -8,11 +8,12 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
8
8
  {
9
9
  public class BlueStackClient : IBlueStackClient
10
10
  {
11
- public static BlueStackClient Instance { get; } = new BlueStackClient();
11
+ public static BlueStackClient Instance { get; } = new BlueStackClient();
12
12
 
13
- public void Initialize(string appId, Settings settings, Action<SDKInitializationStatus> sdkInitCompleteAction, Action<IInitializationStatusClient> adaptersInitCompleteAction)
13
+ public void Initialize(string appId, Settings settings, Action<SDKInitializationStatus> sdkInitCompleteAction,
14
+ Action<IInitializationStatusClient> adaptersInitCompleteAction)
14
15
  {
15
- var status = new SDKInitializationStatus(true, "BlueStack Unity is successfully initialized");
16
+ var status = new SDKInitializationStatus(true, "BlueStack Unity is successfully initialized");
16
17
  sdkInitCompleteAction?.Invoke(status);
17
18
  }
18
19
  }
@@ -34,7 +34,6 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
34
34
  {
35
35
  return new PreferenceClient();
36
36
  }
37
-
38
37
  }
39
38
  }
40
39
  #endif
@@ -13,6 +13,7 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
13
13
  {
14
14
  this.adapterStatusMap = adapterStatusMap;
15
15
  }
16
+
16
17
  public Dictionary<string, AdapterStatus> GetAdapterStatusMap()
17
18
  {
18
19
  return adapterStatusMap;
@@ -8,18 +8,22 @@ using UnityEngine.UI;
8
8
 
9
9
  namespace Azerion.BlueStack.Platforms.UnityEditor
10
10
  {
11
- public class InterstitialAdClient: BaseAdClient, IInterstitialAdClient, IDisposable
11
+ public class InterstitialAdClient : BaseAdClient, IInterstitialAdClient, IDisposable
12
12
  {
13
13
  private string _placementId;
14
14
 
15
15
  // Fires when the Interstitial ad is loaded
16
16
  public event EventHandler<EventArgs> OnInterstitialDidLoaded;
17
+
17
18
  // Fires when the Interstitial ad has failed to load
18
19
  public event EventHandler<BlueStackError> OnInterstitialDidFail;
20
+
19
21
  // Fires when the Interstitial ad is clicked
20
22
  public event EventHandler<EventArgs> OnInterstitialClicked;
23
+
21
24
  // Fires when the Interstitial ad is closed
22
25
  public event EventHandler<EventArgs> OnInterstitialDisappear;
26
+
23
27
  // Fires when the Interstitial ad is shown
24
28
  public event EventHandler<EventArgs> OnInterstitialDidShown;
25
29
 
@@ -28,7 +32,8 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
28
32
  private static readonly AdSize _interstitialLandscape = new AdSize(1024, 768, "1024x768");
29
33
  private static readonly string _adPrefabsDir = "Packages/com.azerion.bluestack/Resources/AdPrefabs/";
30
34
 
31
- private Dictionary<AdSize, string> _prefabAds = new Dictionary<AdSize, string>() {
35
+ private Dictionary<AdSize, string> _prefabAds = new Dictionary<AdSize, string>()
36
+ {
32
37
  { _interstitialPortrait, _adPrefabsDir + "Interstitial/InterstitialPortrait.prefab" },
33
38
  { _interstitialLandscape, _adPrefabsDir + "Interstitial/InterstitialLandscape.prefab" }
34
39
  };
@@ -53,7 +58,7 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
53
58
 
54
59
  if (adPrefab != null)
55
60
  {
56
- OnInterstitialDidLoaded?.Invoke(this, EventArgs.Empty);
61
+ OnInterstitialDidLoaded?.Invoke(this, EventArgs.Empty);
57
62
  }
58
63
  else
59
64
  {
@@ -75,7 +80,7 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
75
80
  dummyAd = AdBehaviour.ShowAd(adPrefab, new Vector3(0, 0, 1));
76
81
  AddClickBehavior(dummyAd);
77
82
  AdBehaviour.PauseGame();
78
- OnInterstitialDidShown?.Invoke(this, EventArgs.Empty);
83
+ OnInterstitialDidShown?.Invoke(this, EventArgs.Empty);
79
84
  }
80
85
  else
81
86
  {
@@ -102,8 +107,9 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
102
107
  Button[] buttons = dummyAd.GetComponentsInChildren<Button>();
103
108
  Button adButton = buttons[0];
104
109
  Button closeButton = buttons[1];
105
-
106
- adButton.onClick.AddListener(() => {
110
+
111
+ adButton.onClick.AddListener(() =>
112
+ {
107
113
  AdBehaviour.OpenURL();
108
114
  OnInterstitialClicked?.Invoke(this, EventArgs.Empty);
109
115
  });
@@ -8,23 +8,28 @@ using UnityEngine.UI;
8
8
 
9
9
  namespace Azerion.BlueStack.Platforms.UnityEditor
10
10
  {
11
- public class NativeAdClient: BaseAdClient, INativeAdClient, IDisposable
11
+ public class NativeAdClient : BaseAdClient, INativeAdClient, IDisposable
12
12
  {
13
13
  private string _placementId;
14
14
 
15
15
  // Fires when the Native ad is loaded
16
16
  public event EventHandler<EventArgs> OnNativeAdDidLoad;
17
+
17
18
  // Fires when the Native ad has failed to load
18
19
  public event EventHandler<BlueStackError> OnNativeAdDidFail;
20
+
19
21
  // Fires when the Native ad records impression
20
22
  public event EventHandler<EventArgs> OnNativeAdImpression;
23
+
21
24
  // Fires when the Native ad is clicked
22
25
  public event EventHandler<EventArgs> OnNativeAdClicked;
26
+
23
27
  // Fires when the Native ad is opening
24
28
  public event EventHandler<EventArgs> OnNativeAdOpening;
29
+
25
30
  // Fires when the Native ad is closed
26
31
  public event EventHandler<EventArgs> OnNativeAdClosed;
27
-
32
+
28
33
  // Creats a Native Ad
29
34
  public void Create(string placementId)
30
35
  {
@@ -59,7 +64,8 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
59
64
 
60
65
  public string GetBodyText()
61
66
  {
62
- return "Native Test Body Text: BlueStack supports native ads, that allow you to retrieve the metadata of ad campaigns and present the ads yourself, within the context of your app, using your own art style. You are fully responsible for rendering the ad views using the information we supply. Native ads however offer methods to help you register impressions and clicks on your custom view.";
67
+ return
68
+ "Native Test Body Text: BlueStack supports native ads, that allow you to retrieve the metadata of ad campaigns and present the ads yourself, within the context of your app, using your own art style. You are fully responsible for rendering the ad views using the information we supply. Native ads however offer methods to help you register impressions and clicks on your custom view.";
63
69
  }
64
70
 
65
71
  public string GetCallToActionText()
@@ -76,40 +82,40 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
76
82
  {
77
83
  return "Ad";
78
84
  }
79
-
85
+
80
86
  public string GetIconUrl()
81
87
  {
82
88
  return "https://creative.mng-ads.com/10/10394-15539.jpg";
83
89
  }
84
-
90
+
85
91
  public string GetCoverImageUrl()
86
92
  {
87
93
  return "https://creative.mng-ads.com/10/10394-15540.jpg";
88
94
  }
89
-
95
+
90
96
  public string GetClickUrl()
91
97
  {
92
98
  return "https://developers.bluestack.app/";
93
99
  }
94
-
100
+
95
101
  public void RecordImpression()
96
102
  {
97
103
  Debug.LogWarning("Unity Native Ad Client : Impression Recorded!");
98
104
  OnNativeAdImpression?.Invoke(this, EventArgs.Empty);
99
105
  }
100
-
106
+
101
107
  public void PerformClick()
102
108
  {
103
109
  OpenURL(GetClickUrl());
104
110
  OnNativeAdClicked?.Invoke(this, EventArgs.Empty);
105
111
  }
106
-
112
+
107
113
  private void OpenURL(string clickUrl)
108
114
  {
109
115
  Debug.Log("Opened URL");
110
116
  Application.OpenURL(clickUrl);
111
117
  }
112
-
118
+
113
119
  // Destroys a Native Ad
114
120
  public void Destroy()
115
121
  {
@@ -15,14 +15,19 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
15
15
 
16
16
  // Fires when the Rewarded ad is loaded
17
17
  public event EventHandler<EventArgs> OnRewardedVideoLoaded;
18
+
18
19
  // Fires when the Rewarded ad has failed to load
19
20
  public event EventHandler<BlueStackError> OnRewardedVideoError;
21
+
20
22
  // Fires when the Rewarded ad is clicked
21
23
  public event EventHandler<EventArgs> OnRewardedVideoClicked;
24
+
22
25
  // Fires when the Rewarded ad has appeared
23
26
  public event EventHandler<EventArgs> OnRewardedVideoAppeared;
27
+
24
28
  // Fires when the Rewarded ad has rewarded the user
25
29
  public event EventHandler<RewardedItem> OnUserRewardEarned;
30
+
26
31
  // Fires when the Rewarded ad is closed
27
32
  public event EventHandler<EventArgs> OnRewardedVideoClosed;
28
33
 
@@ -31,7 +36,8 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
31
36
  private static readonly AdSize _rewardedLandscape = new AdSize(1024, 768, "1024x768");
32
37
  private static readonly string _adPrefabsDir = "Packages/com.azerion.bluestack/Resources/AdPrefabs/";
33
38
 
34
- private Dictionary<AdSize, string> _prefabAds = new Dictionary<AdSize, string>() {
39
+ private Dictionary<AdSize, string> _prefabAds = new Dictionary<AdSize, string>()
40
+ {
35
41
  { _rewardedPortrait, _adPrefabsDir + "Rewarded/RewardedPortrait.prefab" },
36
42
  { _rewardedLandscape, _adPrefabsDir + "Rewarded/RewardedLandscape.prefab" }
37
43
  };
@@ -111,7 +117,8 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
111
117
  Button adButton = buttons[0];
112
118
  Button closeButton = buttons[1];
113
119
 
114
- adButton.onClick.AddListener(() => {
120
+ adButton.onClick.AddListener(() =>
121
+ {
115
122
  AdBehaviour.OpenURL();
116
123
  OnRewardedVideoClicked?.Invoke(this, EventArgs.Empty);
117
124
  });
@@ -124,7 +131,6 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
124
131
  AdBehaviour.ResumeGame();
125
132
  });
126
133
  }
127
-
128
134
  }
129
135
  }
130
136
  #endif
@@ -16,7 +16,10 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
16
16
  else
17
17
  {
18
18
  int stringLength = value.Length;
19
- int characterIndex = (value.StartsWith("0x", StringComparison.Ordinal)) ? 2 : 0; // Does the string define leading HEX indicator '0x'. Adjust starting index accordingly.
19
+ int characterIndex =
20
+ (value.StartsWith("0x", StringComparison.Ordinal))
21
+ ? 2
22
+ : 0; // Does the string define leading HEX indicator '0x'. Adjust starting index accordingly.
20
23
  int numberOfCharacters = stringLength - characterIndex;
21
24
 
22
25
  bool addLeadingZero = false;
@@ -24,7 +27,7 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
24
27
  {
25
28
  addLeadingZero = true;
26
29
 
27
- numberOfCharacters += 1; // Leading '0' has been striped from the string presentation.
30
+ numberOfCharacters += 1; // Leading '0' has been striped from the string presentation.
28
31
  }
29
32
 
30
33
  bytes = new byte[numberOfCharacters / 2]; // Initialize our byte array to hold the converted string.
@@ -64,7 +67,8 @@ namespace Azerion.BlueStack.Platforms.UnityEditor
64
67
  else if ((0x29 < value) && (0x40 > value))
65
68
  value = (byte)((value - 0x30) << shift);
66
69
  else
67
- throw new InvalidOperationException($"Character '{character}' at index '{index}' is not valid alphanumeric character.");
70
+ throw new InvalidOperationException(
71
+ $"Character '{character}' at index '{index}' is not valid alphanumeric character.");
68
72
 
69
73
  return value;
70
74
  }
@@ -7,38 +7,44 @@ using Azerion.BlueStack.Internal;
7
7
 
8
8
  namespace Azerion.BlueStack.Platforms.iOS
9
9
  {
10
- public class BannerAdClient: IBannerAdClient, IDisposable
10
+ public class BannerAdClient : IBannerAdClient, IDisposable
11
11
  {
12
12
  private IntPtr _bannerAdPtr;
13
13
 
14
14
  private IntPtr _bannerAdClientPtr;
15
15
  private IBannerAdClient _bannerAdClient;
16
-
17
- #region BannerAd callback types
16
+
17
+ #region BannerAd callback types
18
18
 
19
19
  internal delegate void BSUOnBannerDidLoadCallback(IntPtr bannerClient);
20
+
20
21
  internal delegate void BSUOnBannerDidFailedCallback(IntPtr bannerClient, IntPtr error);
22
+
21
23
  internal delegate void BSUOnAdClickedCallback(IntPtr bannerClient);
24
+
22
25
  internal delegate void BSUOnBannerDidRefreshCallback(IntPtr bannerClient);
26
+
23
27
  internal delegate void BSUOnBannerDidFailToRefreshCallback(IntPtr bannerClient, IntPtr error);
28
+
24
29
  internal delegate void BSUOnBannerHideCallback(IntPtr bannerClient);
30
+
25
31
  internal delegate void BSUOnBannerDisplayCallback(IntPtr bannerClient);
26
32
 
27
- #endregion
28
-
33
+ #endregion
34
+
29
35
  // This property should be used when setting the bannerViewPtr.
30
36
  private IntPtr BannerAdPtr
31
37
  {
32
38
  get => this._bannerAdPtr;
33
-
39
+
34
40
  set
35
41
  {
36
42
  Externs.BSURelease(this._bannerAdPtr);
37
43
  this._bannerAdPtr = value;
38
44
  }
39
45
  }
40
-
41
- #region Banner callback methods
46
+
47
+ #region Banner callback methods
42
48
 
43
49
  [AOT.MonoPInvokeCallback(typeof(BSUOnBannerDidLoadCallback))]
44
50
  private static void OnBannerDidLoadCallback(IntPtr bannerClient)
@@ -49,7 +55,7 @@ namespace Azerion.BlueStack.Platforms.iOS
49
55
  client.OnBannerDidLoad(client, EventArgs.Empty);
50
56
  }
51
57
  }
52
-
58
+
53
59
  [AOT.MonoPInvokeCallback(typeof(BSUOnBannerDidFailedCallback))]
54
60
  private static void OnBannerDidFailedCallback(IntPtr bannerClient, IntPtr error)
55
61
  {
@@ -59,7 +65,7 @@ namespace Azerion.BlueStack.Platforms.iOS
59
65
  client.OnBannerDidFailed(client, BlueStackErrorUtils.CreateFromIntPtr(error));
60
66
  }
61
67
  }
62
-
68
+
63
69
  [AOT.MonoPInvokeCallback(typeof(BSUOnAdClickedCallback))]
64
70
  private static void OnAdClickedCallback(IntPtr bannerClient)
65
71
  {
@@ -69,7 +75,7 @@ namespace Azerion.BlueStack.Platforms.iOS
69
75
  client.OnAdClicked(client, EventArgs.Empty);
70
76
  }
71
77
  }
72
-
78
+
73
79
  [AOT.MonoPInvokeCallback(typeof(BSUOnBannerDidRefreshCallback))]
74
80
  private static void OnBannerDidRefreshCallback(IntPtr bannerClient)
75
81
  {
@@ -79,7 +85,7 @@ namespace Azerion.BlueStack.Platforms.iOS
79
85
  client.OnBannerDidRefresh(client, EventArgs.Empty);
80
86
  }
81
87
  }
82
-
88
+
83
89
  [AOT.MonoPInvokeCallback(typeof(BSUOnBannerDidFailToRefreshCallback))]
84
90
  private static void OnBannerDidFailToRefreshCallback(IntPtr bannerClient, IntPtr error)
85
91
  {
@@ -89,7 +95,7 @@ namespace Azerion.BlueStack.Platforms.iOS
89
95
  client.OnBannerDidFailToRefresh(client, BlueStackErrorUtils.CreateFromIntPtr(error));
90
96
  }
91
97
  }
92
-
98
+
93
99
  [AOT.MonoPInvokeCallback(typeof(BSUOnBannerHideCallback))]
94
100
  private static void OnBannerHideCallback(IntPtr bannerClient)
95
101
  {
@@ -99,7 +105,7 @@ namespace Azerion.BlueStack.Platforms.iOS
99
105
  client.OnBannerHide(client, EventArgs.Empty);
100
106
  }
101
107
  }
102
-
108
+
103
109
  [AOT.MonoPInvokeCallback(typeof(BSUOnBannerDisplayCallback))]
104
110
  private static void OnBannerDisplayCallback(IntPtr bannerClient)
105
111
  {
@@ -109,15 +115,15 @@ namespace Azerion.BlueStack.Platforms.iOS
109
115
  client.OnBannerDisplay(client, EventArgs.Empty);
110
116
  }
111
117
  }
112
-
118
+
113
119
  private static BannerAdClient IntPtrToBannerAdClient(IntPtr bannerClient)
114
120
  {
115
- GCHandle handle = (GCHandle) bannerClient;
121
+ GCHandle handle = (GCHandle)bannerClient;
116
122
  return handle.Target as BannerAdClient;
117
123
  }
118
-
119
- #endregion
120
-
124
+
125
+ #endregion
126
+
121
127
  public void Destroy()
122
128
  {
123
129
  this.DestroyBannerAd();
@@ -134,16 +140,18 @@ namespace Azerion.BlueStack.Platforms.iOS
134
140
  Externs.BSUDestroyBannerAd(this.BannerAdPtr);
135
141
  this.BannerAdPtr = IntPtr.Zero;
136
142
  }
143
+
137
144
  public void Dispose()
138
145
  {
139
146
  this.DestroyBannerAd();
140
- ((GCHandle) this._bannerAdClientPtr).Free();
147
+ ((GCHandle)this._bannerAdClientPtr).Free();
141
148
  }
149
+
142
150
  ~BannerAdClient()
143
151
  {
144
152
  this.Dispose();
145
153
  }
146
-
154
+
147
155
  public event EventHandler<EventArgs> OnBannerDidLoad;
148
156
  public event EventHandler<BlueStackError> OnBannerDidFailed;
149
157
  public event EventHandler<EventArgs> OnAdClicked;
@@ -154,10 +162,10 @@ namespace Azerion.BlueStack.Platforms.iOS
154
162
 
155
163
  public void CreateBannerAd(string placementId, AdPosition adPosition)
156
164
  {
157
- this._bannerAdClientPtr = (IntPtr) GCHandle.Alloc(this);
165
+ this._bannerAdClientPtr = (IntPtr)GCHandle.Alloc(this);
158
166
 
159
167
  this.BannerAdPtr = Externs.BSUCreateBannerAd(
160
- this._bannerAdClientPtr, placementId, (int) adPosition);
168
+ this._bannerAdClientPtr, placementId, (int)adPosition);
161
169
 
162
170
  Externs.BSUSetBannerAdCallbacks(
163
171
  this.BannerAdPtr,
@@ -179,7 +187,8 @@ namespace Azerion.BlueStack.Platforms.iOS
179
187
  public void Load(AdSize adSize, IPreferenceClient iPreferenceClient)
180
188
  {
181
189
  PreferenceClient preferenceClient = (PreferenceClient)iPreferenceClient;
182
- Externs.BSULoadBannerAdWithPreference(this.BannerAdPtr, adSize.Width, adSize.Height, preferenceClient.GetPreferenceClientPtr());
190
+ Externs.BSULoadBannerAdWithPreference(this.BannerAdPtr, adSize.Width, adSize.Height,
191
+ preferenceClient.GetPreferenceClientPtr());
183
192
  }
184
193
 
185
194
  public void Show()