com.amanotes.gdk 0.2.71 → 0.2.73-1
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 +108 -88
- package/Editor/AmaGDKEditor.cs +133 -135
- package/Editor/EmbedRemoteConfigAssetInspector.cs +1 -1
- package/Editor/Extra/GDKAutoUpdateAdapter.cs +24 -24
- package/Editor/Extra/GDKCIBuildCommand.cs +2 -16
- 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/AdExtension.cs +2 -1
- package/Runtime/Ad/AdLogic.cs +10 -5
- package/Runtime/Ad/AmaGDK.Ads.cs +2 -2
- package/Runtime/AmaGDK.Adapters.cs +7 -4
- package/Runtime/AmaGDK.Analytics.cs +67 -48
- package/Runtime/AmaGDK.Config.cs +1 -7
- package/Runtime/AmaGDK.Consent.cs +9 -8
- package/Runtime/AmaGDK.Context.cs +1 -1
- package/Runtime/AmaGDK.Device.cs +3 -2
- package/Runtime/AmaGDK.IAP.cs +1 -1
- package/Runtime/AmaGDK.RemoteConfig.cs +2 -2
- package/Runtime/AmaGDK.Singleton.cs +1 -1
- package/Runtime/AmaGDK.UserProfile.cs +12 -11
- package/Runtime/AmaGDK.asmdef +1 -1
- package/Runtime/AmaGDK.cs +25 -15
- package/Runtime/AnalyticQualityAsset.cs +5 -6
- package/Runtime/AudioToolkit/AmaGDK.Audio.cs +3 -2
- package/Runtime/AudioToolkit/Plugins/AudioDeviceDetector.cs +2 -2
- package/Runtime/Core/GDKDebug.cs +97 -0
- package/Runtime/Core/GDKDebug.cs.meta +3 -0
- package/Runtime/Core/GDKPool.cs +56 -337
- package/Runtime/Core/GDKRoutine.cs +3 -1
- package/Runtime/Core/GDKSemVer.cs +1 -1
- package/Runtime/Core/GDKString.cs +197 -0
- package/Runtime/Core/GDKString.cs.meta +3 -0
- package/Runtime/EmbedRemoteConfigAsset.cs +2 -1
- package/Runtime/Fps/AmaFPS.Utils.cs +5 -1
- package/Runtime/Fps/AmaFPS.cs +1 -1
- package/Runtime/Fps/AmaFPSVisualizer.cs +7 -2
- package/Runtime/Fps/FrameRecorder.cs +1 -1
- package/Runtime/GDKAudio/GDKAudio.cs +16 -13
- package/Runtime/Internal/AmaGDK.Internal.cs +24 -34
- package/Runtime/Internal/AmaGDK.Utils.cs +4 -4
- package/Runtime/Internal/AmaGDK.WebUtils.cs +1 -1
- package/Runtime/Internal/GDKGeoLocationcs.cs +2 -1
- package/Runtime/Internal/GDKServerTime.cs +2 -1
- package/Runtime/Klavar/Attributes/TimeDiffLastFireAttribute.cs +2 -1
- package/Runtime/Klavar/KlavarContainer.cs +4 -4
- package/Runtime/UserProfile/Plugins/Android/AdvertisingIdFetcher.cs +1 -1
- package/Runtime/Utils/GDKUtils.cs +1 -1
- package/package.json +1 -1
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.Internal.Logging;
|
|
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)
|
|
@@ -370,13 +370,6 @@ namespace Amanotes.Core
|
|
|
370
370
|
|
|
371
371
|
public class GDKPreProcessBuild: IPreprocessBuildWithReport
|
|
372
372
|
{
|
|
373
|
-
#if UNITY_2022_1_OR_NEWER
|
|
374
|
-
private static readonly string GRADLE_VERSION = "7.6.1";
|
|
375
|
-
#else
|
|
376
|
-
private static readonly string GRADLE_VERSION = "6.7.1";
|
|
377
|
-
#endif
|
|
378
|
-
private static readonly string GRADLE_ROOT = "/usr/local/gradle";
|
|
379
|
-
|
|
380
373
|
public int callbackOrder
|
|
381
374
|
{
|
|
382
375
|
get { return 0; }
|
|
@@ -388,19 +381,12 @@ namespace Amanotes.Core
|
|
|
388
381
|
// Change Gradle path when running in headless mode (CI Machine)
|
|
389
382
|
if (Application.isBatchMode)
|
|
390
383
|
{
|
|
391
|
-
EditorPrefs.SetBool("GradleUseEmbedded", false);
|
|
392
|
-
|
|
393
384
|
if (GDKCIBuildCommand.TryGetEnv("GRADLE_PATH", out string envGradlePath))
|
|
394
|
-
{
|
|
385
|
+
{
|
|
386
|
+
EditorPrefs.SetBool("GradleUseEmbedded", false);
|
|
395
387
|
EditorPrefs.SetString("GradlePath", envGradlePath);
|
|
396
388
|
Debug.Log("Update gradle path to: " + envGradlePath);
|
|
397
389
|
}
|
|
398
|
-
else
|
|
399
|
-
{
|
|
400
|
-
string gradlePath = GRADLE_ROOT + "/gradle-" + GRADLE_VERSION;
|
|
401
|
-
EditorPrefs.SetString("GradlePath", gradlePath);
|
|
402
|
-
Debug.Log("Update gradle path to: " + gradlePath);
|
|
403
|
-
}
|
|
404
390
|
}
|
|
405
391
|
}
|
|
406
392
|
|
|
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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
using Amanotes.Core.Internal;
|
|
2
2
|
using System;
|
|
3
|
+
using static Amanotes.Core.GDKDebug;
|
|
3
4
|
namespace Amanotes.Core
|
|
4
5
|
{
|
|
5
6
|
public static class AdExtension
|
|
@@ -105,7 +106,7 @@ namespace Amanotes.Core
|
|
|
105
106
|
bool isValid = (ad != null);
|
|
106
107
|
if (!isValid)
|
|
107
108
|
{
|
|
108
|
-
|
|
109
|
+
LogWarning("Something wrong:: no AdShowContext");
|
|
109
110
|
}
|
|
110
111
|
return isValid;
|
|
111
112
|
}
|
package/Runtime/Ad/AdLogic.cs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
using System.Collections;
|
|
2
2
|
using UnityEngine;
|
|
3
|
-
using static Amanotes.Core.
|
|
3
|
+
using static Amanotes.Core.GDKDebug;
|
|
4
4
|
using static Amanotes.Core.AmaGDK;
|
|
5
5
|
|
|
6
6
|
namespace Amanotes.Core.Internal
|
|
@@ -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
|
{
|
|
@@ -281,11 +285,12 @@ namespace Amanotes.Core.Internal
|
|
|
281
285
|
|
|
282
286
|
private IEnumerator WaitForMediationCallback()
|
|
283
287
|
{
|
|
284
|
-
#if
|
|
285
|
-
while (!
|
|
288
|
+
#if UNITY_EDITOR
|
|
289
|
+
while (!context.hasClosed) yield return null;
|
|
290
|
+
yield break;
|
|
286
291
|
#endif
|
|
287
|
-
|
|
288
|
-
|
|
292
|
+
while (!isFocus) yield return null;
|
|
293
|
+
var wait4CallbackCounter = 0;
|
|
289
294
|
while (!context.potentiallyCompleted && wait4CallbackCounter <= MAX_FRAMES_WAIT_FOR_CALLBACK)
|
|
290
295
|
{
|
|
291
296
|
wait4CallbackCounter++;
|
package/Runtime/Ad/AmaGDK.Ads.cs
CHANGED
|
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|
|
4
4
|
using UnityEngine;
|
|
5
5
|
using Amanotes.Core.Internal;
|
|
6
6
|
|
|
7
|
-
using static Amanotes.Core.
|
|
7
|
+
using static Amanotes.Core.GDKDebug;
|
|
8
8
|
using static Amanotes.Core.AmaGDK;
|
|
9
9
|
|
|
10
10
|
namespace Amanotes.Core
|
|
@@ -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;
|
|
@@ -2,13 +2,11 @@ using System;
|
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using System.Linq;
|
|
4
4
|
using UnityEngine;
|
|
5
|
-
using static Amanotes.Core.
|
|
5
|
+
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;
|