com.taptap.sdk.core 4.9.3 → 4.10.0-beta.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/Mobile/Editor/NativeDependencies.xml +2 -2
- package/Mobile/Runtime/TapCoreMobile.cs +68 -25
- package/Runtime/Internal/Platform/ITapCorePlatform.cs +14 -4
- package/Runtime/Internal/Utils/TapLoom.cs +27 -27
- package/Runtime/Public/TapTapSDK.cs +41 -24
- package/Standalone/Plugins/x86_64/taptap_api.dll +0 -0
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogStandalone.cs +102 -50
- package/Standalone/Runtime/Public/TapCoreStandalone.cs +11 -1
- package/package.json +1 -1
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
<repositories>
|
|
5
5
|
<repository>https://repo.maven.apache.org/maven2</repository>
|
|
6
6
|
</repositories>
|
|
7
|
-
<androidPackage spec="com.taptap.sdk:tap-core-unity:4.
|
|
7
|
+
<androidPackage spec="com.taptap.sdk:tap-core-unity:4.10.0-beta.1"/>
|
|
8
8
|
</androidPackages>
|
|
9
9
|
<iosPods>
|
|
10
10
|
<sources>
|
|
11
11
|
<source>https://github.com/CocoaPods/Specs.git</source>
|
|
12
12
|
</sources>
|
|
13
|
-
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapSDK/Core" version="4.
|
|
13
|
+
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapSDK/Core" version="4.10.0-beta.1"/>
|
|
14
14
|
</iosPods>
|
|
15
15
|
</dependencies>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using System.
|
|
2
|
+
using System.Collections.Generic;
|
|
3
3
|
using System.Linq;
|
|
4
4
|
using System.Runtime.InteropServices;
|
|
5
|
+
using System.Threading.Tasks;
|
|
6
|
+
using Newtonsoft.Json;
|
|
5
7
|
using TapSDK.Core.Internal;
|
|
8
|
+
using TapSDK.Core.Internal.Log;
|
|
6
9
|
using TapSDK.Core.Internal.Utils;
|
|
7
|
-
using System.Collections.Generic;
|
|
8
10
|
using UnityEngine;
|
|
9
|
-
using Newtonsoft.Json;
|
|
10
|
-
using TapSDK.Core.Internal.Log;
|
|
11
11
|
|
|
12
12
|
namespace TapSDK.Core.Mobile
|
|
13
13
|
{
|
|
@@ -44,32 +44,48 @@ namespace TapSDK.Core.Mobile
|
|
|
44
44
|
TapLog.Log("TapCoreMobile SDK inited");
|
|
45
45
|
SetPlatformAndVersion(TapTapSDK.SDKPlatform, TapTapSDK.Version);
|
|
46
46
|
string coreOptionsJson = JsonUtility.ToJson(coreOption);
|
|
47
|
-
string[] otherOptionsJson = otherOptions
|
|
48
|
-
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
string[] otherOptionsJson = otherOptions
|
|
48
|
+
.Select(option => JsonConvert.SerializeObject(option))
|
|
49
|
+
.ToArray();
|
|
50
|
+
Bridge.CallHandler(
|
|
51
|
+
EngineBridgeInitializer
|
|
52
|
+
.GetBridgeServer()
|
|
53
|
+
.Method("init")
|
|
54
|
+
.Args("coreOption", coreOptionsJson)
|
|
55
|
+
.Args("otherOptions", otherOptionsJson)
|
|
56
|
+
.CommandBuilder()
|
|
57
|
+
);
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
private void SetPlatformAndVersion(string platform, string version)
|
|
56
61
|
{
|
|
57
|
-
TapLog.Log(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
TapLog.Log(
|
|
63
|
+
"TapCoreMobile SetPlatformAndVersion called with platform: "
|
|
64
|
+
+ platform
|
|
65
|
+
+ " and version: "
|
|
66
|
+
+ version
|
|
67
|
+
);
|
|
68
|
+
Bridge.CallHandler(
|
|
69
|
+
EngineBridgeInitializer
|
|
70
|
+
.GetBridgeServer()
|
|
71
|
+
.Method("setPlatformAndVersion")
|
|
72
|
+
.Args("platform", TapTapSDK.SDKPlatform)
|
|
73
|
+
.Args("version", TapTapSDK.Version)
|
|
74
|
+
.CommandBuilder()
|
|
75
|
+
);
|
|
63
76
|
SetSDKArtifact("Unity");
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
private void SetSDKArtifact(string value)
|
|
67
80
|
{
|
|
68
81
|
TapLog.Log("TapCoreMobile SetSDKArtifact called with value: " + value);
|
|
69
|
-
Bridge.CallHandler(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
Bridge.CallHandler(
|
|
83
|
+
EngineBridgeInitializer
|
|
84
|
+
.GetBridgeServer()
|
|
85
|
+
.Method("setSDKArtifact")
|
|
86
|
+
.Args("artifact", "Unity")
|
|
87
|
+
.CommandBuilder()
|
|
88
|
+
);
|
|
73
89
|
}
|
|
74
90
|
|
|
75
91
|
public void Init(TapTapSdkOptions coreOption)
|
|
@@ -80,15 +96,42 @@ namespace TapSDK.Core.Mobile
|
|
|
80
96
|
public void UpdateLanguage(TapTapLanguageType language)
|
|
81
97
|
{
|
|
82
98
|
TapLog.Log("TapCoreMobile UpdateLanguage language: " + language);
|
|
83
|
-
Bridge.CallHandler(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
99
|
+
Bridge.CallHandler(
|
|
100
|
+
EngineBridgeInitializer
|
|
101
|
+
.GetBridgeServer()
|
|
102
|
+
.Method("updateLanguage")
|
|
103
|
+
.Args("language", (int)language)
|
|
104
|
+
.CommandBuilder()
|
|
105
|
+
);
|
|
87
106
|
}
|
|
88
107
|
|
|
89
108
|
public Task<bool> IsLaunchedFromTapTapPC()
|
|
90
109
|
{
|
|
91
110
|
return Task.FromResult(false);
|
|
92
111
|
}
|
|
112
|
+
|
|
113
|
+
public void SendOpenLog(
|
|
114
|
+
string project,
|
|
115
|
+
string version,
|
|
116
|
+
string action,
|
|
117
|
+
Dictionary<string, string> properties
|
|
118
|
+
)
|
|
119
|
+
{
|
|
120
|
+
if (properties == null)
|
|
121
|
+
{
|
|
122
|
+
properties = new Dictionary<string, string>();
|
|
123
|
+
}
|
|
124
|
+
string propertiesJson = JsonConvert.SerializeObject(properties);
|
|
125
|
+
Bridge.CallHandler(
|
|
126
|
+
EngineBridgeInitializer
|
|
127
|
+
.GetBridgeServer()
|
|
128
|
+
.Method("sendOpenLog")
|
|
129
|
+
.Args("project", project)
|
|
130
|
+
.Args("version", version)
|
|
131
|
+
.Args("action", action)
|
|
132
|
+
.Args("properties", propertiesJson)
|
|
133
|
+
.CommandBuilder()
|
|
134
|
+
);
|
|
135
|
+
}
|
|
93
136
|
}
|
|
94
|
-
}
|
|
137
|
+
}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
2
3
|
using System.Threading.Tasks;
|
|
3
4
|
|
|
4
|
-
namespace TapSDK.Core.Internal
|
|
5
|
-
|
|
5
|
+
namespace TapSDK.Core.Internal
|
|
6
|
+
{
|
|
7
|
+
public interface ITapCorePlatform
|
|
8
|
+
{
|
|
6
9
|
void Init(TapTapSdkOptions config);
|
|
7
10
|
|
|
8
11
|
void Init(TapTapSdkOptions coreOption, TapTapSdkBaseOptions[] otherOptions);
|
|
9
|
-
|
|
12
|
+
|
|
10
13
|
void UpdateLanguage(TapTapLanguageType language);
|
|
11
14
|
|
|
12
15
|
Task<bool> IsLaunchedFromTapTapPC();
|
|
16
|
+
|
|
17
|
+
void SendOpenLog(
|
|
18
|
+
string project,
|
|
19
|
+
string version,
|
|
20
|
+
string action,
|
|
21
|
+
Dictionary<string, string> properties
|
|
22
|
+
);
|
|
13
23
|
}
|
|
14
|
-
}
|
|
24
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
using
|
|
1
|
+
using System;
|
|
2
2
|
using System.Collections;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
|
-
using System;
|
|
5
|
-
using System.Threading;
|
|
6
4
|
using System.Linq;
|
|
5
|
+
using System.Threading;
|
|
6
|
+
using UnityEngine;
|
|
7
7
|
|
|
8
8
|
namespace TapSDK.Core.Internal.Utils
|
|
9
9
|
{
|
|
@@ -42,7 +42,6 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
42
42
|
{
|
|
43
43
|
if (!initialized)
|
|
44
44
|
{
|
|
45
|
-
|
|
46
45
|
if (!Application.isPlaying)
|
|
47
46
|
return;
|
|
48
47
|
initialized = true;
|
|
@@ -50,15 +49,16 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
50
49
|
DontDestroyOnLoad(g);
|
|
51
50
|
_current = g.AddComponent<TapLoom>();
|
|
52
51
|
}
|
|
53
|
-
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
private List<Action> _actions = new List<Action>();
|
|
55
|
+
|
|
57
56
|
public struct DelayedQueueItem
|
|
58
57
|
{
|
|
59
58
|
public float time;
|
|
60
59
|
public Action action;
|
|
61
60
|
}
|
|
61
|
+
|
|
62
62
|
private List<DelayedQueueItem> _delayed = new List<DelayedQueueItem>();
|
|
63
63
|
|
|
64
64
|
List<DelayedQueueItem> _currentDelayed = new List<DelayedQueueItem>();
|
|
@@ -67,20 +67,26 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
67
67
|
{
|
|
68
68
|
QueueOnMainThread(action, 0f);
|
|
69
69
|
}
|
|
70
|
+
|
|
70
71
|
public static void QueueOnMainThread(Action action, float time)
|
|
71
72
|
{
|
|
72
73
|
if (time != 0)
|
|
73
74
|
{
|
|
74
75
|
lock (Current._delayed)
|
|
75
76
|
{
|
|
76
|
-
Current._delayed.Add(
|
|
77
|
+
Current._delayed.Add(
|
|
78
|
+
new DelayedQueueItem { time = Time.time, action = action }
|
|
79
|
+
);
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
else
|
|
80
83
|
{
|
|
81
|
-
|
|
84
|
+
if (Current != null && Current._actions != null)
|
|
82
85
|
{
|
|
83
|
-
Current._actions
|
|
86
|
+
lock (Current._actions)
|
|
87
|
+
{
|
|
88
|
+
Current._actions.Add(action);
|
|
89
|
+
}
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
}
|
|
@@ -167,37 +173,27 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
167
173
|
{
|
|
168
174
|
((Action)action)();
|
|
169
175
|
}
|
|
170
|
-
catch
|
|
171
|
-
{
|
|
172
|
-
}
|
|
176
|
+
catch { }
|
|
173
177
|
finally
|
|
174
178
|
{
|
|
175
179
|
Interlocked.Decrement(ref numThreads);
|
|
176
180
|
}
|
|
177
|
-
|
|
178
181
|
}
|
|
179
182
|
|
|
180
|
-
|
|
181
183
|
void OnDisable()
|
|
182
184
|
{
|
|
183
185
|
if (_current == this)
|
|
184
186
|
{
|
|
185
|
-
|
|
186
187
|
_current = null;
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
// Use this for initialization
|
|
193
|
-
void Start()
|
|
194
|
-
{
|
|
195
|
-
|
|
196
|
-
}
|
|
191
|
+
// Use this for initialization
|
|
192
|
+
void Start() { }
|
|
197
193
|
|
|
198
194
|
List<Action> _currentActions = new List<Action>();
|
|
199
195
|
|
|
200
|
-
// Update is called once per frame
|
|
196
|
+
// Update is called once per frame
|
|
201
197
|
void Update()
|
|
202
198
|
{
|
|
203
199
|
lock (_actions)
|
|
@@ -223,19 +219,23 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
223
219
|
}
|
|
224
220
|
}
|
|
225
221
|
|
|
226
|
-
private void OnApplicationPause(bool pauseStatus)
|
|
227
|
-
|
|
222
|
+
private void OnApplicationPause(bool pauseStatus)
|
|
223
|
+
{
|
|
224
|
+
if (pauseStatus && isPause == false)
|
|
225
|
+
{
|
|
228
226
|
isPause = true;
|
|
229
227
|
EventManager.TriggerEvent(EventManager.OnApplicationPause, true);
|
|
230
228
|
}
|
|
231
|
-
else if (!pauseStatus && isPause)
|
|
229
|
+
else if (!pauseStatus && isPause)
|
|
230
|
+
{
|
|
232
231
|
isPause = false;
|
|
233
232
|
EventManager.TriggerEvent(EventManager.OnApplicationPause, false);
|
|
234
233
|
}
|
|
235
234
|
}
|
|
236
235
|
|
|
237
|
-
|
|
236
|
+
private void OnApplicationQuit()
|
|
237
|
+
{
|
|
238
238
|
EventManager.TriggerEvent(EventManager.OnApplicationQuit, true);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
}
|
|
241
|
+
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using System.
|
|
2
|
+
using System.Collections.Generic;
|
|
3
3
|
using System.Linq;
|
|
4
|
+
using System.Threading.Tasks;
|
|
4
5
|
using TapSDK.Core.Internal;
|
|
5
|
-
using System.Collections.Generic;
|
|
6
|
-
|
|
7
|
-
using UnityEngine;
|
|
8
|
-
using System.Reflection;
|
|
9
6
|
using TapSDK.Core.Internal.Init;
|
|
10
7
|
using TapSDK.Core.Internal.Log;
|
|
11
|
-
using
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
|
|
10
|
+
namespace TapSDK.Core
|
|
11
|
+
{
|
|
12
|
+
public class TapTapSDK
|
|
13
|
+
{
|
|
14
|
+
public static readonly string Version = "4.10.0-beta.1";
|
|
12
15
|
|
|
13
|
-
namespace TapSDK.Core {
|
|
14
|
-
public class TapTapSDK {
|
|
15
|
-
public static readonly string Version = "4.9.3";
|
|
16
|
-
|
|
17
16
|
public static string SDKPlatform = "TapSDK-Unity";
|
|
18
17
|
|
|
19
18
|
public static TapTapSdkOptions taptapSdkOptions;
|
|
@@ -22,16 +21,19 @@ namespace TapSDK.Core {
|
|
|
22
21
|
|
|
23
22
|
private static bool disableDurationStatistics;
|
|
24
23
|
|
|
25
|
-
public static bool DisableDurationStatistics
|
|
24
|
+
public static bool DisableDurationStatistics
|
|
25
|
+
{
|
|
26
26
|
get => disableDurationStatistics;
|
|
27
|
-
set {
|
|
28
|
-
disableDurationStatistics = value;
|
|
29
|
-
}
|
|
27
|
+
set { disableDurationStatistics = value; }
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
static TapTapSDK()
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
static TapTapSDK()
|
|
31
|
+
{
|
|
32
|
+
platformWrapper =
|
|
33
|
+
PlatformTypeUtils.CreatePlatformImplementationObject(
|
|
34
|
+
typeof(ITapCorePlatform),
|
|
35
|
+
"TapSDK.Core"
|
|
36
|
+
) as ITapCorePlatform;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
public static void Init(TapTapSdkOptions coreOption)
|
|
@@ -71,7 +73,6 @@ namespace TapSDK.Core {
|
|
|
71
73
|
TapLog.Enabled = coreOption.enableLog;
|
|
72
74
|
platformWrapper?.Init(coreOption, otherOptions);
|
|
73
75
|
|
|
74
|
-
|
|
75
76
|
Type[] initTaskTypes = GetInitTypeList();
|
|
76
77
|
if (initTaskTypes != null)
|
|
77
78
|
{
|
|
@@ -96,7 +97,10 @@ namespace TapSDK.Core {
|
|
|
96
97
|
/// <param name="coreOption"></param>
|
|
97
98
|
/// <param name="otherOptions"></param>
|
|
98
99
|
/// <returns>TapEvent 属性</returns>
|
|
99
|
-
private static TapTapEventOptions HandleEventOptions(
|
|
100
|
+
private static TapTapEventOptions HandleEventOptions(
|
|
101
|
+
TapTapSdkOptions coreOption,
|
|
102
|
+
TapTapSdkBaseOptions[] otherOptions = null
|
|
103
|
+
)
|
|
100
104
|
{
|
|
101
105
|
TapTapEventOptions tapEventOptions = null;
|
|
102
106
|
if (otherOptions != null && otherOptions.Length > 0)
|
|
@@ -115,9 +119,11 @@ namespace TapSDK.Core {
|
|
|
115
119
|
if (coreOption != null)
|
|
116
120
|
{
|
|
117
121
|
tapEventOptions.channel = coreOption.channel;
|
|
118
|
-
tapEventOptions.disableAutoLogDeviceLogin =
|
|
122
|
+
tapEventOptions.disableAutoLogDeviceLogin =
|
|
123
|
+
coreOption.disableAutoLogDeviceLogin;
|
|
119
124
|
tapEventOptions.enableAutoIAPEvent = coreOption.enableAutoIAPEvent;
|
|
120
|
-
tapEventOptions.overrideBuiltInParameters =
|
|
125
|
+
tapEventOptions.overrideBuiltInParameters =
|
|
126
|
+
coreOption.overrideBuiltInParameters;
|
|
121
127
|
tapEventOptions.propertiesJson = coreOption.propertiesJson;
|
|
122
128
|
}
|
|
123
129
|
}
|
|
@@ -129,16 +135,18 @@ namespace TapSDK.Core {
|
|
|
129
135
|
{
|
|
130
136
|
platformWrapper?.UpdateLanguage(language);
|
|
131
137
|
}
|
|
132
|
-
|
|
138
|
+
|
|
133
139
|
// 是否通过 PC 启动器唤起游戏
|
|
134
140
|
public static Task<bool> IsLaunchedFromTapTapPC()
|
|
135
141
|
{
|
|
136
142
|
return platformWrapper?.IsLaunchedFromTapTapPC();
|
|
137
143
|
}
|
|
138
144
|
|
|
139
|
-
private static Type[] GetInitTypeList()
|
|
145
|
+
private static Type[] GetInitTypeList()
|
|
146
|
+
{
|
|
140
147
|
Type interfaceType = typeof(IInitTask);
|
|
141
|
-
Type[] initTaskTypes = AppDomain
|
|
148
|
+
Type[] initTaskTypes = AppDomain
|
|
149
|
+
.CurrentDomain.GetAssemblies()
|
|
142
150
|
.Where(asssembly => asssembly.GetName().FullName.StartsWith("TapSDK"))
|
|
143
151
|
.SelectMany(assembly => assembly.GetTypes())
|
|
144
152
|
.Where(clazz => interfaceType.IsAssignableFrom(clazz) && clazz.IsClass)
|
|
@@ -146,5 +154,14 @@ namespace TapSDK.Core {
|
|
|
146
154
|
return initTaskTypes;
|
|
147
155
|
}
|
|
148
156
|
|
|
157
|
+
public static void SendOpenLog(
|
|
158
|
+
string project,
|
|
159
|
+
string version,
|
|
160
|
+
string action,
|
|
161
|
+
Dictionary<string, string> properties = null
|
|
162
|
+
)
|
|
163
|
+
{
|
|
164
|
+
platformWrapper.SendOpenLog(project, version, action, properties);
|
|
165
|
+
}
|
|
149
166
|
}
|
|
150
167
|
}
|
|
Binary file
|
|
@@ -17,16 +17,20 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
17
17
|
public class TapOpenlogStandalone
|
|
18
18
|
{
|
|
19
19
|
public static string openid = "";
|
|
20
|
-
private static readonly Dictionary<string, string> generalParameter =
|
|
21
|
-
|
|
20
|
+
private static readonly Dictionary<string, string> generalParameter =
|
|
21
|
+
new Dictionary<string, string>();
|
|
22
|
+
private static readonly Dictionary<string, System.Object> openlogStartParameter =
|
|
23
|
+
new Dictionary<string, System.Object>();
|
|
22
24
|
private readonly string sdkProjectName;
|
|
23
25
|
private readonly string sdkProjectVersion;
|
|
24
26
|
private static readonly bool isRND = false;
|
|
25
27
|
private static readonly TapLog log = new TapLog(module: "Openlog");
|
|
26
28
|
#if UNITY_STANDALONE
|
|
27
|
-
private static readonly CommonVariablesGetter commonVariablesGetter =
|
|
29
|
+
private static readonly CommonVariablesGetter commonVariablesGetter =
|
|
30
|
+
new CommonVariablesGetter(GetCommonVariables);
|
|
28
31
|
private static readonly FreeStringCallback freeString = new FreeStringCallback(FreeString);
|
|
29
32
|
#endif
|
|
33
|
+
|
|
30
34
|
public static void Init()
|
|
31
35
|
{
|
|
32
36
|
#if UNITY_STANDALONE
|
|
@@ -58,28 +62,37 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
58
62
|
private static void BindWindowChange()
|
|
59
63
|
{
|
|
60
64
|
#if UNITY_STANDALONE
|
|
61
|
-
EventManager.AddListener(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
EventManager.AddListener(
|
|
66
|
+
EventManager.OnApplicationPause,
|
|
67
|
+
(isPause) =>
|
|
68
|
+
{
|
|
69
|
+
var isPauseBool = (bool)isPause;
|
|
70
|
+
if (isPauseBool)
|
|
71
|
+
{
|
|
72
|
+
TdkOnBackground();
|
|
73
|
+
}
|
|
74
|
+
else
|
|
75
|
+
{
|
|
76
|
+
TdkOnForeground();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
EventManager.AddListener(
|
|
82
|
+
EventManager.OnApplicationQuit,
|
|
83
|
+
(quit) =>
|
|
65
84
|
{
|
|
66
|
-
|
|
85
|
+
TdkOnAppStopped();
|
|
67
86
|
}
|
|
68
|
-
|
|
87
|
+
);
|
|
88
|
+
EventManager.AddListener(
|
|
89
|
+
EventManager.OnComplianceUserChanged,
|
|
90
|
+
(userInfo) =>
|
|
69
91
|
{
|
|
70
|
-
|
|
92
|
+
TdkSetExtraAppDurationParams(userInfo.ToString());
|
|
71
93
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
EventManager.AddListener(EventManager.OnApplicationQuit, (quit) =>
|
|
75
|
-
{
|
|
76
|
-
TdkOnAppStopped();
|
|
77
|
-
});
|
|
78
|
-
EventManager.AddListener(EventManager.OnComplianceUserChanged, (userInfo) =>
|
|
79
|
-
{
|
|
80
|
-
TdkSetExtraAppDurationParams(userInfo.ToString());
|
|
81
|
-
});
|
|
82
|
-
#endif
|
|
94
|
+
);
|
|
95
|
+
#endif
|
|
83
96
|
}
|
|
84
97
|
|
|
85
98
|
public TapOpenlogStandalone(string sdkProjectName, string sdkProjectVersion)
|
|
@@ -88,10 +101,7 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
88
101
|
this.sdkProjectVersion = sdkProjectVersion;
|
|
89
102
|
}
|
|
90
103
|
|
|
91
|
-
public void LogBusiness(
|
|
92
|
-
string action,
|
|
93
|
-
Dictionary<string, string> properties = null
|
|
94
|
-
)
|
|
104
|
+
public void LogBusiness(string action, Dictionary<string, string> properties = null)
|
|
95
105
|
{
|
|
96
106
|
#if UNITY_STANDALONE
|
|
97
107
|
if (properties == null)
|
|
@@ -106,13 +116,13 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
106
116
|
#endif
|
|
107
117
|
}
|
|
108
118
|
|
|
109
|
-
public void LogTechnology(
|
|
110
|
-
string action,
|
|
111
|
-
Dictionary<string, string> properties = null
|
|
112
|
-
)
|
|
119
|
+
public void LogTechnology(string action, Dictionary<string, string> properties = null)
|
|
113
120
|
{
|
|
114
121
|
#if UNITY_STANDALONE
|
|
115
|
-
if (
|
|
122
|
+
if (
|
|
123
|
+
TapCoreStandalone.coreOptions.region == TapTapRegionType.CN
|
|
124
|
+
&& !"TapPayment".Equals(sdkProjectName)
|
|
125
|
+
)
|
|
116
126
|
{
|
|
117
127
|
// 国内非支付SDK不上报技术日志
|
|
118
128
|
return;
|
|
@@ -138,16 +148,26 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
138
148
|
}
|
|
139
149
|
else
|
|
140
150
|
{
|
|
141
|
-
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_REGION] =
|
|
151
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_REGION] =
|
|
152
|
+
TapCoreStandalone.coreOptions.region;
|
|
142
153
|
}
|
|
143
154
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_LOG_TO_CONSOLE] = 1;
|
|
144
155
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_LOG_LEVEL] = 1;
|
|
145
156
|
string openLogDirPath = Path.Combine(Application.persistentDataPath, "OpenlogData");
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
if (
|
|
158
|
+
TapTapSDK.taptapSdkOptions != null
|
|
159
|
+
&& !string.IsNullOrEmpty(TapTapSDK.taptapSdkOptions.clientId)
|
|
160
|
+
)
|
|
161
|
+
{
|
|
162
|
+
openLogDirPath = Path.Combine(
|
|
163
|
+
Application.persistentDataPath,
|
|
164
|
+
"OpenlogData_" + TapTapSDK.taptapSdkOptions.clientId
|
|
165
|
+
);
|
|
166
|
+
if (!Directory.Exists(openLogDirPath))
|
|
167
|
+
{
|
|
149
168
|
string oldPath = Path.Combine(Application.persistentDataPath, "OpenlogData");
|
|
150
|
-
if(Directory.Exists(oldPath))
|
|
169
|
+
if (Directory.Exists(oldPath))
|
|
170
|
+
{
|
|
151
171
|
Directory.Move(oldPath, openLogDirPath);
|
|
152
172
|
}
|
|
153
173
|
}
|
|
@@ -155,20 +175,26 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
155
175
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_DATA_DIR] = openLogDirPath;
|
|
156
176
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_ENV] = "local";
|
|
157
177
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_PLATFORM] = "PC";
|
|
158
|
-
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_UA] =
|
|
159
|
-
|
|
160
|
-
openlogStartParameter[TapOpenlogStartParamConstants.
|
|
178
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_UA] =
|
|
179
|
+
TapHttpUtils.GenerateUserAgent();
|
|
180
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_CLIENT_ID] = TapCoreStandalone
|
|
181
|
+
.coreOptions
|
|
182
|
+
.clientId;
|
|
183
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_CLIENT_TOKEN] =
|
|
184
|
+
TapCoreStandalone.coreOptions.clientToken;
|
|
161
185
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_COMMON] = generalParameter;
|
|
162
|
-
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_APP_DURATION] =
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
|
|
186
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_APP_DURATION] =
|
|
187
|
+
new Dictionary<string, string>()
|
|
188
|
+
{
|
|
189
|
+
{ TapOpenlogParamConstants.PARAM_TAPSDK_VERSION, TapTapSDK.Version },
|
|
190
|
+
};
|
|
166
191
|
}
|
|
167
192
|
|
|
168
193
|
private static void InitGeneralParameter()
|
|
169
194
|
{
|
|
170
195
|
// 应用包名
|
|
171
|
-
generalParameter[TapOpenlogParamConstants.PARAM_APP_PACKAGE_NAME] =
|
|
196
|
+
generalParameter[TapOpenlogParamConstants.PARAM_APP_PACKAGE_NAME] =
|
|
197
|
+
Application.identifier;
|
|
172
198
|
// 应用版本字符串
|
|
173
199
|
generalParameter[TapOpenlogParamConstants.PARAM_APP_VERSION] = Application.version;
|
|
174
200
|
// 应用版本(数字)
|
|
@@ -176,7 +202,8 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
176
202
|
// 固定一个枚举值: TapSDK
|
|
177
203
|
generalParameter[TapOpenlogParamConstants.PARAM_PN] = "TapSDK";
|
|
178
204
|
// SDK生成的设备唯一标识
|
|
179
|
-
generalParameter[TapOpenlogParamConstants.PARAM_DEVICE_ID] =
|
|
205
|
+
generalParameter[TapOpenlogParamConstants.PARAM_DEVICE_ID] =
|
|
206
|
+
SystemInfo.deviceUniqueIdentifier;
|
|
180
207
|
// SDK生成的设备一次安装的唯一标识
|
|
181
208
|
generalParameter[TapOpenlogParamConstants.PARAM_INSTALL_UUID] = Identity.InstallationId;
|
|
182
209
|
// 设备品牌,eg: Xiaomi
|
|
@@ -188,13 +215,16 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
188
215
|
// 支持 CPU 架构,eg:arm64-v8a
|
|
189
216
|
generalParameter[TapOpenlogParamConstants.PARAM_CPU_ABIS] = "";
|
|
190
217
|
// 设备操作系统
|
|
191
|
-
generalParameter[TapOpenlogParamConstants.PARAM_OS] =
|
|
218
|
+
generalParameter[TapOpenlogParamConstants.PARAM_OS] =
|
|
219
|
+
SystemInfo.operatingSystemFamily.ToString();
|
|
192
220
|
// 设备操作系统版本
|
|
193
221
|
generalParameter[TapOpenlogParamConstants.PARAM_SV] = SystemInfo.operatingSystem;
|
|
194
222
|
// 物理设备真实屏幕分辨率宽
|
|
195
|
-
generalParameter[TapOpenlogParamConstants.PARAM_WIDTH] =
|
|
223
|
+
generalParameter[TapOpenlogParamConstants.PARAM_WIDTH] =
|
|
224
|
+
Screen.currentResolution.width.ToString();
|
|
196
225
|
// 物理设备真实屏幕分辨率高
|
|
197
|
-
generalParameter[TapOpenlogParamConstants.PARAM_HEIGHT] =
|
|
226
|
+
generalParameter[TapOpenlogParamConstants.PARAM_HEIGHT] =
|
|
227
|
+
Screen.currentResolution.height.ToString();
|
|
198
228
|
// 设备总存储空间(磁盘),单位B
|
|
199
229
|
generalParameter[TapOpenlogParamConstants.PARAM_TOTAL_ROM] = "";
|
|
200
230
|
// 设备总内存,单位B
|
|
@@ -202,7 +232,8 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
202
232
|
// 芯片型号,eg:Qualcomm Technologies, Inc SM7250
|
|
203
233
|
generalParameter[TapOpenlogParamConstants.PARAM_HARDWARE] = SystemInfo.processorType;
|
|
204
234
|
// SDK设置的地区,例如 zh_CN
|
|
205
|
-
generalParameter[TapOpenlogParamConstants.PARAM_SDK_LOCALE] =
|
|
235
|
+
generalParameter[TapOpenlogParamConstants.PARAM_SDK_LOCALE] =
|
|
236
|
+
TapLocalizeManager.GetCurrentLanguageString();
|
|
206
237
|
// taptap的用户ID的外显ID(加密)
|
|
207
238
|
generalParameter[TapOpenlogParamConstants.PARAM_OPEN_ID] = openid;
|
|
208
239
|
}
|
|
@@ -227,8 +258,29 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
227
258
|
// 网络类型,eg:wifi, mobile
|
|
228
259
|
props[TapOpenlogParamConstants.PARAM_NETWORK_TYPE] = "";
|
|
229
260
|
// SDK设置的地区,例如 zh_CN
|
|
230
|
-
props[TapOpenlogParamConstants.PARAM_SDK_LOCALE] =
|
|
261
|
+
props[TapOpenlogParamConstants.PARAM_SDK_LOCALE] =
|
|
262
|
+
TapLocalizeManager.GetCurrentLanguageString();
|
|
231
263
|
return props;
|
|
232
264
|
}
|
|
265
|
+
|
|
266
|
+
internal static void LogBusiness(
|
|
267
|
+
string sdkProjectName,
|
|
268
|
+
string sdkProjectVersion,
|
|
269
|
+
string action,
|
|
270
|
+
Dictionary<string, string> properties = null
|
|
271
|
+
)
|
|
272
|
+
{
|
|
273
|
+
#if UNITY_STANDALONE
|
|
274
|
+
if (properties == null)
|
|
275
|
+
{
|
|
276
|
+
properties = new Dictionary<string, string>();
|
|
277
|
+
}
|
|
278
|
+
properties[TapOpenlogParamConstants.PARAM_TAPSDK_PROJECT] = sdkProjectName;
|
|
279
|
+
properties[TapOpenlogParamConstants.PARAM_TAPSDK_VERSION] = sdkProjectVersion;
|
|
280
|
+
properties[TapOpenlogParamConstants.PARAM_ACTION] = action;
|
|
281
|
+
string propertiesStr = JsonConvert.SerializeObject(properties);
|
|
282
|
+
TdkOpenLog("tapsdk", propertiesStr);
|
|
283
|
+
#endif
|
|
284
|
+
}
|
|
233
285
|
}
|
|
234
|
-
}
|
|
286
|
+
}
|
|
@@ -238,7 +238,17 @@ namespace TapSDK.Core.Standalone
|
|
|
238
238
|
throw new System.NotImplementedException();
|
|
239
239
|
#endif
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
|
|
242
|
+
public void SendOpenLog(
|
|
243
|
+
string project,
|
|
244
|
+
string version,
|
|
245
|
+
string action,
|
|
246
|
+
Dictionary<string, string> properties
|
|
247
|
+
)
|
|
248
|
+
{
|
|
249
|
+
TapOpenlogStandalone.LogBusiness(project, version, action, properties);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
242
252
|
|
|
243
253
|
|
|
244
254
|
public interface IOpenIDProvider
|