com.amanotes.gdk 0.2.72 → 0.2.73
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/CHANGELOG.md +12 -0
- package/Editor/AmaGDKEditor.cs +133 -135
- package/Editor/Extra/GDKAutoUpdateAdapter.cs +24 -24
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/Consent.unitypackage +0 -0
- package/Extra/ForceUpdate.unitypackage +0 -0
- package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
- package/Extra/PostProcessor.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.AdRevenue.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.AdRevenue.unitypackage.meta +7 -0
- package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/MaxAdNetworkAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
- package/Runtime/Ad/AdLogic.cs +5 -1
- package/Runtime/Ad/AmaGDK.Ads.cs +1 -1
- package/Runtime/AmaGDK.Adapters.cs +6 -3
- package/Runtime/AmaGDK.Analytics.cs +52 -20
- package/Runtime/AmaGDK.cs +20 -10
- package/Runtime/Core/GDKDebug.cs +1 -1
- package/Runtime/Fps/AmaFPS.Utils.cs +4 -0
- package/Runtime/Fps/AmaFPSVisualizer.cs +6 -1
- package/Runtime/GDKAudio/GDKAudio.cs +5 -5
- package/Runtime/Internal/AmaGDK.Internal.cs +2 -1
- package/Runtime/Klavar/Attributes/TimeDiffLastFireAttribute.cs +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.73] - 2024-09-09
|
|
4
|
+
- [Fix] Disable incorrect in-editor warning for AdLogic
|
|
5
|
+
- [Dev] Remove AdEventTracking dependency on AppsFlyer
|
|
6
|
+
- [Dev] Rename Utils to GDKUtils
|
|
7
|
+
- [Dev] Automatically convert Enum value to string for analytics
|
|
8
|
+
- [Dev] Show less analytics error and warning log
|
|
9
|
+
- [Fix] Cannot create AmaGDKConfig
|
|
10
|
+
- [Fix] Change to dev mode should automatically refresh packages & recompile
|
|
11
|
+
- [Fix] Screen.currentResolution.refreshRate obsoleted on Unity 2022.2 and newer versions
|
|
12
|
+
- [Dev] Disable auto update adapter
|
|
13
|
+
- [Fix] Show all related adapters of each product
|
|
14
|
+
|
|
3
15
|
## [0.2.72] - 2024-08-29
|
|
4
16
|
- Revert "[Dev] Improve GDKPool performance main thread by using non-locking structure"
|
|
5
17
|
- This reverts commit 5857ea9cb05adf9e96a747216da8acd48e39f93e.
|
package/Editor/AmaGDKEditor.cs
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using Amanotes.Core;
|
|
3
|
-
using Amanotes.Core.Internal;
|
|
4
2
|
using System.Collections.Generic;
|
|
5
3
|
using System.IO;
|
|
6
4
|
using System.Linq;
|
|
7
5
|
using System.Reflection;
|
|
6
|
+
|
|
8
7
|
using UnityEditor;
|
|
9
8
|
using UnityEngine;
|
|
10
9
|
using UnityEngine.Profiling;
|
|
11
|
-
using static Amanotes.Core.GDKDebug;
|
|
12
|
-
using static Amanotes.Core.AmaGDK.AdapterID;
|
|
13
10
|
using UnityObject = UnityEngine.Object;
|
|
14
11
|
using UnityEvent = UnityEngine.Event;
|
|
15
12
|
|
|
13
|
+
using Amanotes.Core;
|
|
14
|
+
using Amanotes.Core.Internal;
|
|
15
|
+
using static Amanotes.Core.GDKDebug;
|
|
16
|
+
using static Amanotes.Core.AmaGDK.AdapterID;
|
|
17
|
+
|
|
16
18
|
namespace Amanotes.Editor
|
|
17
19
|
{
|
|
18
20
|
[CustomEditor(typeof(AmaGDK))]
|
|
@@ -35,11 +37,8 @@ namespace Amanotes.Editor
|
|
|
35
37
|
|
|
36
38
|
// DO NOT PUT [NonSerialized]
|
|
37
39
|
private static bool adapterScanned = false;
|
|
38
|
-
private static bool searchedForConfig = false;
|
|
39
|
-
|
|
40
40
|
private static bool extraScanned = false;
|
|
41
41
|
private static readonly List<string> extraPackages = new List<string>();
|
|
42
|
-
|
|
43
42
|
private static readonly List<string> adapterPackages = new List<string>();
|
|
44
43
|
|
|
45
44
|
public static Color btnColor;
|
|
@@ -62,64 +61,42 @@ namespace Amanotes.Editor
|
|
|
62
61
|
if (sdk != null) sdk.transform.hideFlags = HideFlags.HideInInspector;
|
|
63
62
|
|
|
64
63
|
SDKStatus.ClearCache();
|
|
65
|
-
|
|
64
|
+
RefreshConfigStatus();
|
|
66
65
|
RefreshListAdapters();
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
internal enum ConfigAssetStatus
|
|
70
69
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Resources.UnloadUnusedAssets();
|
|
77
|
-
|
|
78
|
-
configAsset = Resources.Load<ConfigAsset>("AmaGDKConfig");
|
|
79
|
-
invalidConfigAsset = configAsset == null ? Resources.Load("AmaGDKConfig") : null;
|
|
80
|
-
|
|
81
|
-
RefreshListAdapters();
|
|
82
|
-
SDKStatus.ClearCache();
|
|
83
|
-
Repaint();
|
|
70
|
+
None,
|
|
71
|
+
ScriptNotFound,
|
|
72
|
+
AssetNotFound,
|
|
73
|
+
AssetIsInvalid,
|
|
74
|
+
AssetOk
|
|
84
75
|
}
|
|
76
|
+
|
|
77
|
+
[NonSerialized] internal static ConfigAssetStatus cfgStatus = ConfigAssetStatus.None;
|
|
85
78
|
|
|
86
|
-
|
|
79
|
+
void RefreshConfigStatus()
|
|
87
80
|
{
|
|
88
|
-
|
|
89
|
-
if (
|
|
81
|
+
string[] scriptGUIDs = AssetDatabase.FindAssets("t:MonoScript AmaGDKConfigAsset");
|
|
82
|
+
if (scriptGUIDs.Length == 0)
|
|
90
83
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
} else
|
|
84
|
+
cfgStatus = ConfigAssetStatus.ScriptNotFound;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
string[] assetGUIDs = AssetDatabase.FindAssets("t:ConfigAsset");
|
|
89
|
+
if (assetGUIDs.Length == 0)
|
|
98
90
|
{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
{
|
|
102
|
-
if (AmaGUI.BigButton("CREATE", 40f, BLUE))
|
|
103
|
-
{
|
|
104
|
-
AssetDatabase.ImportPackage(Res.AMAGDK_CONFIG_PACKAGE, false);
|
|
105
|
-
|
|
106
|
-
ScriptableObject config = CreateInstance("Amanotes.Core.AmaGDKConfigAsset");
|
|
107
|
-
AssetDatabase.CreateAsset(config, "Assets/AmaGDK/Resources/AmaGDKConfig.asset");
|
|
108
|
-
AssetDatabase.SaveAssets();
|
|
109
|
-
TryLoadConfigAsset();
|
|
110
|
-
adapterScanned = false;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (GUILayout.Button(EditorGUIUtility.IconContent("d_Refresh@2x"), GUILayout.Width(40f), GUILayout.Height(40f)))
|
|
114
|
-
{
|
|
115
|
-
TryLoadConfigAsset();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
GUILayout.EndHorizontal();
|
|
91
|
+
cfgStatus = ConfigAssetStatus.AssetNotFound;
|
|
92
|
+
return;
|
|
119
93
|
}
|
|
120
|
-
|
|
94
|
+
|
|
95
|
+
configAsset = Resources.Load<ConfigAsset>("AmaGDKConfig");
|
|
96
|
+
cfgStatus = configAsset != null ? ConfigAssetStatus.AssetOk : ConfigAssetStatus.AssetIsInvalid;
|
|
97
|
+
if (cfgStatus == ConfigAssetStatus.AssetOk) adapterScanned = false;
|
|
121
98
|
}
|
|
122
|
-
|
|
99
|
+
|
|
123
100
|
private void DrawGUI_AutoInitDisabled()
|
|
124
101
|
{
|
|
125
102
|
if (sdk.autoInit) return;
|
|
@@ -130,21 +107,7 @@ namespace Amanotes.Editor
|
|
|
130
107
|
EditorUtility.SetDirty(sdk);
|
|
131
108
|
}
|
|
132
109
|
}
|
|
133
|
-
|
|
134
|
-
private void DrawGUI_ConfigDetail()
|
|
135
|
-
{
|
|
136
|
-
CreateCachedEditor(configAsset, null, ref editor);
|
|
137
|
-
float lbWidth = EditorGUIUtility.labelWidth;
|
|
138
|
-
EditorGUIUtility.labelWidth = 220f;
|
|
139
|
-
editor.OnInspectorGUI();
|
|
140
|
-
EditorGUIUtility.labelWidth = lbWidth;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private void DrawGUI_ConfigAsset()
|
|
144
|
-
{
|
|
145
|
-
EditorGUILayout.ObjectField(configAsset, configAsset.GetType(), false, GUILayout.Width(EditorGUIUtility.currentViewWidth - 414), GUILayout.ExpandWidth(true));
|
|
146
|
-
}
|
|
147
|
-
|
|
110
|
+
|
|
148
111
|
private void ScanForAdapterPackages()
|
|
149
112
|
{
|
|
150
113
|
adapterScanned = true;
|
|
@@ -193,26 +156,26 @@ namespace Amanotes.Editor
|
|
|
193
156
|
}
|
|
194
157
|
}
|
|
195
158
|
|
|
196
|
-
private void DrawGUI_ExampleScene()
|
|
197
|
-
{
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
private void DrawGUI_ColorPicker()
|
|
207
|
-
{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
159
|
+
// private void DrawGUI_ExampleScene()
|
|
160
|
+
// {
|
|
161
|
+
// var examplePackageName = "AmaGDKExample";
|
|
162
|
+
// if (GUILayout.Button(ObjectNames.NicifyVariableName(examplePackageName)))
|
|
163
|
+
// {
|
|
164
|
+
// var package = $"{Res.PACKAGE_PATH}{examplePackageName}.unitypackage";
|
|
165
|
+
// AssetDatabase.ImportPackage(package, false);
|
|
166
|
+
// }
|
|
167
|
+
// }
|
|
168
|
+
|
|
169
|
+
// private void DrawGUI_ColorPicker()
|
|
170
|
+
// {
|
|
171
|
+
// GUILayout.BeginHorizontal();
|
|
172
|
+
// {
|
|
173
|
+
// btnColor = EditorGUILayout.ColorField(btnColor);
|
|
174
|
+
// btnLerp = EditorGUILayout.Slider(btnLerp, -1f, 1f);
|
|
175
|
+
// }
|
|
176
|
+
// GUILayout.EndHorizontal();
|
|
177
|
+
// }
|
|
178
|
+
|
|
216
179
|
// public void CopyVersion()
|
|
217
180
|
// {
|
|
218
181
|
// var sb = new StringBuilder();
|
|
@@ -236,7 +199,7 @@ namespace Amanotes.Editor
|
|
|
236
199
|
// EditorGUIUtility.systemCopyBuffer = tsv;
|
|
237
200
|
// Debug.Log($"Content of version_info.tsv copied to clipboard!\n\n{tsv}\n\n");
|
|
238
201
|
// }
|
|
239
|
-
|
|
202
|
+
|
|
240
203
|
void ShowAmaGDKContext()
|
|
241
204
|
{
|
|
242
205
|
var menu = new GenericMenu();
|
|
@@ -286,11 +249,6 @@ namespace Amanotes.Editor
|
|
|
286
249
|
AmaGUI.SectionLabel(bannerTitle);
|
|
287
250
|
var rect = GUILayoutUtility.GetLastRect();
|
|
288
251
|
var btnRect = rect;
|
|
289
|
-
|
|
290
|
-
// btnRect.x = 4f;
|
|
291
|
-
// btnRect.width = 24f; //btnRect.xMax -
|
|
292
|
-
// btnRect.yMin = btnRect.yMax - 32f;
|
|
293
|
-
|
|
294
252
|
btnRect.xMin = btnRect.xMax - 24f;
|
|
295
253
|
btnRect.yMin = btnRect.yMax - 32f;
|
|
296
254
|
|
|
@@ -301,6 +259,55 @@ namespace Amanotes.Editor
|
|
|
301
259
|
}
|
|
302
260
|
}
|
|
303
261
|
|
|
262
|
+
void DrawGUI_GDKConfig()
|
|
263
|
+
{
|
|
264
|
+
if (cfgStatus == ConfigAssetStatus.None) RefreshConfigStatus();
|
|
265
|
+
if (cfgStatus == ConfigAssetStatus.ScriptNotFound
|
|
266
|
+
|| cfgStatus == ConfigAssetStatus.AssetIsInvalid)
|
|
267
|
+
{
|
|
268
|
+
// Automatically import GDKConfigAsset
|
|
269
|
+
AssetDatabase.ImportPackage(Res.AMAGDK_CONFIG_PACKAGE, false);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (cfgStatus == ConfigAssetStatus.AssetNotFound)
|
|
274
|
+
{
|
|
275
|
+
EditorGUILayout.HelpBox("[Warning] <Resources/AmaGDKConfig.asset> NOT FOUND!\nYou need to create one to control all the adapter's configurations!", MessageType.Warning);
|
|
276
|
+
GUILayout.BeginHorizontal();
|
|
277
|
+
{
|
|
278
|
+
if (AmaGUI.BigButton("CREATE", 40f, BLUE))
|
|
279
|
+
{
|
|
280
|
+
ScriptableObject config = CreateInstance("Amanotes.Core.AmaGDKConfigAsset");
|
|
281
|
+
var resourcePath = "Assets/AmaGDK/Resources";
|
|
282
|
+
Directory.CreateDirectory(resourcePath);
|
|
283
|
+
|
|
284
|
+
AssetDatabase.CreateAsset(config, Path.Combine(resourcePath, "AmaGDKConfig.asset"));
|
|
285
|
+
AssetDatabase.SaveAssets();
|
|
286
|
+
RefreshConfigStatus();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (GUILayout.Button(EditorGUIUtility.IconContent("d_Refresh@2x"), GUILayout.Width(40f), GUILayout.Height(40f)))
|
|
290
|
+
{
|
|
291
|
+
RefreshConfigStatus();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
GUILayout.EndHorizontal();
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (configAsset == null)
|
|
299
|
+
{
|
|
300
|
+
Debug.LogWarning("Have you just deleted AmaGDKConfig.asset?" + cfgStatus);
|
|
301
|
+
cfgStatus = ConfigAssetStatus.None;
|
|
302
|
+
Repaint();
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
EditorGUILayout.ObjectField(configAsset, configAsset.GetType(), false,
|
|
307
|
+
GUILayout.Width(EditorGUIUtility.currentViewWidth - 414),
|
|
308
|
+
GUILayout.ExpandWidth(true));
|
|
309
|
+
}
|
|
310
|
+
|
|
304
311
|
public override void OnInspectorGUI()
|
|
305
312
|
{
|
|
306
313
|
Profiler.BeginSample("GDKEditor.OnInspectorGUI()");
|
|
@@ -322,7 +329,6 @@ namespace Amanotes.Editor
|
|
|
322
329
|
return;
|
|
323
330
|
}
|
|
324
331
|
|
|
325
|
-
|
|
326
332
|
// DrawGUI_ColorPicker();
|
|
327
333
|
DrawGUI_AmaGDKBanner();
|
|
328
334
|
EditorGUILayout.Space();
|
|
@@ -330,23 +336,23 @@ namespace Amanotes.Editor
|
|
|
330
336
|
|
|
331
337
|
if (EditorApplication.isCompiling || EditorApplication.isUpdating)
|
|
332
338
|
{
|
|
339
|
+
cfgStatus = ConfigAssetStatus.None;
|
|
333
340
|
EditorGUILayout.HelpBox("Please wait for UnityEditor to finish compiling or importing", MessageType.Warning);
|
|
334
341
|
Profiler.EndSample();
|
|
335
342
|
return;
|
|
336
343
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (!extraScanned) ScanForAdapterPackages();
|
|
341
|
-
|
|
344
|
+
|
|
345
|
+
DrawGUI_GDKConfig();
|
|
346
|
+
|
|
342
347
|
if (configAsset == null)
|
|
343
348
|
{
|
|
344
|
-
DrawGUI_ConfigMissing();
|
|
345
|
-
Repaint();
|
|
346
349
|
Profiler.EndSample();
|
|
347
350
|
return;
|
|
348
351
|
}
|
|
349
|
-
|
|
352
|
+
|
|
353
|
+
if (!adapterScanned) ScanForAdapterPackages();
|
|
354
|
+
if (!extraScanned) ScanForAdapterPackages();
|
|
355
|
+
|
|
350
356
|
configSO = new SerializedObject(configAsset);
|
|
351
357
|
configSO.Update();
|
|
352
358
|
DrawProperty(configSO, "common", true);
|
|
@@ -354,6 +360,7 @@ namespace Amanotes.Editor
|
|
|
354
360
|
DrawProperty(configSO, "enableServerTime", false);
|
|
355
361
|
DrawProperty(configSO, "enableGeoLocation", false);
|
|
356
362
|
GUILayout.Space(8f);
|
|
363
|
+
|
|
357
364
|
for (var i = 0; i < allAdapters.Count; i++)
|
|
358
365
|
{
|
|
359
366
|
var item = allAdapters[i];
|
|
@@ -364,6 +371,13 @@ namespace Amanotes.Editor
|
|
|
364
371
|
AmaGUI.Foldout("Adapters", ref showAdapterInstaller, DrawGUI_AdapterList);
|
|
365
372
|
AmaGUI.Foldout("Extras", ref showExtra, DrawGUI_ExtraList);
|
|
366
373
|
EditorGUILayout.ObjectField("Config", configAsset, typeof(ScriptableObject), false);
|
|
374
|
+
|
|
375
|
+
EditorGUILayout.Space();
|
|
376
|
+
if (GUILayout.Button("Reimport Adapters", GUILayout.Height(30)))
|
|
377
|
+
{
|
|
378
|
+
GDKAutoUpdateAdapter.ImportAdapters();
|
|
379
|
+
}
|
|
380
|
+
|
|
367
381
|
Profiler.EndSample();
|
|
368
382
|
}
|
|
369
383
|
|
|
@@ -378,22 +392,6 @@ namespace Amanotes.Editor
|
|
|
378
392
|
return result;
|
|
379
393
|
}
|
|
380
394
|
|
|
381
|
-
|
|
382
|
-
private static List<Type> FindSubClassesOf(Type baseType)
|
|
383
|
-
{
|
|
384
|
-
List<Type> result = new List<Type>();
|
|
385
|
-
|
|
386
|
-
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
387
|
-
foreach (Assembly assembly in assemblies)
|
|
388
|
-
{
|
|
389
|
-
if (!assembly.FullName.Contains("Assembly-CSharp")) continue;
|
|
390
|
-
if (!assembly.FullName.Contains("Editor")) continue;
|
|
391
|
-
Debug.Log(assembly.FullName);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
return result;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
395
|
private static void RefreshListAdapters()
|
|
398
396
|
{
|
|
399
397
|
allAdapters = SDK_IDS
|
|
@@ -405,12 +403,12 @@ namespace Amanotes.Editor
|
|
|
405
403
|
.ToList();
|
|
406
404
|
}
|
|
407
405
|
|
|
408
|
-
private static string
|
|
406
|
+
private static List<string> FindPackagesFor(string adapterId)
|
|
409
407
|
{
|
|
410
|
-
|
|
411
|
-
.Where(item => item.ToLower().Contains(adapterId.ToLower()))
|
|
412
|
-
|
|
413
|
-
|
|
408
|
+
return adapterPackages
|
|
409
|
+
.Where(item => item.ToLower().Contains(adapterId.ToLower()))
|
|
410
|
+
.OrderBy(item => item.Length)
|
|
411
|
+
.ToList();
|
|
414
412
|
}
|
|
415
413
|
|
|
416
414
|
private static void DrawAdapterDetail(string adapterId, Adapter2 adapter)
|
|
@@ -431,19 +429,21 @@ namespace Amanotes.Editor
|
|
|
431
429
|
if (adapter != null)
|
|
432
430
|
{
|
|
433
431
|
DrawSDKConfig(adapter, adapterId, status);
|
|
434
|
-
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
var packages = FindPackagesFor(adapterId);
|
|
435
|
+
EditorGUI.BeginDisabledGroup(!status.sdkInstalled);
|
|
435
436
|
{
|
|
436
|
-
|
|
437
|
-
var package = $"{Res.PACKAGE_PATH}{adapterName}";
|
|
438
|
-
EditorGUI.BeginDisabledGroup(!status.sdkInstalled);
|
|
437
|
+
foreach (var package in packages)
|
|
439
438
|
{
|
|
440
|
-
|
|
439
|
+
var packagePath = $"{Res.PACKAGE_PATH}{package}";
|
|
440
|
+
if (GUILayout.Button(GetGUIContent($"Import {package.Replace(".unitypackage", "")}"), GUILayout.Height(24f)))
|
|
441
441
|
{
|
|
442
|
-
AssetDatabase.ImportPackage(
|
|
443
|
-
}
|
|
442
|
+
AssetDatabase.ImportPackage(packagePath, false);
|
|
443
|
+
}
|
|
444
444
|
}
|
|
445
|
-
EditorGUI.EndDisabledGroup();
|
|
446
445
|
}
|
|
446
|
+
EditorGUI.EndDisabledGroup();
|
|
447
447
|
|
|
448
448
|
}, () =>
|
|
449
449
|
{
|
|
@@ -484,8 +484,6 @@ namespace Amanotes.Editor
|
|
|
484
484
|
}
|
|
485
485
|
});
|
|
486
486
|
|
|
487
|
-
|
|
488
|
-
|
|
489
487
|
if (changed) configOpen[adapterId] = isOpen;
|
|
490
488
|
}
|
|
491
489
|
|
|
@@ -28,32 +28,32 @@ namespace Amanotes.Editor
|
|
|
28
28
|
{ "AndroidPostProcessor", $"{Res.EXTRA_PATH}PostProcessor.unitypackage" }
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private static void CheckImportedAssets(string[] importedAssets)
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
31
|
+
// private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
|
|
32
|
+
// {
|
|
33
|
+
// #if AMAGDK_DEV
|
|
34
|
+
// return;
|
|
35
|
+
// #endif
|
|
36
|
+
//
|
|
37
|
+
// #pragma warning disable CS0162
|
|
38
|
+
// CheckImportedAssets(importedAssets);
|
|
39
|
+
// #pragma warning restore CS0162
|
|
40
|
+
// }
|
|
41
|
+
//
|
|
42
|
+
// private static void CheckImportedAssets(string[] importedAssets)
|
|
43
|
+
// {
|
|
44
|
+
// if (importedAssets.Length == 0) return;
|
|
45
|
+
// // Debug.LogWarning($"importedAssets: {string.Join("\n", importedAssets)}");
|
|
46
|
+
//
|
|
47
|
+
// foreach (string path in importedAssets)
|
|
48
|
+
// {
|
|
49
|
+
// if (!path.EndsWith("AmaGDK.cs", StringComparison.InvariantCulture)) continue;
|
|
50
|
+
// ImportAdapters();
|
|
51
|
+
// break;
|
|
52
|
+
// }
|
|
53
|
+
// }
|
|
54
54
|
|
|
55
55
|
[MenuItem("Window/AmaGDK/Reimport Adapters")]
|
|
56
|
-
|
|
56
|
+
public static void ImportAdapters()
|
|
57
57
|
{
|
|
58
58
|
var packages = new List<string>();
|
|
59
59
|
foreach (KeyValuePair<string, string> kvp in packageMap)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/Runtime/Ad/AdLogic.cs
CHANGED
|
@@ -131,7 +131,11 @@ namespace Amanotes.Core.Internal
|
|
|
131
131
|
private Coroutine _showAdRoutine;
|
|
132
132
|
protected bool _isRequesting;
|
|
133
133
|
protected bool _isInterstitial => adType == AdType.Interstitial;
|
|
134
|
+
|
|
135
|
+
// Do not warn unused variable, it's been use outside of Editor (Runtime)
|
|
136
|
+
#pragma warning disable
|
|
134
137
|
private bool isFocus;
|
|
138
|
+
#pragma warning enable
|
|
135
139
|
|
|
136
140
|
public void StartShowAd()
|
|
137
141
|
{
|
|
@@ -285,7 +289,7 @@ namespace Amanotes.Core.Internal
|
|
|
285
289
|
while (!isFocus) yield return null;
|
|
286
290
|
#endif
|
|
287
291
|
|
|
288
|
-
|
|
292
|
+
var wait4CallbackCounter = 0;
|
|
289
293
|
while (!context.potentiallyCompleted && wait4CallbackCounter <= MAX_FRAMES_WAIT_FOR_CALLBACK)
|
|
290
294
|
{
|
|
291
295
|
wait4CallbackCounter++;
|
package/Runtime/Ad/AmaGDK.Ads.cs
CHANGED
|
@@ -157,7 +157,7 @@ namespace Amanotes.Core
|
|
|
157
157
|
{
|
|
158
158
|
if (Adapter2.GetAllAdapter<AdAdapter>().Count > 1)
|
|
159
159
|
{
|
|
160
|
-
|
|
160
|
+
GDKUtils.ThrowExceptionIfEditor("Multiple AdAdapters is not supported!");
|
|
161
161
|
}
|
|
162
162
|
_adapter = Adapter2.GetAdapter<AdAdapter>();
|
|
163
163
|
return _adapter != null;
|
|
@@ -6,9 +6,7 @@ using static Amanotes.Core.GDKDebug;
|
|
|
6
6
|
|
|
7
7
|
namespace Amanotes.Core.Internal
|
|
8
8
|
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
public abstract partial class Adapter2
|
|
9
|
+
public abstract class GDKInternal
|
|
12
10
|
{
|
|
13
11
|
protected internal enum ConfigStatus
|
|
14
12
|
{
|
|
@@ -17,6 +15,11 @@ namespace Amanotes.Core.Internal
|
|
|
17
15
|
Warning
|
|
18
16
|
}
|
|
19
17
|
|
|
18
|
+
internal protected static Action<string, string, double> _onAdImpression;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public abstract partial class Adapter2 : GDKInternal
|
|
22
|
+
{
|
|
20
23
|
// internal use
|
|
21
24
|
[HideInNormalInspector] [SerializeField] internal int initOrder;
|
|
22
25
|
[HideInNormalInspector] [SerializeField] internal bool enabled = true;
|
|
@@ -415,7 +415,7 @@ namespace Amanotes.Core
|
|
|
415
415
|
{
|
|
416
416
|
if (eventData.isLoggedImmediately) continue;
|
|
417
417
|
if (Config.analytics.immediatelyLoggedEvents.Contains(eventData.eventName)){
|
|
418
|
-
|
|
418
|
+
GDKUtils.ThrowExceptionIfEditor($"This event '{eventData.eventName}' must be sent immediately by AmaGDK.Analytics.LogEvent(eventName).LogImmediately()");
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
LogEventActually(eventData);
|
|
@@ -443,7 +443,7 @@ namespace Amanotes.Core
|
|
|
443
443
|
|
|
444
444
|
if (config.showAnalyticsLog)
|
|
445
445
|
{
|
|
446
|
-
ForceLog($"
|
|
446
|
+
ForceLog($"[Analytics] Event <{eventNameToSend}> (in session: {countInSession}, total: {totalCount})\n{JsonUtils.DictionaryToJson(eventParams.parameters, true)}");
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
config.quality.CheckEventQuality(eventParams.eventName, eventParams.parameters);
|
|
@@ -493,7 +493,7 @@ namespace Amanotes.Core
|
|
|
493
493
|
int.TryParse(eventData.parameters[ACCUMULATED_COUNT].ToString(), out int oriAccCount);
|
|
494
494
|
if (oriAccCount != countByGDK)
|
|
495
495
|
{
|
|
496
|
-
|
|
496
|
+
// Log($"[Analytics] event <{eventData.eventName}>, game count: {oriAccCount}, AmaGDK count: {countByGDK}");
|
|
497
497
|
if (Config.analytics.migrateAccumulatedCount && !eventData.withinSession)
|
|
498
498
|
{
|
|
499
499
|
Log($"[Analytics] Update event count of event <{eventData.eventName}> from {countByGDK} to {oriAccCount}");
|
|
@@ -915,6 +915,27 @@ namespace Amanotes.Core
|
|
|
915
915
|
|
|
916
916
|
public static class EventParamsExtension
|
|
917
917
|
{
|
|
918
|
+
internal static string AppendEventErrorDetail(this string message, string eventName, string eventParamName, string eventParamValue)
|
|
919
|
+
{
|
|
920
|
+
return $"{message}\n{GetEventErrorDetail(eventName, eventParamName, eventParamValue)}";
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
internal static string GetEventErrorDetail(string eventName, string eventParamName, string eventParamValue)
|
|
924
|
+
{
|
|
925
|
+
string key = eventParamName == null
|
|
926
|
+
? "null" : string.IsNullOrWhiteSpace(eventParamName)
|
|
927
|
+
? "\"\""
|
|
928
|
+
: eventParamName;
|
|
929
|
+
|
|
930
|
+
string value = eventParamValue == null
|
|
931
|
+
? "null" : string.IsNullOrWhiteSpace(eventParamValue)
|
|
932
|
+
? "\"\""
|
|
933
|
+
: eventParamValue;
|
|
934
|
+
|
|
935
|
+
return $"Event <{eventName}> {{ {key} : {value}, ... }}\n";
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
|
|
918
939
|
public static void LogImmediately(this IEventParamsBuilder ap)
|
|
919
940
|
{
|
|
920
941
|
if (ap == null) return;
|
|
@@ -927,7 +948,7 @@ namespace Amanotes.Core
|
|
|
927
948
|
public static IEventParamsBuilder AttachParam_TimeDiffLastFire(this IEventParamsBuilder ap)
|
|
928
949
|
{
|
|
929
950
|
var data = ap as EventParams;
|
|
930
|
-
return data?.AddParam("time_diff_last_fire",
|
|
951
|
+
return data?.AddParam("time_diff_last_fire", GDKUtils.GetTimeDiffLastFire(data.eventName));
|
|
931
952
|
}
|
|
932
953
|
|
|
933
954
|
public static IEventParamsBuilder AttachParam_InternetConnectionStatus(this IEventParamsBuilder ap)
|
|
@@ -1089,35 +1110,46 @@ namespace Amanotes.Core
|
|
|
1089
1110
|
{
|
|
1090
1111
|
string eventName = (ap as EventParams)?.eventName;
|
|
1091
1112
|
|
|
1092
|
-
var sb = GDKPool.GetStringBuilder();
|
|
1093
|
-
sb.Clear();
|
|
1094
|
-
NormalizeKeyString(ref key, sb, AmaGDK.Config.analytics.normalizeEventName);
|
|
1095
|
-
|
|
1096
|
-
if (sb.Length > 0) LogWarningOnce($"Warning for event <{eventName}>, param <{key}>:\n{sb}", $"NormalizeParamKey <{eventName}>");
|
|
1097
|
-
GDKPool.Return(sb);
|
|
1098
|
-
|
|
1099
|
-
if (string.IsNullOrWhiteSpace(key))
|
|
1100
|
-
{
|
|
1101
|
-
LogWarning($"Param key is empty. Event name: {eventName}!");
|
|
1102
|
-
return false;
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
1113
|
if (value == null)
|
|
1106
1114
|
{
|
|
1107
|
-
LogWarning($"
|
|
1115
|
+
LogWarning($"[Analytics] parameter value should not be null!"
|
|
1116
|
+
.AppendEventErrorDetail(eventName, key, null)
|
|
1117
|
+
);
|
|
1108
1118
|
return false;
|
|
1109
1119
|
}
|
|
1110
|
-
|
|
1120
|
+
|
|
1111
1121
|
if (value is string stringValue)
|
|
1112
1122
|
{
|
|
1113
1123
|
var strLimit = 100;
|
|
1114
1124
|
if (stringValue.Length > strLimit)
|
|
1115
1125
|
{
|
|
1116
1126
|
value = stringValue.Substring(0, strLimit);
|
|
1117
|
-
LogWarning($"
|
|
1127
|
+
LogWarning($"[Analytics] parameter value length = {stringValue.Length} > {strLimit} chars!"
|
|
1128
|
+
.AppendEventErrorDetail(eventName, key, stringValue));
|
|
1118
1129
|
}
|
|
1119
1130
|
}
|
|
1120
1131
|
|
|
1132
|
+
string valueString;
|
|
1133
|
+
if (string.IsNullOrWhiteSpace(key))
|
|
1134
|
+
{
|
|
1135
|
+
valueString = (string)Convert.ChangeType(value, typeof(string));
|
|
1136
|
+
LogWarning($"[Analytics] parameter name should not be null or empty!"
|
|
1137
|
+
.AppendEventErrorDetail(eventName, key, valueString));
|
|
1138
|
+
return false;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
StringBuilder sb = GDKPool.GetStringBuilder();
|
|
1142
|
+
sb.Clear();
|
|
1143
|
+
NormalizeKeyString(ref key, sb, AmaGDK.Config.analytics.normalizeEventName);
|
|
1144
|
+
if (sb.Length > 0)
|
|
1145
|
+
{
|
|
1146
|
+
valueString = (string)Convert.ChangeType(value, typeof(string));
|
|
1147
|
+
var onceKey = $"NormalizeParamKey <{eventName}>";
|
|
1148
|
+
var onceMessage = $"[Analytics] normalized KeyValue applied for {GetEventErrorDetail(eventName, key, valueString)}\n{sb}";
|
|
1149
|
+
LogWarningOnce(onceMessage, onceKey);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
GDKPool.Return(sb);
|
|
1121
1153
|
return true;
|
|
1122
1154
|
}
|
|
1123
1155
|
}
|
package/Runtime/AmaGDK.cs
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using System.Collections;
|
|
3
|
-
using System.Collections.Generic;
|
|
4
|
-
using System.Diagnostics;
|
|
5
2
|
using System.IO;
|
|
6
3
|
using System.Text;
|
|
7
|
-
using System.Text.RegularExpressions;
|
|
8
|
-
using Amanotes.Core.Internal;
|
|
9
4
|
using System.Linq;
|
|
5
|
+
using System.Diagnostics;
|
|
6
|
+
using System.Collections;
|
|
7
|
+
using System.Collections.Generic;
|
|
8
|
+
using System.Text.RegularExpressions;
|
|
9
|
+
|
|
10
10
|
using UnityEngine;
|
|
11
11
|
using UnityEngine.Profiling;
|
|
12
|
+
using Debug = UnityEngine.Debug;
|
|
13
|
+
|
|
14
|
+
using Amanotes.Core.Internal;
|
|
12
15
|
using static Amanotes.Core.GDKDebug;
|
|
13
16
|
using static Amanotes.Core.Internal.Messsage;
|
|
14
|
-
|
|
17
|
+
|
|
18
|
+
#if UNITY_EDITOR
|
|
19
|
+
using UnityEditor;
|
|
20
|
+
using UnityEditor.PackageManager;
|
|
21
|
+
#endif
|
|
15
22
|
|
|
16
23
|
namespace Amanotes.Core
|
|
17
24
|
{
|
|
18
25
|
public partial class AmaGDK : MonoBehaviour
|
|
19
26
|
{
|
|
20
|
-
public const string VERSION = "0.2.
|
|
27
|
+
public const string VERSION = "0.2.73";
|
|
21
28
|
|
|
22
29
|
internal static Status _status = Status.None;
|
|
23
30
|
private static ConfigAsset _config = null;
|
|
@@ -210,7 +217,7 @@ namespace Amanotes.Core
|
|
|
210
217
|
LogEvent_GDKInit(Mathf.RoundToInt(initDuration));
|
|
211
218
|
|
|
212
219
|
sb.Append($"\nMapping UserId: {User.UserId}\n");
|
|
213
|
-
ForceLog($"
|
|
220
|
+
ForceLog($"v{VERSION} | {READY} in {initDuration:#0.00}s\n\n{sb}");
|
|
214
221
|
GDKPool.Return(sb);
|
|
215
222
|
}
|
|
216
223
|
|
|
@@ -437,8 +444,8 @@ namespace Amanotes.Core
|
|
|
437
444
|
const string manifestPath = "Packages/manifest.json";
|
|
438
445
|
string manifestJson = File.ReadAllText(manifestPath);
|
|
439
446
|
|
|
440
|
-
|
|
441
|
-
|
|
447
|
+
var pattern = "\"com\\.amanotes\\.gdk\": \"(.*)\"";
|
|
448
|
+
var devModeEntry = $"\"com.amanotes.gdk\": \"{strDesired}\"";
|
|
442
449
|
|
|
443
450
|
manifestJson = Regex.Replace(manifestJson, pattern, devModeEntry);
|
|
444
451
|
File.WriteAllText(manifestPath, manifestJson);
|
|
@@ -448,6 +455,9 @@ namespace Amanotes.Core
|
|
|
448
455
|
Debug.LogWarning($"AmaGDK changes to dev mode failed. The expected value is: {devModeEntry}");
|
|
449
456
|
return;
|
|
450
457
|
}
|
|
458
|
+
|
|
459
|
+
AssetDatabase.Refresh();
|
|
460
|
+
Client.Resolve();
|
|
451
461
|
Debug.Log("AmaGDK changes to dev mode successfully");
|
|
452
462
|
}
|
|
453
463
|
catch (Exception e)
|
package/Runtime/Core/GDKDebug.cs
CHANGED
|
@@ -33,7 +33,11 @@ namespace Amanotes.Core
|
|
|
33
33
|
dictionary.Add("processor_frequency", SystemInfo.processorFrequency);
|
|
34
34
|
dictionary.Add("screen_width", resolution.width);
|
|
35
35
|
dictionary.Add("screen_height", resolution.height);
|
|
36
|
+
#if UNITY_2022_2_OR_NEWER
|
|
37
|
+
dictionary.Add("screen_refresh_rate", resolution.refreshRateRatio.value);
|
|
38
|
+
#else
|
|
36
39
|
dictionary.Add("screen_refresh_rate", resolution.refreshRate);
|
|
40
|
+
#endif
|
|
37
41
|
}
|
|
38
42
|
internal static void InjectDeviceStatus(Dictionary<string, object> dictionary)
|
|
39
43
|
{
|
|
@@ -197,8 +197,13 @@ namespace Amanotes.Core
|
|
|
197
197
|
{
|
|
198
198
|
graphic = GetComponent<Graphic>()
|
|
199
199
|
};
|
|
200
|
-
|
|
200
|
+
|
|
201
|
+
#if UNITY_2022_2_OR_NEWER
|
|
202
|
+
Application.targetFrameRate = (int)Screen.currentResolution.refreshRateRatio.value;
|
|
203
|
+
#else
|
|
201
204
|
Application.targetFrameRate = Screen.currentResolution.refreshRate;
|
|
205
|
+
#endif
|
|
206
|
+
|
|
202
207
|
Log($"Target FrameRate: {Application.targetFrameRate}");
|
|
203
208
|
}
|
|
204
209
|
|
|
@@ -24,7 +24,7 @@ namespace Amanotes.Core
|
|
|
24
24
|
GDKAudio.EnsureDecompressOnLoad(legacyAudioSource.clip);
|
|
25
25
|
if (legacyAudioSource.gameObject.GetComponents<AudioSource>().Length > 1)
|
|
26
26
|
{
|
|
27
|
-
|
|
27
|
+
GDKUtils.ThrowExceptionIfEditor("GDKAudio only allows the GameObject to contain a single AudioSource component.");
|
|
28
28
|
}
|
|
29
29
|
var instance = legacyAudioSource.gameObject.AddComponent<GDKAudio>();
|
|
30
30
|
if (legacyAudioSource.clip != null)
|
|
@@ -101,7 +101,7 @@ namespace Amanotes.Core
|
|
|
101
101
|
}
|
|
102
102
|
catch (Exception ex)
|
|
103
103
|
{
|
|
104
|
-
|
|
104
|
+
GDKUtils.ThrowExceptionIfEditor(ex.ToString());
|
|
105
105
|
}
|
|
106
106
|
return this;
|
|
107
107
|
}
|
|
@@ -121,12 +121,12 @@ namespace Amanotes.Core
|
|
|
121
121
|
}
|
|
122
122
|
if (gameObject.GetComponents<AudioSource>().Length > 1)
|
|
123
123
|
{
|
|
124
|
-
|
|
124
|
+
GDKUtils.ThrowExceptionIfEditor("GDKAudio only allows the GameObject to contain a single AudioSource component.");
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
if (gameObject.GetComponents<GDKAudio>().Length > 1)
|
|
128
128
|
{
|
|
129
|
-
|
|
129
|
+
GDKUtils.ThrowExceptionIfEditor("GDKAudio only allows the GameObject to contain a single GDKAudio component.");
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -140,7 +140,7 @@ namespace Amanotes.Core
|
|
|
140
140
|
{
|
|
141
141
|
if (clip != null && clip.loadType != AudioClipLoadType.DecompressOnLoad)
|
|
142
142
|
{
|
|
143
|
-
|
|
143
|
+
GDKUtils.ThrowExceptionIfEditor("GDKAudio only supports AudioClips with Load Type set to Decompress On Load.");
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -48,6 +48,7 @@ namespace Amanotes.Core.Internal
|
|
|
48
48
|
[MenuItem("GameObject/AmaGDK/Add AmaGDK Prefab", false, 10)]
|
|
49
49
|
private static void AddAmaGDKPrefab()
|
|
50
50
|
{
|
|
51
|
+
AssetDatabase.ImportPackage(Res.AMAGDK_CONFIG_PACKAGE, false);
|
|
51
52
|
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(AMAGDK_PREFAB);
|
|
52
53
|
if (prefab == null)
|
|
53
54
|
{
|
|
@@ -171,7 +172,7 @@ namespace Amanotes.Core.Internal
|
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
public static class
|
|
175
|
+
public static partial class GDKUtils // Hidden Utils
|
|
175
176
|
{
|
|
176
177
|
private static readonly Dictionary<string, float> LastFireInSessions = new Dictionary<string, float>();
|
|
177
178
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
using System.Collections.Generic;
|
|
2
2
|
using System.Reflection;
|
|
3
|
+
using Amanotes.Core.Internal;
|
|
3
4
|
using UnityEngine;
|
|
4
5
|
|
|
5
6
|
namespace Amanotes.Core
|
|
@@ -9,7 +10,7 @@ namespace Amanotes.Core
|
|
|
9
10
|
public override object Convert(object parent, FieldInfo fieldInfo, object param)
|
|
10
11
|
{
|
|
11
12
|
string name = parent.GetType().FullName;
|
|
12
|
-
return
|
|
13
|
+
return GDKUtils.GetTimeDiffLastFire(name);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
|