com.amanotes.gdk 0.2.56 → 0.2.57

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.57 - 2024-04-08]
4
+ - [Dev] Fix bug in value conversion within KlavarEvent
5
+ - [Dev] Auto get change log
6
+ - [Dev] Auto publish command
7
+ - [Dev] Upgrade to Unity 2021.3.35f1
8
+ - [Dev] Add support for various banner sizes in IronsourceAdapter
9
+ - [Dev] Clean up and add tooltip for options
10
+ - [Fix] Null exception in LocalBuild Version
11
+
12
+
3
13
  ## [0.2.56 - 2024-04-03]
4
14
  - Release AmaGDK v0.2.56
5
15
 
@@ -369,20 +369,7 @@ namespace Amanotes.Editor
369
369
  {
370
370
  configOpen.Add(adapterId, isOpen = false);
371
371
  }
372
-
373
- // if (adapter == null)
374
- // {
375
- // // EditorGUILayout.HelpBox("Adapter<" + adapterId + "> not imported!", MessageType.Info);
376
- // string adapterName = FindBestAdapterFor(adapterId);
377
- // var package = $"{Res.PACKAGE_PATH}{adapterName}";
378
- //
379
- // if (GUILayout.Button(adapterName))
380
- // {
381
- // AssetDatabase.ImportPackage(package, false);
382
- // }
383
- // return;
384
- // }
385
-
372
+
386
373
  SDKStatus status = SDKStatus.Get(adapterId);
387
374
  bool changed = AmaGUI.Foldout(ObjectNames.NicifyVariableName(adapterId), ref isOpen, () =>
388
375
  {
@@ -461,18 +448,21 @@ namespace Amanotes.Editor
461
448
  EditorGUILayout.HelpBox($"{adapterId} SDK not installed", MessageType.Warning);
462
449
  return;
463
450
  }
451
+
464
452
  if (!status.adapterInstalled)
465
453
  {
466
454
  EditorGUILayout.HelpBox($"{adapterId}-GDKAdapter not installed", MessageType.Warning);
455
+ if (adapterId == IRONSOURCE)
456
+ {
457
+ AmaGUI.Foldout("Enabled AdNetworks", ref showIRSAdapter, () =>
458
+ {
459
+ DrawIRSAdapterVersions();
460
+ GUILayout.Space(8f);
461
+ });
462
+ }
467
463
  return;
468
- }
469
-
470
- if (!status.adapterInstalled)
471
- {
472
- EditorGUILayout.HelpBox($"{adapterId}-GDKAdapter not installed", MessageType.Warning);
473
- return;
474
- }
475
-
464
+ }
465
+
476
466
  DrawModuleConfig(adapter, adapterId);
477
467
  }
478
468
 
@@ -11,7 +11,7 @@ using UnityObject = UnityEngine.Object;
11
11
 
12
12
  namespace Amanotes.Editor
13
13
  {
14
- [CreateAssetMenu(menuName = "Ama GDK/Build Config", fileName = "LocalBuild")]
14
+ [CreateAssetMenu(menuName = "Ama GDK/Local Build Config", fileName = "LocalBuild")]
15
15
  public class GDKLocalBuild : ScriptableObject
16
16
  {
17
17
  private const string DEFAULT_BUILD_FOLDER = "../../_Build";
@@ -37,7 +37,6 @@ namespace Amanotes.Editor
37
37
  public List<UnityObject> listUnused;
38
38
  public BuildRequestTS buildRQ;
39
39
  public UnityEvent beforeBuild;
40
- public TextAsset shTemplate;
41
40
 
42
41
  [NonSerialized] private BuildInfo _buildInfo;
43
42
  [NonSerialized] private int _lockCount;
@@ -493,12 +492,14 @@ namespace Amanotes.Editor
493
492
  buildNumber++;
494
493
  if (string.IsNullOrEmpty(buildVersion)) buildVersion = "1.0.0";
495
494
 
496
- string[] arr = buildVersion.Split('.');
497
- int last = int.Parse(arr[2]);
495
+ List<string> list = buildVersion.Split('.').ToList();
496
+ if (list.Count < 2) list.Add("0");
497
+ if (list.Count < 3) list.Add("0");
498
+ int last = int.Parse(list[2]);
498
499
  last++;
499
500
 
500
- arr[2] = last.ToString();
501
- buildVersion = string.Join(".", arr);
501
+ list[2] = last.ToString();
502
+ buildVersion = string.Join(".", list);
502
503
  }
503
504
  }
504
505
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -13,7 +13,7 @@ namespace Amanotes.Core.Internal
13
13
  [HideInInspector] [SerializeField] internal bool enabled = true;
14
14
  [NonSerialized] internal string adapterId;
15
15
  [NonSerialized] internal string adapterVersion;
16
- [NonSerialized] protected internal Status status = Status.None;
16
+ [NonSerialized] internal protected Status status = Status.None;
17
17
 
18
18
  protected abstract void Init(Action<bool> onComplete);
19
19
 
@@ -9,8 +9,6 @@ using static Amanotes.Core.AmaGDK;
9
9
 
10
10
  namespace Amanotes.Core
11
11
  {
12
-
13
-
14
12
  public static class AdExtension
15
13
  {
16
14
  public static IAdCallback OnAdOpened(this IAdCallback ad, Action callback)
@@ -173,20 +171,7 @@ namespace Amanotes.Core
173
171
  [Serializable]
174
172
  public class AdAdapterConfig
175
173
  {
176
- // public bool manualInit;
177
- public int adLoadTimeoutInSecs = 60;
178
- public int adShowTimeoutInSecs = 5;
179
- public BannerPosition bannerPosition = BannerPosition.BOTTOM;
180
- public bool autoLogEvent = true;
181
-
182
- public bool enableInterstitial = true;
183
- public bool enableRewarded = true;
184
- public bool enableBanner = true;
185
- public bool autoMute = true;
186
- public bool autoTimeScale = true;
187
174
 
188
- [Header("EDITOR")]
189
- [Range(0f, 1f)] public float rewardAdShowSuccessRate = 1;
190
175
  }
191
176
 
192
177
  public partial class Ads
@@ -255,7 +240,7 @@ namespace Amanotes.Core
255
240
  if (_isBannerShowing)
256
241
  {
257
242
  _isBannerShowing = false;
258
- ShowBanner(_showingBannerPosition);
243
+ ShowBanner();
259
244
  }
260
245
  }
261
246
 
@@ -298,22 +283,22 @@ namespace Amanotes.Core
298
283
 
299
284
 
300
285
  private static bool _isBannerShowing;
301
- private static BannerPosition _showingBannerPosition;
302
286
 
303
- public static void ShowBanner(BannerPosition? bannerPosition = null)
287
+ public static void ShowBanner()
304
288
  {
289
+ if (_config.ad.enableBanner) return;
290
+
305
291
  if (_isBannerShowing) return;
306
292
  _isBannerShowing = true;
307
- _showingBannerPosition = bannerPosition ?? Config.ad.bannerPosition;
308
-
309
293
  if (_adapter == null) return;
310
294
 
311
295
  dispatcher.Dispatch(Event.BANNER_SHOW);
312
- _adapter.ShowBanner(_showingBannerPosition);
296
+ _adapter.ShowBanner();
313
297
  }
314
298
 
315
299
  public static void HideBanner()
316
300
  {
301
+ if (_config.ad.enableBanner) return;
317
302
  if (!_isBannerShowing) return;
318
303
  _isBannerShowing = false;
319
304
  if (_adapter == null) return;
@@ -369,22 +354,27 @@ namespace Amanotes.Core.Internal
369
354
  {
370
355
  [Serializable] public class AdModuleConfig
371
356
  {
372
- // [Header("----- MODULE CONFIG -----")]
373
- // public bool manualInit;
357
+ [Tooltip("Automatically retry requesting ad if an ad failed to response in this amount of time (in secs)")]
374
358
  public int adLoadTimeoutInSecs = 60;
359
+
360
+ [Tooltip("When an ad is not ready to show, keep waiting for this amount of time (in secs)\n\nIf the ad is ready during that time, it would be shown normally.")]
375
361
  public int adShowTimeoutInSecs = 5;
376
- public BannerPosition bannerPosition = BannerPosition.BOTTOM;
377
- public bool autoLogEvent = true;
362
+
363
+ [Tooltip("When an ad is not ready to show, verify that there is an internet connection by ping the internet check URL .\nIf there is no internet connection, we will not need to wait for adShowTimeout secs")]
378
364
  public bool checkInternet = true;
379
-
380
- public bool enableInterstitial = true;
381
- public bool enableRewarded = true;
382
- public bool enableBanner = true;
383
-
365
+
366
+ [HideInInspector] public bool enableInterstitial = true;
367
+ [HideInInspector] public bool enableRewarded = true;
368
+ [HideInInspector] public bool enableBanner = true;
369
+
370
+ [Tooltip("Before showing an ad: set AudioListener.volume to 0\nAfter the ad is closed: restore the previously saved AudioListener.volume")]
384
371
  public bool autoMute = true;
372
+
373
+ [Tooltip("Before showing an ad: set Time.timeScale to 0\nAfter the ad is closed: restore the previously saved Time.timeScale")]
385
374
  public bool autoTimeScale = true;
386
375
 
387
376
  [Header("EDITOR")]
377
+ [Tooltip("Only applicable in Editor\n0 = 0% success\n1 = 100% success")]
388
378
  [Range(0f, 1f)] public float rewardAdShowSuccessRate = 1;
389
379
  }
390
380
 
@@ -399,14 +389,14 @@ namespace Amanotes.Core.Internal
399
389
  protected AdModuleConfig moduleConfig => Config.ad;
400
390
 
401
391
  // APIs
402
- protected internal abstract AdLogic interstitial { get; }
403
- protected internal abstract AdLogic rewardVideo { get; }
392
+ internal protected abstract AdLogic interstitial { get; }
393
+ internal protected abstract AdLogic rewardVideo { get; }
404
394
 
405
- public abstract void ShowBanner(BannerPosition bannerPosition);
395
+ public abstract void ShowBanner();
406
396
  public abstract void HideBanner();
407
397
 
408
398
  // Internally used
409
- protected internal abstract void SetUserId(string userId);
399
+ internal protected abstract void SetUserId(string userId);
410
400
  }
411
401
 
412
402
  public interface IAdCallback { }
@@ -443,13 +433,6 @@ namespace Amanotes.Core.Internal
443
433
  Fail = 256
444
434
  }
445
435
 
446
- public enum BannerPosition
447
- {
448
- TOP = 1,
449
- BOTTOM = 2,
450
- RECTANGLE = 3
451
- }
452
-
453
436
  public enum AdType
454
437
  {
455
438
  Interstitial,
@@ -2,7 +2,6 @@ using System;
2
2
  using System.Collections.Concurrent;
3
3
  using System.Collections.Generic;
4
4
  using System.Text;
5
- using System.Text.RegularExpressions;
6
5
  using Amanotes.Core.Internal;
7
6
  using UnityEngine;
8
7
  using UnityEngine.Profiling;
@@ -1050,10 +1049,10 @@ namespace Amanotes.Core.Internal
1050
1049
  {
1051
1050
  // [Header("----- MODULE CONFIG -----")]
1052
1051
  public bool showAnalyticsLog;
1053
- public bool normalizeEventName = true;
1054
- public bool checkMigrationIntegrity = true;
1055
- public bool migrateAccumulatedCount = true;
1056
- public bool enableEventStat;
1052
+ [HideInInspector] public bool normalizeEventName = true;
1053
+ [HideInInspector] public bool checkMigrationIntegrity = true;
1054
+ [HideInInspector] public bool migrateAccumulatedCount = true;
1055
+ [HideInInspector] public bool enableEventStat;
1057
1056
  public AnalyticQualityConfig quality;
1058
1057
  }
1059
1058
 
@@ -1079,11 +1078,10 @@ namespace Amanotes.Core.Internal
1079
1078
 
1080
1079
  public abstract class AnalyticsAdapter : Adapter2
1081
1080
  {
1082
- public bool SendEventByDefault;
1083
-
1084
- public List<string> NeverSend;
1085
- public List<string> AlwaysSend;
1086
-
1081
+ [HideInInspector] public List<string> NeverSend = new List<string>();
1082
+ [HideInInspector] public List<string> AlwaysSend = new List<string>();
1083
+ protected abstract bool SendEventByDefault { get; }
1084
+
1087
1085
  public bool IsForbidden(string eventName)
1088
1086
  {
1089
1087
  return SendEventByDefault
@@ -361,20 +361,6 @@ namespace Amanotes.Core
361
361
  }
362
362
  }
363
363
  }
364
-
365
- // public static class RemoteConfigExtension
366
- // {
367
- // public static void InitRemoteConfigModule(this RemoteConfigAdapter ap, Action<bool> onCompleteCallback)
368
- // {
369
- // if (AmaGDK.RemoteConfig.fetchState != AmaGDK.RemoteConfig.FetchState.None)
370
- // {
371
- // LogWarning($"[RemoteConfig] Current state {AmaGDK.RemoteConfig.fetchState.ToString()}\nCannot start to initialize");
372
- // return;
373
- // }
374
- //
375
- // AmaGDK.RemoteConfig.NextState();
376
- // }
377
- // }
378
364
  }
379
365
 
380
366
  namespace Amanotes.Core.Internal
@@ -382,10 +368,13 @@ namespace Amanotes.Core.Internal
382
368
  [Serializable]
383
369
  public class RemoteConfigConfig
384
370
  {
385
- // [Header("----- MODULE CONFIG -----")]
386
-
371
+ [Tooltip("Fetch timeout for first session (in secs)")]
387
372
  public float firstFetchTimeOutInSeconds = 10;
373
+
374
+ [Tooltip("Fetch timeout for 2nd+ session (in secs)")]
388
375
  public float defaultTimeOutInSeconds = 3;
376
+
377
+ [Tooltip("To create embed Remote config:\n\n- Right click in Project panel\n- Create > AmaGDK > Embed Remote Config\n- Drag & drop the asset here")]
389
378
  [SerializeField] internal EmbedRemoteConfigAsset embedRemoteConfig;
390
379
  }
391
380
 
package/Runtime/AmaGDK.cs CHANGED
@@ -17,7 +17,7 @@ namespace Amanotes.Core
17
17
  {
18
18
  public partial class AmaGDK : MonoBehaviour
19
19
  {
20
- public const string VERSION = "0.2.56";
20
+ public const string VERSION = "0.2.57";
21
21
 
22
22
  internal static AmaGDK _instance;
23
23
  internal static Status _status = Status.None;
@@ -151,6 +151,7 @@ namespace Amanotes.Core.Internal
151
151
 
152
152
  public partial class SDKConfig
153
153
  {
154
- public string internetCheckUrl = "http://www.google.com";
154
+ [Tooltip("The URL we would use to ping to verify if the app is actually connected to the internet")]
155
+ public string internetCheckUrl = "http://clients3.google.com/generate_204";
155
156
  }
156
157
  }
@@ -43,14 +43,22 @@ namespace Amanotes.Core
43
43
  {
44
44
  this.converter = converter;
45
45
  }
46
-
47
- private string GetValueAsString(object enumVal)
46
+
47
+ private string GetValueAsString(object fieldValue)
48
48
  {
49
- // get the field
50
- var field = enumVal.GetType().GetField(enumVal.ToString());
51
- var attr = field.GetCustomAttribute<ValueAttribute>();
52
-
53
- return attr != null ? convertMethods[converter](attr.sValue) : convertMethods[converter](enumVal.ToString());
49
+ var fieldStringValue = fieldValue.ToString();
50
+ var fieldType = fieldValue.GetType();
51
+ if (fieldType.IsEnum)
52
+ {
53
+ var members = fieldType.GetMember(fieldStringValue);
54
+ if (members.Length > 0)
55
+ {
56
+ var attribute = (ValueAttribute)GetCustomAttribute(members[0], typeof(ValueAttribute));
57
+ if (attribute != null)
58
+ return convertMethods[converter](attribute.sValue);
59
+ }
60
+ }
61
+ return convertMethods[converter](fieldStringValue);
54
62
  }
55
63
 
56
64
  public override object Convert(object parent, FieldInfo fieldInfo, object param)
@@ -87,7 +87,7 @@ namespace Amanotes.Core
87
87
  {
88
88
  return this
89
89
  .GetType()
90
- .GetFields()
90
+ .GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
91
91
  .Where(field => field.GetCustomAttribute<IgnoreAttribute>() == null)
92
92
  .Select(field => Validate(field))
93
93
  .ToDictionary(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.56",
3
+ "version": "0.2.57",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",