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.
- package/Editor/Android/AndroidBuildPostProcess.cs +0 -1
- package/Editor/Android/AndroidDependency.cs +1 -2
- package/Editor/Android/AndroidDependencyModifier.cs +55 -0
- package/Editor/Android/AndroidDependencyModifier.cs.meta +3 -0
- package/Editor/Android/AndroidDependencyParser.cs +26 -1
- package/Editor/Android/ManifestProcessor.cs +2 -1
- package/Editor/Azerion.BlueStack.Editor.asmdef +14 -14
- package/Editor/BlueStackDependencies.xml +1 -1
- package/Editor/BlueStackMediationDependencies.xml +11 -0
- package/Editor/BlueStackMediationDependencies.xml.meta +7 -0
- package/Editor/BlueStackSettings.cs +21 -18
- package/Editor/BlueStackSettingsEditor.cs +64 -1
- package/Editor/DebugHelper.cs +2 -2
- package/Editor/Dependency.cs +1 -1
- package/Editor/DependencyProvider.cs +213 -2
- package/Editor/IDependencyModifier.cs +12 -0
- package/Editor/IDependencyModifier.cs.meta +11 -0
- package/Editor/IDependencyParser.cs +1 -0
- package/Editor/MediationNetworkDependency.cs +34 -0
- package/Editor/MediationNetworkDependency.cs.meta +3 -0
- package/Editor/iOS/IOSDependency.cs +12 -0
- package/Editor/iOS/IOSDependency.cs.meta +11 -0
- package/Editor/iOS/IOSDependencyModifier.cs +105 -0
- package/Editor/iOS/IOSDependencyModifier.cs.meta +3 -0
- package/Editor/iOS/IOSDependencyParser.cs +32 -0
- package/Editor/iOS/PodDependency/PodDependencyUtils.cs +5 -1
- package/Example/Azerion.BlueStack.Example.asmdef +14 -14
- package/Example/Scripts/NativeAdManager.cs +5 -7
- package/Example/Scripts/SmallNativeAdManager.cs +4 -6
- package/README.md +4 -1
- package/Runtime/API/AdSize.cs +2 -2
- package/Runtime/API/Banner/BannerAd.cs +1 -1
- package/Runtime/API/BlueStackAds.cs +7 -3
- package/Runtime/API/InterstitialAd.cs +20 -5
- package/Runtime/API/NativeAd/NativeAd.cs +20 -26
- package/Runtime/API/NativeAd/NativeAdEventArgs.cs +1 -5
- package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +176 -173
- package/Runtime/API/NativeAd/NativeAdLoader.cs +10 -14
- package/Runtime/API/NativeAd/NativeAdObject.cs +563 -547
- package/Runtime/API/NativeAd/NativeAdType.cs +6 -6
- package/Runtime/API/NativeAd/NativeAssetInfo.cs +28 -28
- package/Runtime/Azerion.BlueStack.asmdef +14 -14
- package/Runtime/Common/NativeAd/AdLoaderClientArgs.cs +8 -8
- package/Runtime/Common/NativeAd/AdsEventExecutor.cs +69 -68
- package/Runtime/Common/NativeAd/DummyNativeClient.cs +52 -52
- package/Runtime/Common/NativeAd/NativeClientEventArgs.cs +5 -5
- package/Runtime/Common/NativeAd/NativeUtils.cs +111 -107
- package/Runtime/Internal/IBannerAdClient.cs +1 -1
- package/Runtime/Internal/IBlueStackClient.cs +2 -1
- package/Runtime/Internal/NativeAd/IAdLoaderClient.cs +12 -12
- package/Runtime/Internal/NativeAd/INativeAdClient.cs +1 -1
- package/Runtime/Internal/NativeAd/INativeClientFactory.cs +5 -5
- package/Runtime/Platforms/Android/BlueStackClient.cs +2 -1
- package/Runtime/Platforms/Android/BlueStackNativeClassNames.cs +2 -1
- package/Runtime/Platforms/Unity/AdvertisementManager.cs +5 -4
- package/Runtime/Platforms/Unity/BannerAdClient.cs +16 -9
- package/Runtime/Platforms/Unity/BaseAdClient.cs +7 -5
- package/Runtime/Platforms/Unity/BlueStackClient.cs +4 -3
- package/Runtime/Platforms/Unity/ClientsFactory.cs +0 -1
- package/Runtime/Platforms/Unity/InitializationStatusClient.cs +1 -0
- package/Runtime/Platforms/Unity/InterstitialAdClient.cs +12 -6
- package/Runtime/Platforms/Unity/NativeAdClient.cs +16 -10
- package/Runtime/Platforms/Unity/RewardedVideoAdClient.cs +9 -3
- package/Runtime/Platforms/Unity/Utils.cs +7 -3
- package/Runtime/Platforms/iOS/BannerAdClient.cs +33 -24
- package/Runtime/Platforms/iOS/BlueStackClient.cs +14 -10
- package/Runtime/Platforms/iOS/ClientsFactory.cs +0 -2
- package/Runtime/Platforms/iOS/Externs.cs +72 -65
- package/Runtime/Platforms/iOS/InitializationStatusClient.cs +6 -5
- package/Runtime/Platforms/iOS/InterstitialAdClient.cs +27 -21
- package/Runtime/Platforms/iOS/NativeAdClient.cs +27 -22
- package/Runtime/Platforms/iOS/PreferenceClient.cs +1 -1
- package/Runtime/Platforms/iOS/RewardedVideoAdClient.cs +27 -20
- package/Runtime/Platforms/iOS/Utils.cs +6 -3
- package/Runtime/Utilities/MiniJSON.cs +12 -12
- package/package.json +1 -1
- package/Editor/iOS/Dependency.cs +0 -0
- package/Editor/iOS/Dependency.cs.meta +0 -3
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using System.Linq;
|
|
5
|
+
using System.Xml;
|
|
6
|
+
using UnityEditor;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace Azerion.BlueStack.Editor.iOS
|
|
10
|
+
{
|
|
11
|
+
public class IOSDependencyModifier : IDependencyModifier
|
|
12
|
+
{
|
|
13
|
+
void IDependencyModifier.modifyDependencies(string xmlFilePath, List<MediationNetworkDependency> dependencies)
|
|
14
|
+
{
|
|
15
|
+
XmlDocument xmlDoc = new XmlDocument();
|
|
16
|
+
|
|
17
|
+
try
|
|
18
|
+
{
|
|
19
|
+
xmlDoc.Load(xmlFilePath);
|
|
20
|
+
}
|
|
21
|
+
catch (IOException e)
|
|
22
|
+
{
|
|
23
|
+
throw new Exception("Unable to load xml, error: " + e.Message);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
XmlNode mainNode = xmlDoc.SelectSingleNode($"//dependencies/iosPods/iosPod[@name='BlueStack-SDK']");
|
|
27
|
+
if (mainNode == null || mainNode.Attributes == null)
|
|
28
|
+
{
|
|
29
|
+
Debug.LogError("No node with the name 'BlueStack-SDK' found in the xml");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var subspecsAttribute = mainNode.Attributes["subspecs"];
|
|
34
|
+
if (subspecsAttribute == null)
|
|
35
|
+
{
|
|
36
|
+
Debug.LogError("No 'subspecs' Attribute found in the node 'BlueStack-SDK'");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// remove all inactive networks from the list
|
|
41
|
+
// dependencies.RemoveAll(a => dependencies.Any(b => !b.Active));
|
|
42
|
+
|
|
43
|
+
mainNode.Attributes["subspecs"].Value = "[";
|
|
44
|
+
foreach (MediationNetworkDependency dependency in dependencies)
|
|
45
|
+
{
|
|
46
|
+
if (dependency.Active)
|
|
47
|
+
{
|
|
48
|
+
mainNode.Attributes["subspecs"].Value += $"'{dependency.Package}', ";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
mainNode.Attributes["subspecs"].Value += "]";
|
|
52
|
+
|
|
53
|
+
// Replace main dependency XML content with the updated XML
|
|
54
|
+
System.IO.File.WriteAllText(xmlFilePath, xmlDoc.OuterXml);
|
|
55
|
+
AssetDatabase.Refresh();
|
|
56
|
+
|
|
57
|
+
Debug.Log("Mediation Dependencies are updated successfully in Main Dependencies XML.");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
void IDependencyModifier.modifyMediationNetworkDependencies(string xmlFilePath,
|
|
61
|
+
List<MediationNetworkDependency> dependencies)
|
|
62
|
+
{
|
|
63
|
+
XmlDocument xmlDoc = new XmlDocument();
|
|
64
|
+
|
|
65
|
+
try
|
|
66
|
+
{
|
|
67
|
+
xmlDoc.Load(xmlFilePath);
|
|
68
|
+
}
|
|
69
|
+
catch (IOException e)
|
|
70
|
+
{
|
|
71
|
+
throw new Exception("Unable to load xml, error: " + e.Message);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
foreach (MediationNetworkDependency dependency in dependencies)
|
|
75
|
+
{
|
|
76
|
+
XmlNode mainNode =
|
|
77
|
+
xmlDoc.SelectSingleNode($"//networkList/iosNetworks/network[@name='{dependency.Name}']");
|
|
78
|
+
|
|
79
|
+
if (mainNode != null)
|
|
80
|
+
{
|
|
81
|
+
mainNode.Attributes["active"].Value = dependency.Active.ToString();
|
|
82
|
+
}
|
|
83
|
+
else
|
|
84
|
+
{
|
|
85
|
+
// Node doesn't exists in Mediation Dependency XML
|
|
86
|
+
Debug.LogError(
|
|
87
|
+
$"Something went wrong: Node '{dependency.Name}' doesn't exists in Mediation Dependency XML! " +
|
|
88
|
+
"Please check if you have manually changed the xml");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Replace main mediation dependency XML content with the modified XML
|
|
93
|
+
System.IO.File.WriteAllText(xmlFilePath, xmlDoc.OuterXml);
|
|
94
|
+
AssetDatabase.Refresh();
|
|
95
|
+
Debug.Log("Mediation Network Dependencies XML file updated successfully.");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private static void SaveMainXMLFile(string updatedXML, string path)
|
|
99
|
+
{
|
|
100
|
+
// Replace main mediation dependency XML content with the updated XML
|
|
101
|
+
System.IO.File.WriteAllText(path, updatedXML);
|
|
102
|
+
AssetDatabase.Refresh();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -30,5 +30,37 @@ namespace Azerion.BlueStack.Editor.iOS
|
|
|
30
30
|
|
|
31
31
|
return dependencies;
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
List<MediationNetworkDependency> IDependencyParser.parseMediationNetworkDependencies(string xmlFilePath)
|
|
35
|
+
{
|
|
36
|
+
XmlDocument xmlDoc = new XmlDocument();
|
|
37
|
+
xmlDoc.Load(xmlFilePath);
|
|
38
|
+
string xmlPathPattern = "//networkList/iosNetworks/network";
|
|
39
|
+
XmlNodeList networkList = xmlDoc.SelectNodes(xmlPathPattern);
|
|
40
|
+
|
|
41
|
+
List<MediationNetworkDependency> dependencies = new List<MediationNetworkDependency>();
|
|
42
|
+
if (networkList != null && networkList.Count > 0)
|
|
43
|
+
{
|
|
44
|
+
foreach (XmlNode network in networkList)
|
|
45
|
+
{
|
|
46
|
+
// XmlNode network = node.FirstChild;
|
|
47
|
+
if (network.Attributes == null) continue;
|
|
48
|
+
var nameAttribute = network.Attributes["name"];
|
|
49
|
+
var packageAttribute = network.Attributes["package"];
|
|
50
|
+
var activeAttribute = network.Attributes["active"];
|
|
51
|
+
if (nameAttribute == null || packageAttribute == null) continue;
|
|
52
|
+
var name = nameAttribute.Value;
|
|
53
|
+
var package = packageAttribute.Value;
|
|
54
|
+
var active = bool.Parse(activeAttribute.Value);
|
|
55
|
+
|
|
56
|
+
Debug.Log("name: " + name);
|
|
57
|
+
Debug.Log("package: " + package);
|
|
58
|
+
Debug.Log("active: " + active);
|
|
59
|
+
dependencies.Add(new MediationNetworkDependency(name, package, active));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return dependencies;
|
|
64
|
+
}
|
|
33
65
|
}
|
|
34
66
|
}
|
|
@@ -16,21 +16,25 @@ namespace Azerion.BlueStack.Editor.iOS.PodDependency
|
|
|
16
16
|
isFound = false;
|
|
17
17
|
foreach (string line in podLines)
|
|
18
18
|
{
|
|
19
|
-
if (line.Contains(dependency.Name) && line.Contains(dependency.Version) &&
|
|
19
|
+
if (line.Contains(dependency.Name) && line.Contains(dependency.Version) &&
|
|
20
|
+
line.Trim().StartsWith("pod"))
|
|
20
21
|
{
|
|
21
22
|
isFound = true;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
if (!isFound)
|
|
25
27
|
{
|
|
26
28
|
break;
|
|
27
29
|
}
|
|
28
30
|
}
|
|
31
|
+
|
|
29
32
|
if (!isFound)
|
|
30
33
|
{
|
|
31
34
|
return new DependencyCheckResult(true,
|
|
32
35
|
missingDependency + " dependency is missing in your 'Pod File'");
|
|
33
36
|
}
|
|
37
|
+
|
|
34
38
|
return new DependencyCheckResult(false, "");
|
|
35
39
|
}
|
|
36
40
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"name": "Azerion.BlueStack.Example",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"GUID:c7532bb0d57b44689bcc8a6df65dc5fe"
|
|
6
|
+
],
|
|
7
|
+
"includePlatforms": [],
|
|
8
|
+
"excludePlatforms": [],
|
|
9
|
+
"allowUnsafeCode": false,
|
|
10
|
+
"overrideReferences": false,
|
|
11
|
+
"precompiledReferences": [],
|
|
12
|
+
"autoReferenced": true,
|
|
13
|
+
"defineConstraints": [],
|
|
14
|
+
"versionDefines": [],
|
|
15
|
+
"noEngineReferences": false
|
|
16
16
|
}
|
|
@@ -11,7 +11,6 @@ namespace Azerion.BlueStack.Example
|
|
|
11
11
|
{
|
|
12
12
|
public class NativeAdManager : MonoBehaviour
|
|
13
13
|
{
|
|
14
|
-
|
|
15
14
|
private NativeAd nativeAd;
|
|
16
15
|
private bool unifiedNativeAdLoaded;
|
|
17
16
|
private Preference _preference;
|
|
@@ -51,7 +50,6 @@ namespace Azerion.BlueStack.Example
|
|
|
51
50
|
// Use this for initialization
|
|
52
51
|
void Start()
|
|
53
52
|
{
|
|
54
|
-
|
|
55
53
|
Settings settings = new Settings(isDebugModeEnabled: true);
|
|
56
54
|
BlueStackAds.Initialize(AppId, settings, HandleSDKInitCompleteAction);
|
|
57
55
|
_preference = CreatePreference();
|
|
@@ -80,9 +78,9 @@ namespace Azerion.BlueStack.Example
|
|
|
80
78
|
if (this.unifiedNativeAdLoaded)
|
|
81
79
|
{
|
|
82
80
|
this.unifiedNativeAdLoaded = false;
|
|
83
|
-
|
|
81
|
+
|
|
84
82
|
Debug.Log("NativeAdManager: RegisterGameObjects");
|
|
85
|
-
|
|
83
|
+
|
|
86
84
|
// badge
|
|
87
85
|
string badgeText = this.nativeAd.GetBadge();
|
|
88
86
|
if (badgeText != null)
|
|
@@ -181,10 +179,10 @@ namespace Azerion.BlueStack.Example
|
|
|
181
179
|
Debug.Log("NativeAdManager: Unified Native Ad Loaded");
|
|
182
180
|
this.nativeAd = args.nativeAd;
|
|
183
181
|
this.unifiedNativeAdLoaded = true;
|
|
184
|
-
|
|
182
|
+
|
|
185
183
|
this.nativeAd.OnNativeAdImpression += this.HandleNativeAdImpression;
|
|
186
184
|
this.nativeAd.OnNativeAdClicked += this.HandleNativeAdClicked;
|
|
187
|
-
|
|
185
|
+
|
|
188
186
|
// RegisterGameObjects();
|
|
189
187
|
}
|
|
190
188
|
|
|
@@ -192,7 +190,7 @@ namespace Azerion.BlueStack.Example
|
|
|
192
190
|
{
|
|
193
191
|
Debug.Log("NativeAdManager: Native Ad Impression successful");
|
|
194
192
|
}
|
|
195
|
-
|
|
193
|
+
|
|
196
194
|
private void HandleNativeAdClicked(object sender, EventArgs args)
|
|
197
195
|
{
|
|
198
196
|
Debug.Log("NativeAdManager: Unified Native Ad click successful");
|
|
@@ -11,7 +11,6 @@ namespace Azerion.BlueStack.Example
|
|
|
11
11
|
{
|
|
12
12
|
public class SmallNativeAdManager : MonoBehaviour
|
|
13
13
|
{
|
|
14
|
-
|
|
15
14
|
private NativeAd nativeAd;
|
|
16
15
|
private bool unifiedNativeAdLoaded;
|
|
17
16
|
private Preference _preference;
|
|
@@ -74,7 +73,6 @@ namespace Azerion.BlueStack.Example
|
|
|
74
73
|
// Update is called once per frame
|
|
75
74
|
void Update()
|
|
76
75
|
{
|
|
77
|
-
|
|
78
76
|
if (this.unifiedNativeAdLoaded)
|
|
79
77
|
{
|
|
80
78
|
this.unifiedNativeAdLoaded = false;
|
|
@@ -149,16 +147,16 @@ namespace Azerion.BlueStack.Example
|
|
|
149
147
|
Debug.Log("BlueStack NativeAd failed to load: " + "errorCode: " + args.ErrorCode + " message: " +
|
|
150
148
|
args.Message);
|
|
151
149
|
}
|
|
152
|
-
|
|
150
|
+
|
|
153
151
|
private void HandleNativeAdLoaded(object sender, NativeAdEventArgs args)
|
|
154
152
|
{
|
|
155
153
|
Debug.Log("NativeAdManager: Unified Native Ad Loaded");
|
|
156
154
|
this.nativeAd = args.nativeAd;
|
|
157
155
|
this.unifiedNativeAdLoaded = true;
|
|
158
|
-
|
|
156
|
+
|
|
159
157
|
this.nativeAd.OnNativeAdImpression += this.HandleNativeAdImpression;
|
|
160
158
|
this.nativeAd.OnNativeAdClicked += this.HandleNativeAdClicked;
|
|
161
|
-
|
|
159
|
+
|
|
162
160
|
// RegisterGameObjects();
|
|
163
161
|
}
|
|
164
162
|
|
|
@@ -166,7 +164,7 @@ namespace Azerion.BlueStack.Example
|
|
|
166
164
|
{
|
|
167
165
|
Debug.Log("NativeAdManager: Native Ad Impression successful");
|
|
168
166
|
}
|
|
169
|
-
|
|
167
|
+
|
|
170
168
|
private void HandleNativeAdClicked(object sender, EventArgs args)
|
|
171
169
|
{
|
|
172
170
|
Debug.Log("NativeAdManager: Unified Native Ad click successful");
|
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# BlueStack SDK - Unity Plugin
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
BlueStack unity plugin provides functionalities to integrate native( Android and iOS) BlueStack SDKs into unity project.
|
|
4
|
+
Using this single plugin Game developer can display ads on their game from Madvertise and other third-party ad networks.
|
|
3
5
|
|
|
4
6
|
## Documentation
|
|
7
|
+
|
|
5
8
|
Documentation can be found [here](https://developers.bluestack.app/unity)
|
package/Runtime/API/AdSize.cs
CHANGED
|
@@ -14,7 +14,7 @@ namespace Azerion.BlueStack.API
|
|
|
14
14
|
private int _width;
|
|
15
15
|
private int _height;
|
|
16
16
|
private string _size;
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
public AdSize(int width, int height, string size)
|
|
19
19
|
{
|
|
20
20
|
this._width = width;
|
|
@@ -25,7 +25,7 @@ namespace Azerion.BlueStack.API
|
|
|
25
25
|
public int Width => _width;
|
|
26
26
|
|
|
27
27
|
public int Height => _height;
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
public string Size => _size;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -52,7 +52,7 @@ namespace Azerion.BlueStack.API.Banner
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
_bannerAdClient.OnBannerHide += (EventSender, args) => { OnBannerHide?.Invoke(this, args); };
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
_bannerAdClient.OnBannerDisplay += (EventSender, args) => { OnBannerDisplay?.Invoke(this, args); };
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -18,11 +18,15 @@ namespace Azerion.BlueStack.API
|
|
|
18
18
|
_blueStackClient = GetClientsFactory().CreateBlueStackClient();
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
public static void Initialize(string appId, Settings settings,
|
|
21
|
+
public static void Initialize(string appId, Settings settings,
|
|
22
|
+
Action<SDKInitializationStatus> sdkInitCompleteAction,
|
|
23
|
+
Action<AdaptersInitializationStatus> adaptersInitCompleteAction = null)
|
|
22
24
|
{
|
|
23
25
|
Instance._settings = settings;
|
|
24
|
-
Instance._blueStackClient.Initialize(appId, settings, sdkInitCompleteAction, client =>
|
|
25
|
-
|
|
26
|
+
Instance._blueStackClient.Initialize(appId, settings, sdkInitCompleteAction, client =>
|
|
27
|
+
{
|
|
28
|
+
if (adaptersInitCompleteAction != null)
|
|
29
|
+
adaptersInitCompleteAction.Invoke(new AdaptersInitializationStatus(client));
|
|
26
30
|
});
|
|
27
31
|
AdsEventExecutor.Initialize();
|
|
28
32
|
}
|
|
@@ -27,15 +27,30 @@ namespace Azerion.BlueStack.API
|
|
|
27
27
|
|
|
28
28
|
private void ConfigureEvents()
|
|
29
29
|
{
|
|
30
|
-
_interstitialAdClient.OnInterstitialDidLoaded += (sender, args) =>
|
|
30
|
+
_interstitialAdClient.OnInterstitialDidLoaded += (sender, args) =>
|
|
31
|
+
{
|
|
32
|
+
OnInterstitialDidLoaded?.Invoke(this, args);
|
|
33
|
+
};
|
|
31
34
|
|
|
32
|
-
_interstitialAdClient.OnInterstitialDidShown += (sender, args) =>
|
|
35
|
+
_interstitialAdClient.OnInterstitialDidShown += (sender, args) =>
|
|
36
|
+
{
|
|
37
|
+
OnInterstitialDidShown?.Invoke(this, args);
|
|
38
|
+
};
|
|
33
39
|
|
|
34
|
-
_interstitialAdClient.OnInterstitialDisappear += (sender, args) =>
|
|
40
|
+
_interstitialAdClient.OnInterstitialDisappear += (sender, args) =>
|
|
41
|
+
{
|
|
42
|
+
OnInterstitialDisappear?.Invoke(this, args);
|
|
43
|
+
};
|
|
35
44
|
|
|
36
|
-
_interstitialAdClient.OnInterstitialDidFail += (sender, args) =>
|
|
45
|
+
_interstitialAdClient.OnInterstitialDidFail += (sender, args) =>
|
|
46
|
+
{
|
|
47
|
+
OnInterstitialDidFail?.Invoke(this, args);
|
|
48
|
+
};
|
|
37
49
|
|
|
38
|
-
_interstitialAdClient.OnInterstitialClicked += (sender, args) =>
|
|
50
|
+
_interstitialAdClient.OnInterstitialClicked += (sender, args) =>
|
|
51
|
+
{
|
|
52
|
+
OnInterstitialClicked?.Invoke(this, args);
|
|
53
|
+
};
|
|
39
54
|
}
|
|
40
55
|
|
|
41
56
|
public void Load()
|
|
@@ -9,21 +9,21 @@ namespace Azerion.BlueStack.API
|
|
|
9
9
|
public class NativeAd
|
|
10
10
|
{
|
|
11
11
|
private INativeAdClient _nativeAdClient;
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
private Texture2D _iconTexture;
|
|
14
14
|
private Texture2D _imageTexture;
|
|
15
15
|
private bool _isTextureLoaded;
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
internal event EventHandler<EventArgs> OnNativeAdDidLoad;
|
|
18
18
|
internal event EventHandler<BlueStackError> OnNativeAdDidFail;
|
|
19
19
|
internal event EventHandler<EventArgs> OnNativeAdOpening;
|
|
20
20
|
internal event EventHandler<EventArgs> OnNativeAdClosed;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
public event EventHandler<EventArgs> OnNativeAdImpression;
|
|
23
23
|
public event EventHandler<EventArgs> OnNativeAdClicked;
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
private NativeAdInteractionHandler _nativeAdInteractionHandler;
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
internal NativeAd(string placementId) : this(placementId,
|
|
28
28
|
BlueStackAds.GetClientsFactory().CreateNativeAdClient())
|
|
29
29
|
{
|
|
@@ -41,18 +41,15 @@ namespace Azerion.BlueStack.API
|
|
|
41
41
|
|
|
42
42
|
private void ConfigureEvents()
|
|
43
43
|
{
|
|
44
|
-
_nativeAdClient.OnNativeAdDidLoad += (sender, args) =>
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
LoadTextures();
|
|
48
|
-
});
|
|
44
|
+
_nativeAdClient.OnNativeAdDidLoad += (sender, args) =>
|
|
45
|
+
{
|
|
46
|
+
AdsEventExecutor.ExecuteInUpdate(delegate { LoadTextures(); });
|
|
49
47
|
// SetClickUrl();
|
|
50
48
|
};
|
|
51
49
|
_nativeAdClient.OnNativeAdDidFail += (sender, args) => { OnNativeAdDidFail?.Invoke(this, args); };
|
|
52
50
|
_nativeAdClient.OnNativeAdImpression += (sender, args) => { OnNativeAdImpression?.Invoke(this, args); };
|
|
53
51
|
_nativeAdClient.OnNativeAdClicked += (sender, args) => { OnNativeAdClicked?.Invoke(this, args); };
|
|
54
52
|
_nativeAdClient.OnNativeAdClosed += (sender, args) => { OnNativeAdClosed?.Invoke(this, args); };
|
|
55
|
-
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
internal void Load()
|
|
@@ -71,7 +68,7 @@ namespace Azerion.BlueStack.API
|
|
|
71
68
|
this._iconTexture = null;
|
|
72
69
|
this._imageTexture = null;
|
|
73
70
|
}
|
|
74
|
-
|
|
71
|
+
|
|
75
72
|
private void LoadTextures()
|
|
76
73
|
{
|
|
77
74
|
// Debug.Log("GetIconUrl: " + _nativeAdClient.GetIconUrl());
|
|
@@ -98,7 +95,7 @@ namespace Azerion.BlueStack.API
|
|
|
98
95
|
}
|
|
99
96
|
));
|
|
100
97
|
}
|
|
101
|
-
|
|
98
|
+
|
|
102
99
|
public string GetTitle()
|
|
103
100
|
{
|
|
104
101
|
// Debug.Log("GetTitle: " + _nativeAdClient.GetTitle());
|
|
@@ -125,12 +122,12 @@ namespace Azerion.BlueStack.API
|
|
|
125
122
|
{
|
|
126
123
|
return _nativeAdClient.GetBadge();
|
|
127
124
|
}
|
|
128
|
-
|
|
125
|
+
|
|
129
126
|
public Texture2D GetIconTexture()
|
|
130
127
|
{
|
|
131
128
|
return this._iconTexture;
|
|
132
129
|
}
|
|
133
|
-
|
|
130
|
+
|
|
134
131
|
public Texture2D GetCoverImageTexture()
|
|
135
132
|
{
|
|
136
133
|
return this._imageTexture;
|
|
@@ -145,12 +142,12 @@ namespace Azerion.BlueStack.API
|
|
|
145
142
|
// {
|
|
146
143
|
// _nativeAdClient.PerformClick();
|
|
147
144
|
// }
|
|
148
|
-
|
|
145
|
+
|
|
149
146
|
private void SetClickUrl()
|
|
150
147
|
{
|
|
151
148
|
_nativeAdInteractionHandler.SetClickUrl(_nativeAdClient.GetClickUrl());
|
|
152
149
|
}
|
|
153
|
-
|
|
150
|
+
|
|
154
151
|
public bool RegisterTitleTextGameObject(GameObject gameObject)
|
|
155
152
|
{
|
|
156
153
|
return _nativeAdInteractionHandler.RegisterHeadlineTextGameObject(gameObject);
|
|
@@ -160,17 +157,17 @@ namespace Azerion.BlueStack.API
|
|
|
160
157
|
{
|
|
161
158
|
return _nativeAdInteractionHandler.RegisterBodyTextGameObject(gameObject);
|
|
162
159
|
}
|
|
163
|
-
|
|
160
|
+
|
|
164
161
|
public bool RegisterImageGameObject(GameObject gameObject)
|
|
165
162
|
{
|
|
166
163
|
return _nativeAdInteractionHandler.RegisterImageGameObjects(gameObject);
|
|
167
164
|
}
|
|
168
|
-
|
|
165
|
+
|
|
169
166
|
public bool RegisterIconImageGameObject(GameObject gameObject)
|
|
170
167
|
{
|
|
171
168
|
return _nativeAdInteractionHandler.RegisterIconImageGameObject(gameObject);
|
|
172
169
|
}
|
|
173
|
-
|
|
170
|
+
|
|
174
171
|
public bool RegisterCallToActionGameObject(GameObject gameObject)
|
|
175
172
|
{
|
|
176
173
|
return _nativeAdInteractionHandler.RegisterCallToActionGameObject(gameObject);
|
|
@@ -180,19 +177,16 @@ namespace Azerion.BlueStack.API
|
|
|
180
177
|
{
|
|
181
178
|
return _nativeAdInteractionHandler.RegisterAdvertiserTextGameObject(gameObject);
|
|
182
179
|
}
|
|
183
|
-
|
|
180
|
+
|
|
184
181
|
internal void Destroy()
|
|
185
182
|
{
|
|
186
183
|
_nativeAdClient.Destroy();
|
|
187
184
|
}
|
|
188
|
-
|
|
185
|
+
|
|
189
186
|
~NativeAd()
|
|
190
187
|
{
|
|
191
188
|
Debug.Log("NativeAd Destructor was called");
|
|
192
|
-
AdsEventExecutor.ExecuteInUpdate(delegate
|
|
193
|
-
{
|
|
194
|
-
Destroy();
|
|
195
|
-
});
|
|
189
|
+
AdsEventExecutor.ExecuteInUpdate(delegate { Destroy(); });
|
|
196
190
|
}
|
|
197
191
|
}
|
|
198
192
|
}
|