com.amanotes.gdk 0.2.71 → 0.2.73-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.
- package/CHANGELOG.md +108 -88
- package/Editor/AmaGDKEditor.cs +133 -135
- package/Editor/EmbedRemoteConfigAssetInspector.cs +1 -1
- package/Editor/Extra/GDKAutoUpdateAdapter.cs +24 -24
- package/Editor/Extra/GDKCIBuildCommand.cs +2 -16
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/Consent.unitypackage +0 -0
- package/Extra/ForceUpdate.unitypackage +0 -0
- package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
- package/Extra/PostProcessor.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.AdRevenue.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.AdRevenue.unitypackage.meta +7 -0
- package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/MaxAdNetworkAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
- package/Runtime/Ad/AdExtension.cs +2 -1
- package/Runtime/Ad/AdLogic.cs +10 -5
- package/Runtime/Ad/AmaGDK.Ads.cs +2 -2
- package/Runtime/AmaGDK.Adapters.cs +7 -4
- package/Runtime/AmaGDK.Analytics.cs +67 -48
- package/Runtime/AmaGDK.Config.cs +1 -7
- package/Runtime/AmaGDK.Consent.cs +9 -8
- package/Runtime/AmaGDK.Context.cs +1 -1
- package/Runtime/AmaGDK.Device.cs +3 -2
- package/Runtime/AmaGDK.IAP.cs +1 -1
- package/Runtime/AmaGDK.RemoteConfig.cs +2 -2
- package/Runtime/AmaGDK.Singleton.cs +1 -1
- package/Runtime/AmaGDK.UserProfile.cs +12 -11
- package/Runtime/AmaGDK.asmdef +1 -1
- package/Runtime/AmaGDK.cs +25 -15
- package/Runtime/AnalyticQualityAsset.cs +5 -6
- package/Runtime/AudioToolkit/AmaGDK.Audio.cs +3 -2
- package/Runtime/AudioToolkit/Plugins/AudioDeviceDetector.cs +2 -2
- package/Runtime/Core/GDKDebug.cs +97 -0
- package/Runtime/Core/GDKDebug.cs.meta +3 -0
- package/Runtime/Core/GDKPool.cs +56 -337
- package/Runtime/Core/GDKRoutine.cs +3 -1
- package/Runtime/Core/GDKSemVer.cs +1 -1
- package/Runtime/Core/GDKString.cs +197 -0
- package/Runtime/Core/GDKString.cs.meta +3 -0
- package/Runtime/EmbedRemoteConfigAsset.cs +2 -1
- package/Runtime/Fps/AmaFPS.Utils.cs +5 -1
- package/Runtime/Fps/AmaFPS.cs +1 -1
- package/Runtime/Fps/AmaFPSVisualizer.cs +7 -2
- package/Runtime/Fps/FrameRecorder.cs +1 -1
- package/Runtime/GDKAudio/GDKAudio.cs +16 -13
- package/Runtime/Internal/AmaGDK.Internal.cs +24 -34
- package/Runtime/Internal/AmaGDK.Utils.cs +4 -4
- package/Runtime/Internal/AmaGDK.WebUtils.cs +1 -1
- package/Runtime/Internal/GDKGeoLocationcs.cs +2 -1
- package/Runtime/Internal/GDKServerTime.cs +2 -1
- package/Runtime/Klavar/Attributes/TimeDiffLastFireAttribute.cs +2 -1
- package/Runtime/Klavar/KlavarContainer.cs +4 -4
- package/Runtime/UserProfile/Plugins/Android/AdvertisingIdFetcher.cs +1 -1
- package/Runtime/Utils/GDKUtils.cs +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace Amanotes.Core
|
|
5
|
+
{
|
|
6
|
+
public static class GDKStringExtension
|
|
7
|
+
{
|
|
8
|
+
internal static void Log(GDKString gdkStr, LogType logType, UnityEngine.Object context, Action<string, UnityEngine.Object> logFunc)
|
|
9
|
+
{
|
|
10
|
+
StackTraceLogType type = Application.GetStackTraceLogType(logType);
|
|
11
|
+
Application.SetStackTraceLogType(logType, StackTraceLogType.None);
|
|
12
|
+
{
|
|
13
|
+
logFunc(gdkStr.ToString(), context);
|
|
14
|
+
}
|
|
15
|
+
Application.SetStackTraceLogType(logType, type);
|
|
16
|
+
gdkStr.Clear();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public static void Log(this GDKString gdkStr, UnityEngine.Object context = null)
|
|
20
|
+
{
|
|
21
|
+
Log(gdkStr, LogType.Log, context, Debug.Log);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public static void LogWarning(this GDKString gdkStr, UnityEngine.Object context = null)
|
|
25
|
+
{
|
|
26
|
+
Log(gdkStr, LogType.Warning, context, Debug.LogWarning);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public static void LogError(this GDKString gdkStr, UnityEngine.Object context = null)
|
|
30
|
+
{
|
|
31
|
+
Log(gdkStr, LogType.Error, context, Debug.LogError);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private static readonly char[] DigitChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
|
35
|
+
internal static unsafe int Write(string s, int stIndex, ulong value, bool writePrefix = false, char prefix = '-')
|
|
36
|
+
{
|
|
37
|
+
fixed (char* ptr = s)
|
|
38
|
+
{
|
|
39
|
+
var idx = 0;
|
|
40
|
+
if (writePrefix)
|
|
41
|
+
{
|
|
42
|
+
ptr[stIndex] = prefix;
|
|
43
|
+
idx++;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (value <= 9)
|
|
47
|
+
{
|
|
48
|
+
ptr[stIndex + idx] = DigitChars[value];
|
|
49
|
+
idx++;
|
|
50
|
+
return idx;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var len = (int)Math.Ceiling(Math.Log10(value));
|
|
54
|
+
int endIdx = stIndex + len - 1 + idx;
|
|
55
|
+
do
|
|
56
|
+
{
|
|
57
|
+
ptr[endIdx] = (char)('0' + value % 10);
|
|
58
|
+
endIdx--;
|
|
59
|
+
value /= 10;
|
|
60
|
+
} while (value > 0);
|
|
61
|
+
|
|
62
|
+
idx += len;
|
|
63
|
+
return idx;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
internal static int WriteULong(this string s, int stIndex, ulong value)
|
|
68
|
+
{
|
|
69
|
+
return Write(s, stIndex, value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
internal static int WriteLong(this string s, int stIndex, long value)
|
|
73
|
+
{
|
|
74
|
+
return Write(s, stIndex, (ulong)(value < 0 ? -value : value), value < 0, '-');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
internal static int WriteDouble(this string s, int stIndex, double value, int decimalPlaces = 4)
|
|
78
|
+
{
|
|
79
|
+
var integerPart = (ulong)value;
|
|
80
|
+
int counter = Write(s, stIndex, integerPart, value < 0);
|
|
81
|
+
if (decimalPlaces <= 0) return counter;
|
|
82
|
+
|
|
83
|
+
double fractionalPart = value - integerPart;
|
|
84
|
+
for (var i = 0; i < decimalPlaces; i++)
|
|
85
|
+
{
|
|
86
|
+
fractionalPart *= 10;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var fractionalInt = (ulong)(fractionalPart + 0.5);
|
|
90
|
+
counter += Write(s, stIndex + counter, fractionalInt, true, '.');
|
|
91
|
+
return counter;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public unsafe class GDKString
|
|
96
|
+
{
|
|
97
|
+
private readonly int _capacity;
|
|
98
|
+
private readonly string _str;
|
|
99
|
+
private int _length;
|
|
100
|
+
|
|
101
|
+
public GDKString(int capacity)
|
|
102
|
+
{
|
|
103
|
+
_capacity = capacity;
|
|
104
|
+
_str = new string('\0', capacity);
|
|
105
|
+
_length = 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public int Length => _length;
|
|
109
|
+
|
|
110
|
+
private GDKString SetLength(int value)
|
|
111
|
+
{
|
|
112
|
+
if (value < 0 || value > _capacity)
|
|
113
|
+
{
|
|
114
|
+
throw new ArgumentOutOfRangeException(nameof(value));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
_length = value;
|
|
118
|
+
fixed (char* ptr = _str)
|
|
119
|
+
{
|
|
120
|
+
ptr[value] = '\0';
|
|
121
|
+
*(int*)((IntPtr)ptr - sizeof(int)) = _length;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
public GDKString Append(string value)
|
|
128
|
+
{
|
|
129
|
+
return string.IsNullOrEmpty(value) ? this : WriteAt(_length, value);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public GDKString WriteAt(int stIdx, string value)
|
|
133
|
+
{
|
|
134
|
+
if (string.IsNullOrEmpty(value)) return this;
|
|
135
|
+
|
|
136
|
+
int vLength = value.Length;
|
|
137
|
+
if (stIdx + vLength >= _capacity)
|
|
138
|
+
{
|
|
139
|
+
throw new InvalidOperationException("Buffer overflow.");
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Calculate the number of bytes to copy (2 bytes per char)
|
|
143
|
+
fixed (char* srcPtr = value)
|
|
144
|
+
fixed (char* destPtr = _str)
|
|
145
|
+
{
|
|
146
|
+
// Use memcpy equivalent with pointers
|
|
147
|
+
char* destPos = destPtr + _length;
|
|
148
|
+
for (var i = 0; i < vLength; i++)
|
|
149
|
+
{
|
|
150
|
+
*(destPos + i) = *(srcPtr + i);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (stIdx + vLength > _length) SetLength(_length + vLength);
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public GDKString Append(int value)
|
|
159
|
+
{
|
|
160
|
+
int vLength = _str.WriteLong(Length, value);
|
|
161
|
+
return SetLength(_length + vLength);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
public GDKString Append(uint value)
|
|
165
|
+
{
|
|
166
|
+
int vLength = _str.WriteULong(Length, value);
|
|
167
|
+
return SetLength(_length + vLength);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
private const string TRUE = "True";
|
|
171
|
+
private const string FALSE = "False";
|
|
172
|
+
public GDKString Append(bool value)
|
|
173
|
+
{
|
|
174
|
+
Append(value ? TRUE : FALSE);
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
public GDKString Append(float value)
|
|
179
|
+
{
|
|
180
|
+
int vLength = _str.WriteDouble(Length, value);
|
|
181
|
+
return SetLength(_length + vLength);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
public GDKString Append(double value)
|
|
185
|
+
{
|
|
186
|
+
int vLength = _str.WriteDouble(Length, value);
|
|
187
|
+
return SetLength(_length + vLength);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
public GDKString Clear()
|
|
191
|
+
{
|
|
192
|
+
return SetLength(0);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public override string ToString() => _str;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Linq;
|
|
3
3
|
using UnityEngine;
|
|
4
|
+
using static Amanotes.Core.GDKDebug;
|
|
4
5
|
|
|
5
6
|
namespace Amanotes.Core.Internal
|
|
6
7
|
{
|
|
@@ -30,7 +31,7 @@ namespace Amanotes.Core.Internal
|
|
|
30
31
|
{
|
|
31
32
|
var config = configs?.FirstOrDefault(a => a.id == id);
|
|
32
33
|
if (config == null)
|
|
33
|
-
|
|
34
|
+
LogWarningOnce($"Not found embedded config <{id}>");
|
|
34
35
|
return config;
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
using System.Collections.Generic;
|
|
2
|
-
using static Amanotes.Core.
|
|
2
|
+
using static Amanotes.Core.GDKDebug;
|
|
3
3
|
using UnityEngine;
|
|
4
4
|
namespace Amanotes.Core
|
|
5
5
|
{
|
|
@@ -33,7 +33,11 @@ namespace Amanotes.Core
|
|
|
33
33
|
dictionary.Add("processor_frequency", SystemInfo.processorFrequency);
|
|
34
34
|
dictionary.Add("screen_width", resolution.width);
|
|
35
35
|
dictionary.Add("screen_height", resolution.height);
|
|
36
|
+
#if UNITY_2022_2_OR_NEWER
|
|
37
|
+
dictionary.Add("screen_refresh_rate", resolution.refreshRateRatio.value);
|
|
38
|
+
#else
|
|
36
39
|
dictionary.Add("screen_refresh_rate", resolution.refreshRate);
|
|
40
|
+
#endif
|
|
37
41
|
}
|
|
38
42
|
internal static void InjectDeviceStatus(Dictionary<string, object> dictionary)
|
|
39
43
|
{
|
package/Runtime/Fps/AmaFPS.cs
CHANGED
|
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|
|
3
3
|
using UnityEngine;
|
|
4
4
|
using UnityEngine.Profiling;
|
|
5
5
|
using UnityEngine.UI;
|
|
6
|
-
using static Amanotes.Core.
|
|
6
|
+
using static Amanotes.Core.GDKDebug;
|
|
7
7
|
|
|
8
8
|
namespace Amanotes.Core
|
|
9
9
|
{
|
|
@@ -197,8 +197,13 @@ namespace Amanotes.Core
|
|
|
197
197
|
{
|
|
198
198
|
graphic = GetComponent<Graphic>()
|
|
199
199
|
};
|
|
200
|
-
|
|
200
|
+
|
|
201
|
+
#if UNITY_2022_2_OR_NEWER
|
|
202
|
+
Application.targetFrameRate = (int)Screen.currentResolution.refreshRateRatio.value;
|
|
203
|
+
#else
|
|
201
204
|
Application.targetFrameRate = Screen.currentResolution.refreshRate;
|
|
205
|
+
#endif
|
|
206
|
+
|
|
202
207
|
Log($"Target FrameRate: {Application.targetFrameRate}");
|
|
203
208
|
}
|
|
204
209
|
|
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
// 2. On Android devices (excluding the Unity Editor).
|
|
8
8
|
// 3. In the Unity Editor running on macOS with Apple Silicon (M1, M2, etc.).
|
|
9
9
|
#if UNITY_2021_1_OR_NEWER && ((UNITY_MOBILE && !UNITY_EDITOR) || (UNITY_MOBILE && UNITY_EDITOR_OSX))
|
|
10
|
+
|
|
10
11
|
using System;
|
|
11
12
|
using System.Runtime.InteropServices;
|
|
12
13
|
using Amanotes.Core.Internal;
|
|
14
|
+
using static Amanotes.Core.GDKDebug;
|
|
15
|
+
|
|
13
16
|
using UnityEngine;
|
|
14
17
|
|
|
15
18
|
namespace Amanotes.Core
|
|
@@ -21,7 +24,7 @@ namespace Amanotes.Core
|
|
|
21
24
|
GDKAudio.EnsureDecompressOnLoad(legacyAudioSource.clip);
|
|
22
25
|
if (legacyAudioSource.gameObject.GetComponents<AudioSource>().Length > 1)
|
|
23
26
|
{
|
|
24
|
-
|
|
27
|
+
GDKUtils.ThrowExceptionIfEditor("GDKAudio only allows the GameObject to contain a single AudioSource component.");
|
|
25
28
|
}
|
|
26
29
|
var instance = legacyAudioSource.gameObject.AddComponent<GDKAudio>();
|
|
27
30
|
if (legacyAudioSource.clip != null)
|
|
@@ -98,7 +101,7 @@ namespace Amanotes.Core
|
|
|
98
101
|
}
|
|
99
102
|
catch (Exception ex)
|
|
100
103
|
{
|
|
101
|
-
|
|
104
|
+
GDKUtils.ThrowExceptionIfEditor(ex.ToString());
|
|
102
105
|
}
|
|
103
106
|
return this;
|
|
104
107
|
}
|
|
@@ -118,12 +121,12 @@ namespace Amanotes.Core
|
|
|
118
121
|
}
|
|
119
122
|
if (gameObject.GetComponents<AudioSource>().Length > 1)
|
|
120
123
|
{
|
|
121
|
-
|
|
124
|
+
GDKUtils.ThrowExceptionIfEditor("GDKAudio only allows the GameObject to contain a single AudioSource component.");
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
if (gameObject.GetComponents<GDKAudio>().Length > 1)
|
|
125
128
|
{
|
|
126
|
-
|
|
129
|
+
GDKUtils.ThrowExceptionIfEditor("GDKAudio only allows the GameObject to contain a single GDKAudio component.");
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
|
|
@@ -137,7 +140,7 @@ namespace Amanotes.Core
|
|
|
137
140
|
{
|
|
138
141
|
if (clip != null && clip.loadType != AudioClipLoadType.DecompressOnLoad)
|
|
139
142
|
{
|
|
140
|
-
|
|
143
|
+
GDKUtils.ThrowExceptionIfEditor("GDKAudio only supports AudioClips with Load Type set to Decompress On Load.");
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
146
|
}
|
|
@@ -212,7 +215,7 @@ namespace Amanotes.Core
|
|
|
212
215
|
) / numChannel;
|
|
213
216
|
audioData = new float[numSamples*numChannel];
|
|
214
217
|
Marshal.Copy(audioDataResample, audioData, 0, numSamples*numChannel);
|
|
215
|
-
|
|
218
|
+
LogWarning(
|
|
216
219
|
"Warning: The input AudioClip has a sample rate of " + fs + " Hz," +
|
|
217
220
|
" which does not match AudioSetting sample rate of " + AudioSettings.outputSampleRate + " Hz." +
|
|
218
221
|
" GDKAudio will resample the audio to match AudioSetting with high memory usage." +
|
|
@@ -220,17 +223,17 @@ namespace Amanotes.Core
|
|
|
220
223
|
);
|
|
221
224
|
}
|
|
222
225
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
Log("[AAA]numSamples: " + numSamples);
|
|
227
|
+
Log("[AAA]numChannel:" + numChannel);
|
|
228
|
+
Log("[AAA]bufferLength:" + bufferLength);
|
|
229
|
+
Log("[AAA]numBuffer:" + numBuffer);
|
|
227
230
|
|
|
228
231
|
nFFT = 2048;
|
|
229
232
|
// hop = 512;
|
|
230
233
|
|
|
231
234
|
numFrame = (numSamples - nFFT) / hop;
|
|
232
235
|
// Initialize
|
|
233
|
-
|
|
236
|
+
Log("[AAA]TSM_Init");
|
|
234
237
|
TSM_Init(audioData, speed, fs, numChannel, nFFT, hop, ref ptrL, ref ptrR);
|
|
235
238
|
initialized = true;
|
|
236
239
|
hopFrame = new float[hop*numChannel];
|
|
@@ -239,7 +242,7 @@ namespace Amanotes.Core
|
|
|
239
242
|
|
|
240
243
|
audioSource.clip = audioClip;
|
|
241
244
|
audioSource.loop = loop;
|
|
242
|
-
|
|
245
|
+
Log("[AAA]AudioSettings.outputSampleRate (later): " + AudioSettings.outputSampleRate);
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
private void OnAudioFilterRead(float[] data, int channels)
|
|
@@ -257,7 +260,7 @@ namespace Amanotes.Core
|
|
|
257
260
|
return;
|
|
258
261
|
}
|
|
259
262
|
idxFrame = 0;
|
|
260
|
-
|
|
263
|
+
Log("[AAA] Loop");
|
|
261
264
|
}
|
|
262
265
|
|
|
263
266
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
using System;
|
|
1
|
+
using System;
|
|
2
2
|
using System.Collections.Generic;
|
|
3
|
-
using System.Text;
|
|
4
3
|
using UnityEngine;
|
|
5
4
|
using UnityObject = UnityEngine.Object;
|
|
6
5
|
using static Amanotes.Core.AmaGDK.Analytics;
|
|
7
6
|
using static Amanotes.Core.AmaGDK;
|
|
7
|
+
using static Amanotes.Core.GDKDebug;
|
|
8
8
|
|
|
9
9
|
#if UNITY_EDITOR
|
|
10
10
|
using UnityEditor;
|
|
@@ -48,6 +48,7 @@ namespace Amanotes.Core.Internal
|
|
|
48
48
|
[MenuItem("GameObject/AmaGDK/Add AmaGDK Prefab", false, 10)]
|
|
49
49
|
private static void AddAmaGDKPrefab()
|
|
50
50
|
{
|
|
51
|
+
AssetDatabase.ImportPackage(Res.AMAGDK_CONFIG_PACKAGE, false);
|
|
51
52
|
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(AMAGDK_PREFAB);
|
|
52
53
|
if (prefab == null)
|
|
53
54
|
{
|
|
@@ -63,40 +64,29 @@ namespace Amanotes.Core.Internal
|
|
|
63
64
|
}
|
|
64
65
|
#endif
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
|
|
68
|
+
#if !AMAGDK_DEV
|
|
69
|
+
|
|
70
|
+
[Obsolete("Deprecated class - use GDKDebug instead!")]
|
|
67
71
|
public static class Logging
|
|
68
72
|
{
|
|
69
|
-
|
|
70
|
-
private static readonly HashSet<string> nonFatalDict = new HashSet<string>();
|
|
71
|
-
public static readonly HashSet<string> logWarningDict = new HashSet<string>();
|
|
72
|
-
|
|
73
|
+
[Obsolete("Deprecated method - use GDKDebug.LogWarningOnce() instead!")]
|
|
73
74
|
public static void LogWarningOnce(string message, string key = null)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (!logWarningDict.Add(key)) return;
|
|
78
|
-
Debug.LogWarning($"AmaGDK {message}");
|
|
79
|
-
}
|
|
75
|
+
=> GDKDebug.LogWarningOnce(message, key);
|
|
76
|
+
|
|
77
|
+
[Obsolete("Deprecated method - use GDKDebug.LogWarning() instead!")]
|
|
80
78
|
public static void LogWarning(string message)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
=> GDKDebug.LogWarning(message);
|
|
80
|
+
|
|
81
|
+
[Obsolete("Deprecated method - use GDKDebug.LogError() instead!")]
|
|
84
82
|
public static void LogError(string message)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
GDKUtils.DoOnMainThread(() =>
|
|
89
|
-
{
|
|
90
|
-
if (nonFatalDict.Contains(message)) return; // LogOnce
|
|
91
|
-
nonFatalDict.Add(message);
|
|
92
|
-
logNonfatalErrorHook(message);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
83
|
+
=> GDKDebug.LogError(message);
|
|
84
|
+
|
|
85
|
+
[Obsolete("Deprecated method - use GDKDebug.Log() instead!")]
|
|
95
86
|
public static void Log(string message)
|
|
96
|
-
|
|
97
|
-
if (Config.common.logLevel == LogLevel.Verbose) Debug.Log($"AmaGDK {message}");
|
|
98
|
-
}
|
|
87
|
+
=> GDKDebug.Log(message);
|
|
99
88
|
}
|
|
89
|
+
#endif
|
|
100
90
|
|
|
101
91
|
public static class Forbidden
|
|
102
92
|
{
|
|
@@ -141,7 +131,7 @@ namespace Amanotes.Core.Internal
|
|
|
141
131
|
}
|
|
142
132
|
#endif
|
|
143
133
|
|
|
144
|
-
//
|
|
134
|
+
// LogWarning("Something wrong: another AmaGDK instance found!");
|
|
145
135
|
UnityObject.Destroy(result[i].gameObject);
|
|
146
136
|
}
|
|
147
137
|
|
|
@@ -182,7 +172,7 @@ namespace Amanotes.Core.Internal
|
|
|
182
172
|
}
|
|
183
173
|
}
|
|
184
174
|
|
|
185
|
-
public static class
|
|
175
|
+
public static partial class GDKUtils // Hidden Utils
|
|
186
176
|
{
|
|
187
177
|
private static readonly Dictionary<string, float> LastFireInSessions = new Dictionary<string, float>();
|
|
188
178
|
|
|
@@ -203,10 +193,10 @@ namespace Amanotes.Core.Internal
|
|
|
203
193
|
public static void ThrowExceptionIfEditor(string message)
|
|
204
194
|
{
|
|
205
195
|
#if UNITY_EDITOR
|
|
206
|
-
throw new GDKException(message);
|
|
207
|
-
#else
|
|
208
|
-
Logging.LogError(message);
|
|
196
|
+
if (Application.isEditor) throw new GDKException(message);
|
|
209
197
|
#endif
|
|
198
|
+
|
|
199
|
+
LogError(message);
|
|
210
200
|
}
|
|
211
201
|
|
|
212
202
|
/// <summary>
|
|
@@ -8,7 +8,7 @@ using System.Text;
|
|
|
8
8
|
using System.Text.RegularExpressions;
|
|
9
9
|
using UnityEngine;
|
|
10
10
|
using UnityEngine.Profiling;
|
|
11
|
-
using static Amanotes.Core.
|
|
11
|
+
using static Amanotes.Core.GDKDebug;
|
|
12
12
|
|
|
13
13
|
namespace Amanotes.Core.Internal
|
|
14
14
|
{
|
|
@@ -268,7 +268,7 @@ namespace Amanotes.Core.Internal
|
|
|
268
268
|
|
|
269
269
|
public static void ClearCacheData()
|
|
270
270
|
{
|
|
271
|
-
var sb = GDKPool.
|
|
271
|
+
var sb = GDKPool.GetStringBuilder();
|
|
272
272
|
sb.AppendLine("[AmaGDK] All cached data & stats cleared");
|
|
273
273
|
|
|
274
274
|
if (!Directory.Exists(basePath))
|
|
@@ -411,7 +411,7 @@ namespace Amanotes.Core.Internal
|
|
|
411
411
|
if (inputDict == null) return "{}";
|
|
412
412
|
|
|
413
413
|
Profiler.BeginSample("AmaGDK.JsonUtils.DictionaryToJson()");
|
|
414
|
-
var jsonSb = GDKPool.
|
|
414
|
+
var jsonSb = GDKPool.GetStringBuilder(8);
|
|
415
415
|
jsonSb.Append("{");
|
|
416
416
|
bool isFirstElement = true;
|
|
417
417
|
|
|
@@ -431,7 +431,7 @@ namespace Amanotes.Core.Internal
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
jsonSb.AppendFormat("{0}{1}", format ? "\n" : "", "}");
|
|
434
|
-
var result = GDKPool.
|
|
434
|
+
var result = GDKPool.ReturnString(jsonSb);
|
|
435
435
|
Profiler.EndSample();
|
|
436
436
|
|
|
437
437
|
return result;
|
|
@@ -2,6 +2,7 @@ using System;
|
|
|
2
2
|
using System.Collections;
|
|
3
3
|
using UnityEngine;
|
|
4
4
|
using UnityEngine.Networking;
|
|
5
|
+
using static Amanotes.Core.GDKDebug;
|
|
5
6
|
|
|
6
7
|
namespace Amanotes.Core.Internal
|
|
7
8
|
{
|
|
@@ -39,7 +40,7 @@ namespace Amanotes.Core.Internal
|
|
|
39
40
|
{
|
|
40
41
|
result?.Invoke(data.countryCode?.ToUpper());
|
|
41
42
|
if (data.errorMessage != null)
|
|
42
|
-
|
|
43
|
+
Log(data.errorMessage);
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -3,6 +3,7 @@ using System.Collections;
|
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using UnityEngine;
|
|
5
5
|
using UnityEngine.Networking;
|
|
6
|
+
using static Amanotes.Core.GDKDebug;
|
|
6
7
|
|
|
7
8
|
namespace Amanotes.Core
|
|
8
9
|
{
|
|
@@ -189,7 +190,7 @@ namespace Amanotes.Core.Internal
|
|
|
189
190
|
else
|
|
190
191
|
{
|
|
191
192
|
result?.Invoke(null);
|
|
192
|
-
|
|
193
|
+
Log(data.errorMessage);
|
|
193
194
|
FetchTimeWithOtherProvider();
|
|
194
195
|
}
|
|
195
196
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
using System.Collections.Generic;
|
|
2
2
|
using System.Reflection;
|
|
3
|
+
using Amanotes.Core.Internal;
|
|
3
4
|
using UnityEngine;
|
|
4
5
|
|
|
5
6
|
namespace Amanotes.Core
|
|
@@ -9,7 +10,7 @@ namespace Amanotes.Core
|
|
|
9
10
|
public override object Convert(object parent, FieldInfo fieldInfo, object param)
|
|
10
11
|
{
|
|
11
12
|
string name = parent.GetType().FullName;
|
|
12
|
-
return
|
|
13
|
+
return GDKUtils.GetTimeDiffLastFire(name);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Reflection;
|
|
3
|
-
using Amanotes.Core.Internal;
|
|
4
3
|
using UnityEngine;
|
|
5
4
|
using GUID = System.Guid;
|
|
5
|
+
using static Amanotes.Core.GDKDebug;
|
|
6
6
|
|
|
7
7
|
namespace Amanotes.Core
|
|
8
8
|
{
|
|
@@ -26,10 +26,10 @@ namespace Amanotes.Core
|
|
|
26
26
|
public static void ThrowIfEditor(string message)
|
|
27
27
|
{
|
|
28
28
|
#if UNITY_EDITOR
|
|
29
|
-
throw new KlavarException(message);
|
|
30
|
-
#else
|
|
31
|
-
Logging.LogError(message);
|
|
29
|
+
if (Application.isEditor) throw new KlavarException(message);
|
|
32
30
|
#endif
|
|
31
|
+
|
|
32
|
+
LogError(message);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
public static void ThrowErrorOnField(object parent, FieldInfo fieldInfo, string message)
|