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.
- package/CHANGELOG.md +9 -1
- package/Editor/AmaGDKEditor.cs +281 -104
- package/Editor/MatchSDKVersion.cs +3 -6
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +5 -1
- 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/{FirebaseRemoteConfigAdapter_v9.1.0.unitypackage.meta → AppsFlyerAdapter.unitypackage.meta} +1 -1
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/{AppsFlyerAdapter_v6.5.4.unitypackage.meta → FirebaseAnalyticsAdapter.unitypackage.meta} +1 -1
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/{IronSourceAdapter_v7.5.2.unitypackage.meta → FirebaseRemoteConfigAdapter.unitypackage.meta} +1 -1
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/{FirebaseAnalyticsAdapter_v9.1.0.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 +160 -174
- 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/Internal/AmaGDK.Internal.AmaGUI.cs +8 -3
- package/Runtime/Internal/AmaGDK.Internal.SemVer.cs +21 -17
- package/Runtime/Internal/AmaGDK.Internal.cs +17 -6
- package/Runtime/Internal/AmaGDK.Utils.cs +78 -11
- package/Runtime/Klavar/Attributes/AccumulatedCountAttribute.cs +19 -0
- package/Runtime/Klavar/Attributes/AccumulatedCountAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/ConnectionAttribute.cs +18 -0
- package/Runtime/Klavar/Attributes/ConnectionAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/CountInSessionAttribute.cs +27 -0
- package/Runtime/Klavar/Attributes/CountInSessionAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/DescriptionAttribute.cs +7 -0
- package/Runtime/Klavar/Attributes/DescriptionAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/DynamicValidateAttribute.cs +30 -0
- package/Runtime/Klavar/Attributes/DynamicValidateAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/IgnoreAttribute.cs +16 -0
- package/Runtime/Klavar/Attributes/IgnoreAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/MinMaxAttribute.cs +130 -0
- package/Runtime/Klavar/Attributes/MinMaxAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/MinMaxLengthAttribute.cs +88 -0
- package/Runtime/Klavar/Attributes/MinMaxLengthAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/NameAttribute.cs +35 -0
- package/Runtime/Klavar/Attributes/NameAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/NotNullAttribute.cs +16 -0
- package/Runtime/Klavar/Attributes/NotNullAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/RegexPatternAttribute.cs +58 -0
- package/Runtime/Klavar/Attributes/RegexPatternAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/TimeDiffLastFireAttribute.cs +28 -0
- package/Runtime/Klavar/Attributes/TimeDiffLastFireAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/ToStringAttribute.cs +97 -0
- package/Runtime/Klavar/Attributes/ToStringAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes/ValueAttribute.cs +30 -0
- package/Runtime/Klavar/Attributes/ValueAttribute.cs.meta +11 -0
- package/Runtime/Klavar/Attributes.meta +12 -0
- package/Runtime/Klavar/KlavarEvent.cs +91 -0
- package/Runtime/Klavar/KlavarEvent.cs.meta +11 -0
- package/Runtime/Klavar/KlavarEventAttribute.cs +39 -0
- package/Runtime/Klavar/KlavarEventAttribute.cs.meta +11 -0
- package/Runtime/Klavar/KlavarEventTools.cs +92 -0
- package/Runtime/Klavar/KlavarEventTools.cs.meta +11 -0
- package/Runtime/Klavar/KlavarEventUtils.cs +58 -0
- package/Runtime/Klavar/KlavarEventUtils.cs.meta +11 -0
- package/Runtime/Klavar.meta +12 -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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Reflection;
|
|
4
|
+
|
|
5
|
+
namespace Amanotes.Core
|
|
6
|
+
{
|
|
7
|
+
#pragma warning disable CS3005
|
|
8
|
+
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// Convert param to string
|
|
11
|
+
/// </summary>
|
|
12
|
+
public class ToStringAttribute : ConverterLogEventAttribute
|
|
13
|
+
{
|
|
14
|
+
public enum Converter
|
|
15
|
+
{
|
|
16
|
+
NoThing,
|
|
17
|
+
|
|
18
|
+
ToLowerCase,
|
|
19
|
+
ToUpperCase,
|
|
20
|
+
|
|
21
|
+
ToSnakeCase,
|
|
22
|
+
ToCamelCase,
|
|
23
|
+
ToPascalCase,
|
|
24
|
+
ToKebabCase
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static readonly Dictionary<Converter, Func<string, string>> convertMethods = new Dictionary<Converter, Func<string, string>>()
|
|
28
|
+
{
|
|
29
|
+
{Converter.NoThing, val=>val},
|
|
30
|
+
{Converter.ToLowerCase, KlavarEventUtils.ToLowerCase},
|
|
31
|
+
{Converter.ToUpperCase, KlavarEventUtils.ToUpperCase},
|
|
32
|
+
{Converter.ToSnakeCase, KlavarEventUtils.ToSnakeCase},
|
|
33
|
+
{Converter.ToCamelCase, KlavarEventUtils.ToCamelCase},
|
|
34
|
+
{Converter.ToPascalCase, KlavarEventUtils.ToPascalCase},
|
|
35
|
+
{Converter.ToKebabCase, KlavarEventUtils.ToKebabCase},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
public readonly Converter converter;
|
|
39
|
+
|
|
40
|
+
public ToStringAttribute() { converter = Converter.NoThing; }
|
|
41
|
+
|
|
42
|
+
public ToStringAttribute(Converter converter)
|
|
43
|
+
{
|
|
44
|
+
this.converter = converter;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private string GetValueAsString(object enumVal)
|
|
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());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public override object Convert(object parent, FieldInfo fieldInfo, object param)
|
|
57
|
+
{
|
|
58
|
+
return GetValueAsString(param);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
public class ToStringLowerCase : ToStringAttribute
|
|
64
|
+
{
|
|
65
|
+
public ToStringLowerCase() : base(ToStringAttribute.Converter.ToLowerCase) { }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
public class ToStringUpperCase : ToStringAttribute
|
|
70
|
+
{
|
|
71
|
+
public ToStringUpperCase() : base(ToStringAttribute.Converter.ToUpperCase) { }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
public class ToStringToSnakeCase : ToStringAttribute
|
|
76
|
+
{
|
|
77
|
+
public ToStringToSnakeCase() : base(ToStringAttribute.Converter.ToSnakeCase) { }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public class ToStringCamelCase : ToStringAttribute
|
|
81
|
+
{
|
|
82
|
+
public ToStringCamelCase() : base(ToStringAttribute.Converter.ToCamelCase) { }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public class ToStringPascalCase : ToStringAttribute
|
|
86
|
+
{
|
|
87
|
+
public ToStringPascalCase() : base(ToStringAttribute.Converter.ToPascalCase) { }
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
public class ToStringKebabCase : ToStringAttribute
|
|
92
|
+
{
|
|
93
|
+
public ToStringKebabCase() : base(ToStringAttribute.Converter.ToKebabCase) { }
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
#pragma warning restore CS3005
|
|
97
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
namespace Amanotes.Core
|
|
2
|
+
{
|
|
3
|
+
/// <summary>
|
|
4
|
+
/// Change the value of param to new value in the attribute
|
|
5
|
+
/// </summary>
|
|
6
|
+
public class ValueAttribute : KlavarEventAttribute
|
|
7
|
+
{
|
|
8
|
+
public readonly int iValue;
|
|
9
|
+
public readonly string sValue;
|
|
10
|
+
public readonly float fValue;
|
|
11
|
+
public readonly double dValue;
|
|
12
|
+
public ValueAttribute(int value)
|
|
13
|
+
{
|
|
14
|
+
this.iValue = value;
|
|
15
|
+
}
|
|
16
|
+
public ValueAttribute(string value)
|
|
17
|
+
{
|
|
18
|
+
this.sValue = value;
|
|
19
|
+
}
|
|
20
|
+
public ValueAttribute(float value)
|
|
21
|
+
{
|
|
22
|
+
this.fValue = value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public ValueAttribute(double value)
|
|
26
|
+
{
|
|
27
|
+
this.dValue = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
<<<<<<<< HEAD:GDK/AmaGDKCore/Runtime/Klavar/Attributes.meta
|
|
3
|
+
guid: 74f302749097e44ff889ed117ec82dd3
|
|
4
|
+
========
|
|
5
|
+
guid: 2fdae68db26424f679091198f471cf00
|
|
6
|
+
>>>>>>>> fafdc57 ([Release] 0.2.47):GDKTest/GDK-Unity2020.3/Assets/AmaGDKTest.meta
|
|
7
|
+
folderAsset: yes
|
|
8
|
+
DefaultImporter:
|
|
9
|
+
externalObjects: {}
|
|
10
|
+
userData:
|
|
11
|
+
assetBundleName:
|
|
12
|
+
assetBundleVariant:
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Linq;
|
|
4
|
+
using System.Reflection;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
namespace Amanotes.Core
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// LogEvent parameters Schema
|
|
11
|
+
/// </summary>
|
|
12
|
+
public abstract class KlavarEvent
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
/// LogEvent
|
|
16
|
+
/// </summary>
|
|
17
|
+
/// <exception cref="ArgumentException"></exception>
|
|
18
|
+
public void LogEvent()
|
|
19
|
+
{
|
|
20
|
+
var type = this.GetType();
|
|
21
|
+
var eventNameAttr = (EventNameAttribute)Attribute.GetCustomAttribute(type, typeof(EventNameAttribute));
|
|
22
|
+
|
|
23
|
+
if (eventNameAttr == null)
|
|
24
|
+
throw new ArgumentException($"Add `EventName` attribute to class {type.FullName}");
|
|
25
|
+
|
|
26
|
+
var @params = this.ToDict();
|
|
27
|
+
var eventName = eventNameAttr.name;
|
|
28
|
+
AmaGDK.Analytics.LogEvent(eventName, @params);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// throw exception from attribute if field is invalid.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <param name="field"></param>
|
|
36
|
+
/// <returns></returns>
|
|
37
|
+
/// <exception cref="ArgumentException">when field go wrong.</exception>
|
|
38
|
+
private FieldInfo Validate(FieldInfo field)
|
|
39
|
+
{
|
|
40
|
+
var param = field.GetValue(this);
|
|
41
|
+
var attrs = field.GetCustomAttributes<ValidateLogEventAttribute>(true);
|
|
42
|
+
foreach (var attr in attrs) attr.Validate(this, field, param);
|
|
43
|
+
|
|
44
|
+
return field;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// Apply converter attribute in field.
|
|
49
|
+
/// </summary>
|
|
50
|
+
/// <param name="field"></param>
|
|
51
|
+
/// <returns></returns>
|
|
52
|
+
private object Convert(FieldInfo field)
|
|
53
|
+
{
|
|
54
|
+
var attrs = field.GetCustomAttributes<ConverterLogEventAttribute>(true);
|
|
55
|
+
var param = field.GetValue(this);
|
|
56
|
+
foreach (var attr in attrs) param = attr.Convert(this, field, param);
|
|
57
|
+
return param;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// Convert the name in field to new name by attribute.
|
|
63
|
+
/// </summary>
|
|
64
|
+
/// <param name="field"></param>
|
|
65
|
+
/// <returns>the new param name</returns>
|
|
66
|
+
private string GetName(FieldInfo field)
|
|
67
|
+
{
|
|
68
|
+
var attr = field.GetCustomAttribute<NamingLogEventAttribute>(true);
|
|
69
|
+
var param = field.GetValue(this);
|
|
70
|
+
return attr?.GetName(this, field) ?? field.Name;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
/// Convert all params to dict by field name.
|
|
76
|
+
/// </summary>
|
|
77
|
+
/// <returns>dictionary of params</returns>
|
|
78
|
+
public Dictionary<string, object> ToDict()
|
|
79
|
+
{
|
|
80
|
+
return this
|
|
81
|
+
.GetType()
|
|
82
|
+
.GetFields()
|
|
83
|
+
.Where(field => field.GetCustomAttribute<IgnoreAttribute>() == null)
|
|
84
|
+
.Select(field => Validate(field))
|
|
85
|
+
.ToDictionary(
|
|
86
|
+
field => GetName(field),
|
|
87
|
+
field => Convert(field)
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Reflection;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
namespace Amanotes.Core
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Pretty Log Event Attribute
|
|
9
|
+
/// </summary>
|
|
10
|
+
public abstract class KlavarEventAttribute : Attribute
|
|
11
|
+
{
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/// <summary>
|
|
15
|
+
/// Validate Property Attribute
|
|
16
|
+
/// </summary>
|
|
17
|
+
public abstract class ValidateLogEventAttribute : KlavarEventAttribute
|
|
18
|
+
{
|
|
19
|
+
public abstract void Validate(object parent, FieldInfo fieldInfo, object param);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Converter Value of Property Attribute
|
|
24
|
+
/// </summary>
|
|
25
|
+
public abstract class ConverterLogEventAttribute : KlavarEventAttribute
|
|
26
|
+
{
|
|
27
|
+
public abstract object Convert(object parent, FieldInfo fieldInfo, object param);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
/// Nameing Property Attribute
|
|
33
|
+
/// </summary>
|
|
34
|
+
public abstract class NamingLogEventAttribute : KlavarEventAttribute
|
|
35
|
+
{
|
|
36
|
+
public abstract string GetName(object parent, FieldInfo fieldInfo);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
//
|
|
2
|
+
// #if UNITY_EDITOR
|
|
3
|
+
//
|
|
4
|
+
// using System.Linq;
|
|
5
|
+
// using System.Collections;
|
|
6
|
+
// using UnityEditor;
|
|
7
|
+
// using UnityEngine;
|
|
8
|
+
//
|
|
9
|
+
// using System.IO;
|
|
10
|
+
// using System.Collections.Generic;
|
|
11
|
+
// using System;
|
|
12
|
+
//
|
|
13
|
+
// namespace Amanotes.Core
|
|
14
|
+
// {
|
|
15
|
+
// /// <summary>
|
|
16
|
+
// /// Prety Log Event Tools
|
|
17
|
+
// /// </summary>
|
|
18
|
+
// public class KlavarEventTools
|
|
19
|
+
// {
|
|
20
|
+
// public class KlavarEventLine
|
|
21
|
+
// {
|
|
22
|
+
// public string No;
|
|
23
|
+
// public string EventName;
|
|
24
|
+
// public string EventParameterName;
|
|
25
|
+
//
|
|
26
|
+
// public string ValueType;
|
|
27
|
+
//
|
|
28
|
+
// public string ParameterValue;
|
|
29
|
+
//
|
|
30
|
+
// public bool IsInvalid()
|
|
31
|
+
// {
|
|
32
|
+
// return string.IsNullOrWhiteSpace(No)
|
|
33
|
+
// && string.IsNullOrWhiteSpace(EventName)
|
|
34
|
+
// && string.IsNullOrWhiteSpace(EventParameterName)
|
|
35
|
+
// && string.IsNullOrWhiteSpace(ValueType)
|
|
36
|
+
// && string.IsNullOrWhiteSpace(ParameterValue);
|
|
37
|
+
// }
|
|
38
|
+
// }
|
|
39
|
+
//
|
|
40
|
+
// static private IEnumerable<T[]> Chunk<T>(IEnumerable<T> colection, Func<T, bool> splitter)
|
|
41
|
+
// {
|
|
42
|
+
//
|
|
43
|
+
// IEnumerator<T> iter = colection.GetEnumerator();
|
|
44
|
+
// var running = iter.MoveNext();
|
|
45
|
+
//
|
|
46
|
+
// IEnumerable<T> OneChunk()
|
|
47
|
+
// {
|
|
48
|
+
// yield return iter.Current;
|
|
49
|
+
// while (running = iter.MoveNext())
|
|
50
|
+
// {
|
|
51
|
+
// var val = iter.Current;
|
|
52
|
+
// if (splitter(val)) break;
|
|
53
|
+
// yield return val;
|
|
54
|
+
// }
|
|
55
|
+
// }
|
|
56
|
+
//
|
|
57
|
+
// while (running)
|
|
58
|
+
// {
|
|
59
|
+
// var chunk = OneChunk().ToArray();
|
|
60
|
+
// if (chunk.Length > 0) yield return chunk;
|
|
61
|
+
// }
|
|
62
|
+
// }
|
|
63
|
+
//
|
|
64
|
+
//
|
|
65
|
+
// static void ConvertFromCSV()
|
|
66
|
+
// {
|
|
67
|
+
//
|
|
68
|
+
// // string path = EditorUtility.OpenFilePanel("Overwrite with png", ".", "tsv");
|
|
69
|
+
//
|
|
70
|
+
// var path = "/Users/nam.dn/Downloads/Test Pretty Event - Ad Mon.tsv";
|
|
71
|
+
// if (string.IsNullOrEmpty(path)) return;
|
|
72
|
+
//
|
|
73
|
+
//
|
|
74
|
+
// Debug.Log(path);
|
|
75
|
+
// string text = File.ReadAllText(path);
|
|
76
|
+
// var lines = Amanotes.Klavar.TSVParser
|
|
77
|
+
// .Parse<KlavarEventLine>(text)
|
|
78
|
+
// .Where(line => !line.IsInvalid());
|
|
79
|
+
//
|
|
80
|
+
// var linesEvents = Chunk(lines, line => !string.IsNullOrEmpty(line.No));
|
|
81
|
+
// foreach (var linesEvent in linesEvents)
|
|
82
|
+
// {
|
|
83
|
+
// Debug.Log(linesEvent[0]);
|
|
84
|
+
// Debug.Log(linesEvent.Length);
|
|
85
|
+
//
|
|
86
|
+
// var linesParams = Chunk(lines, line => !string.IsNullOrEmpty(line.EventParameterName));
|
|
87
|
+
//
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
90
|
+
// }
|
|
91
|
+
// }
|
|
92
|
+
// #endif
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Linq;
|
|
3
|
+
using System.Text.RegularExpressions;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
namespace Amanotes.Core
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// Convert string to some famous case
|
|
10
|
+
/// https://dev.to/ankitmalikg/difference-among-casings-snake-case-vs-camel-case-vs-pascal-case-vs-kebab-case-2m8b#:~:text=Pascal%20Case%20is%20similar%20to,C%23%2C%20Java%2C%20and%20TypeScript.
|
|
11
|
+
/// </summary>
|
|
12
|
+
internal class KlavarEventUtils
|
|
13
|
+
{
|
|
14
|
+
private static readonly char[] delimiters = { '-', '_', ' ' };
|
|
15
|
+
// private static readonly string delimiters = "_- ";
|
|
16
|
+
public static string[] ToTokens(string text)
|
|
17
|
+
{
|
|
18
|
+
text = Regex.Replace(text, "([A-Z])", " $1");
|
|
19
|
+
var tokens = text.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
|
|
20
|
+
return tokens;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
public static string ToLowerCase(string text) => text.ToLower();
|
|
25
|
+
|
|
26
|
+
public static string ToUpperCase(string text) => text.ToUpper();
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Convert string to SnakeCase
|
|
30
|
+
/// </summary>
|
|
31
|
+
/// <param name="text"></param>
|
|
32
|
+
/// <returns></returns>
|
|
33
|
+
public static string ToSnakeCase(string text)
|
|
34
|
+
{
|
|
35
|
+
var tokens = ToTokens(text);
|
|
36
|
+
return string.Join("_", tokens.Select(t => t.ToLower()));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public static string ToCamelCase(string text)
|
|
40
|
+
{
|
|
41
|
+
var tokens = ToTokens(text);
|
|
42
|
+
return string.Join("", tokens.Select(t => Char.ToUpper(t[0]) + t.Substring(1).ToLower()));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static string ToPascalCase(string text)
|
|
46
|
+
{
|
|
47
|
+
var tokens = ToTokens(text);
|
|
48
|
+
return string.Join("", tokens.Select((t, i) =>
|
|
49
|
+
(i == 0 ? Char.ToLower(t[0]) : Char.ToUpper(t[0])) + t.Substring(1).ToLower()));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public static string ToKebabCase(string text)
|
|
53
|
+
{
|
|
54
|
+
var tokens = ToTokens(text);
|
|
55
|
+
return string.Join("-", tokens.Select(t => t.ToLower()));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
<<<<<<<< HEAD:GDK/AmaGDKCore/Runtime/Klavar.meta
|
|
3
|
+
guid: 5b981038cfa6f4ec2a7dd96f58fde6cd
|
|
4
|
+
========
|
|
5
|
+
guid: 74f302749097e44ff889ed117ec82dd3
|
|
6
|
+
>>>>>>>> fafdc57 ([Release] 0.2.47):GDK/AmaGDKCore/Runtime/Klavar/Attributes.meta
|
|
7
|
+
folderAsset: yes
|
|
8
|
+
DefaultImporter:
|
|
9
|
+
externalObjects: {}
|
|
10
|
+
userData:
|
|
11
|
+
assetBundleName:
|
|
12
|
+
assetBundleVariant:
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|