com.azerion.bluestack 3.0.0-preview1 → 3.0.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.
@@ -206,7 +206,7 @@ RectTransform:
206
206
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
207
207
  m_AnchorMin: {x: 0.5, y: 0.5}
208
208
  m_AnchorMax: {x: 0.5, y: 0.5}
209
- m_AnchoredPosition: {x: 0, y: -154}
209
+ m_AnchoredPosition: {x: 0, y: 241}
210
210
  m_SizeDelta: {x: 1040, y: 1040}
211
211
  m_Pivot: {x: 0.5, y: 0.5}
212
212
  --- !u!222 &5666620918374091933
@@ -801,13 +801,13 @@ BoxCollider2D:
801
801
  m_PrefabInstance: {fileID: 0}
802
802
  m_PrefabAsset: {fileID: 0}
803
803
  m_GameObject: {fileID: 5666620919071030920}
804
- m_Enabled: 0
804
+ m_Enabled: 1
805
805
  m_Density: 1
806
806
  m_Material: {fileID: 0}
807
807
  m_IsTrigger: 0
808
808
  m_UsedByEffector: 0
809
809
  m_UsedByComposite: 0
810
- m_Offset: {x: 100.407486, y: -100.05159}
810
+ m_Offset: {x: 100, y: -100}
811
811
  m_SpriteTilingProperty:
812
812
  border: {x: 0, y: 0, z: 0, w: 0}
813
813
  pivot: {x: 0, y: 0}
@@ -818,7 +818,7 @@ BoxCollider2D:
818
818
  adaptiveTiling: 0
819
819
  m_AutoTiling: 0
820
820
  serializedVersion: 2
821
- m_Size: {x: 201.81497, y: 201.10318}
821
+ m_Size: {x: 200, y: 200}
822
822
  m_EdgeRadius: 0
823
823
  --- !u!1 &5666620919168347859
824
824
  GameObject:
@@ -53,7 +53,7 @@ namespace Azerion.BlueStack.Example
53
53
 
54
54
  Settings settings = new Settings(isDebugModeEnabled: true);
55
55
  BlueStackAds.Initialize(AppId, settings, HandleSDKInitCompleteAction);
56
- _preference = createBSPreference();
56
+ _preference = CreatePreference();
57
57
  }
58
58
 
59
59
  private void HandleSDKInitCompleteAction(SDKInitializationStatus sdkInitializationStatus)
@@ -74,13 +74,14 @@ namespace Azerion.BlueStack.Example
74
74
 
75
75
 
76
76
  // Update is called once per frame
77
- void RegisterGameObjects()
77
+ void Update()
78
78
  {
79
- Debug.Log("NativeAdManager: RegisterGameObjects");
80
79
  if (this.unifiedNativeAdLoaded)
81
80
  {
82
81
  this.unifiedNativeAdLoaded = false;
83
-
82
+
83
+ Debug.Log("NativeAdManager: RegisterGameObjects");
84
+
84
85
  // badge
85
86
  string badgeText = this.nativeAd.GetBadge();
86
87
  if (badgeText != null)
@@ -130,7 +131,7 @@ namespace Azerion.BlueStack.Example
130
131
  }
131
132
  }
132
133
 
133
- // Main/Cover Images
134
+ // Main/Cover Image
134
135
  Texture2D imageTexture = this.nativeAd.GetCoverImageTexture();
135
136
  if (imageTexture != null)
136
137
  {
@@ -163,13 +164,13 @@ namespace Azerion.BlueStack.Example
163
164
  private void RequestNativeAd()
164
165
  {
165
166
  Debug.Log("NativeAdManager: Requesting Ad!");
166
- AdLoader adLoader = new AdLoader.Builder(NativeAdUnitId).Build();
167
- adLoader.OnNativeAdLoaded += this.HandleNativeAdLoaded;
168
- adLoader.OnAdFailedToLoad += this.HandleNativeAdFailedToLoad;
169
- adLoader.LoadAd();
167
+ NativeAdLoader nativeAdLoader = new NativeAdLoader(NativeAdUnitId);
168
+ nativeAdLoader.OnNativeAdLoaded += this.HandleNativeAdLoaded;
169
+ nativeAdLoader.OnNativeAdFailedToLoad += this.HandleNativeNativeAdFailedToLoad;
170
+ nativeAdLoader.Load();
170
171
  }
171
172
 
172
- private void HandleNativeAdFailedToLoad(object sender, BlueStackError args)
173
+ private void HandleNativeNativeAdFailedToLoad(object sender, BlueStackError args)
173
174
  {
174
175
  Debug.Log("BlueStack NativeAd failed to load: " + "errorCode: " + args.ErrorCode + " message: " +
175
176
  args.Message);
@@ -180,11 +181,11 @@ namespace Azerion.BlueStack.Example
180
181
  Debug.Log("NativeAdManager: Unified Native Ad Loaded");
181
182
  this.nativeAd = args.nativeAd;
182
183
  this.unifiedNativeAdLoaded = true;
183
- RegisterGameObjects();
184
+ // RegisterGameObjects();
184
185
  }
185
186
 
186
187
 
187
- private Preference createBSPreference()
188
+ private Preference CreatePreference()
188
189
  {
189
190
  Preference bsPreference = new Preference();
190
191
 
@@ -50,7 +50,7 @@ namespace Azerion.BlueStack.Example
50
50
  {
51
51
  Settings settings = new Settings(isDebugModeEnabled: true);
52
52
  BlueStackAds.Initialize(AppId, settings, HandleSDKInitCompleteAction);
53
- _preference = createBSPreference();
53
+ _preference = CreatePreference();
54
54
  }
55
55
 
56
56
  private void HandleSDKInitCompleteAction(SDKInitializationStatus sdkInitializationStatus)
@@ -71,13 +71,15 @@ namespace Azerion.BlueStack.Example
71
71
 
72
72
 
73
73
  // Update is called once per frame
74
- void RegisterGameObjects()
74
+ void Update()
75
75
  {
76
- Debug.Log("NativeAdManager: RegisterGameObjects");
76
+
77
77
  if (this.unifiedNativeAdLoaded)
78
78
  {
79
79
  this.unifiedNativeAdLoaded = false;
80
80
 
81
+ Debug.Log("NativeAdManager: RegisterGameObjects");
82
+
81
83
  // badge
82
84
  string badgeText = this.nativeAd.GetBadge();
83
85
  if (badgeText != null)
@@ -135,13 +137,13 @@ namespace Azerion.BlueStack.Example
135
137
  private void RequestNativeAd()
136
138
  {
137
139
  Debug.Log("NativeAdManager: Requesting Ad!");
138
- AdLoader adLoader = new AdLoader.Builder(NativeAdUnitId).Build();
139
- adLoader.OnNativeAdLoaded += this.HandleNativeAdLoaded;
140
- adLoader.OnAdFailedToLoad += this.HandleNativeAdFailedToLoad;
141
- adLoader.LoadAd();
140
+ NativeAdLoader nativeAdLoader = new NativeAdLoader(NativeAdUnitId);
141
+ nativeAdLoader.OnNativeAdLoaded += this.HandleNativeAdLoaded;
142
+ nativeAdLoader.OnNativeAdFailedToLoad += this.HandleNativeNativeAdFailedToLoad;
143
+ nativeAdLoader.Load();
142
144
  }
143
145
 
144
- private void HandleNativeAdFailedToLoad(object sender, BlueStackError args)
146
+ private void HandleNativeNativeAdFailedToLoad(object sender, BlueStackError args)
145
147
  {
146
148
  Debug.Log("BlueStack NativeAd failed to load: " + "errorCode: " + args.ErrorCode + " message: " +
147
149
  args.Message);
@@ -152,11 +154,11 @@ namespace Azerion.BlueStack.Example
152
154
  Debug.Log("NativeAdManager: Unified Native Ad Loaded");
153
155
  this.nativeAd = args.nativeAd;
154
156
  this.unifiedNativeAdLoaded = true;
155
- RegisterGameObjects();
157
+ // RegisterGameObjects();
156
158
  }
157
159
 
158
160
 
159
- private Preference createBSPreference()
161
+ private Preference CreatePreference()
160
162
  {
161
163
  Preference bsPreference = new Preference();
162
164
 
@@ -0,0 +1,57 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Runtime.CompilerServices;
4
+ using System.Threading;
5
+ using Azerion.BlueStack.Common;
6
+ using Azerion.BlueStack.Internal;
7
+ using UnityEngine;
8
+
9
+ // WIP
10
+ namespace Azerion.BlueStack.API
11
+ {
12
+ public class NativeAdLoader
13
+ {
14
+ private IAdLoaderClient _adLoaderClient;
15
+ public event EventHandler<BlueStackError> OnNativeAdFailedToLoad;
16
+ public event EventHandler<NativeAdEventArgs> OnNativeAdLoaded;
17
+
18
+ internal bool IsAdLoaded;
19
+ internal GameObject AdGameObject;
20
+ private NativeAd _nativeAd;
21
+
22
+ public NativeAdLoader(string adUnitId)
23
+ {
24
+ AdUnitId = adUnitId;
25
+
26
+ NativeUtils.CheckInitialization();
27
+
28
+ _nativeAd = new NativeAd(AdUnitId);
29
+
30
+ _nativeAd.OnNativeAdDidFail += (sender, args) =>
31
+ {
32
+ OnNativeAdFailedToLoad?.Invoke(this, args);
33
+ };
34
+
35
+ _nativeAd.OnNativeAdDidLoad +=(_sender, _args) =>
36
+ {
37
+ NativeAdEventArgs nativeAdEventArgs = new NativeAdEventArgs
38
+ {
39
+ nativeAd = _nativeAd
40
+ };
41
+
42
+ this.OnNativeAdLoaded?.Invoke(this, nativeAdEventArgs);
43
+ };
44
+
45
+ }
46
+
47
+ public string AdUnitId { get; private set; }
48
+ public HashSet<NativeAdType> AdTypes { get; private set; }
49
+ public HashSet<string> FormatIds { get; private set; }
50
+ internal int NumberOfAdsToLoad { get; private set; }
51
+
52
+ public void Load() => this._nativeAd.Load();
53
+ public void Load(Preference preference) => this._nativeAd.Load(preference);
54
+
55
+ }
56
+
57
+ }
@@ -512,22 +512,7 @@ namespace Azerion.BlueStack.API
512
512
  {
513
513
  return true;
514
514
  }
515
-
516
- // Check if it is completely inside the viewport
517
- // Vector3[] corners = new Vector3[4];
518
- // rectTransform.GetWorldCorners(corners);
519
- // Debug.Log("Ad Object: " + this.name + " - " + corners.Length);
520
- // foreach (Vector3 corner in corners)
521
- // {
522
- // // Debug.Log("corner: " + corner);
523
- // Vector3 viewportPoint = Camera.main.WorldToViewportPoint(corner);
524
- // // Debug.Log("viewportPoints: " + viewportPoint);
525
- // if (viewportPoint.x >= 0 && viewportPoint.x <= 1 && viewportPoint.y >= 0 && viewportPoint.y <= 1 && viewportPoint.z > 0)
526
- // {
527
- // //return true;
528
- // }
529
- // }
530
-
515
+
531
516
  Debug.Log("Object Not visible!");
532
517
  return false;
533
518
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.azerion.bluestack",
3
- "version": "3.0.0-preview1",
3
+ "version": "3.0.0-preview2",
4
4
  "displayName": "BlueStack",
5
5
  "description": "BlueStack SDK has been designed to give developers options for showing Ads from different ad networks.",
6
6
  "unity": "2020.3",
@@ -1,135 +0,0 @@
1
- using System;
2
- using System.Collections.Generic;
3
- using System.Runtime.CompilerServices;
4
- using System.Threading;
5
- using Azerion.BlueStack.Common;
6
- using Azerion.BlueStack.Internal;
7
- using UnityEngine;
8
-
9
- namespace Azerion.BlueStack.API
10
- {
11
- public class AdLoader
12
- {
13
- private IAdLoaderClient _adLoaderClient;
14
- public event EventHandler<BlueStackError> OnAdFailedToLoad;
15
- public event EventHandler<NativeAdEventArgs> OnNativeAdLoaded; //NativeAdEventArgs
16
-
17
- internal bool IsAdLoaded;
18
- internal GameObject AdGameObject;
19
- private NativeAd _nativeAd;
20
-
21
- private AdLoader(AdLoader.Builder builder)
22
- {
23
- AdUnitId = string.Copy(builder.AdUnitId);
24
- FormatIds = new HashSet<string>(builder.FormatIds);
25
- AdTypes = new HashSet<NativeAdType>(builder.AdTypes);
26
- AdGameObject = builder.AdGameObject;
27
- NumberOfAdsToLoad = builder.NumberOfAdsToLoad;
28
- IsAdLoaded = builder.IsAdLoaded;
29
- Dictionary<string, bool> formatIdDictionary = new Dictionary<string, bool>();
30
-
31
- foreach (string formatId in this.FormatIds)
32
- {
33
- formatIdDictionary[formatId] = false;
34
- }
35
-
36
- // _adLoaderClient = NativeClientFactoryManager.CreateAdLoaderClient(
37
- // new AdLoaderClientArgs()
38
- // {
39
- // AdUnitId = this.AdUnitId,
40
- // AdTypes = this.AdTypes,
41
- // FormatIds = formatIdDictionary,
42
- // NumberOfAdsToLoad = this.NumberOfAdsToLoad
43
- // }
44
- // );
45
-
46
- NativeUtils.CheckInitialization();
47
-
48
- _nativeAd = new NativeAd(AdUnitId);
49
-
50
- _nativeAd.OnNativeAdDidFail += (sender, args) =>
51
- {
52
- OnAdFailedToLoad?.Invoke(this, args);
53
- };
54
-
55
- _nativeAd.OnNativeAdDidLoad +=(_sender, _args) =>
56
- {
57
- // NativeAd nativeAd = new NativeAd(AdUnitId);
58
- // NativeAd nativeAd = new NativeAd(_args.nativeAdClient);
59
- NativeAdEventArgs nativeAdEventArgs = new NativeAdEventArgs
60
- {
61
- nativeAd = _nativeAd
62
- };
63
-
64
- this.OnNativeAdLoaded?.Invoke(this, nativeAdEventArgs);
65
- };
66
-
67
- // _adLoaderClient.OnNativeAdImpression += (_sender, _args) =>
68
- // {
69
- // this.OnNativeAdImpression?.Invoke(this, _args);
70
- // };
71
- //
72
- // _adLoaderClient.OnNativeAdClicked += (_sender, _args) =>
73
- // {
74
- // this.OnNativeAdClicked?.Invoke(this, _args);
75
- // };
76
- //
77
- // _adLoaderClient.OnNativeAdOpening += (_sender, _args) =>
78
- // {
79
- // this.OnNativeAdOpening?.Invoke(this, _args);
80
- // };
81
- //
82
- // _adLoaderClient.OnNativeAdClosed += (_sender, _args) =>
83
- // {
84
- // this.OnNativeAdClosed?.Invoke(this, _args);
85
- // };
86
- }
87
-
88
-
89
- public string AdUnitId { get; private set; }
90
- public HashSet<NativeAdType> AdTypes { get; private set; }
91
- public HashSet<string> FormatIds { get; private set; }
92
- internal int NumberOfAdsToLoad { get; private set; }
93
-
94
- // public void LoadAd() => this._adLoaderClient.LoadAd();
95
- public void LoadAd() => this._nativeAd.Load();
96
- public void LoadAd(Preference preference) => this._nativeAd.Load(preference);
97
-
98
- // public void LoadAd(AdRequest request) => this._adLoaderClient.LoadAd(request); //new AdRequest.Builder().Build()
99
-
100
- public class Builder
101
- {
102
- internal bool IsAdLoaded;
103
- internal GameObject AdGameObject;
104
-
105
- public Builder(string adUnitId)
106
- {
107
- IsAdLoaded = false;
108
- FormatIds = new HashSet<string>();
109
- NumberOfAdsToLoad = 1;
110
- AdTypes = new HashSet<NativeAdType>();
111
- AdUnitId = adUnitId;
112
- }
113
-
114
- internal string AdUnitId { get; private set; }
115
- internal HashSet<NativeAdType> AdTypes { get; private set; }
116
- internal HashSet<string> FormatIds { get; private set; }
117
- internal int NumberOfAdsToLoad { get; private set; }
118
-
119
- // public Builder ForNativeAd()
120
- // {
121
- // AdTypes.Add(NativeAdType.NativeAd);
122
- // return this;
123
- // }
124
- //
125
- // public Builder SetNumberOfAdsToLoad(int num)
126
- // {
127
- // NumberOfAdsToLoad = num;
128
- // return this;
129
- // }
130
-
131
- public AdLoader Build() => new AdLoader(this);
132
- }
133
- }
134
-
135
- }