com.amanotes.gdk 0.1.9 → 0.1.11

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 (38) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/Editor/AmaGDKEditor.cs +35 -77
  3. package/Editor/AmaGDKManager.cs +236 -0
  4. package/{Runtime/Interfaces/Analytics/IAnalytics.cs.meta → Editor/AmaGDKManager.cs.meta} +1 -1
  5. package/Editor/Resources/amasdk-modules.json +31 -0
  6. package/Editor/Resources/amasdk-modules.json.meta +7 -0
  7. package/{Runtime/Interfaces.meta → Editor/Resources.meta} +1 -1
  8. package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +171 -0
  9. package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs.meta +11 -0
  10. package/Editor/Utils/AmaGDKEditor.GUI.cs +82 -0
  11. package/Editor/Utils/AmaGDKEditor.GUI.cs.meta +11 -0
  12. package/Editor/Utils/AmaGDKEditor.Utils.cs +35 -0
  13. package/Editor/Utils/AmaGDKEditor.Utils.cs.meta +11 -0
  14. package/{Runtime/Interfaces/Analytics.meta → Editor/Utils.meta} +1 -1
  15. package/Packages/AmaGDKConfig.unitypackage +0 -0
  16. package/Packages/AmaGDKExample.unitypackage +0 -0
  17. package/Packages/AmaGDKExample.unitypackage.meta +7 -0
  18. package/Packages/AppsflyerAdapter_v6.5.4.unitypackage +0 -0
  19. package/Packages/AppsflyerAdapter_v6.5.4.unitypackage.meta +7 -0
  20. package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
  21. package/Packages/IronsourceAdapter_v7.2.6.unitypackage +3 -0
  22. package/Packages/IronsourceAdapter_v7.2.6.unitypackage.meta +7 -0
  23. package/Runtime/AmaGDK.Ads.cs +235 -0
  24. package/Runtime/AmaGDK.Ads.cs.meta +11 -0
  25. package/Runtime/AmaGDK.Analytics.cs +81 -17
  26. package/Runtime/AmaGDK.Internal.cs +26 -1
  27. package/Runtime/AmaGDK.cs +19 -7
  28. package/Samples~/Example/AmaGDKExample.cs +87 -0
  29. package/Samples~/Example/AmaGDKExample.cs.meta +11 -0
  30. package/Samples~/Example/AmaGDKExample.unity +3114 -0
  31. package/Samples~/Example/AmaGDKExample.unity.meta +7 -0
  32. package/Sample~/Example/AmaGDKExample.cs +87 -0
  33. package/Sample~/Example/AmaGDKExample.cs.meta +11 -0
  34. package/Sample~/Example/AmaGDKExample.unity +3114 -0
  35. package/Sample~/Example/AmaGDKExample.unity.meta +7 -0
  36. package/Tests/Runtime/MigrationTest.cs +3 -3
  37. package/package.json +1 -1
  38. package/Runtime/Interfaces/Analytics/IAnalytics.cs +0 -6
@@ -0,0 +1,82 @@
1
+ using System;
2
+ using System.Collections;
3
+ using System.Collections.Generic;
4
+ using UnityEditor;
5
+ using UnityEngine;
6
+
7
+ namespace Amanotes.Editor
8
+ {
9
+ public static class GUI
10
+ {
11
+ static Color LIGHT_BLUE = new Color(0.25f, 0.5f, 1f);
12
+
13
+ static GUIStyle BIG_LABEL = null;
14
+
15
+ public static void SectionLabel(string text)
16
+ {
17
+ if (BIG_LABEL == null)
18
+ {
19
+ BIG_LABEL = new GUIStyle(UnityEngine.GUI.skin.label)
20
+ {
21
+ fontSize = 18,
22
+ alignment = TextAnchor.MiddleCenter,
23
+ richText = true
24
+ };
25
+
26
+ BIG_LABEL.normal.textColor = Color.white;
27
+ }
28
+
29
+ Rect rect = GUILayoutUtility.GetRect(Screen.width, 32);
30
+ rect.xMin -= 16f;
31
+ EditorGUI.DrawRect(rect, LIGHT_BLUE);
32
+ EditorGUI.LabelField(rect, text, BIG_LABEL);
33
+ }
34
+
35
+ public static bool BigButton(string label, float height = 16f, Color? color = null, float colorMod = 0.5f)
36
+ {
37
+ var bgColor = UnityEngine.GUI.backgroundColor;
38
+
39
+ bool result;
40
+ if (color != null)
41
+ {
42
+ var c = (colorMod < 0f) ? Color.Lerp(color.Value, Color.black, -colorMod)
43
+ : (colorMod > 0f) ? Color.Lerp(color.Value, Color.white, colorMod) : color.Value;
44
+ UnityEngine.GUI.backgroundColor = c;
45
+ }
46
+ {
47
+ result = GUILayout.Button(label, GUILayout.Height(height));
48
+ }
49
+ if (color != null) UnityEngine.GUI.backgroundColor = bgColor;
50
+ return result;
51
+ }
52
+
53
+ public static bool Toggle(string label, ref bool value)
54
+ {
55
+ var newValue = EditorGUILayout.Toggle(label, value);
56
+ if (newValue == value) return false;
57
+
58
+ value = newValue;
59
+ return true;
60
+ }
61
+
62
+ public static bool ToggleGroup(string label, ref bool isOpen, Action drawFunc, Action titleFunc = null){
63
+ GUILayout.BeginHorizontal();
64
+ var newValue = EditorGUILayout.Foldout(isOpen, label);
65
+ var changed = newValue != isOpen;
66
+ titleFunc?.Invoke();
67
+ GUILayout.EndHorizontal();
68
+
69
+ if (isOpen)
70
+ {
71
+ EditorGUI.indentLevel++;
72
+ drawFunc();
73
+ EditorGUI.indentLevel--;
74
+ }
75
+
76
+ if (!changed) return false;
77
+
78
+ isOpen = newValue;
79
+ return true;
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 3e22cadf10a36442f9c330cd96560105
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,35 @@
1
+ using System;
2
+ using System.Collections;
3
+ using UnityEditor;
4
+ using UnityEngine;
5
+
6
+ namespace Amanotes.Editor
7
+ {
8
+ public static class Utils
9
+ {
10
+ public static void StartEditorCoroutine(this IEnumerator update, Action end = null)
11
+ {
12
+ EditorApplication.CallbackFunction closureCallback = null;
13
+
14
+ closureCallback = () =>
15
+ {
16
+ try
17
+ {
18
+ if (update.MoveNext() == false)
19
+ {
20
+ end?.Invoke();
21
+ EditorApplication.update -= closureCallback;
22
+ }
23
+ }
24
+ catch (Exception ex)
25
+ {
26
+ end?.Invoke();
27
+ Debug.LogException(ex);
28
+ EditorApplication.update -= closureCallback;
29
+ }
30
+ };
31
+
32
+ EditorApplication.update += closureCallback;
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: f9a4ffdedf54b4782bb27923c4096eaa
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: d1a686515ec7946df9492f35e9638fea
2
+ guid: 61beaa5df6bc4435b9a397f7bdd79ab7
3
3
  folderAsset: yes
4
4
  DefaultImporter:
5
5
  externalObjects: {}
Binary file
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 6d185dbf1f37b42ac94953317558aca6
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: ab7f4809a233742778d8686d6d64cc7f
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:313276bb7dcfb6c5dc1a760945f89b413282c7329d1b4856e777c6aee75cc22e
3
+ size 1635
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 1a3999539db3049c998b0c84b7f92f07
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,235 @@
1
+ using System;
2
+ using System.Collections;
3
+
4
+ using UnityEngine;
5
+
6
+ using Amanotes.Core.Internal;
7
+ using static Amanotes.Core.Internal.Logging;
8
+
9
+ namespace Amanotes.Core
10
+ {
11
+ public interface IAds
12
+ {
13
+ bool IsAdReady(AdType Type);
14
+
15
+ #region Interstitial
16
+ event Action InterstitialShowSucceededCallback;
17
+ event Action InterstitialShowFailedCallback;
18
+ event Action InterstitialClickedCallback;
19
+ void RequestInterstitial();
20
+ void ShowInterstitial();
21
+ void ShowInterstitial(string placementName);
22
+ #endregion FullAds
23
+
24
+ #region VideoAds
25
+ event Action RewardedVideoShowFailedCallback;
26
+ event Action RewardedVideoClosedCallback;
27
+ event Action RewardedCallback;
28
+ event Action RewardedVideoClickCallback;
29
+ void RequestRewardedVideo();
30
+ void ShowRewardedVideo();
31
+ void ShowRewardedVideo(string placementName);
32
+ #endregion VideoAds
33
+
34
+ #region Banner
35
+ event Action BannerAdsClickCallback;
36
+ event Action BannerShowCallback;
37
+ void RequestBanner(BannerPosition position = BannerPosition.TOP);
38
+ void RequestBanner(BannerPosition position, string placementName);
39
+ void ShowBanner();
40
+ void HideBanner();
41
+ #endregion Banner
42
+ }
43
+
44
+ public enum BannerPosition
45
+ {
46
+ TOP = 1,
47
+ BOTTOM = 2
48
+ };
49
+
50
+ public enum AdType : byte
51
+ {
52
+ Interstitial,
53
+ Reward,
54
+ Banner
55
+ };
56
+
57
+ public partial class AmaGDK // IAds module
58
+ {
59
+ public static class Ads
60
+ {
61
+ internal static IAds adsModule;
62
+ public static Action<string> OnInterstitalFailCallback;
63
+ public static Action<string> OnRewardedVideoFailCallback;
64
+
65
+ public static void Init()
66
+ {
67
+ var adsModules = Adapter.FindAll<IAds>();
68
+
69
+ if (adsModules == null || adsModules.Count < 1)
70
+ {
71
+ LogError("Ads module not found!");
72
+ return;
73
+ }
74
+
75
+ if (adsModules.Count > 1)
76
+ {
77
+ LogError("Multiple Ads modules is not supported!");
78
+ return;
79
+ }
80
+
81
+ adsModule = adsModules[0].GetAdapterApi<IAds>();
82
+ }
83
+
84
+ public static void RequestBanner(BannerPosition position)
85
+ {
86
+ if (adsModule == null)
87
+ {
88
+ LogWarning("Ads module is not initialized");
89
+ return;
90
+ }
91
+ adsModule.RequestBanner(position);
92
+ }
93
+
94
+ public static void ShowBanner()
95
+ {
96
+ adsModule.ShowBanner();
97
+ }
98
+
99
+ public static void HideBanner()
100
+ {
101
+ if (!adsModule.IsAdReady(AdType.Banner))
102
+ {
103
+ LogWarning("Banner is not ready");
104
+ return;
105
+ }
106
+
107
+ adsModule.HideBanner();
108
+ }
109
+
110
+ public static void RequestInterstitial()
111
+ {
112
+ if (adsModule == null)
113
+ {
114
+ LogWarning("Ads module is not initialized");
115
+ return;
116
+ }
117
+ adsModule.RequestInterstitial();
118
+ }
119
+
120
+ public static void ShowInterstitial()
121
+ {
122
+ if (!adsModule.IsAdReady(AdType.Interstitial))
123
+ {
124
+ LogWarning("Interstitial is not ready");
125
+ BeginCoroutine(IWaitShowInterstitial());
126
+ return;
127
+ }
128
+ adsModule.ShowInterstitial();
129
+ }
130
+
131
+ public static void RequestRewardedVideo()
132
+ {
133
+ if (adsModule == null)
134
+ {
135
+ LogWarning("Ads module is not initialized");
136
+ return;
137
+ }
138
+ adsModule.RequestRewardedVideo();
139
+ }
140
+
141
+ public static void ShowRewardedVideo()
142
+ {
143
+ if (!adsModule.IsAdReady(AdType.Reward))
144
+ {
145
+ LogWarning("Reward is not ready");
146
+ BeginCoroutine(IWaitShowRewardedVideo());
147
+ return;
148
+ }
149
+ adsModule.ShowRewardedVideo();
150
+ }
151
+
152
+ private static IEnumerator IWaitShowRewardedVideo()
153
+ {
154
+ LogWarning("Wait Show Rewarded Video");
155
+ if (adsModule == null)
156
+ {
157
+ OnRewardedVideoFailCallback?.Invoke("Not found ads module");
158
+ OnRewardedVideoFailCallback = null;
159
+ yield break;
160
+ }
161
+
162
+ var startTime = Time.time;
163
+ float timeout = 5;
164
+ string error = null;
165
+ while (!adsModule.IsAdReady(AdType.Reward))
166
+ {
167
+ if (Application.internetReachability == NetworkReachability.NotReachable)
168
+ {
169
+ error = Application.internetReachability.ToString();
170
+ break;
171
+ }
172
+
173
+ if ((Time.time - startTime) > timeout)
174
+ {
175
+ error = "Timeout";
176
+ break;
177
+ }
178
+
179
+ yield return null;
180
+ }
181
+
182
+ if (adsModule.IsAdReady(AdType.Reward))
183
+ {
184
+ adsModule.ShowRewardedVideo();
185
+ }
186
+ else
187
+ {
188
+ OnRewardedVideoFailCallback?.Invoke(error);
189
+ OnRewardedVideoFailCallback = null;
190
+ }
191
+ }
192
+
193
+ private static IEnumerator IWaitShowInterstitial()
194
+ {
195
+ LogWarning("Wait Show Interstitial");
196
+ if (adsModule == null)
197
+ {
198
+ OnInterstitalFailCallback?.Invoke("Not found ads module");
199
+ OnInterstitalFailCallback = null;
200
+ yield break;
201
+ }
202
+
203
+ var startTime = Time.time;
204
+ float timeout = 5;
205
+ string error = null;
206
+ while (!adsModule.IsAdReady(AdType.Interstitial))
207
+ {
208
+ if (Application.internetReachability == NetworkReachability.NotReachable)
209
+ {
210
+ error = Application.internetReachability.ToString();
211
+ break;
212
+ }
213
+
214
+ if ((Time.time - startTime) > timeout)
215
+ {
216
+ error = "Timeout";
217
+ break;
218
+ }
219
+
220
+ yield return null;
221
+ }
222
+
223
+ if (adsModule.IsAdReady(AdType.Interstitial))
224
+ {
225
+ adsModule.ShowInterstitial();
226
+ }
227
+ else
228
+ {
229
+ OnInterstitalFailCallback?.Invoke(error);
230
+ OnInterstitalFailCallback = null;
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 46425c80eac894185a5609143ace732f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -8,7 +8,22 @@ using IEventParamsBuilder = Amanotes.Core.AmaGDK.Analytics.IEventParamsBuilder;
8
8
  using EventParams = Amanotes.Core.AmaGDK.Analytics.EventParams;
9
9
 
10
10
  namespace Amanotes.Core
11
- {
11
+ {
12
+ [Serializable]
13
+ public class AnalyticsAdapterBaseConfig
14
+ {
15
+ public bool SendEventByDefault;
16
+ public List<string> NeverSend;
17
+ public List<string> AlwaysSend;
18
+
19
+ public bool AllowSend(string eventName)
20
+ {
21
+ return SendEventByDefault
22
+ ? !NeverSend.Contains(eventName)
23
+ : AlwaysSend.Contains(eventName);
24
+ }
25
+ }
26
+
12
27
  partial class AmaGDK
13
28
  {
14
29
  //PUBLIC APIS
@@ -22,6 +37,7 @@ namespace Amanotes.Core
22
37
  public Dictionary<string, object> parameters = new Dictionary<string, object>();
23
38
  public string funnelSignature;
24
39
  public bool accumulated;
40
+ public bool withinSession;
25
41
  public HashSet<string> ignoreAnalyticIds = new HashSet<string>();
26
42
  public HashSet<string> allowAnalyticIds = new HashSet<string>();
27
43
 
@@ -51,15 +67,36 @@ namespace Amanotes.Core
51
67
  return result;
52
68
  }
53
69
 
70
+ public static IEventParamsBuilder LogEvent(string eventName, params (string, object)[] parameters)
71
+ {
72
+ var result = new EventParams(eventName);
73
+ for (var i = 0;i < parameters.Length; i++)
74
+ {
75
+ result.AddParam(parameters[i].Item1, parameters[i].Item2);
76
+ }
77
+ eventQueue.Enqueue(result);
78
+ return result;
79
+ }
80
+
54
81
  public static IEventParamsBuilder LogFunnelEvent(string eventName, string signature = "")
55
82
  {
56
83
  return LogEvent(eventName).SetAsFunnel(signature);
57
84
  }
58
85
 
59
- public static int GetAccumulatedCount(string eventName)
86
+ public static IEventParamsBuilder LogFunnelEvent(string eventName, Dictionary<string, object> parameters, string signature = "")
87
+ {
88
+ return LogEvent(eventName, parameters).SetAsFunnel(signature);
89
+ }
90
+
91
+ public static IEventParamsBuilder LogFunnelEvent(string eventName, string signature = "", params (string, object)[] parameters)
92
+ {
93
+ return LogEvent(eventName, parameters).SetAsFunnel(signature);
94
+ }
95
+
96
+ public static int GetAccumulatedCount(string eventName, bool withinSession = false)
60
97
  {
61
98
  var eventDetail = localData.GetEventDetail(eventName);
62
- return eventDetail != null ? eventDetail.count : 0;
99
+ return eventDetail != null ? (withinSession ? eventDetail.countInSession : eventDetail.totalCount) : 0;
63
100
  }
64
101
 
65
102
  public static void SetLogEventCondition(Predicate<EventDetail> condition)
@@ -116,20 +153,20 @@ namespace Amanotes.Core
116
153
  localData.eventDetails.Add(new EventDetail
117
154
  {
118
155
  eventName = e.Key,
119
- count = e.Value
156
+ totalCount = e.Value
120
157
  });
121
158
  flag |= IntegrityFlag.NewEvent;
122
159
  continue;
123
160
  }
124
161
 
125
- if (eventDetail.count != e.Value)
162
+ if (eventDetail.totalCount != e.Value)
126
163
  {
127
164
  flag |= IntegrityFlag.DifferentCount;
128
165
  }
129
166
 
130
167
  if (sumEventCount)
131
168
  {
132
- eventDetail.count += e.Value;
169
+ eventDetail.totalCount += e.Value;
133
170
  }
134
171
  }
135
172
 
@@ -169,10 +206,13 @@ namespace Amanotes.Core
169
206
  internal static readonly List<AdapterInfo> listAdapters = new List<AdapterInfo>();
170
207
  internal static readonly AnalyticsData localData = new AnalyticsData().LoadJsonFromFile();
171
208
 
172
- internal static void GetAnalyticAdapters()
209
+ internal static void Init()
173
210
  {
174
211
  listAdapters.Clear();
175
212
  listAdapters.AddRange(Adapter.FindAll<IAnalyticAdapter>());
213
+
214
+ _frameUpdate -= ProcessEventQueue;
215
+ _frameUpdate += ProcessEventQueue;
176
216
  }
177
217
 
178
218
  internal static void ProcessEventQueue()
@@ -187,22 +227,24 @@ namespace Amanotes.Core
187
227
  if (!NormalizeEventName(ref eventData.eventName))
188
228
  continue;
189
229
 
190
- var counter = localData.IncreaseCounter(eventData.eventName);
230
+ var (countInSession, totalCount) = localData.IncreaseCounter(eventData.eventName);
191
231
 
192
232
  if (!ShouldSendEvent(eventData))
193
233
  continue;
194
234
 
195
235
  if (eventData.accumulated)
196
236
  {
197
- eventData.AddParam("accumulated_count", counter);
237
+ eventData.AddParam("accumulated_count", eventData.withinSession ? countInSession : totalCount);
198
238
  }
199
239
 
200
240
  foreach (var m in listAdapters)
201
241
  {
242
+ if (!eventData.allowAnalyticIds.Contains(m.id))
243
+ continue;
202
244
  if (eventData.ignoreAnalyticIds.Contains(m.id))
203
245
  continue;
204
246
  m.GetAdapterApi<IAnalyticAdapter>().LogEvent(eventData);
205
- if (showAnalyticsLog) Debug.Log($"[{m.id}] Sent event <{eventData.eventName}> ({counter})");
247
+ if (showAnalyticsLog) Debug.Log($"[{m.id}] Sent event <{eventData.eventName}> (in session: {countInSession}, total: {totalCount})");
206
248
  }
207
249
  }
208
250
 
@@ -263,8 +305,10 @@ namespace Amanotes.Core
263
305
  [Serializable]
264
306
  public class EventDetail
265
307
  {
266
- public string eventName;
267
- public int count;
308
+ public string eventName;
309
+ [NonSerialized]
310
+ public int countInSession;
311
+ public int totalCount;
268
312
  }
269
313
 
270
314
  [Flags]
@@ -330,12 +374,13 @@ namespace Amanotes.Core
330
374
  return true;
331
375
  }
332
376
 
333
- internal int IncreaseCounter(string eventName)
377
+ internal (int countInSession, int totalCount) IncreaseCounter(string eventName)
334
378
  {
335
379
  var result = GetEventDetail(eventName, true);
336
- result.count++;
380
+ result.countInSession++;
381
+ result.totalCount++;
337
382
  _dirty = true;
338
- return result.count;
383
+ return (result.countInSession, result.totalCount);
339
384
  }
340
385
 
341
386
  internal void SaveIfDirty()
@@ -383,11 +428,13 @@ namespace Amanotes.Core
383
428
  data.funnelSignature = string.IsNullOrEmpty(signature) ? data.eventName : signature;
384
429
  return ap;
385
430
  }
386
- public static IEventParamsBuilder SetAsAccumulated(this IEventParamsBuilder ap)
431
+ public static IEventParamsBuilder SetAsAccumulated(this IEventParamsBuilder ap, bool withinSession = false)
387
432
  {
388
433
  if (ap == null) return null;
389
434
 
390
- (ap as EventParams).accumulated = true;
435
+ EventParams data = ap as EventParams;
436
+ data.accumulated = true;
437
+ data.withinSession = withinSession;
391
438
  return ap;
392
439
  }
393
440
 
@@ -450,6 +497,23 @@ namespace Amanotes.Core
450
497
  return ap;
451
498
  }
452
499
 
500
+ public static IEventParamsBuilder AddParam(this IEventParamsBuilder ap, params (string key, object value)[] parameters)
501
+ {
502
+ if (ap == null) return null;
503
+ if (parameters.Length == 0)
504
+ {
505
+ LogWarning($"Param tuple is null. Event name: {(ap as EventParams).eventName}!");
506
+ return ap;
507
+ }
508
+
509
+ foreach (var kvp in parameters)
510
+ {
511
+ if (IsValidKeyValue(ap, kvp.key, kvp.value))
512
+ ap.AddParam(kvp.key, kvp.value);
513
+ }
514
+ return ap;
515
+ }
516
+
453
517
  static bool IsValidKeyValue(IEventParamsBuilder ap, string key, object value)
454
518
  {
455
519
  string eventName = (ap as EventParams).eventName;
@@ -5,6 +5,10 @@ using System.Collections.Generic;
5
5
  using UnityEngine;
6
6
  using UnityObject = UnityEngine.Object;
7
7
 
8
+ #if UNITY_EDITOR
9
+ using UnityEditor;
10
+ #endif
11
+
8
12
  namespace Amanotes.Core.Internal
9
13
  {
10
14
  public enum Status
@@ -38,8 +42,29 @@ namespace Amanotes.Core.Internal
38
42
  public static readonly string[] AMAGDK_ADAPTERS = new string[]
39
43
  {
40
44
  "FirebaseAnalyticsAdapter_v9.1.0",
41
- //"AppsflyerAdapter_v6.5.4",
45
+ "AppsflyerAdapter_v6.5.4",
46
+ // "IronsourceAdapter_v7.2.6",
42
47
  };
48
+
49
+ #if UNITY_EDITOR
50
+
51
+ [MenuItem("GameObject/AmaGDK/Add AmaGDK Prefab", false, 10)]
52
+ private static void AddAmaGDKPrefab()
53
+ {
54
+ GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(AMAGDK_PREFAB);
55
+ if (prefab == null)
56
+ {
57
+ Debug.LogWarning($"Prefab [AmaGDK] not found at: {AMAGDK_PREFAB}");
58
+ return;
59
+ }
60
+
61
+ GameObject newPrefab = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
62
+ newPrefab.name = "AmaGDK";
63
+ newPrefab.transform.SetAsLastSibling();
64
+ Selection.activeObject = null;
65
+ Selection.activeObject = newPrefab;
66
+ }
67
+ #endif
43
68
  }
44
69
 
45
70