com.amanotes.gdk 0.2.45 → 0.2.47
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 +10 -0
- package/Editor/AmaGDKEditor.cs +325 -120
- package/Editor/MatchSDKVersion.cs +3 -6
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +6 -4
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AmaGDKProject.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.unitypackage +0 -0
- package/Packages/{FirebaseAnalyticsAdapter_v9.1.0.unitypackage.meta → AppsFlyerAdapter.unitypackage.meta} +1 -1
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/{IronSourceAdapter_v7.5.2.unitypackage.meta → FirebaseAnalyticsAdapter.unitypackage.meta} +1 -1
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/{FirebaseRemoteConfigAdapter_v9.1.0.unitypackage.meta → FirebaseRemoteConfigAdapter.unitypackage.meta} +1 -1
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/{AppsFlyerAdapter_v6.5.4.unitypackage.meta → IronSourceAdapter.unitypackage.meta} +1 -1
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage.meta +7 -0
- package/Runtime/AmaGDK.Adapters.cs +55 -77
- package/Runtime/AmaGDK.Ads.cs +155 -163
- package/Runtime/AmaGDK.Analytics.cs +245 -125
- package/Runtime/AmaGDK.Config.cs +2 -1
- package/Runtime/AmaGDK.IAP.cs +47 -48
- package/Runtime/AmaGDK.RemoteConfig.cs +38 -35
- package/Runtime/AmaGDK.UserProfile.cs +27 -19
- package/Runtime/AmaGDK.cs +158 -111
- package/Runtime/Core.meta +8 -0
- package/{Editor/Utils/AmaGDKEditor.GUI.cs → Runtime/Internal/AmaGDK.Internal.AmaGUI.cs} +110 -85
- package/{Editor/Utils/AmaGDKEditor.GUI.cs.meta → Runtime/Internal/AmaGDK.Internal.AmaGUI.cs.meta} +1 -1
- package/Runtime/{AmaGDK.Internal.SemVer.cs → Internal/AmaGDK.Internal.SemVer.cs} +21 -17
- package/Runtime/{AmaGDK.Internal.cs → Internal/AmaGDK.Internal.cs} +17 -6
- package/Runtime/{AmaGDK.Utils.cs → Internal/AmaGDK.Utils.cs} +91 -17
- package/Runtime/Internal.meta +8 -0
- package/package.json +1 -1
- package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/IronSourceAdapter_v7.5.2.unitypackage +0 -0
- package/Packages/IronsourceAdapter_v7.2.6.unitypackage +0 -0
- package/Packages/IronsourceAdapter_v7.2.6.unitypackage.meta +0 -7
- package/Packages/RevenueCatAdapter_v6.0.0.unitypackage +0 -0
- package/Packages/RevenueCatAdapter_v6.0.0.unitypackage.meta +0 -7
- /package/Runtime/{AmaGDK.Internal.SemVer.cs.meta → Internal/AmaGDK.Internal.SemVer.cs.meta} +0 -0
- /package/Runtime/{AmaGDK.Internal.cs.meta → Internal/AmaGDK.Internal.cs.meta} +0 -0
- /package/Runtime/{AmaGDK.Utils.cs.meta → Internal/AmaGDK.Utils.cs.meta} +0 -0
- /package/Runtime/{AmaGDK.WebUtils.cs → Internal/AmaGDK.WebUtils.cs} +0 -0
- /package/Runtime/{AmaGDK.WebUtils.cs.meta → Internal/AmaGDK.WebUtils.cs.meta} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.47 - 2024-01-09]
|
|
4
|
+
- Some clean up, null checks & improvements for AmaGDK Editor
|
|
5
|
+
- Add GDKTest project for Unity versions 2020.3, 2021.3 and 2022.3
|
|
6
|
+
|
|
7
|
+
## [0.2.46 - 2023-12-19]
|
|
8
|
+
- Cleaner UI interface for AmaGDK Inspector
|
|
9
|
+
- Add AmaGUI to centralize all GUI handles
|
|
10
|
+
- [Fix] OnAdResult callback being looped through calling StopWaitForAd
|
|
11
|
+
- [Fix] Exception while loading / parsing LoadJsonFromFile
|
|
12
|
+
|
|
3
13
|
## [0.2.45 - 2023-12-13]
|
|
4
14
|
- [Fix] Able to assign ama_device_id in Editor
|
|
5
15
|
|
package/Editor/AmaGDKEditor.cs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using System.Text;
|
|
3
2
|
using Amanotes.Core;
|
|
4
3
|
using Amanotes.Core.Internal;
|
|
5
4
|
using System.Collections.Generic;
|
|
6
5
|
using System.IO;
|
|
6
|
+
using System.Linq;
|
|
7
|
+
using System.Reflection;
|
|
7
8
|
using UnityEditor;
|
|
8
9
|
using UnityEngine;
|
|
9
10
|
using static Amanotes.Core.Internal.Logging;
|
|
10
|
-
using static Amanotes.Editor.AmaGUI;
|
|
11
11
|
using static Amanotes.Core.AmaGDK.AdapterID;
|
|
12
|
+
using UnityObject = UnityEngine.Object;
|
|
12
13
|
|
|
13
14
|
namespace Amanotes.Editor
|
|
14
15
|
{
|
|
@@ -16,16 +17,26 @@ namespace Amanotes.Editor
|
|
|
16
17
|
internal class AmaGDKEditor : UnityEditor.Editor
|
|
17
18
|
{
|
|
18
19
|
private static readonly Color BLUE = new Color32(0x34, 0xFF, 0xF7, 0xFF);
|
|
20
|
+
private static readonly Color ORANGE = new Color32(0xFF, 0xC0, 0x00, 0xFF);
|
|
21
|
+
|
|
22
|
+
[NonSerialized] private static AmaGDK sdk;
|
|
23
|
+
[NonSerialized] private static ConfigAsset configAsset;
|
|
24
|
+
[NonSerialized] private static UnityObject invalidConfigAsset;
|
|
25
|
+
[NonSerialized] private static SerializedObject configSO;
|
|
26
|
+
[NonSerialized] private static UnityEditor.Editor editor;
|
|
19
27
|
|
|
20
|
-
private static
|
|
21
|
-
private static ConfigAsset configAsset;
|
|
22
|
-
private static UnityEditor.Editor editor;
|
|
23
|
-
|
|
28
|
+
private static bool showIRSAdapter;
|
|
24
29
|
private static bool showConfigDetail;
|
|
25
30
|
private static bool showAdapterInstaller;
|
|
26
31
|
private static bool showExampleDetail;
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// DO NOT PUT [NonSerialized]
|
|
36
|
+
private static bool adapterScanned = false;
|
|
37
|
+
private static bool searchedForConfig = false;
|
|
38
|
+
|
|
39
|
+
private static readonly List<string> adapterPackages = new List<string>();
|
|
29
40
|
|
|
30
41
|
public static Color btnColor;
|
|
31
42
|
public static float btnLerp;
|
|
@@ -38,69 +49,71 @@ namespace Amanotes.Editor
|
|
|
38
49
|
IRONSOURCE,
|
|
39
50
|
REVENUECAT
|
|
40
51
|
};
|
|
41
|
-
|
|
52
|
+
|
|
42
53
|
public void OnEnable()
|
|
43
54
|
{
|
|
44
55
|
sdk = (AmaGDK)target;
|
|
45
56
|
if (sdk != null) sdk.transform.hideFlags = HideFlags.HideInInspector;
|
|
46
|
-
|
|
57
|
+
|
|
58
|
+
SDKStatus.ClearCache();
|
|
59
|
+
TryLoadConfigAsset();
|
|
60
|
+
RefreshListAdapters();
|
|
47
61
|
}
|
|
48
62
|
|
|
49
|
-
private void
|
|
63
|
+
private void TryLoadConfigAsset()
|
|
50
64
|
{
|
|
65
|
+
if (configAsset != null) return;
|
|
66
|
+
if (EditorApplication.isCompiling) return;
|
|
67
|
+
if (EditorApplication.isUpdating) return;
|
|
68
|
+
|
|
69
|
+
searchedForConfig = true;
|
|
51
70
|
Resources.UnloadUnusedAssets();
|
|
71
|
+
|
|
52
72
|
configAsset = Resources.Load<ConfigAsset>("AmaGDKConfig");
|
|
73
|
+
invalidConfigAsset = configAsset == null ? Resources.Load("AmaGDKConfig") : null;
|
|
74
|
+
|
|
75
|
+
RefreshListAdapters();
|
|
76
|
+
SDKStatus.ClearCache();
|
|
77
|
+
Repaint();
|
|
53
78
|
}
|
|
54
|
-
|
|
55
|
-
private void KeepSearchingForConfig()
|
|
56
|
-
{
|
|
57
|
-
if (EditorApplication.isUpdating || EditorApplication.isCompiling) return;
|
|
58
|
-
SearchForConfigAsset();
|
|
59
|
-
|
|
60
|
-
if (configAsset == null) return;
|
|
61
|
-
EditorApplication.update -= KeepSearchingForConfig;
|
|
62
|
-
}
|
|
63
|
-
|
|
79
|
+
|
|
64
80
|
private void DrawGUI_ConfigMissing()
|
|
65
81
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
GUILayout.BeginHorizontal();
|
|
82
|
+
EditorGUI.indentLevel--;
|
|
83
|
+
if (invalidConfigAsset != null)
|
|
69
84
|
{
|
|
70
|
-
|
|
85
|
+
EditorGUILayout.HelpBox($" INVALID <Resources/AmaGDKConfig.asset> found!", MessageType.Warning);
|
|
86
|
+
if (AmaGUI.BigButton("RE-IMPORT GDK Config", 40f, ORANGE))
|
|
71
87
|
{
|
|
72
|
-
|
|
88
|
+
AssetDatabase.ImportPackage(Res.AMAGDK_CONFIG_PACKAGE, false);
|
|
89
|
+
searchedForConfig = false;
|
|
90
|
+
}
|
|
91
|
+
} else
|
|
92
|
+
{
|
|
93
|
+
EditorGUILayout.HelpBox("[Warning] <Resources/AmaGDKConfig.asset> NOT FOUND!\nYou need to create one to control all the adapter's configurations!", MessageType.Warning);
|
|
94
|
+
GUILayout.BeginHorizontal();
|
|
95
|
+
{
|
|
96
|
+
if (AmaGUI.BigButton("CREATE", 40f, BLUE))
|
|
73
97
|
{
|
|
74
98
|
AssetDatabase.ImportPackage(Res.AMAGDK_CONFIG_PACKAGE, false);
|
|
75
|
-
|
|
76
|
-
EditorApplication.update += KeepSearchingForConfig;
|
|
99
|
+
adapterScanned = false;
|
|
77
100
|
}
|
|
78
|
-
|
|
101
|
+
|
|
102
|
+
if (GUILayout.Button(EditorGUIUtility.IconContent("d_Refresh@2x"), GUILayout.Width(40f), GUILayout.Height(40f)))
|
|
79
103
|
{
|
|
80
|
-
|
|
104
|
+
TryLoadConfigAsset();
|
|
81
105
|
}
|
|
82
106
|
}
|
|
83
|
-
|
|
84
|
-
if (GUILayout.Button(EditorGUIUtility.IconContent("d_Refresh@2x"), GUILayout.Width(40f), GUILayout.Height(40f)))
|
|
85
|
-
{
|
|
86
|
-
SearchForConfigAsset();
|
|
87
|
-
}
|
|
107
|
+
GUILayout.EndHorizontal();
|
|
88
108
|
}
|
|
89
|
-
|
|
90
|
-
GUILayout.EndHorizontal();
|
|
109
|
+
EditorGUI.indentLevel++;
|
|
91
110
|
}
|
|
92
111
|
|
|
93
|
-
private void
|
|
112
|
+
private void DrawGUI_AutoInitDisabled()
|
|
94
113
|
{
|
|
95
|
-
if (sdk.autoInit)
|
|
96
|
-
{
|
|
97
|
-
Toggle("Auto Init", ref sdk.autoInit);
|
|
98
|
-
EditorUtility.SetDirty(sdk);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
114
|
+
if (sdk.autoInit) return;
|
|
102
115
|
EditorGUILayout.HelpBox("You disabled AmaGDK AutoInit\nMake sure to call AmaGDK.Init() manually!", MessageType.Warning);
|
|
103
|
-
if (BigButton("Enable AutoInit", 40f, BLUE))
|
|
116
|
+
if (AmaGUI.BigButton("Enable AutoInit", 40f, BLUE))
|
|
104
117
|
{
|
|
105
118
|
sdk.autoInit = true;
|
|
106
119
|
EditorUtility.SetDirty(sdk);
|
|
@@ -121,24 +134,21 @@ namespace Amanotes.Editor
|
|
|
121
134
|
EditorGUILayout.ObjectField(configAsset, configAsset.GetType(), false, GUILayout.Width(EditorGUIUtility.currentViewWidth - 414), GUILayout.ExpandWidth(true));
|
|
122
135
|
}
|
|
123
136
|
|
|
124
|
-
private void
|
|
137
|
+
private void ScanForAdapterPackages()
|
|
125
138
|
{
|
|
126
|
-
if(adapterScanned)
|
|
127
|
-
return;
|
|
128
|
-
|
|
129
139
|
adapterScanned = true;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
for (int i = 0; i < adapterPath.Length; i++)
|
|
140
|
+
adapterPackages.Clear();
|
|
141
|
+
string[] adapterPath = Directory.GetFiles(Res.PACKAGE_PATH, "*Adapter*.unitypackage", SearchOption.AllDirectories);
|
|
142
|
+
for (var i = 0; i < adapterPath.Length; i++)
|
|
134
143
|
{
|
|
135
|
-
|
|
144
|
+
adapterPackages.Add(Path.GetFileName(adapterPath[i]));
|
|
136
145
|
}
|
|
137
146
|
}
|
|
147
|
+
|
|
138
148
|
private void DrawGUI_AdapterList()
|
|
139
149
|
{
|
|
140
|
-
|
|
141
|
-
foreach (
|
|
150
|
+
if (!adapterScanned) ScanForAdapterPackages();
|
|
151
|
+
foreach (string adapter in adapterPackages)
|
|
142
152
|
{
|
|
143
153
|
if (GUILayout.Button(ObjectNames.NicifyVariableName(adapter)))
|
|
144
154
|
{
|
|
@@ -157,6 +167,7 @@ namespace Amanotes.Editor
|
|
|
157
167
|
AssetDatabase.ImportPackage(package, false);
|
|
158
168
|
}
|
|
159
169
|
}
|
|
170
|
+
|
|
160
171
|
private void DrawGUI_ColorPicker()
|
|
161
172
|
{
|
|
162
173
|
GUILayout.BeginHorizontal();
|
|
@@ -166,102 +177,296 @@ namespace Amanotes.Editor
|
|
|
166
177
|
}
|
|
167
178
|
GUILayout.EndHorizontal();
|
|
168
179
|
}
|
|
180
|
+
|
|
181
|
+
// public void CopyVersion()
|
|
182
|
+
// {
|
|
183
|
+
// var sb = new StringBuilder();
|
|
184
|
+
// sb.AppendLine("ID\tSDK VERSION\tADAPTER VERSION");
|
|
185
|
+
// for (var i = 0; i < SDK_IDS.Length; i++)
|
|
186
|
+
// {
|
|
187
|
+
// SDKStatus status = SDKStatus.Get(SDK_IDS[i]);
|
|
188
|
+
// sb.AppendLine(status.ToTSVString());
|
|
189
|
+
// if (status.sdkId != IRONSOURCE) continue;
|
|
190
|
+
// if (!status.sdkInstalled || !status.adapterInstalled) continue;
|
|
191
|
+
//
|
|
192
|
+
// List<IronSourceSDKAdapter> list = ExtractVersion.IronSourceAdapter();
|
|
193
|
+
// for (var j = 0; j < list.Count; j++)
|
|
194
|
+
// {
|
|
195
|
+
// IronSourceSDKAdapter item = list[j];
|
|
196
|
+
// sb.AppendLine($"IS{item.name}Adapter\t{item.version}");
|
|
197
|
+
// }
|
|
198
|
+
// }
|
|
199
|
+
//
|
|
200
|
+
// var tsv = sb.ToString();
|
|
201
|
+
// EditorGUIUtility.systemCopyBuffer = tsv;
|
|
202
|
+
// Debug.Log($"Content of version_info.tsv copied to clipboard!\n\n{tsv}\n\n");
|
|
203
|
+
// }
|
|
169
204
|
|
|
205
|
+
void DrawGUI_AmaGDKBanner()
|
|
206
|
+
{
|
|
207
|
+
AmaGUI.SectionLabel($"<b>AmaGDK</b> <size=12><color=gray>v{AmaGDK.VERSION}</color></size>");
|
|
208
|
+
var rect = GUILayoutUtility.GetLastRect();
|
|
209
|
+
if (Event.current.isMouse && Event.current.button == 1 && rect.Contains(Event.current.mousePosition))
|
|
210
|
+
{
|
|
211
|
+
var menu = new GenericMenu();
|
|
212
|
+
menu.AddDisabledItem(new GUIContent("AmaGDK"));
|
|
213
|
+
menu.AddSeparator("");
|
|
214
|
+
menu.AddItem(new GUIContent("Auto Init"), sdk.autoInit, () =>
|
|
215
|
+
{
|
|
216
|
+
sdk.autoInit = !sdk.autoInit;
|
|
217
|
+
EditorUtility.SetDirty(sdk);
|
|
218
|
+
});
|
|
219
|
+
menu.AddItem(new GUIContent("Clear Cache"), false, () =>
|
|
220
|
+
{
|
|
221
|
+
GDKFileUtils.ClearCacheData();
|
|
222
|
+
});
|
|
223
|
+
menu.ShowAsContext();
|
|
224
|
+
Event.current.Use();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
170
228
|
public override void OnInspectorGUI()
|
|
171
229
|
{
|
|
172
|
-
if (
|
|
173
|
-
|
|
230
|
+
if (target == null)
|
|
231
|
+
{
|
|
232
|
+
EditorGUILayout.HelpBox("Target is null!", MessageType.Warning);
|
|
233
|
+
Repaint();
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
sdk = (AmaGDK)target;
|
|
238
|
+
if (sdk == null)
|
|
239
|
+
{
|
|
240
|
+
EditorGUILayout.HelpBox("AmaGDK is null!", MessageType.Warning);
|
|
241
|
+
Repaint();
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
|
|
174
245
|
// DrawGUI_ColorPicker();
|
|
175
|
-
|
|
246
|
+
DrawGUI_AmaGDKBanner();
|
|
176
247
|
EditorGUILayout.Space();
|
|
248
|
+
DrawGUI_AutoInitDisabled();
|
|
177
249
|
|
|
178
|
-
|
|
250
|
+
if (EditorApplication.isCompiling || EditorApplication.isUpdating)
|
|
179
251
|
{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
252
|
+
EditorGUILayout.HelpBox("Please wait for UnityEditor to finish compiling or importing", MessageType.Warning);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (!searchedForConfig) TryLoadConfigAsset();
|
|
257
|
+
if (!adapterScanned) ScanForAdapterPackages();
|
|
258
|
+
|
|
259
|
+
if (configAsset == null)
|
|
260
|
+
{
|
|
261
|
+
DrawGUI_ConfigMissing();
|
|
262
|
+
Repaint();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
configSO = new SerializedObject(configAsset);
|
|
267
|
+
configSO.Update();
|
|
268
|
+
|
|
269
|
+
DrawProperty(configSO, "common");
|
|
270
|
+
GUILayout.Space(8f);
|
|
271
|
+
for (var i = 0; i < allAdapters.Count; i++)
|
|
272
|
+
{
|
|
273
|
+
var item = allAdapters[i];
|
|
274
|
+
DrawAdapterDetail(item.id, item.adapter);
|
|
194
275
|
}
|
|
276
|
+
|
|
195
277
|
EditorGUILayout.Space();
|
|
278
|
+
AmaGUI.Foldout("Config", ref showConfigDetail, DrawGUI_ConfigDetail, DrawGUI_ConfigAsset);
|
|
279
|
+
AmaGUI.Foldout("Adapters", ref showAdapterInstaller, DrawGUI_AdapterList);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
private static List<(string id, Adapter2 adapter)> allAdapters = new List<(string, Adapter2)>();
|
|
283
|
+
private static readonly Dictionary<string, bool> configOpen = new Dictionary<string, bool>();
|
|
284
|
+
|
|
285
|
+
private static List<Type> FindSubClassesOf(Type baseType)
|
|
286
|
+
{
|
|
287
|
+
List<Type> result = new List<Type>();
|
|
196
288
|
|
|
197
|
-
|
|
289
|
+
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
290
|
+
foreach (Assembly assembly in assemblies)
|
|
291
|
+
{
|
|
292
|
+
if (!assembly.FullName.Contains("Assembly-CSharp")) continue;
|
|
293
|
+
if (!assembly.FullName.Contains("Editor")) continue;
|
|
294
|
+
Debug.Log(assembly.FullName);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return result;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
private static void RefreshListAdapters()
|
|
301
|
+
{
|
|
302
|
+
allAdapters = SDK_IDS
|
|
303
|
+
.Select(id => (id: id, adapter: GetAdapter(id)))
|
|
304
|
+
.OrderBy(x=>
|
|
305
|
+
x.adapter == null ? 2:
|
|
306
|
+
x.adapter.enabled == false ? 1 :
|
|
307
|
+
-x.adapter.initOrder)
|
|
308
|
+
.ToList();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
private static void DrawAdapterDetail(string adapterId, Adapter2 adapter)
|
|
312
|
+
{
|
|
313
|
+
if (!configOpen.TryGetValue(adapterId, out bool isOpen))
|
|
314
|
+
{
|
|
315
|
+
configOpen.Add(adapterId, isOpen = false);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (adapter == null)
|
|
319
|
+
{
|
|
320
|
+
EditorGUILayout.HelpBox("Adapter<" + adapterId + "> not imported!", MessageType.Info);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
SDKStatus status = SDKStatus.Get(adapterId);
|
|
325
|
+
bool changed = AmaGUI.Foldout(ObjectNames.NicifyVariableName(adapterId), ref isOpen, () =>
|
|
326
|
+
{
|
|
327
|
+
DrawSDKConfig(adapter, adapterId, status);
|
|
328
|
+
}, () =>
|
|
198
329
|
{
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
for (var i = 0; i < SDK_IDS.Length; i++)
|
|
330
|
+
GUILayout.FlexibleSpace();
|
|
331
|
+
if (!adapter.enabled)
|
|
202
332
|
{
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
List<IronSourceSDKAdapter> list = ExtractVersion.IronSourceAdapter();
|
|
209
|
-
for (var j = 0; j < list.Count; j++)
|
|
210
|
-
{
|
|
211
|
-
var item = list[j];
|
|
212
|
-
sb.AppendLine($"IS{item.name}Adapter\t{item.version}");
|
|
213
|
-
}
|
|
333
|
+
Color c = GUI.color;
|
|
334
|
+
GUI.color = Color.yellow;
|
|
335
|
+
GUILayout.Label("disabled", GUILayout.Width(60f));
|
|
336
|
+
GUI.color = c;
|
|
214
337
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
338
|
+
AmaGUI.DrawVersionTag(status.sdkVersion, status.adapterInstalled && adapter.enabled);
|
|
339
|
+
Rect titleRect = GUILayoutUtility.GetLastRect();
|
|
340
|
+
bool hit = Event.current.isMouse && titleRect.Contains(Event.current.mousePosition);
|
|
341
|
+
if (hit && Event.current.button == 1)
|
|
342
|
+
{
|
|
343
|
+
Event.current.Use();
|
|
344
|
+
CreateGenericMenu(adapter, adapterId);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
if (changed) configOpen[adapterId] = isOpen;
|
|
351
|
+
}
|
|
220
352
|
|
|
221
|
-
|
|
353
|
+
private static void CreateGenericMenu(Adapter2 adapter, string adapterId)
|
|
354
|
+
{
|
|
355
|
+
var menu = new GenericMenu();
|
|
356
|
+
menu.AddDisabledItem(new GUIContent(adapterId));
|
|
357
|
+
menu.AddSeparator("");
|
|
358
|
+
menu.AddItem(new GUIContent("enable"), adapter.enabled, () =>
|
|
222
359
|
{
|
|
223
|
-
|
|
360
|
+
adapter.enabled = !adapter.enabled;
|
|
361
|
+
EditorUtility.SetDirty(configAsset);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
menu.ShowAsContext();
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
private static void DrawSDKConfig(Adapter2 adapter, string adapterId, SDKStatus status)
|
|
368
|
+
{
|
|
369
|
+
if (!status.sdkInstalled)
|
|
370
|
+
{
|
|
371
|
+
EditorGUILayout.HelpBox($"{adapterId} SDK not installed", MessageType.Warning);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
if (!status.adapterInstalled)
|
|
375
|
+
{
|
|
376
|
+
EditorGUILayout.HelpBox($"{adapterId}-GDKAdapter not installed", MessageType.Warning);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (!status.adapterInstalled)
|
|
381
|
+
{
|
|
382
|
+
EditorGUILayout.HelpBox($"{adapterId}-GDKAdapter not installed", MessageType.Warning);
|
|
224
383
|
return;
|
|
225
384
|
}
|
|
385
|
+
|
|
386
|
+
DrawModuleConfig(adapter, adapterId);
|
|
387
|
+
}
|
|
226
388
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
389
|
+
private static void DrawModuleConfig(Adapter2 adapter, string adapterId)
|
|
390
|
+
{
|
|
391
|
+
EditorGUI.BeginDisabledGroup(!adapter.enabled);
|
|
392
|
+
EditorGUIUtility.labelWidth += 70;
|
|
393
|
+
{
|
|
394
|
+
DrawProperty(configSO, adapterId);
|
|
395
|
+
GUILayout.Space(8f);
|
|
230
396
|
|
|
231
|
-
|
|
397
|
+
if (adapterId == IRONSOURCE)
|
|
398
|
+
{
|
|
399
|
+
AmaGUI.Foldout("Enabled AdNetworks", ref showIRSAdapter, () =>
|
|
400
|
+
{
|
|
401
|
+
DrawIRSAdapterVersions();
|
|
402
|
+
GUILayout.Space(8f);
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (adapter.enabled)
|
|
407
|
+
{
|
|
408
|
+
Color c = GUI.contentColor;
|
|
409
|
+
GUI.contentColor = BLUE;
|
|
410
|
+
if (adapter is AdAdapter) EditorGUILayout.PropertyField(configSO.FindProperty("ad"), new GUIContent("Shared settings for Ad Modules"));
|
|
411
|
+
if (adapter is IAPAdapter) EditorGUILayout.PropertyField(configSO.FindProperty("iap"), new GUIContent("Shared settings for In App Purchase Modules"));
|
|
412
|
+
if (adapter is AnalyticsAdapter) EditorGUILayout.PropertyField(configSO.FindProperty("analytics"), new GUIContent("Shared settings for Analytics Modules"));
|
|
413
|
+
if (adapter is RemoteConfigAdapter) EditorGUILayout.PropertyField(configSO.FindProperty("remoteConfig"), new GUIContent("Shared settings for Remote Config Modules"));
|
|
414
|
+
GUI.contentColor = c;
|
|
415
|
+
}
|
|
416
|
+
configSO.ApplyModifiedProperties();
|
|
417
|
+
}
|
|
418
|
+
EditorGUIUtility.labelWidth -= 70;
|
|
419
|
+
EditorGUI.EndDisabledGroup();
|
|
420
|
+
}
|
|
232
421
|
|
|
233
|
-
|
|
422
|
+
private static void DrawProperty(SerializedObject so, string propertyField)
|
|
423
|
+
{
|
|
424
|
+
SerializedProperty property = so.FindProperty(propertyField);
|
|
425
|
+
if (property == null) return;
|
|
426
|
+
|
|
427
|
+
string basePath = property.propertyPath;
|
|
428
|
+
var first = true;
|
|
429
|
+
while (property.NextVisible(first))
|
|
234
430
|
{
|
|
235
|
-
|
|
431
|
+
first = false;
|
|
432
|
+
if (!property.propertyPath.Contains(basePath)) break;
|
|
433
|
+
EditorGUILayout.PropertyField(property);
|
|
236
434
|
}
|
|
435
|
+
|
|
436
|
+
so.ApplyModifiedProperties();
|
|
237
437
|
}
|
|
238
|
-
|
|
239
|
-
private static
|
|
438
|
+
|
|
439
|
+
private static Adapter2 GetAdapter(string id)
|
|
240
440
|
{
|
|
241
|
-
|
|
441
|
+
if (configAsset == null) return null;
|
|
442
|
+
Type configType = configAsset.GetType();
|
|
443
|
+
|
|
444
|
+
FieldInfo field = configType
|
|
445
|
+
.GetField(id, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
|
446
|
+
|
|
447
|
+
if (field == null)
|
|
242
448
|
{
|
|
243
|
-
|
|
449
|
+
#if AMAGDK_DEV
|
|
450
|
+
LogWarningOnce($"[GDKDev] Adapter <{id}> not declared in ConfigAsset?");
|
|
451
|
+
#endif
|
|
452
|
+
return null;
|
|
244
453
|
}
|
|
245
|
-
|
|
454
|
+
|
|
455
|
+
var adapter = (Adapter2) field.GetValue(AmaGDK.Config);
|
|
456
|
+
if (adapter != null) return adapter;
|
|
457
|
+
|
|
458
|
+
LogWarning($"Adapter <{id}> == null in ConfigAsset? (non-serialized?)");
|
|
459
|
+
return null;
|
|
246
460
|
}
|
|
247
|
-
public static bool showIronSourceSDKAdapter = false;
|
|
248
461
|
|
|
249
462
|
public static void DrawIRSAdapterVersions()
|
|
250
463
|
{
|
|
251
|
-
SDKStatus status = SDKStatus.Get(IRONSOURCE);
|
|
252
|
-
if (!status.sdkInstalled) return;
|
|
253
|
-
if (!status.adapterInstalled) return;
|
|
254
|
-
if (!showIronSourceSDKAdapter) return;
|
|
255
|
-
|
|
256
|
-
// Get the list of installed SDK & versions
|
|
257
464
|
List<IronSourceSDKAdapter> list = ExtractVersion.IronSourceAdapter();
|
|
258
|
-
|
|
259
465
|
var color = new Color(0.0f, .5f, .5f, 1f);
|
|
260
|
-
|
|
466
|
+
AmaGUI.DrawListColumn(list, (item) =>
|
|
261
467
|
{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
468
|
+
AmaGUI.SemVerGUI(item.name, item.semVer, color);
|
|
469
|
+
});
|
|
265
470
|
}
|
|
266
471
|
}
|
|
267
472
|
}
|
|
@@ -109,12 +109,9 @@ namespace Amanotes.Core
|
|
|
109
109
|
if (files == null)
|
|
110
110
|
{
|
|
111
111
|
string dataPath = Path.Combine(Application.dataPath, "AmaGDK/Adapters");
|
|
112
|
-
if (!Directory.Exists(dataPath))
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
DirectoryInfo directory = new DirectoryInfo(dataPath);
|
|
112
|
+
if (!Directory.Exists(dataPath)) return;
|
|
113
|
+
|
|
114
|
+
var directory = new DirectoryInfo(dataPath);
|
|
118
115
|
files = directory.GetFiles("*Adapter.cs", SearchOption.AllDirectories);
|
|
119
116
|
}
|
|
120
117
|
|
|
@@ -26,10 +26,10 @@ namespace Amanotes.Editor
|
|
|
26
26
|
|
|
27
27
|
[Serializable] public class SDKStatus
|
|
28
28
|
{
|
|
29
|
-
|
|
30
29
|
//
|
|
31
|
-
|
|
32
30
|
private static readonly Dictionary<string, SDKStatus> _cache = new Dictionary<string, SDKStatus>();
|
|
31
|
+
internal static void ClearCache(){ _cache.Clear(); }
|
|
32
|
+
|
|
33
33
|
public string sdkId;
|
|
34
34
|
public SemVer adapterVersion;
|
|
35
35
|
public SemVer sdkVersion;
|
|
@@ -44,7 +44,7 @@ namespace Amanotes.Editor
|
|
|
44
44
|
public static SDKStatus Get(string sdkId, bool force = false)
|
|
45
45
|
{
|
|
46
46
|
if (!force && _cache.TryGetValue(sdkId, out var result)) return result;
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
result = new SDKStatus
|
|
49
49
|
{
|
|
50
50
|
sdkId = sdkId,
|
|
@@ -52,6 +52,8 @@ namespace Amanotes.Editor
|
|
|
52
52
|
sdkVersion = new SemVer(ExtractVersion.ThirdParty(sdkId))
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
// Debug.LogWarning($"Get <{sdkId} --> " + result.adapterVersion + " | " + result.sdkVersion);
|
|
56
|
+
|
|
55
57
|
if (_cache.ContainsKey(sdkId))
|
|
56
58
|
{
|
|
57
59
|
_cache[sdkId] = result;
|
|
@@ -184,7 +186,7 @@ namespace Amanotes.Editor
|
|
|
184
186
|
if (oType.Name.Equals("AdjustAndroid") || oType.Name.Equals("AdjustiOS") )
|
|
185
187
|
{
|
|
186
188
|
version = oType.GetField("sdkPrefix", BindingFlags.Static | BindingFlags.NonPublic)?.GetValue(null).ToString();
|
|
187
|
-
version = version.StartsWith("unity") ? version.Substring(5) : "";
|
|
189
|
+
version = version != null && version.StartsWith("unity") ? version.Substring(5) : "";
|
|
188
190
|
}
|
|
189
191
|
}
|
|
190
192
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|