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
@@ -1,8 +1,8 @@
1
1
  namespace Azerion.BlueStack.API
2
2
  {
3
- public enum NativeAdType
4
- {
5
- CustomNativeAd,
6
- NativeAd
7
- }
8
- }
3
+ public enum NativeAdType
4
+ {
5
+ CustomNativeAd,
6
+ NativeAd
7
+ }
8
+ }
@@ -2,42 +2,42 @@ using System.Collections.Generic;
2
2
 
3
3
  namespace Azerion.BlueStack.API
4
4
  {
5
- public class NativeAssetID
6
- {
7
- public string Value { get; set; }
5
+ public class NativeAssetID
6
+ {
7
+ public string Value { get; set; }
8
8
 
9
- public static NativeAssetID Image => new NativeAssetID("Image");
9
+ public static NativeAssetID Image => new NativeAssetID("Image");
10
10
 
11
- public static NativeAssetID Icon => new NativeAssetID("Icon");
11
+ public static NativeAssetID Icon => new NativeAssetID("Icon");
12
12
 
13
- public static NativeAssetID AdChoices => new NativeAssetID("AdChoices");
13
+ public static NativeAssetID AdChoices => new NativeAssetID("AdChoices");
14
14
 
15
- public static NativeAssetID Headline => new NativeAssetID("Headline");
15
+ public static NativeAssetID Headline => new NativeAssetID("Headline");
16
16
 
17
- public static NativeAssetID Body => new NativeAssetID("Body");
17
+ public static NativeAssetID Body => new NativeAssetID("Body");
18
18
 
19
- public static NativeAssetID CallToAction => new NativeAssetID("CallToAction");
19
+ public static NativeAssetID CallToAction => new NativeAssetID("CallToAction");
20
20
 
21
- public static NativeAssetID Advertiser => new NativeAssetID("Advertiser");
21
+ public static NativeAssetID Advertiser => new NativeAssetID("Advertiser");
22
22
 
23
- public static NativeAssetID Price => new NativeAssetID("Price");
23
+ public static NativeAssetID Price => new NativeAssetID("Price");
24
24
 
25
- public static NativeAssetID Store => new NativeAssetID("Store");
25
+ public static NativeAssetID Store => new NativeAssetID("Store");
26
26
 
27
- private NativeAssetID(string value)
28
- {
29
- Value = value;
30
- }
31
- }
27
+ private NativeAssetID(string value)
28
+ {
29
+ Value = value;
30
+ }
31
+ }
32
32
 
33
- public class NativeAssetInfo
34
- {
35
- public static List<string> RequiredAssets => new List<string>
36
- {
37
- NativeAssetID.Icon.Value,
38
- NativeAssetID.Headline.Value,
39
- NativeAssetID.CallToAction.Value,
40
- NativeAssetID.Advertiser.Value
41
- };
42
- }
43
- }
33
+ public class NativeAssetInfo
34
+ {
35
+ public static List<string> RequiredAssets => new List<string>
36
+ {
37
+ NativeAssetID.Icon.Value,
38
+ NativeAssetID.Headline.Value,
39
+ NativeAssetID.CallToAction.Value,
40
+ NativeAssetID.Advertiser.Value
41
+ };
42
+ }
43
+ }
@@ -1,16 +1,16 @@
1
1
  {
2
- "name": "Azerion.BlueStack",
3
- "rootNamespace": "",
4
- "references": [],
5
- "includePlatforms": [],
6
- "excludePlatforms": [],
7
- "allowUnsafeCode": false,
8
- "overrideReferences": false,
9
- "precompiledReferences": [
10
- ""
11
- ],
12
- "autoReferenced": true,
13
- "defineConstraints": [],
14
- "versionDefines": [],
15
- "noEngineReferences": false
2
+ "name": "Azerion.BlueStack",
3
+ "rootNamespace": "",
4
+ "references": [],
5
+ "includePlatforms": [],
6
+ "excludePlatforms": [],
7
+ "allowUnsafeCode": false,
8
+ "overrideReferences": false,
9
+ "precompiledReferences": [
10
+ ""
11
+ ],
12
+ "autoReferenced": true,
13
+ "defineConstraints": [],
14
+ "versionDefines": [],
15
+ "noEngineReferences": false
16
16
  }
@@ -3,14 +3,14 @@ using Azerion.BlueStack.API;
3
3
 
4
4
  namespace Azerion.BlueStack.Common
5
5
  {
6
- public class AdLoaderClientArgs
7
- {
8
- public string AdUnitId { get; set; }
6
+ public class AdLoaderClientArgs
7
+ {
8
+ public string AdUnitId { get; set; }
9
9
 
10
- public HashSet<NativeAdType> AdTypes { get; set; }
10
+ public HashSet<NativeAdType> AdTypes { get; set; }
11
11
 
12
- internal Dictionary<string, bool> FormatIds { get; set; }
12
+ internal Dictionary<string, bool> FormatIds { get; set; }
13
13
 
14
- internal int NumberOfAdsToLoad { get; set; }
15
- }
16
- }
14
+ internal int NumberOfAdsToLoad { get; set; }
15
+ }
16
+ }
@@ -5,80 +5,81 @@ using UnityEngine.Events;
5
5
 
6
6
  namespace Azerion.BlueStack.Common
7
7
  {
8
- public class AdsEventExecutor : MonoBehaviour
9
- {
10
- public static AdsEventExecutor instance = null;
8
+ public class AdsEventExecutor : MonoBehaviour
9
+ {
10
+ public static AdsEventExecutor instance = null;
11
11
 
12
- private static System.Collections.Generic.List<System.Action> adEventsQueue = new System.Collections.Generic.List<System.Action>();
12
+ private static System.Collections.Generic.List<System.Action> adEventsQueue =
13
+ new System.Collections.Generic.List<System.Action>();
13
14
 
14
- private static volatile bool adEventsQueueEmpty = true;
15
+ private static volatile bool adEventsQueueEmpty = true;
15
16
 
16
- public static void Initialize()
17
- {
18
- if (AdsEventExecutor.IsActive())
19
- {
20
- return;
21
- }
22
- GameObject gameObject = new GameObject("AdsMainThreadExecuter");
23
- gameObject.hideFlags = HideFlags.HideAndDontSave;
24
- UnityEngine.Object.DontDestroyOnLoad(gameObject);
25
- AdsEventExecutor.instance = gameObject.AddComponent<AdsEventExecutor>();
26
- }
17
+ public static void Initialize()
18
+ {
19
+ if (AdsEventExecutor.IsActive())
20
+ {
21
+ return;
22
+ }
27
23
 
28
- public static bool IsActive()
29
- {
30
- return AdsEventExecutor.instance != null;
31
- }
24
+ GameObject gameObject = new GameObject("AdsMainThreadExecuter");
25
+ gameObject.hideFlags = HideFlags.HideAndDontSave;
26
+ UnityEngine.Object.DontDestroyOnLoad(gameObject);
27
+ AdsEventExecutor.instance = gameObject.AddComponent<AdsEventExecutor>();
28
+ }
32
29
 
33
- public void Awake()
34
- {
35
- UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
36
- }
30
+ public static bool IsActive()
31
+ {
32
+ return AdsEventExecutor.instance != null;
33
+ }
37
34
 
38
- public static void ExecuteInUpdate(System.Action action)
39
- {
40
- object obj = AdsEventExecutor.adEventsQueue;
41
- lock (obj)
42
- {
43
- AdsEventExecutor.adEventsQueue.Add(action);
44
- AdsEventExecutor.adEventsQueueEmpty = false;
45
- }
46
- }
35
+ public void Awake()
36
+ {
37
+ UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
38
+ }
47
39
 
48
- public static void InvokeInUpdate(UnityEvent eventParam)
49
- {
50
- AdsEventExecutor.ExecuteInUpdate(delegate
51
- {
52
- eventParam.Invoke();
53
- });
54
- }
40
+ public static void ExecuteInUpdate(System.Action action)
41
+ {
42
+ object obj = AdsEventExecutor.adEventsQueue;
43
+ lock (obj)
44
+ {
45
+ AdsEventExecutor.adEventsQueue.Add(action);
46
+ AdsEventExecutor.adEventsQueueEmpty = false;
47
+ }
48
+ }
55
49
 
56
- public void Update()
57
- {
58
- if (AdsEventExecutor.adEventsQueueEmpty)
59
- {
60
- return;
61
- }
62
- System.Collections.Generic.List<System.Action> list = new System.Collections.Generic.List<System.Action>();
63
- object obj = AdsEventExecutor.adEventsQueue;
64
- lock (obj)
65
- {
66
- list.AddRange(AdsEventExecutor.adEventsQueue);
67
- AdsEventExecutor.adEventsQueue.Clear();
68
- AdsEventExecutor.adEventsQueueEmpty = true;
69
- }
70
- foreach (System.Action current in list)
71
- {
72
- if (current.Target != null)
73
- {
74
- current();
75
- }
76
- }
77
- }
50
+ public static void InvokeInUpdate(UnityEvent eventParam)
51
+ {
52
+ AdsEventExecutor.ExecuteInUpdate(delegate { eventParam.Invoke(); });
53
+ }
78
54
 
79
- public void OnDisable()
80
- {
81
- AdsEventExecutor.instance = null;
82
- }
83
- }
84
- }
55
+ public void Update()
56
+ {
57
+ if (AdsEventExecutor.adEventsQueueEmpty)
58
+ {
59
+ return;
60
+ }
61
+
62
+ System.Collections.Generic.List<System.Action> list = new System.Collections.Generic.List<System.Action>();
63
+ object obj = AdsEventExecutor.adEventsQueue;
64
+ lock (obj)
65
+ {
66
+ list.AddRange(AdsEventExecutor.adEventsQueue);
67
+ AdsEventExecutor.adEventsQueue.Clear();
68
+ AdsEventExecutor.adEventsQueueEmpty = true;
69
+ }
70
+
71
+ foreach (System.Action current in list)
72
+ {
73
+ if (current.Target != null)
74
+ {
75
+ current();
76
+ }
77
+ }
78
+ }
79
+
80
+ public void OnDisable()
81
+ {
82
+ AdsEventExecutor.instance = null;
83
+ }
84
+ }
85
+ }
@@ -7,55 +7,55 @@ using UnityEngine;
7
7
 
8
8
  namespace Azerion.BlueStack.Common
9
9
  {
10
- // public class DummyNativeClient : INativeAdInteractionHandlerClient, IAdLoaderClient
11
- // {
12
- // //* public event EventHandler<LoadAdErrorClientEventArgs> OnAdFailedToLoad;
13
- //
14
- // public event EventHandler<NativeClientEventArgs> OnNativeAdLoaded;
15
- //
16
- // public event EventHandler<EventArgs> OnNativeAdImpression;
17
- //
18
- // public event EventHandler<EventArgs> OnNativeAdClicked;
19
- //
20
- // public event EventHandler<EventArgs> OnNativeAdOpening;
21
- //
22
- // public event EventHandler<EventArgs> OnNativeAdClosed;
23
- //
24
- // public DummyNativeClient()
25
- // {
26
- // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
27
- // }
28
- //
29
- // //* public void LoadAd(AdRequest request)
30
- // // {
31
- // // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
32
- // // }
33
- //
34
- // public void CreateAdLoader(AdLoaderClientArgs args)
35
- // {
36
- // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
37
- // }
38
- //
39
- // public Dictionary<string, string> GetAssetIDMappings()
40
- // {
41
- // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
42
- // return null;
43
- // }
44
- //
45
- // public bool RecordImpression(Dictionary<string, object> signal)
46
- // {
47
- // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
48
- // return false;
49
- // }
50
- //
51
- // public void PerformClick(Dictionary<string, object> signal)
52
- // {
53
- // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
54
- // }
55
- //
56
- // public void ReportTouchEvent(Dictionary<string, string> signal)
57
- // {
58
- // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
59
- // }
60
- // }
61
- }
10
+ // public class DummyNativeClient : INativeAdInteractionHandlerClient, IAdLoaderClient
11
+ // {
12
+ // //* public event EventHandler<LoadAdErrorClientEventArgs> OnAdFailedToLoad;
13
+ //
14
+ // public event EventHandler<NativeClientEventArgs> OnNativeAdLoaded;
15
+ //
16
+ // public event EventHandler<EventArgs> OnNativeAdImpression;
17
+ //
18
+ // public event EventHandler<EventArgs> OnNativeAdClicked;
19
+ //
20
+ // public event EventHandler<EventArgs> OnNativeAdOpening;
21
+ //
22
+ // public event EventHandler<EventArgs> OnNativeAdClosed;
23
+ //
24
+ // public DummyNativeClient()
25
+ // {
26
+ // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
27
+ // }
28
+ //
29
+ // //* public void LoadAd(AdRequest request)
30
+ // // {
31
+ // // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
32
+ // // }
33
+ //
34
+ // public void CreateAdLoader(AdLoaderClientArgs args)
35
+ // {
36
+ // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
37
+ // }
38
+ //
39
+ // public Dictionary<string, string> GetAssetIDMappings()
40
+ // {
41
+ // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
42
+ // return null;
43
+ // }
44
+ //
45
+ // public bool RecordImpression(Dictionary<string, object> signal)
46
+ // {
47
+ // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
48
+ // return false;
49
+ // }
50
+ //
51
+ // public void PerformClick(Dictionary<string, object> signal)
52
+ // {
53
+ // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
54
+ // }
55
+ //
56
+ // public void ReportTouchEvent(Dictionary<string, string> signal)
57
+ // {
58
+ // Debug.Log((object)("Dummy " + MethodBase.GetCurrentMethod()!.Name));
59
+ // }
60
+ // }
61
+ }
@@ -3,8 +3,8 @@ using Azerion.BlueStack.Internal;
3
3
 
4
4
  namespace Azerion.BlueStack.Common
5
5
  {
6
- public class NativeClientEventArgs : EventArgs
7
- {
8
- internal INativeAdClient nativeAdClient { get; set; }
9
- }
10
- }
6
+ public class NativeClientEventArgs : EventArgs
7
+ {
8
+ internal INativeAdClient nativeAdClient { get; set; }
9
+ }
10
+ }
@@ -8,110 +8,114 @@ using Debug = UnityEngine.Debug;
8
8
 
9
9
  namespace Azerion.BlueStack.Common
10
10
  {
11
- internal class NativeUtils
12
- {
13
- public static string Version
14
- {
15
- get;
16
- private set;
17
- }
18
-
19
- static NativeUtils()
20
- {
21
- Version version = typeof(NativeUtils).Assembly.GetName().Version;
22
- NativeUtils.Version = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Revision);
23
- }
24
-
25
- public static bool IsRenderedInScreenSpaceOverlayCanvas(GameObject gameObject)
26
- {
27
- Canvas componentInParent = gameObject.GetComponentInParent<Canvas>();
28
- return !(componentInParent == null) && componentInParent.renderMode == RenderMode.ScreenSpaceOverlay;
29
- }
30
-
31
- public static Vector3 GetBoundsMin(GameObject gameObject, Camera cam, Bounds bounds)
32
- {
33
- if (!NativeUtils.IsRenderedInScreenSpaceOverlayCanvas(gameObject))
34
- {
35
- return cam.WorldToScreenPoint(bounds.min);
36
- }
37
- return bounds.min;
38
- }
39
-
40
- public static Vector3 GetBoundsMax(GameObject gameObject, Camera cam, Bounds bounds)
41
- {
42
- if (!NativeUtils.IsRenderedInScreenSpaceOverlayCanvas(gameObject))
43
- {
44
- return cam.WorldToScreenPoint(bounds.max);
45
- }
46
- return bounds.max;
47
- }
48
-
49
- public static Camera GetCamera()
50
- {
51
- Camera[] array = new Camera[Camera.allCamerasCount];
52
- Camera.GetAllCameras(array);
53
- Camera camera = null;
54
- foreach (var camera2 in array)
55
- {
56
- if (camera == null || camera2.depth >= camera.depth)
57
- {
58
- camera = camera2;
59
- }
60
- }
61
- return camera;
62
- }
63
-
64
- public static float ConvertPxToDp(float pixels)
65
- {
66
- float num = 160f;
67
- return pixels / (Screen.dpi / num);
68
- }
69
-
70
- public static Dictionary<string, string> CastAssetIDMappings(string jsonMappings)
71
- {
72
- Dictionary<string, object> dictionary = Json.Deserialize(jsonMappings) as Dictionary<string, object>;
73
- Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
74
- foreach (KeyValuePair<string, object> current in dictionary)
75
- {
76
- dictionary2.Add(current.Key, (current.Value != null) ? current.Value.ToString() : string.Empty);
77
- }
78
- return dictionary2;
79
- }
80
-
81
- [DebuggerHidden]
82
- public static IEnumerator LoadImage(string url, Action<Texture2D> callback)
83
- {
84
- WWW www = new WWW(url);
85
- float elapsedTime = 0f;
86
- while (!www.isDone)
87
- {
88
- elapsedTime += Time.deltaTime;
89
- if (elapsedTime >= 10f)
90
- {
91
- break;
92
- }
93
- yield return null;
94
- }
95
- if (!www.isDone || !string.IsNullOrEmpty(www.error))
96
- {
97
- callback(null);
98
- }
99
- else
100
- {
101
- callback(www.texture);
102
- }
103
- }
104
-
105
- public static void CheckInitialization()
106
- {
107
- if (!AdsEventExecutor.IsActive())
108
- AdsEventExecutor.Initialize();
109
- }
110
-
111
- public static Texture2D GetTexture2DFromByteArray(byte[] img)
112
- {
113
- Texture2D tex = new Texture2D(1, 1);
114
- return tex.LoadImage(img) ? tex : throw new InvalidOperationException("Could not load custom native template image asset as texture");
115
- }
116
- }
117
- }
11
+ internal class NativeUtils
12
+ {
13
+ public static string Version { get; private set; }
14
+
15
+ static NativeUtils()
16
+ {
17
+ Version version = typeof(NativeUtils).Assembly.GetName().Version;
18
+ NativeUtils.Version = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Revision);
19
+ }
20
+
21
+ public static bool IsRenderedInScreenSpaceOverlayCanvas(GameObject gameObject)
22
+ {
23
+ Canvas componentInParent = gameObject.GetComponentInParent<Canvas>();
24
+ return !(componentInParent == null) && componentInParent.renderMode == RenderMode.ScreenSpaceOverlay;
25
+ }
26
+
27
+ public static Vector3 GetBoundsMin(GameObject gameObject, Camera cam, Bounds bounds)
28
+ {
29
+ if (!NativeUtils.IsRenderedInScreenSpaceOverlayCanvas(gameObject))
30
+ {
31
+ return cam.WorldToScreenPoint(bounds.min);
32
+ }
33
+
34
+ return bounds.min;
35
+ }
36
+
37
+ public static Vector3 GetBoundsMax(GameObject gameObject, Camera cam, Bounds bounds)
38
+ {
39
+ if (!NativeUtils.IsRenderedInScreenSpaceOverlayCanvas(gameObject))
40
+ {
41
+ return cam.WorldToScreenPoint(bounds.max);
42
+ }
43
+
44
+ return bounds.max;
45
+ }
46
+
47
+ public static Camera GetCamera()
48
+ {
49
+ Camera[] array = new Camera[Camera.allCamerasCount];
50
+ Camera.GetAllCameras(array);
51
+ Camera camera = null;
52
+ foreach (var camera2 in array)
53
+ {
54
+ if (camera == null || camera2.depth >= camera.depth)
55
+ {
56
+ camera = camera2;
57
+ }
58
+ }
59
+
60
+ return camera;
61
+ }
62
+
63
+ public static float ConvertPxToDp(float pixels)
64
+ {
65
+ float num = 160f;
66
+ return pixels / (Screen.dpi / num);
67
+ }
68
+
69
+ public static Dictionary<string, string> CastAssetIDMappings(string jsonMappings)
70
+ {
71
+ Dictionary<string, object> dictionary = Json.Deserialize(jsonMappings) as Dictionary<string, object>;
72
+ Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
73
+ foreach (KeyValuePair<string, object> current in dictionary)
74
+ {
75
+ dictionary2.Add(current.Key, (current.Value != null) ? current.Value.ToString() : string.Empty);
76
+ }
77
+
78
+ return dictionary2;
79
+ }
80
+
81
+ [DebuggerHidden]
82
+ public static IEnumerator LoadImage(string url, Action<Texture2D> callback)
83
+ {
84
+ WWW www = new WWW(url);
85
+ float elapsedTime = 0f;
86
+ while (!www.isDone)
87
+ {
88
+ elapsedTime += Time.deltaTime;
89
+ if (elapsedTime >= 10f)
90
+ {
91
+ break;
92
+ }
93
+
94
+ yield return null;
95
+ }
96
+
97
+ if (!www.isDone || !string.IsNullOrEmpty(www.error))
98
+ {
99
+ callback(null);
100
+ }
101
+ else
102
+ {
103
+ callback(www.texture);
104
+ }
105
+ }
106
+
107
+ public static void CheckInitialization()
108
+ {
109
+ if (!AdsEventExecutor.IsActive())
110
+ AdsEventExecutor.Initialize();
111
+ }
112
+
113
+ public static Texture2D GetTexture2DFromByteArray(byte[] img)
114
+ {
115
+ Texture2D tex = new Texture2D(1, 1);
116
+ return tex.LoadImage(img)
117
+ ? tex
118
+ : throw new InvalidOperationException("Could not load custom native template image asset as texture");
119
+ }
120
+ }
121
+ }
@@ -18,7 +18,7 @@ namespace Azerion.BlueStack.Internal
18
18
  event EventHandler<BlueStackError> OnBannerDidFailToRefresh;
19
19
 
20
20
  event EventHandler<EventArgs> OnBannerHide;
21
-
21
+
22
22
  event EventHandler<EventArgs> OnBannerDisplay;
23
23
 
24
24
  void CreateBannerAd(string placementId, AdPosition adPosition);
@@ -5,6 +5,7 @@ namespace Azerion.BlueStack.Internal
5
5
  {
6
6
  public interface IBlueStackClient
7
7
  {
8
- void Initialize(string appId, Settings settings,Action<SDKInitializationStatus> sdkInitCompleteAction, Action<IInitializationStatusClient> adaptersInitCompleteAction);
8
+ void Initialize(string appId, Settings settings, Action<SDKInitializationStatus> sdkInitCompleteAction,
9
+ Action<IInitializationStatusClient> adaptersInitCompleteAction);
9
10
  }
10
11
  }