com.amanotes.gdk 0.1.21 → 0.2.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +5 -5
  2. package/Editor/AmaGDKEditor.cs +91 -46
  3. package/Editor/AmaGDKManager.cs +26 -27
  4. package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +133 -103
  5. package/Editor/Utils/AmaGDKEditor.GUI.cs +54 -51
  6. package/Editor/Utils/AmaGDKEditor.Utils.cs +2 -3
  7. package/Packages/AmaGDKConfig.unitypackage +0 -0
  8. package/Packages/AmaGDKExample.unitypackage +0 -0
  9. package/Packages/AmaGDKTest.unitypackage +0 -0
  10. package/Packages/AmaPassport.ATTSupport.unitypackage +0 -0
  11. package/Packages/AmaPassport.ATTSupport.unitypackage.meta +7 -0
  12. package/Packages/AmaPassport.AdvertisingID.unitypackage +0 -0
  13. package/Packages/AmaPassport.AdvertisingID.unitypackage.meta +7 -0
  14. package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
  15. package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
  16. package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage +0 -0
  17. package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage.meta +1 -1
  18. package/Runtime/AmaGDK.Adapters.cs +13 -14
  19. package/Runtime/AmaGDK.Ads.cs +523 -151
  20. package/Runtime/AmaGDK.AmaPassport.cs +433 -0
  21. package/Runtime/AmaGDK.AmaPassport.cs.meta +11 -0
  22. package/Runtime/AmaGDK.Analytics.cs +78 -89
  23. package/Runtime/AmaGDK.Config.cs +23 -19
  24. package/Runtime/AmaGDK.Internal.SemVer.cs +11 -29
  25. package/Runtime/AmaGDK.Internal.cs +16 -10
  26. package/Runtime/AmaGDK.RemoteConfig.cs +32 -23
  27. package/Runtime/AmaGDK.UserProfile.cs +5 -8
  28. package/Runtime/AmaGDK.Utils.cs +40 -50
  29. package/Runtime/AmaGDK.WebUtils.cs +42 -42
  30. package/Runtime/AmaGDK.cs +70 -20
  31. package/Runtime/AssemblyInfo.cs +0 -1
  32. package/package.json +1 -1
@@ -1,12 +1,10 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
- using UnityEngine;
4
3
  using System.Text;
5
-
6
4
  using Amanotes.Core.Internal;
5
+ using UnityEngine;
6
+ using static Amanotes.Core.AmaGDK.Analytics;
7
7
  using static Amanotes.Core.Internal.Logging;
8
- using IEventParamsBuilder = Amanotes.Core.AmaGDK.Analytics.IEventParamsBuilder;
9
- using EventParams = Amanotes.Core.AmaGDK.Analytics.EventParams;
10
8
 
11
9
  namespace Amanotes.Core
12
10
  {
@@ -95,16 +93,16 @@ namespace Amanotes.Core
95
93
 
96
94
  public static IEventParamsBuilder LogEvent(string eventName, Dictionary<string, object> parameters)
97
95
  {
98
- return LogEvent(eventName).AddParam(parameters);
96
+ return LogEvent(eventName).AddParam(parameters);
99
97
  }
100
98
 
101
99
  public static IEventParamsBuilder LogEvent(string eventName, params (string, object)[] parameters)
102
100
  {
103
- var result = LogEvent(eventName);
104
- for (var i = 0;i < parameters.Length; i++)
101
+ IEventParamsBuilder result = LogEvent(eventName);
102
+ for (var i = 0; i < parameters.Length; i++)
105
103
  {
106
104
  result.AddParam(parameters[i].Item1, parameters[i].Item2);
107
- }
105
+ }
108
106
  return result;
109
107
  }
110
108
 
@@ -143,7 +141,7 @@ namespace Amanotes.Core
143
141
  return;
144
142
  }
145
143
 
146
- foreach (var s in listAdapters)
144
+ foreach (AdapterContext s in listAdapters)
147
145
  {
148
146
  s.GetAdapterApi<IAnalyticAdapter>().SetUserId(userId);
149
147
  }
@@ -157,17 +155,17 @@ namespace Amanotes.Core
157
155
  return;
158
156
  }
159
157
 
160
- foreach (var s in listAdapters)
158
+ foreach (AdapterContext s in listAdapters)
161
159
  {
162
160
  s.GetAdapterApi<IAnalyticAdapter>().SetUserProperty(key, value);
163
161
  }
164
162
  }
165
-
163
+
166
164
  private static IntegrityFlag MergeData(List<string> funnelEvents, Dictionary<string, int> eventCountMap, bool sumEventCount)
167
165
  {
168
166
  var flag = IntegrityFlag.Ok;
169
167
 
170
- foreach (var e in funnelEvents)
168
+ foreach (string e in funnelEvents)
171
169
  {
172
170
  if (localData.funnelSignatures.Contains(e)) continue;
173
171
 
@@ -175,9 +173,9 @@ namespace Amanotes.Core
175
173
  localData.AddFunnelSignature(e);
176
174
  }
177
175
 
178
- foreach (var e in eventCountMap)
176
+ foreach (KeyValuePair<string, int> e in eventCountMap)
179
177
  {
180
- var eventDetail = localData.GetEventDetail(e.Key);
178
+ EventDetail eventDetail = localData.GetEventDetail(e.Key);
181
179
  if (eventDetail == null)
182
180
  {
183
181
  localData.eventDetails.Add(new EventDetail
@@ -205,7 +203,7 @@ namespace Amanotes.Core
205
203
 
206
204
  public static void Migrate(List<string> lsFunnelEvents, Dictionary<string, int> dicEventCounts)
207
205
  {
208
- var migrationLog = localData.migrationLog;
206
+ MigrationLog migrationLog = localData.migrationLog;
209
207
 
210
208
  //First time
211
209
  if (migrationLog.count == 0)
@@ -216,12 +214,11 @@ namespace Amanotes.Core
216
214
  }
217
215
 
218
216
  //Integrity check
219
- if (!Config.common.checkMigrationIntegrity)
220
- return;
217
+ if (!Config.common.checkMigrationIntegrity) return;
221
218
 
222
219
  // False: DO NOT UPDATE EXISTED COUNT VALUE BECAUSE WE DON'T HAVE
223
220
  // ENOUGH INFORMATION TO DECIDE WHICH ONE IS MORE ACCURATE
224
- var flag = MergeData(lsFunnelEvents, dicEventCounts, false);
221
+ IntegrityFlag flag = MergeData(lsFunnelEvents, dicEventCounts, false);
225
222
  if (flag == IntegrityFlag.Ok) return;
226
223
 
227
224
  localData.UpdateMigrationLog();
@@ -229,9 +226,9 @@ namespace Amanotes.Core
229
226
 
230
227
  public static void OnlyAllowEvents(List<string> eventNames, params string[] adapterIDs)
231
228
  {
232
- foreach (var adapterID in adapterIDs)
229
+ foreach (string adapterID in adapterIDs)
233
230
  {
234
- var adapter = listAdapters.Find(a => a.adapterId == adapterID);
231
+ AdapterContext adapter = listAdapters.Find(a => a.adapterId == adapterID);
235
232
  if (adapter == null) continue;
236
233
 
237
234
  var config = adapter.GetAdapterConfig<AnalyticsAdapterConfig>();
@@ -241,9 +238,9 @@ namespace Amanotes.Core
241
238
 
242
239
  public static void OnlyBanEvents(List<string> eventNames, params string[] adapterIDs)
243
240
  {
244
- foreach (var adapterID in adapterIDs)
245
- {
246
- var adapter = listAdapters.Find(a => a.adapterId == adapterID);
241
+ foreach (string adapterID in adapterIDs)
242
+ {
243
+ AdapterContext adapter = listAdapters.Find(a => a.adapterId == adapterID);
247
244
  if (adapter == null) continue;
248
245
 
249
246
  var config = adapter.GetAdapterConfig<AnalyticsAdapterConfig>();
@@ -264,14 +261,14 @@ namespace Amanotes.Core
264
261
  if (sendAtCount.ContainsKey(eventName))
265
262
  {
266
263
  LogWarning($"{eventName} has already been set list of count number to log.");
267
- sendAtCount[eventName] = config;
264
+ sendAtCount[eventName] = config;
268
265
  }
269
266
  else
270
267
  {
271
268
  sendAtCount.Add(eventName, config);
272
- }
269
+ }
270
+ }
273
271
  }
274
- }
275
272
 
276
273
  //INTERNAL
277
274
  public static partial class Analytics
@@ -296,8 +293,8 @@ namespace Amanotes.Core
296
293
  listAdapters.Clear();
297
294
  listAdapters.AddRange(Adapter.FindAll<IAnalyticAdapter>());
298
295
 
299
- _frameUpdate -= ProcessEventQueue;
300
- _frameUpdate += ProcessEventQueue;
296
+ onFrameUpdate -= ProcessEventQueue;
297
+ onFrameUpdate += ProcessEventQueue;
301
298
  }
302
299
 
303
300
  internal static void ProcessEventQueue()
@@ -311,23 +308,22 @@ namespace Amanotes.Core
311
308
  var eventData = eventQueue.Dequeue();
312
309
  var (countInSession, totalCount) = localData.IncreaseCounter(eventData.eventName);
313
310
 
314
- if (!ShouldSendEvent(eventData))
315
- continue;
311
+ if (!ShouldSendEvent(eventData)) continue;
316
312
 
317
313
  if (eventData.accumulated)
318
314
  {
319
315
  eventData.AddParam("accumulated_count", eventData.withinSession ? countInSession : totalCount);
320
316
  }
321
317
 
322
- var eventNameToSend = GetEventNameToSend(eventData.eventName, countInSession, totalCount);
318
+ string eventNameToSend = GetEventNameToSend(eventData.eventName, countInSession, totalCount);
323
319
  NormalizeEventName(ref eventNameToSend);
324
320
 
325
321
  if (showAnalyticsLog) Debug.Log($"[AmaGDK] Event <{eventNameToSend}> (in session: {countInSession}, total: {totalCount})\n" +
326
- $"Params:\n{JsonUtils.DictionaryToJson(eventData.parameters, true)}");
322
+ $"Params:\n{JsonUtils.DictionaryToJson(eventData.parameters, true)}");
327
323
 
328
324
  var inUseAdapterIDs = new List<string>();
329
- foreach (var m in listAdapters)
330
- {
325
+ foreach (AdapterContext m in listAdapters)
326
+ {
331
327
  var api = m.GetAdapterApi<IAnalyticAdapter>();
332
328
  var config = m.GetAdapterConfig<AnalyticsAdapterConfig>();
333
329
 
@@ -364,16 +360,16 @@ namespace Amanotes.Core
364
360
 
365
361
  internal static void NormalizeEventName(ref string eventName)
366
362
  {
367
- var sb = tmpWarningSB;
363
+ StringBuilder sb = tmpWarningSB;
368
364
  sb.Clear();
369
365
 
370
366
  if (string.IsNullOrEmpty(eventName))
371
367
  {
372
- sb.AppendLine($" - EventName should not be empty");
368
+ sb.AppendLine(" - EventName should not be empty");
373
369
  return;
374
- }
370
+ }
375
371
 
376
- var normalizedEventName = eventName.Trim()
372
+ string normalizedEventName = eventName.Trim()
377
373
  .Replace(' ', '_')
378
374
  .Replace('-', '_');
379
375
 
@@ -411,7 +407,7 @@ namespace Amanotes.Core
411
407
  //Check the rule to log event
412
408
  if (logEventHook != null)
413
409
  {
414
- var eventDetail = localData.GetEventDetail(eventData.eventName, true);
410
+ EventDetail eventDetail = localData.GetEventDetail(eventData.eventName, true);
415
411
  return logEventHook(eventDetail);
416
412
  }
417
413
 
@@ -425,10 +421,10 @@ namespace Amanotes.Core
425
421
  [Serializable]
426
422
  public class EventDetail
427
423
  {
428
- public string eventName;
424
+ public string eventName;
425
+ public int totalCount;
429
426
  [NonSerialized]
430
427
  public int countInSession;
431
- public int totalCount;
432
428
  }
433
429
 
434
430
  [Serializable]
@@ -436,12 +432,12 @@ namespace Amanotes.Core
436
432
  {
437
433
  public string eventNameToSend;
438
434
  public List<string> adapters;
439
- public string parameters;
435
+ public string parameters;
440
436
 
441
437
  public EventStat(string eventNameToSend, EventParams eventParams, List<string> adapterIDs)
442
438
  {
443
439
  this.eventNameToSend = eventNameToSend;
444
- parameters = JsonUtils.DictionaryToJson(eventParams.parameters, false);
440
+ parameters = JsonUtils.DictionaryToJson(eventParams.parameters);
445
441
  adapters = adapterIDs;
446
442
  }
447
443
 
@@ -483,17 +479,17 @@ namespace Amanotes.Core
483
479
  [Serializable]
484
480
  internal class AnalyticsData : IJsonFile
485
481
  {
486
- [NonSerialized] internal bool _dirty = false;
487
482
 
488
483
  public List<string> funnelSignatures = new List<string>();
489
484
  public List<EventDetail> eventDetails = new List<EventDetail>();
490
- public MigrationLog migrationLog = new MigrationLog();
485
+ public MigrationLog migrationLog = new MigrationLog();
486
+ [NonSerialized] internal bool _dirty;
491
487
 
492
488
  internal EventDetail GetEventDetail(string eventName, bool autoNew = false)
493
489
  {
494
490
  if (string.IsNullOrEmpty(eventName)) return null;
495
491
 
496
- var result = eventDetails.Find(e => e.eventName == eventName);
492
+ EventDetail result = eventDetails.Find(e => e.eventName == eventName);
497
493
  if (result != null) return result;
498
494
  if (autoNew == false) return null;
499
495
 
@@ -508,10 +504,7 @@ namespace Amanotes.Core
508
504
 
509
505
  internal bool AddFunnelSignature(string signature)
510
506
  {
511
- if (funnelSignatures.Contains(signature))
512
- {
513
- return false;
514
- }
507
+ if (funnelSignatures.Contains(signature)) return false;
515
508
 
516
509
  _dirty = true;
517
510
  funnelSignatures.Add(signature);
@@ -520,9 +513,9 @@ namespace Amanotes.Core
520
513
 
521
514
  internal (int countInSession, int totalCount) IncreaseCounter(string eventName)
522
515
  {
523
- var result = GetEventDetail(eventName, true);
516
+ EventDetail result = GetEventDetail(eventName, true);
524
517
  result.countInSession++;
525
- result.totalCount++;
518
+ result.totalCount++;
526
519
  _dirty = true;
527
520
  return (result.countInSession, result.totalCount);
528
521
  }
@@ -540,44 +533,41 @@ namespace Amanotes.Core
540
533
  {
541
534
  migrationLog.deviceId = SystemInfo.deviceUniqueIdentifier;
542
535
  migrationLog.appVersion = Application.version;
543
- migrationLog.amaGDKVersion = AmaGDK.VERSION;
536
+ migrationLog.amaGDKVersion = VERSION;
544
537
  migrationLog.count = 1;
545
- Log($"Analytics data was migrated successfully");
538
+ Log("Analytics data was migrated successfully");
546
539
  }
547
540
  else
548
541
  {
549
542
  migrationLog.count++;
550
543
  Log($"Analytics data was migrated {migrationLog.count} times");
551
544
 
552
- if (migrationLog.count == 2)
553
- {
554
- LogEvent("migration_error").AddParam(migrationLog.ToDictionary());
555
- }
545
+ if (migrationLog.count == 2) LogEvent("migration_error").AddParam(migrationLog.ToDictionary());
556
546
  }
557
547
 
558
548
  _dirty = true;
559
549
  SaveIfDirty();
560
- }
550
+ }
561
551
  }
562
552
 
563
553
  internal class SessionStat
564
- {
565
- public List<EventStat> lastFrameEventStats = new List<EventStat>();
554
+ {
566
555
 
567
- const string TSV_HEADER_ROW = "EventName\tAdapters\tParameters";
568
- string fileName = nameof(SessionStat) + DateTime.Now.ToString("_yyMMdd_HHmmss") + ".tsv";
569
- bool isFirstSave = true;
570
- StringBuilder contents = new StringBuilder();
556
+ private const string TSV_HEADER_ROW = "EventName\tAdapters\tParameters";
557
+ private readonly string fileName = nameof(SessionStat) + DateTime.Now.ToString("_yyMMdd_HHmmss") + ".tsv";
558
+ private StringBuilder contents = new StringBuilder();
559
+ private bool isFirstSave = true;
560
+ public List<EventStat> lastFrameEventStats = new List<EventStat>();
571
561
 
572
562
  internal void Add(string eventNameToSend, EventParams eventParams, List<string> adapterIDs)
573
563
  {
574
- var eventStat = new EventStat(eventNameToSend, eventParams, adapterIDs);
564
+ var eventStat = new EventStat(eventNameToSend, eventParams, adapterIDs);
575
565
  lastFrameEventStats.Add(eventStat);
576
566
  }
577
567
 
578
568
  internal void ClearLastFrameEventInfo()
579
569
  {
580
- lastFrameEventStats.Clear();
570
+ lastFrameEventStats.Clear();
581
571
  }
582
572
 
583
573
  internal void Save()
@@ -590,13 +580,13 @@ namespace Amanotes.Core
590
580
  contents = contents.AppendLine(TSV_HEADER_ROW);
591
581
  isFirstSave = false;
592
582
  }
593
- foreach (var stat in lastFrameEventStats)
583
+ foreach (EventStat stat in lastFrameEventStats)
594
584
  {
595
585
  contents.AppendLine(stat.ToTsv());
596
- }
597
-
586
+ }
587
+
598
588
  FileUtils.SaveAppend(fileName, contents.ToString());
599
- }
589
+ }
600
590
  }
601
591
  }
602
592
  }
@@ -607,7 +597,7 @@ namespace Amanotes.Core
607
597
  {
608
598
  if (ap == null) return null;
609
599
 
610
- EventParams data = ap as EventParams;
600
+ var data = ap as EventParams;
611
601
  data.funnelSignature = string.IsNullOrEmpty(signature) ? data.eventName : signature;
612
602
  return ap;
613
603
  }
@@ -616,7 +606,7 @@ namespace Amanotes.Core
616
606
  {
617
607
  if (ap == null) return null;
618
608
 
619
- EventParams data = ap as EventParams;
609
+ var data = ap as EventParams;
620
610
  data.accumulated = true;
621
611
  data.withinSession = withinSession;
622
612
  return ap;
@@ -631,7 +621,7 @@ namespace Amanotes.Core
631
621
  return ap;
632
622
  }
633
623
 
634
- EventParams eventData = ap as EventParams;
624
+ var eventData = ap as EventParams;
635
625
  if (eventData.overrideConfig)
636
626
  {
637
627
  LogWarning("Except() can only be set once!");
@@ -639,7 +629,7 @@ namespace Amanotes.Core
639
629
  }
640
630
 
641
631
  eventData.overrideConfig = true;
642
- foreach (var mId in analyticIds)
632
+ foreach (string mId in analyticIds)
643
633
  {
644
634
  eventData.ignoreAdapterIds.Add(mId);
645
635
  }
@@ -655,7 +645,7 @@ namespace Amanotes.Core
655
645
  return ap;
656
646
  }
657
647
 
658
- EventParams eventData = ap as EventParams;
648
+ var eventData = ap as EventParams;
659
649
  if (eventData.overrideConfig)
660
650
  {
661
651
  LogWarning("OnlyTo() can only be set once!");
@@ -663,7 +653,7 @@ namespace Amanotes.Core
663
653
  }
664
654
 
665
655
  eventData.overrideConfig = true;
666
- foreach (var mId in analyticIds)
656
+ foreach (string mId in analyticIds)
667
657
  {
668
658
  eventData.allowAdapterIds.Add(mId);
669
659
  }
@@ -673,16 +663,16 @@ namespace Amanotes.Core
673
663
  public static IEventParamsBuilder AddParam(this IEventParamsBuilder ap, string key, object value)
674
664
  {
675
665
  if (ap == null) return null;
676
- if (!IsValidKeyValue(ap, key, value)) return ap;
666
+ if (!IsValidKeyValue(ap, key, value)) return ap;
677
667
 
678
- var parameters = (ap as EventParams).parameters;
679
- if (parameters.ContainsKey(key))
668
+ Dictionary<string, object> parameters = (ap as EventParams)?.parameters;
669
+ if (parameters != null && parameters.ContainsKey(key))
680
670
  {
681
671
  LogWarning($"Duplicated key: {key}!");
682
672
  return ap;
683
- };
684
-
685
- parameters.Add(key, value);
673
+ }
674
+
675
+ parameters?.Add(key, value);
686
676
  return ap;
687
677
  }
688
678
 
@@ -691,11 +681,11 @@ namespace Amanotes.Core
691
681
  if (ap == null) return null;
692
682
  if (dictParams == null)
693
683
  {
694
- LogWarning($"Param dictionary is null. Event name: {(ap as EventParams).eventName}!");
684
+ LogWarning($"Param dictionary is null. Event name: {((EventParams)ap).eventName}!");
695
685
  return ap;
696
686
  }
697
687
 
698
- foreach (var kvp in dictParams)
688
+ foreach (KeyValuePair<string, object> kvp in dictParams)
699
689
  {
700
690
  if (IsValidKeyValue(ap, kvp.Key, kvp.Value))
701
691
  ap.AddParam(kvp.Key, kvp.Value);
@@ -720,7 +710,7 @@ namespace Amanotes.Core
720
710
  return ap;
721
711
  }
722
712
 
723
- static bool IsValidKeyValue(IEventParamsBuilder ap, string key, object value)
713
+ private static bool IsValidKeyValue(IEventParamsBuilder ap, string key, object value)
724
714
  {
725
715
  string eventName = (ap as EventParams).eventName;
726
716
  if (string.IsNullOrWhiteSpace(key))
@@ -735,8 +725,7 @@ namespace Amanotes.Core
735
725
  }
736
726
 
737
727
  return true;
738
- }
739
-
728
+ }
740
729
  }
741
730
  }
742
731
 
@@ -758,4 +747,4 @@ namespace Amanotes.Core.Internal
758
747
 
759
748
  void SetUserProperty(string key, string value);
760
749
  }
761
- }
750
+ }
@@ -2,12 +2,12 @@ using System;
2
2
  using System.Collections.Generic;
3
3
  using System.Reflection;
4
4
  using UnityEngine;
5
-
6
5
  #if UNITY_EDITOR
7
6
  using UnityEditor;
8
7
  #endif
9
8
 
10
- namespace Amanotes.Core.Internal {
9
+ namespace Amanotes.Core.Internal
10
+ {
11
11
  public partial class ConfigAsset : ScriptableObject
12
12
  {
13
13
  [SerializeField] internal bool simpleOrder = true;
@@ -15,63 +15,67 @@ namespace Amanotes.Core.Internal {
15
15
  [SerializeField] public SDKConfig common;
16
16
 
17
17
  #if UNITY_EDITOR
18
- void OnValidate()
18
+ private void OnValidate()
19
19
  {
20
20
  if (Application.isPlaying) return;
21
- if (simpleOrder) {
21
+ if (simpleOrder)
22
+ {
22
23
  EditorApplication.update -= DelayCheckOrder;
23
24
  EditorApplication.update += DelayCheckOrder;
24
25
  }
25
26
  }
26
27
 
27
- void DelayCheckOrder()
28
+ private void DelayCheckOrder()
28
29
  {
29
30
  EditorApplication.update -= DelayCheckOrder;
30
31
  var dirty = false;
31
- for (var i =0 ;i < initOrder.Count;i++){
32
+ for (var i = 0; i < initOrder.Count; i++)
33
+ {
32
34
  if (initOrder[i].order == i) continue;
33
35
  dirty = true;
34
36
  break;
35
37
  }
36
38
 
37
39
  if (!dirty) return;
38
- initOrder.Sort((a1, a2)=> a1.order.CompareTo(a2.order));
39
- for (var i =0 ;i < initOrder.Count;i++){
40
+ initOrder.Sort((a1, a2) => a1.order.CompareTo(a2.order));
41
+ for (var i = 0; i < initOrder.Count; i++)
42
+ {
40
43
  initOrder[i].order = i;
41
44
  }
42
45
  EditorUtility.SetDirty(this);
43
46
  }
44
47
 
45
48
  [ContextMenu("Scan Adapters")]
46
- void ScanAdapters()
49
+ private void ScanAdapters()
47
50
  {
48
51
  initOrder.Clear();
49
52
 
50
53
  var counter = 0;
51
- foreach (var adapter in GetAllAdapters<AdapterContext>())
54
+ foreach (Type adapter in GetAllAdapters<AdapterContext>())
52
55
  {
53
- var id = adapter.Name.Replace("Adapter", string.Empty);
56
+ string id = adapter.Name.Replace("Adapter", string.Empty);
54
57
  initOrder.Add(new InitOrder(){ id = id, order = counter++ });
55
58
  }
56
59
  }
57
60
 
58
61
  [ContextMenu("Refresh Order")]
59
- void UpdateOrderToPosition()
62
+ private void UpdateOrderToPosition()
60
63
  {
61
- for (var i =0 ;i < initOrder.Count; i++)
64
+ for (var i = 0; i < initOrder.Count; i++)
62
65
  {
63
66
  initOrder[i].order = i;
64
67
  }
65
68
  }
66
-
69
+
67
70
  public static IEnumerable<Type> GetAllAdapters<T>()
68
71
  {
69
- var typeT = typeof(T);
72
+ Type typeT = typeof(T);
70
73
  foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
71
74
  {
72
75
  if (!a.FullName.Contains("Assembly-CSharp")) continue;
73
-
74
- foreach (var type in a.GetTypes()){
76
+
77
+ foreach (Type type in a.GetTypes())
78
+ {
75
79
  if (typeT.IsAssignableFrom(type)) yield return type;
76
80
  }
77
81
  }
@@ -82,7 +86,7 @@ namespace Amanotes.Core.Internal {
82
86
  [Serializable]
83
87
  public partial class SDKConfig
84
88
  {
85
- public bool verboseLog = false;
89
+ public bool verboseLog;
86
90
  }
87
91
 
88
92
  [Serializable]
@@ -91,4 +95,4 @@ namespace Amanotes.Core.Internal {
91
95
  public string id;
92
96
  public int order;
93
97
  }
94
- }
98
+ }
@@ -29,14 +29,11 @@ namespace Amanotes.Core.Internal
29
29
  patch = 0;
30
30
  extra = -1;
31
31
 
32
- if (string.IsNullOrEmpty(version))
33
- {
34
- return;
35
- }
32
+ if (string.IsNullOrEmpty(version)) return;
36
33
 
37
34
  version = version.Trim();
38
35
 
39
- Regex regex = new Regex(@"^(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?$");
36
+ var regex = new Regex(@"^(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?$");
40
37
  Match match = regex.Match(version);
41
38
  if (!match.Success)
42
39
  {
@@ -51,10 +48,10 @@ namespace Amanotes.Core.Internal
51
48
  if (!int.TryParse(match.Groups[4].Value, out extra))
52
49
  extra = -1;
53
50
  }
54
-
51
+
55
52
  }
56
53
 
57
- public bool isValid { get { return this != ZERO; } }
54
+ public bool isValid => this != ZERO;
58
55
 
59
56
  public override string ToString()
60
57
  {
@@ -65,22 +62,10 @@ namespace Amanotes.Core.Internal
65
62
 
66
63
  public int CompareTo(SemVer other)
67
64
  {
68
- if (major != other.major)
69
- {
70
- return major.CompareTo(other.major);
71
- }
72
- if (minor != other.minor)
73
- {
74
- return minor.CompareTo(other.minor);
75
- }
76
- if (patch != other.patch)
77
- {
78
- return patch.CompareTo(other.patch);
79
- }
80
- if (extra != other.extra)
81
- {
82
- return extra.CompareTo(other.extra);
83
- }
65
+ if (major != other.major) return major.CompareTo(other.major);
66
+ if (minor != other.minor) return minor.CompareTo(other.minor);
67
+ if (patch != other.patch) return patch.CompareTo(other.patch);
68
+ if (extra != other.extra) return extra.CompareTo(other.extra);
84
69
  return 0;
85
70
  }
86
71
 
@@ -91,11 +76,8 @@ namespace Amanotes.Core.Internal
91
76
 
92
77
  public override bool Equals(object obj)
93
78
  {
94
- if (!(obj is SemVer))
95
- {
96
- return false;
97
- }
98
- SemVer other = (SemVer)obj;
79
+ if (!(obj is SemVer)) return false;
80
+ var other = (SemVer)obj;
99
81
  return major == other.major && minor == other.minor && patch == other.patch && extra == other.extra;
100
82
  }
101
83
 
@@ -134,4 +116,4 @@ namespace Amanotes.Core.Internal
134
116
  return (major << 24) | (minor << 16) | (patch << 8) | extra;
135
117
  }
136
118
  }
137
- }
119
+ }