com.azerion.bluestack 2.0.1 → 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.
- package/Editor/BlueStackDependencies.xml +1 -1
- package/Example/Azerion.BlueStack.Example.asmdef +16 -0
- package/Example/Azerion.BlueStack.Example.asmdef.meta +7 -0
- package/Example/Prefabs/NativeAd.prefab +908 -0
- package/Example/Prefabs/NativeAd.prefab.meta +7 -0
- package/Example/Prefabs/SmallNativeAd.prefab +739 -0
- package/Example/Prefabs/SmallNativeAd.prefab.meta +7 -0
- package/Example/Prefabs.meta +8 -0
- package/Example/Scripts/NativeAdManager.cs +208 -0
- package/Example/Scripts/NativeAdManager.cs.meta +11 -0
- package/Example/Scripts/SmallNativeAdManager.cs +181 -0
- package/Example/Scripts/SmallNativeAdManager.cs.meta +11 -0
- package/Example/Scripts.meta +8 -0
- package/Example.meta +8 -0
- package/Plugins/Android/{bluestack-unity-android-bridge-1.0.1.aar → bluestack-unity-android-bridge-2.0.0-preview1.aar} +0 -0
- package/Plugins/Android/{bluestack-unity-android-bridge-1.0.1.aar.meta → bluestack-unity-android-bridge-2.0.0-preview1.aar.meta} +1 -1
- package/Plugins/iOS/BSUInterface.h +14 -0
- package/Plugins/iOS/BSUInterface.m +83 -1
- package/Plugins/iOS/BSUNativeAd.h +32 -0
- package/Plugins/iOS/BSUNativeAd.h.meta +27 -0
- package/Plugins/iOS/BSUNativeAd.m +82 -0
- package/Plugins/iOS/BSUNativeAd.m.meta +37 -0
- package/Plugins/iOS/BSUTypes.h +12 -0
- package/Runtime/API/BlueStackAds.cs +4 -2
- package/Runtime/API/NativeAd/NativeAd.cs +182 -0
- package/Runtime/API/NativeAd/NativeAd.cs.meta +3 -0
- package/Runtime/API/NativeAd/NativeAdEventArgs.cs +14 -0
- package/Runtime/API/NativeAd/NativeAdEventArgs.cs.meta +11 -0
- package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +157 -0
- package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs.meta +11 -0
- package/Runtime/API/NativeAd/NativeAdInteractionUtils.cs +122 -0
- package/Runtime/API/NativeAd/NativeAdInteractionUtils.cs.meta +11 -0
- package/Runtime/API/NativeAd/NativeAdLoader.cs +57 -0
- package/Runtime/API/NativeAd/NativeAdLoader.cs.meta +11 -0
- package/Runtime/API/NativeAd/NativeAdObject.cs +520 -0
- package/Runtime/API/NativeAd/NativeAdObject.cs.meta +11 -0
- package/Runtime/API/NativeAd/NativeAdType.cs +8 -0
- package/Runtime/API/NativeAd/NativeAdType.cs.meta +11 -0
- package/Runtime/API/NativeAd/NativeAssetID.cs +30 -0
- package/Runtime/API/NativeAd/NativeAssetID.cs.meta +11 -0
- package/Runtime/API/NativeAd/NativeClientFactoryManager.cs +32 -0
- package/Runtime/API/NativeAd/NativeClientFactoryManager.cs.meta +11 -0
- package/Runtime/API/NativeAd.meta +8 -0
- package/Runtime/Common/NativeAd/AdLoaderClientArgs.cs +16 -0
- package/Runtime/Common/NativeAd/AdLoaderClientArgs.cs.meta +11 -0
- package/Runtime/Common/NativeAd/AdsEventExecutor.cs +84 -0
- package/Runtime/Common/NativeAd/AdsEventExecutor.cs.meta +11 -0
- package/Runtime/Common/NativeAd/DummyNativeClient.cs +61 -0
- package/Runtime/Common/NativeAd/DummyNativeClient.cs.meta +11 -0
- package/Runtime/Common/NativeAd/NativeClientEventArgs.cs +10 -0
- package/Runtime/Common/NativeAd/NativeClientEventArgs.cs.meta +11 -0
- package/Runtime/Common/NativeAd/NativeUtils.cs +117 -0
- package/Runtime/Common/NativeAd/NativeUtils.cs.meta +11 -0
- package/Runtime/Internal/IClientsFactory.cs +5 -2
- package/Runtime/Internal/NativeAd/IAdLoaderClient.cs +24 -0
- package/Runtime/Internal/NativeAd/IAdLoaderClient.cs.meta +11 -0
- package/Runtime/Internal/NativeAd/INativeAdClient.cs +25 -0
- package/Runtime/Internal/NativeAd/INativeAdClient.cs.meta +3 -0
- package/Runtime/Internal/NativeAd/INativeAdInteractionHandlerClient.cs +15 -0
- package/Runtime/Internal/NativeAd/INativeAdInteractionHandlerClient.cs.meta +11 -0
- package/Runtime/Internal/NativeAd/INativeClientFactory.cs +9 -0
- package/Runtime/Internal/NativeAd/INativeClientFactory.cs.meta +11 -0
- package/Runtime/Internal/NativeAd.meta +8 -0
- package/Runtime/Platforms/Android/AndroidJavaObjectFactory.cs +9 -1
- package/Runtime/Platforms/Android/BannerAdClient.cs +1 -1
- package/Runtime/Platforms/Android/BlueStackClient.cs +1 -1
- package/Runtime/Platforms/Android/BlueStackErrorUtils.cs +1 -1
- package/Runtime/Platforms/Android/BlueStackNativeClassNames.cs +4 -1
- package/Runtime/Platforms/Android/ClientsFactory.cs +12 -1
- package/Runtime/Platforms/Android/InitializationStatusClient.cs +1 -1
- package/Runtime/Platforms/Android/InterstitialAdClient.cs +1 -1
- package/Runtime/Platforms/Android/NativeAdClient.cs +108 -0
- package/Runtime/Platforms/Android/NativeAdClient.cs.meta +3 -0
- package/Runtime/Platforms/Android/PreferenceClient.cs +1 -1
- package/Runtime/Platforms/Android/RewardedVideoAdClient.cs +1 -1
- package/Runtime/Platforms/Unity/BannerAdClient.cs +1 -0
- package/Runtime/Platforms/Unity/ClientsFactory.cs +6 -1
- package/Runtime/Platforms/Unity/NativeAdClient.cs +101 -0
- package/Runtime/Platforms/Unity/NativeAdClient.cs.meta +3 -0
- package/Runtime/Platforms/Unity/RewardedTimer.cs +2 -2
- package/Runtime/Platforms/Unity/Utils.cs +73 -0
- package/Runtime/Platforms/Unity/Utils.cs.meta +11 -0
- package/Runtime/Platforms/iOS/BannerAdClient.cs +1 -1
- package/Runtime/Platforms/iOS/BlueStackClient.cs +1 -1
- package/Runtime/Platforms/iOS/BlueStackErrorUtils.cs +1 -1
- package/Runtime/Platforms/iOS/ClientsFactory.cs +13 -1
- package/Runtime/Platforms/iOS/Externs.cs +49 -1
- package/Runtime/Platforms/iOS/InitializationStatusClient.cs +1 -1
- package/Runtime/Platforms/iOS/InterstitialAdClient.cs +1 -1
- package/Runtime/Platforms/iOS/NativeAdClient.cs +156 -0
- package/Runtime/Platforms/iOS/NativeAdClient.cs.meta +3 -0
- package/Runtime/Platforms/iOS/PreferenceClient.cs +1 -1
- package/Runtime/Platforms/iOS/RewardedVideoAdClient.cs +1 -1
- package/Runtime/Platforms/iOS/Utils.cs +1 -1
- package/Runtime/Utilities/MiniJSON.cs +581 -0
- package/Runtime/Utilities/MiniJSON.cs.meta +11 -0
- package/Runtime/Utilities.meta +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
using Azerion.BlueStack.API;
|
|
3
|
+
|
|
4
|
+
namespace Azerion.BlueStack.Common
|
|
5
|
+
{
|
|
6
|
+
public class AdLoaderClientArgs
|
|
7
|
+
{
|
|
8
|
+
public string AdUnitId { get; set; }
|
|
9
|
+
|
|
10
|
+
public HashSet<NativeAdType> AdTypes { get; set; }
|
|
11
|
+
|
|
12
|
+
internal Dictionary<string, bool> FormatIds { get; set; }
|
|
13
|
+
|
|
14
|
+
internal int NumberOfAdsToLoad { get; set; }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using UnityEngine.Events;
|
|
5
|
+
|
|
6
|
+
namespace Azerion.BlueStack.Common
|
|
7
|
+
{
|
|
8
|
+
public class AdsEventExecutor : MonoBehaviour
|
|
9
|
+
{
|
|
10
|
+
public static AdsEventExecutor instance = null;
|
|
11
|
+
|
|
12
|
+
private static System.Collections.Generic.List<System.Action> adEventsQueue = new System.Collections.Generic.List<System.Action>();
|
|
13
|
+
|
|
14
|
+
private static volatile bool adEventsQueueEmpty = true;
|
|
15
|
+
|
|
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
|
+
}
|
|
27
|
+
|
|
28
|
+
public static bool IsActive()
|
|
29
|
+
{
|
|
30
|
+
return AdsEventExecutor.instance != null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public void Awake()
|
|
34
|
+
{
|
|
35
|
+
UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
|
|
36
|
+
}
|
|
37
|
+
|
|
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
|
+
}
|
|
47
|
+
|
|
48
|
+
public static void InvokeInUpdate(UnityEvent eventParam)
|
|
49
|
+
{
|
|
50
|
+
AdsEventExecutor.ExecuteInUpdate(delegate
|
|
51
|
+
{
|
|
52
|
+
eventParam.Invoke();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
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
|
+
}
|
|
78
|
+
|
|
79
|
+
public void OnDisable()
|
|
80
|
+
{
|
|
81
|
+
AdsEventExecutor.instance = null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Reflection;
|
|
4
|
+
using Azerion.BlueStack.API;
|
|
5
|
+
using Azerion.BlueStack.Internal;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace Azerion.BlueStack.Common
|
|
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
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Diagnostics;
|
|
5
|
+
using Azerion.BlueStack.MiniJSON;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
using Debug = UnityEngine.Debug;
|
|
8
|
+
|
|
9
|
+
namespace Azerion.BlueStack.Common
|
|
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
|
+
}
|
|
@@ -4,10 +4,13 @@ namespace Azerion.BlueStack.Internal
|
|
|
4
4
|
{
|
|
5
5
|
public IBlueStackClient CreateBlueStackClient();
|
|
6
6
|
|
|
7
|
-
public
|
|
7
|
+
public IBannerAdClient CreatBannerAdClient();
|
|
8
8
|
|
|
9
9
|
public IInterstitialAdClient CreatInterstitialAdClient();
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
public IRewardedVideoAdClient CreatRewardedVideoAdClient();
|
|
12
|
+
|
|
13
|
+
public INativeAdClient CreateNativeAdClient();
|
|
11
14
|
|
|
12
15
|
public IPreferenceClient CreateIPreferenceClient();
|
|
13
16
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using Azerion.BlueStack.API;
|
|
3
|
+
using Azerion.BlueStack.Common;
|
|
4
|
+
|
|
5
|
+
namespace Azerion.BlueStack.Internal
|
|
6
|
+
{
|
|
7
|
+
public interface IAdLoaderClient
|
|
8
|
+
{
|
|
9
|
+
event EventHandler<BlueStackError> OnAdFailedToLoad;
|
|
10
|
+
|
|
11
|
+
event EventHandler<NativeClientEventArgs> OnNativeAdLoaded; //NativeClientEventArgs
|
|
12
|
+
|
|
13
|
+
event EventHandler<EventArgs> OnNativeAdImpression;
|
|
14
|
+
|
|
15
|
+
event EventHandler<EventArgs> OnNativeAdClicked;
|
|
16
|
+
|
|
17
|
+
event EventHandler<EventArgs> OnNativeAdOpening;
|
|
18
|
+
|
|
19
|
+
event EventHandler<EventArgs> OnNativeAdClosed;
|
|
20
|
+
|
|
21
|
+
// void LoadAd(AdRequest request);
|
|
22
|
+
void LoadAd();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using Azerion.BlueStack;
|
|
3
|
+
using Azerion.BlueStack.API;
|
|
4
|
+
|
|
5
|
+
namespace Azerion.BlueStack.Internal
|
|
6
|
+
{
|
|
7
|
+
public interface INativeAdClient
|
|
8
|
+
{
|
|
9
|
+
event EventHandler<EventArgs> OnNativeAdDidLoad;
|
|
10
|
+
event EventHandler<BlueStackError> OnNativeAdDidFail;
|
|
11
|
+
|
|
12
|
+
void Create(string placementId);
|
|
13
|
+
void Load();
|
|
14
|
+
void Load(IPreferenceClient iPreferenceClient);
|
|
15
|
+
string GetTitle();
|
|
16
|
+
string GetBodyText();
|
|
17
|
+
string GetCallToActionText();
|
|
18
|
+
byte[] GetBadgeBytes();
|
|
19
|
+
string GetBadge();
|
|
20
|
+
string GetIconUrl();
|
|
21
|
+
string GetCoverImageUrl();
|
|
22
|
+
string GetClickUrl();
|
|
23
|
+
void Destroy();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace Azerion.BlueStack.Internal
|
|
4
|
+
{
|
|
5
|
+
public interface INativeAdInteractionHandlerClient
|
|
6
|
+
{
|
|
7
|
+
Dictionary<string, string> GetAssetIDMappings();
|
|
8
|
+
|
|
9
|
+
bool RecordImpression(Dictionary<string, object> signal);
|
|
10
|
+
|
|
11
|
+
void PerformClick(Dictionary<string, object> signal);
|
|
12
|
+
|
|
13
|
+
void ReportTouchEvent(Dictionary<string, string> signal);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#if UNITY_ANDROID
|
|
1
|
+
#if UNITY_ANDROID //&& !UNITY_EDITOR
|
|
2
2
|
using UnityEngine;
|
|
3
3
|
|
|
4
4
|
namespace Azerion.BlueStack.Platforms.Android
|
|
@@ -33,6 +33,14 @@ namespace Azerion.BlueStack.Platforms.Android
|
|
|
33
33
|
return new AndroidJavaObject(
|
|
34
34
|
BlueStackNativeClassNames.UnityBannerAdClassName, activity, unityBannerAdListener);
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
public virtual AndroidJavaObject CreateUnityNativeAdAndroidJavaObject(object unityNativeAdListener)
|
|
38
|
+
{
|
|
39
|
+
AndroidJavaClass playerClass = new AndroidJavaClass(BlueStackNativeClassNames.UnityActivityClassName);
|
|
40
|
+
AndroidJavaObject activity =
|
|
41
|
+
playerClass.GetStatic<AndroidJavaObject>("currentActivity");
|
|
42
|
+
return new AndroidJavaObject(BlueStackNativeClassNames.UnityNativeAd, activity, unityNativeAdListener);
|
|
43
|
+
}
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
#endif
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#if UNITY_ANDROID
|
|
1
|
+
#if UNITY_ANDROID //&& !UNITY_EDITOR
|
|
2
2
|
namespace Azerion.BlueStack.Platforms.Android
|
|
3
3
|
{
|
|
4
4
|
public class BlueStackNativeClassNames
|
|
@@ -26,6 +26,9 @@ namespace Azerion.BlueStack.Platforms.Android
|
|
|
26
26
|
public const string UnityBannerAdClassName = "com.azerion.bluestack.unity.banner.UnityBannerAd";
|
|
27
27
|
public const string UnityBannerAdListenerClassName = "com.azerion.bluestack.unity.banner.UnityBannerAdListener";
|
|
28
28
|
|
|
29
|
+
public const string UnityNativeAd = "com.azerion.bluestack.unity.native.UnityNativeAd";
|
|
30
|
+
public const string UnityNativeAdListener = "com.azerion.bluestack.unity.native.UnityNativeAdListener";
|
|
31
|
+
|
|
29
32
|
#endregion
|
|
30
33
|
|
|
31
34
|
#region Unity class names
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#if UNITY_ANDROID
|
|
1
|
+
#if UNITY_ANDROID //&& !UNITY_EDITOR
|
|
2
2
|
using System;
|
|
3
3
|
using System.Reflection;
|
|
4
4
|
using Azerion.BlueStack.Internal;
|
|
@@ -62,6 +62,17 @@ namespace Azerion.BlueStack.Platforms.Android
|
|
|
62
62
|
throw new InvalidOperationException(@"Called " + MethodBase.GetCurrentMethod()?.Name +
|
|
63
63
|
" on non-Android runtime");
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
public INativeAdClient CreateNativeAdClient()
|
|
67
|
+
{
|
|
68
|
+
if (Application.platform == RuntimePlatform.Android)
|
|
69
|
+
{
|
|
70
|
+
return new NativeAdClient(AndroidJavaObjectFactory.Instance, BlueStackErrorUtils.Instance);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
throw new InvalidOperationException(@"Called " + MethodBase.GetCurrentMethod()?.Name +
|
|
74
|
+
" on non-Android runtime");
|
|
75
|
+
}
|
|
65
76
|
}
|
|
66
77
|
}
|
|
67
78
|
#endif
|