com.amanotes.gdk 0.2.46 → 0.2.48

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 (78) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/Editor/AmaGDKEditor.cs +281 -104
  3. package/Editor/MatchSDKVersion.cs +3 -6
  4. package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +5 -1
  5. package/Extra/AmaGDKInstaller.unitypackage +0 -0
  6. package/Extra/AmaGDKProject.unitypackage +0 -0
  7. package/Packages/AmaGDKConfig.unitypackage +0 -0
  8. package/Packages/AmaGDKExample.unitypackage +0 -0
  9. package/Packages/AmaGDKTest.unitypackage +0 -0
  10. package/Packages/AppsFlyerAdapter.unitypackage +0 -0
  11. package/Packages/{FirebaseRemoteConfigAdapter_v9.1.0.unitypackage.meta → AppsFlyerAdapter.unitypackage.meta} +1 -1
  12. package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
  13. package/Packages/{AppsFlyerAdapter_v6.5.4.unitypackage.meta → FirebaseAnalyticsAdapter.unitypackage.meta} +1 -1
  14. package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
  15. package/Packages/{IronSourceAdapter_v7.5.2.unitypackage.meta → FirebaseRemoteConfigAdapter.unitypackage.meta} +1 -1
  16. package/Packages/IronSourceAdapter.unitypackage +0 -0
  17. package/Packages/{FirebaseAnalyticsAdapter_v9.1.0.unitypackage.meta → IronSourceAdapter.unitypackage.meta} +1 -1
  18. package/Packages/RevenueCatAdapter.unitypackage +0 -0
  19. package/Packages/RevenueCatAdapter.unitypackage.meta +7 -0
  20. package/Runtime/AmaGDK.Adapters.cs +55 -77
  21. package/Runtime/AmaGDK.Ads.cs +160 -174
  22. package/Runtime/AmaGDK.Analytics.cs +245 -125
  23. package/Runtime/AmaGDK.Config.cs +2 -1
  24. package/Runtime/AmaGDK.IAP.cs +47 -48
  25. package/Runtime/AmaGDK.RemoteConfig.cs +38 -35
  26. package/Runtime/AmaGDK.UserProfile.cs +27 -19
  27. package/Runtime/AmaGDK.cs +158 -111
  28. package/Runtime/Internal/AmaGDK.Internal.AmaGUI.cs +8 -3
  29. package/Runtime/Internal/AmaGDK.Internal.SemVer.cs +21 -17
  30. package/Runtime/Internal/AmaGDK.Internal.cs +17 -6
  31. package/Runtime/Internal/AmaGDK.Utils.cs +78 -11
  32. package/Runtime/Klavar/Attributes/AccumulatedCountAttribute.cs +19 -0
  33. package/Runtime/Klavar/Attributes/AccumulatedCountAttribute.cs.meta +11 -0
  34. package/Runtime/Klavar/Attributes/ConnectionAttribute.cs +18 -0
  35. package/Runtime/Klavar/Attributes/ConnectionAttribute.cs.meta +11 -0
  36. package/Runtime/Klavar/Attributes/CountInSessionAttribute.cs +27 -0
  37. package/Runtime/Klavar/Attributes/CountInSessionAttribute.cs.meta +11 -0
  38. package/Runtime/Klavar/Attributes/DescriptionAttribute.cs +7 -0
  39. package/Runtime/Klavar/Attributes/DescriptionAttribute.cs.meta +11 -0
  40. package/Runtime/Klavar/Attributes/DynamicValidateAttribute.cs +30 -0
  41. package/Runtime/Klavar/Attributes/DynamicValidateAttribute.cs.meta +11 -0
  42. package/Runtime/Klavar/Attributes/IgnoreAttribute.cs +16 -0
  43. package/Runtime/Klavar/Attributes/IgnoreAttribute.cs.meta +11 -0
  44. package/Runtime/Klavar/Attributes/MinMaxAttribute.cs +130 -0
  45. package/Runtime/Klavar/Attributes/MinMaxAttribute.cs.meta +11 -0
  46. package/Runtime/Klavar/Attributes/MinMaxLengthAttribute.cs +88 -0
  47. package/Runtime/Klavar/Attributes/MinMaxLengthAttribute.cs.meta +11 -0
  48. package/Runtime/Klavar/Attributes/NameAttribute.cs +35 -0
  49. package/Runtime/Klavar/Attributes/NameAttribute.cs.meta +11 -0
  50. package/Runtime/Klavar/Attributes/NotNullAttribute.cs +16 -0
  51. package/Runtime/Klavar/Attributes/NotNullAttribute.cs.meta +11 -0
  52. package/Runtime/Klavar/Attributes/RegexPatternAttribute.cs +58 -0
  53. package/Runtime/Klavar/Attributes/RegexPatternAttribute.cs.meta +11 -0
  54. package/Runtime/Klavar/Attributes/TimeDiffLastFireAttribute.cs +28 -0
  55. package/Runtime/Klavar/Attributes/TimeDiffLastFireAttribute.cs.meta +11 -0
  56. package/Runtime/Klavar/Attributes/ToStringAttribute.cs +97 -0
  57. package/Runtime/Klavar/Attributes/ToStringAttribute.cs.meta +11 -0
  58. package/Runtime/Klavar/Attributes/ValueAttribute.cs +30 -0
  59. package/Runtime/Klavar/Attributes/ValueAttribute.cs.meta +11 -0
  60. package/Runtime/Klavar/Attributes.meta +12 -0
  61. package/Runtime/Klavar/KlavarEvent.cs +91 -0
  62. package/Runtime/Klavar/KlavarEvent.cs.meta +11 -0
  63. package/Runtime/Klavar/KlavarEventAttribute.cs +39 -0
  64. package/Runtime/Klavar/KlavarEventAttribute.cs.meta +11 -0
  65. package/Runtime/Klavar/KlavarEventTools.cs +92 -0
  66. package/Runtime/Klavar/KlavarEventTools.cs.meta +11 -0
  67. package/Runtime/Klavar/KlavarEventUtils.cs +58 -0
  68. package/Runtime/Klavar/KlavarEventUtils.cs.meta +11 -0
  69. package/Runtime/Klavar.meta +12 -0
  70. package/package.json +1 -1
  71. package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
  72. package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
  73. package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage +0 -0
  74. package/Packages/IronSourceAdapter_v7.5.2.unitypackage +0 -0
  75. package/Packages/IronsourceAdapter_v7.2.6.unitypackage +0 -0
  76. package/Packages/IronsourceAdapter_v7.2.6.unitypackage.meta +0 -7
  77. package/Packages/RevenueCatAdapter_v6.0.0.unitypackage +0 -0
  78. package/Packages/RevenueCatAdapter_v6.0.0.unitypackage.meta +0 -7
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 4676ec6aa5eac4473b464688797b7e74
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,18 @@
1
+ using System.Collections.Generic;
2
+ using System.Reflection;
3
+ using UnityEngine;
4
+
5
+ namespace Amanotes.Core
6
+ {
7
+ /// <summary>
8
+ /// Get Connection Attribute
9
+ /// </summary>
10
+ public class ConnectionAttribute : ConverterLogEventAttribute
11
+ {
12
+ public override object Convert(object parent, FieldInfo fieldInfo, object param)
13
+ {
14
+ return Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork ?
15
+ "online" : "offline";
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 4a5ccb72b88f14dfd830e677754f07df
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,27 @@
1
+ using System.Collections.Generic;
2
+ using System.Reflection;
3
+ using UnityEngine;
4
+
5
+ namespace Amanotes.Core
6
+ {
7
+ /// <summary>
8
+ /// Get Connection Attribute
9
+ /// </summary>
10
+ public class CountInSessionAttribute : ConverterLogEventAttribute
11
+ {
12
+ static readonly Dictionary<string, int> countInSessions = new Dictionary<string, int>();
13
+
14
+ public override object Convert(object parent, FieldInfo fieldInfo, object param)
15
+ {
16
+ // return AmaGDK.Ads.InterstitialShowCalledInSession;
17
+ string name = parent.GetType().FullName;
18
+ if (!countInSessions.TryGetValue(name, out var count))
19
+ {
20
+ count = countInSessions[name] = 1;
21
+ return 1;
22
+ }
23
+ count = countInSessions[name] = count + 1;
24
+ return count;
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c775bcc69b77340e7a160f75ce5a249f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,7 @@
1
+ namespace Amanotes.Core
2
+ {
3
+ public class DescriptionAttribute : KlavarEventAttribute
4
+ {
5
+ public DescriptionAttribute(string description) { }
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 3ab249f3648b84b6db12944cea37b8d0
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,30 @@
1
+ using System;
2
+ using System.Reflection;
3
+
4
+ namespace Amanotes.Core
5
+ {
6
+ /// <summary>
7
+ /// Dynamic validate param by Function
8
+ /// </summary>
9
+ public class DynamicValidateAttribute : ValidateLogEventAttribute
10
+ {
11
+ readonly string functioName;
12
+ public DynamicValidateAttribute(string functionName)
13
+ {
14
+ this.functioName = functionName;
15
+ }
16
+
17
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
18
+ {
19
+ var function = param.GetType().GetMethod(functioName);
20
+ try
21
+ {
22
+ function?.Invoke(parent, new object[] { param });
23
+ }
24
+ catch (Exception e)
25
+ {
26
+ throw new ArgumentException($"Field {fieldInfo.Name} is in-valid with error {e.Message}");
27
+ }
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 40accc99a6f324666902522f4305acd3
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,16 @@
1
+ namespace Amanotes.Core
2
+ {
3
+ /// <summary>
4
+ /// Ignore this param
5
+ /// </summary>
6
+ public class IgnoreAttribute : KlavarEventAttribute
7
+ {
8
+ }
9
+ }
10
+
11
+
12
+
13
+
14
+
15
+
16
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 4959d05652b9c461c8d8c3ddba63d934
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,130 @@
1
+ using System;
2
+ using System.Reflection;
3
+
4
+ namespace Amanotes.Core
5
+ {
6
+ /// <summary>
7
+ /// Min, Max validate param
8
+ /// </summary>
9
+ public class MinMaxAttribute : ValidateLogEventAttribute
10
+ {
11
+
12
+ public readonly double min;
13
+
14
+ public readonly double max;
15
+
16
+ public MinMaxAttribute(double min, double max)
17
+ {
18
+ this.min = min;
19
+ this.max = max;
20
+ }
21
+
22
+
23
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
24
+ {
25
+ if (!(param is int) && !(param is float) && !(param is double))
26
+ throw new ArgumentException($"type of `{fieldInfo.Name}` is must be int, float or double");
27
+
28
+ double val = Convert.ToDouble(param);
29
+ if (val < min) throw new ArgumentException($"Field `{fieldInfo.Name}` must be in range [{min}, {max}]. Current value: {param}");
30
+ if (val > max) throw new ArgumentException($"Field `{fieldInfo.Name}` must be in range [{min}, {max}]. Current value: {param}");
31
+ }
32
+ }
33
+
34
+
35
+ public class MinimumAttribute : ValidateLogEventAttribute
36
+ {
37
+
38
+ public readonly double min;
39
+
40
+
41
+ public MinimumAttribute(double min)
42
+ {
43
+ this.min = min;
44
+ }
45
+
46
+
47
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
48
+ {
49
+ if (!(param is int) && !(param is float) && !(param is double))
50
+ throw new ArgumentException($"type of `{fieldInfo.Name}` is must be int, float or double");
51
+
52
+ double val = Convert.ToDouble(param);
53
+ if (val < min) throw new ArgumentException($"Field `{fieldInfo.Name}` must be greater or equal to {min}. Current value: {param}");
54
+ }
55
+ }
56
+
57
+
58
+ public class ExclusiveMinimumAttribute : ValidateLogEventAttribute
59
+ {
60
+
61
+ public readonly double min;
62
+
63
+
64
+ public ExclusiveMinimumAttribute(double min)
65
+ {
66
+ this.min = min;
67
+ }
68
+
69
+
70
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
71
+ {
72
+ if (!(param is int) && !(param is float) && !(param is double))
73
+ throw new ArgumentException($"type of `{fieldInfo.Name}` is must be int, float or double");
74
+
75
+ double val = Convert.ToDouble(param);
76
+ if (val <= min) throw new ArgumentException($"Field `{fieldInfo.Name}` must be greater {min}. Current value: {param}");
77
+ }
78
+ }
79
+
80
+
81
+
82
+
83
+
84
+ public class MaximumAttribute : ValidateLogEventAttribute
85
+ {
86
+
87
+ public readonly double max;
88
+
89
+
90
+ public MaximumAttribute(double max)
91
+ {
92
+ this.max = max;
93
+ }
94
+
95
+
96
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
97
+ {
98
+ if (!(param is int) && !(param is float) && !(param is double))
99
+ throw new ArgumentException($"type of `{fieldInfo.Name}` is must be int, float or double");
100
+
101
+ double val = Convert.ToDouble(param);
102
+ if (val > max) throw new ArgumentException($"Field `{fieldInfo.Name}` must be smaller or equal to {max}. Current value: {param}");
103
+ }
104
+ }
105
+
106
+
107
+ public class ExclusiveMaximumAttribute : ValidateLogEventAttribute
108
+ {
109
+
110
+ public readonly double max;
111
+
112
+
113
+ public ExclusiveMaximumAttribute(double max)
114
+ {
115
+ this.max = max;
116
+ }
117
+
118
+
119
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
120
+ {
121
+ if (!(param is int) && !(param is float) && !(param is double))
122
+ throw new ArgumentException($"type of `{fieldInfo.Name}` is must be int, float or double");
123
+
124
+ double val = Convert.ToDouble(param);
125
+ if (val >= max) throw new ArgumentException($"Field `{fieldInfo.Name}` must be smaller to {max}. Current value: {param}");
126
+ }
127
+ }
128
+ }
129
+
130
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c773f7760fee54649bbd4adc39fc2c5b
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,88 @@
1
+ using System;
2
+ using System.Reflection;
3
+
4
+ namespace Amanotes.Core
5
+ {
6
+ /// <summary>
7
+ /// Min, Max length valudate validate param. (Just apply for string only)
8
+ /// </summary>
9
+ public class MinMaxLengthAttribute : ValidateLogEventAttribute
10
+ {
11
+ public readonly int min;
12
+ public readonly int max;
13
+
14
+ public MinMaxLengthAttribute(int min, int max)
15
+ {
16
+ this.min = min;
17
+ this.max = max;
18
+ }
19
+
20
+
21
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
22
+ {
23
+ if (!(param is string text)) throw new ArgumentException($"Field {fieldInfo.Name} must be string.");
24
+ if (param is null) throw new ArgumentException($"Field {fieldInfo.Name} must not be null.");
25
+ if (text.Length < min) throw new ArgumentException($"The length of string field `{fieldInfo.Name}` must be in range [{min}, {max}]. Current length: {text.Length}");
26
+ if (text.Length > max) throw new ArgumentException($"The length of string field `{fieldInfo.Name}` must be in range [{min}, {max}]. Current length: {text.Length}");
27
+ }
28
+ }
29
+
30
+
31
+ public class MinLengthAttribute : ValidateLogEventAttribute
32
+ {
33
+ public readonly int min;
34
+
35
+ public MinLengthAttribute(int min)
36
+ {
37
+ this.min = min;
38
+ }
39
+
40
+
41
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
42
+ {
43
+ if (!(param is string text)) throw new ArgumentException($"Field {fieldInfo.Name} must be string.");
44
+ if (param is null) throw new ArgumentException($"Field {fieldInfo.Name} must not be null.");
45
+ if (text.Length < min) throw new ArgumentException($"The length of string field `{fieldInfo.Name}` must be greater or equal to {min}. Current length: {text.Length}");
46
+ }
47
+ }
48
+
49
+
50
+ public class MaxLengthAttribute : ValidateLogEventAttribute
51
+ {
52
+ public readonly int max;
53
+
54
+ public MaxLengthAttribute(int max)
55
+ {
56
+ this.max = max;
57
+ }
58
+
59
+
60
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
61
+ {
62
+ if (!(param is string text)) throw new ArgumentException($"Field {fieldInfo.Name} must be string.");
63
+ if (param is null) throw new ArgumentException($"Field {fieldInfo.Name} must not be null.");
64
+ if (text.Length > max) throw new ArgumentException($"The length of string field `{fieldInfo.Name}` must be smaller or equal to {max}. Current length: {text.Length}");
65
+ }
66
+ }
67
+
68
+
69
+ public class FixedLengthAttribute : ValidateLogEventAttribute
70
+ {
71
+ public readonly int length;
72
+
73
+ public FixedLengthAttribute(int length)
74
+ {
75
+ this.length = length;
76
+ }
77
+
78
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
79
+ {
80
+ if (!(param is string text)) throw new ArgumentException($"Field {fieldInfo.Name} must be string.");
81
+ if (param is null) throw new ArgumentException($"Field {fieldInfo.Name} must not be null.");
82
+ if (text.Length != length)
83
+ throw new ArgumentException($"The length of string field `{fieldInfo.Name}` must be equal to {length}. Current length: {text.Length}");
84
+ }
85
+ }
86
+ }
87
+
88
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 6b927e38cacb34a7195b04f17f90c2f3
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,35 @@
1
+
2
+ using System.Reflection;
3
+
4
+ namespace Amanotes.Core
5
+ {
6
+
7
+ /// <summary>
8
+ /// Change the Name of param
9
+ /// </summary>
10
+ public class NameAttribute : NamingLogEventAttribute
11
+ {
12
+ public readonly string name;
13
+
14
+ public NameAttribute(string name)
15
+ {
16
+ this.name = name;
17
+ }
18
+ public override string GetName(object parent, FieldInfo fieldInfo) => name;
19
+ }
20
+
21
+
22
+
23
+ /// <summary>
24
+ /// Set the event name
25
+ /// </summary>
26
+ public class EventNameAttribute : KlavarEventAttribute
27
+ {
28
+ public readonly string name;
29
+
30
+ public EventNameAttribute(string name)
31
+ {
32
+ this.name = name;
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 47031184d3e984c99abbca06a5c51fe0
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,16 @@
1
+ using System;
2
+ using System.Reflection;
3
+
4
+ namespace Amanotes.Core
5
+ {
6
+ /// <summary>
7
+ /// Not null validate param
8
+ /// </summary>
9
+ public class NotNullAttribute : ValidateLogEventAttribute
10
+ {
11
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
12
+ {
13
+ if (param is null) throw new ArgumentException($"Field `{fieldInfo.Name}` must not be null");
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a9edce640cd3545c6a026d6590a1f50d
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,58 @@
1
+ using System;
2
+ using System.Reflection;
3
+ using System.Text.RegularExpressions;
4
+
5
+ namespace Amanotes.Core
6
+ {
7
+ #pragma warning disable CS3015
8
+
9
+ /// <summary>
10
+ /// Apply Regex Validation for param
11
+ /// </summary>
12
+ public class RegexPatternAttribute : ValidateLogEventAttribute
13
+ {
14
+ public readonly string[] regexes;
15
+
16
+
17
+ public RegexPatternAttribute(string regex)
18
+ {
19
+ this.regexes = new string[] { regex };
20
+ }
21
+
22
+
23
+ public RegexPatternAttribute(string[] regexes)
24
+ {
25
+ this.regexes = regexes;
26
+ }
27
+
28
+
29
+ public override void Validate(object parent, FieldInfo fieldInfo, object param)
30
+ {
31
+ if (param is null) throw new ArgumentException($"Field `{fieldInfo.Name}` must not be null");
32
+ foreach (var regex in regexes)
33
+ {
34
+ var match = Regex.Match(param.ToString(), regex);
35
+ if (match != null && match.Success) return;
36
+ }
37
+ throw new ArgumentException($"Field `{fieldInfo.Name}` is not match as {this.GetType().Name.Replace("Attribute", "")}");
38
+ }
39
+ }
40
+
41
+ #pragma warning restore CA2200
42
+
43
+ /// <summary>
44
+ /// Is Email validate Param
45
+ /// </summary>
46
+ public class IsEmailAddressAttribute : RegexPatternAttribute
47
+ {
48
+ public IsEmailAddressAttribute() : base(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$") { }
49
+ }
50
+
51
+ /// <summary>
52
+ /// Is ObjectID validate param
53
+ /// </summary>
54
+ public class IsObjectIDAttribute : RegexPatternAttribute
55
+ {
56
+ public IsObjectIDAttribute() : base(@"^(?=[a-f\d]{24}$)(\d+[a-f]|[a-f]+\d)") { }
57
+ }
58
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: b25602076710f4965a41f41a5d1afb46
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,28 @@
1
+ using System.Collections.Generic;
2
+ using System.Reflection;
3
+ using UnityEngine;
4
+
5
+ namespace Amanotes.Core
6
+ {
7
+ public class TimeDiffLastFireAttribute : ConverterLogEventAttribute
8
+ {
9
+ static readonly Dictionary<string, float> lastFireInSessions = new Dictionary<string, float>();
10
+
11
+ public override object Convert(object parent, FieldInfo fieldInfo, object param)
12
+ {
13
+ // return AmaGDK.Ads.InterstitialShowCalledInSession;
14
+ string name = parent.GetType().FullName;
15
+ if (!lastFireInSessions.TryGetValue(name, out var lastFire))
16
+ {
17
+ lastFireInSessions[name] = Time.realtimeSinceStartup;
18
+ return 0;
19
+ }
20
+
21
+ var current = Time.realtimeSinceStartup;
22
+ var diff = Mathf.RoundToInt(current - lastFire);
23
+ lastFireInSessions[name] = current;
24
+ return diff;
25
+ }
26
+ }
27
+
28
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: e93b0c22875584b17840d4a5c8e30424
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: