com.taptap.sdk.core 4.8.0-beta.1 → 4.8.1-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/AndroidNativeWrapper.cs +2 -1
- package/Mobile/Runtime/BridgeAndroid.cs +2 -1
- package/Mobile/Runtime/BridgeIOS.cs +2 -3
- package/Mobile/Runtime/EngineBridgeInitializer.cs +2 -1
- package/Mobile/Runtime/TapCoreMobile.cs +6 -5
- package/Mobile/Runtime/TapEventMobile.cs +22 -21
- package/Resources/TapMessage.prefab +8 -8
- package/Runtime/Internal/Http/TapHttpClient.cs +2 -1
- package/Runtime/Internal/Http/TapHttpUtils.cs +3 -2
- package/Runtime/Internal/Log/TapLog.cs +39 -3
- package/Runtime/Internal/Platform/PlatformTypeUtils.cs +3 -7
- package/Runtime/Internal/UI/Base/UIManager.cs +2 -1
- package/Runtime/Internal/UI/BasePanel/BasePanelController.cs +2 -1
- package/Runtime/Internal/Utils/BridgeUtils.cs +23 -22
- package/Runtime/Internal/Utils/EventManager.cs +1 -1
- package/Runtime/Internal/Utils/ImageUtils.cs +5 -4
- package/Runtime/Public/DataStorage.cs +17 -4
- package/Runtime/Public/Log/TapLogger.cs +1 -1
- package/Runtime/Public/TapTapEvent.cs +2 -1
- package/Runtime/Public/TapTapSDK.cs +2 -2
- package/Standalone/Plugins/x86/tapsdkcore.dll +0 -0
- package/Standalone/Plugins/x86_64/tapsdkcore.dll +0 -0
- package/Standalone/Plugins/x86_64/taptap_api.dll +0 -0
- package/Standalone/Plugins/x86_64/taptap_api.dll.meta +34 -6
- package/Standalone/Runtime/Internal/DeviceInfo.cs +2 -1
- package/Standalone/Runtime/Internal/EventSender.cs +2 -2
- package/Standalone/Runtime/Internal/Http/TapHttpUtils.cs +0 -8
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogWrapper.cs +2 -2
- package/Standalone/Runtime/Internal/Prefs.cs +3 -2
- package/Standalone/Runtime/Internal/TapClientBridge.cs +222 -139
- package/Standalone/Runtime/Internal/TapClientBridgePoll.cs +2 -1
- package/Standalone/Runtime/Internal/Tracker.cs +7 -6
- package/Standalone/Runtime/Internal/UI/TapClientConnectTipController.cs +6 -6
- package/Standalone/Runtime/Public/TapClientStandalone.cs +122 -84
- package/Standalone/Runtime/Public/TapCoreStandalone.cs +1 -1
- package/Standalone/Runtime/Public/TapEventStandalone.cs +9 -9
- package/link.xml.meta +1 -1
- package/package.json +9 -9
|
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
|
|
5
5
|
using UnityEngine;
|
|
6
6
|
using System.Runtime.InteropServices;
|
|
7
7
|
using System.Text;
|
|
8
|
+
using TapSDK.Core.Internal.Log;
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
@@ -22,28 +23,30 @@ namespace TapSDK.Core.Standalone.Internal
|
|
|
22
23
|
// 已安装 TapTap,游戏未通过 TapTap 启动
|
|
23
24
|
NotLaunchedByPlatform = 3,
|
|
24
25
|
|
|
26
|
+
// 平台版本不匹配,请引导用户升级 TapTap 与游戏至最新版本,再重新运行游戏
|
|
27
|
+
PlatformVersionMismatch = 4,
|
|
28
|
+
|
|
25
29
|
// SDK 本地执行时未知错误
|
|
26
|
-
Unknown = -1
|
|
27
|
-
|
|
28
|
-
Timeout = -2,
|
|
30
|
+
Unknown = -1
|
|
31
|
+
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
internal enum TapEventID
|
|
32
35
|
{
|
|
33
|
-
|
|
36
|
+
AuthorizeFinished_internal = 2001,
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
SystemStateChanged = 1,
|
|
38
|
+
AuthorizeFinished = 2002,
|
|
37
39
|
|
|
38
|
-
// [
|
|
39
|
-
|
|
40
|
+
// [4001, 6000), reserved for TapTap ownership events
|
|
41
|
+
GamePlayableStatusChanged = 4001,
|
|
42
|
+
DLCPlayableStatusChanged = 4002,
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
// 系统事件类型
|
|
43
46
|
internal enum SystemState
|
|
44
47
|
{
|
|
45
|
-
kSystemState_Unknown = 0,
|
|
46
|
-
kSystemState_PlatformExit = 1,
|
|
48
|
+
kSystemState_Unknown = 0, // 未知
|
|
49
|
+
kSystemState_PlatformExit = 1, // 平台退出
|
|
47
50
|
};
|
|
48
51
|
|
|
49
52
|
// 是否触发授权的返回结果
|
|
@@ -67,162 +70,242 @@ namespace TapSDK.Core.Standalone.Internal
|
|
|
67
70
|
{
|
|
68
71
|
|
|
69
72
|
#if UNITY_STANDALONE_WIN
|
|
70
|
-
|
|
73
|
+
public const string DLL_NAME = "taptap_api";
|
|
71
74
|
#endif
|
|
72
75
|
|
|
73
76
|
#if UNITY_STANDALONE_WIN
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
[global::System.Runtime.InteropServices.DllImport(TapClientBridge.DLL_NAME, CharSet =CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
78
|
-
internal static extern int TapSDK_Init(StringBuilder errMsg, [MarshalAs( UnmanagedType.LPStr )]string pubKey);
|
|
79
|
-
|
|
80
|
-
[global::System.Runtime.InteropServices.DllImport(TapClientBridge.DLL_NAME, CharSet =CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
81
|
-
internal static extern void TapSDK_Shutdown();
|
|
82
|
-
|
|
83
|
-
// 定义与 C 兼容的委托
|
|
84
|
-
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
85
|
-
internal delegate void CallbackDelegate(int id, IntPtr userData);
|
|
86
|
-
|
|
87
|
-
// 系统状态返回结果结构体
|
|
88
|
-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
|
89
|
-
internal struct SystemStateResponse
|
|
90
|
-
{
|
|
91
|
-
public SystemState state; // 枚举直接映射
|
|
92
|
-
}
|
|
77
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
78
|
+
internal static extern bool TapSDK_RestartAppIfNecessary([MarshalAs(UnmanagedType.LPStr)] string clientId);
|
|
93
79
|
|
|
94
|
-
|
|
95
|
-
|
|
80
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
81
|
+
internal static extern int TapSDK_Init(StringBuilder errMsg, [MarshalAs(UnmanagedType.LPStr)] string pubKey);
|
|
96
82
|
|
|
97
|
-
|
|
98
|
-
|
|
83
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
84
|
+
internal static extern void TapSDK_Shutdown();
|
|
99
85
|
|
|
100
|
-
|
|
101
|
-
|
|
86
|
+
// 定义与 C 兼容的委托
|
|
87
|
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
88
|
+
internal delegate void CallbackDelegate(int id, IntPtr userData);
|
|
102
89
|
|
|
90
|
+
// 系统状态返回结果结构体
|
|
91
|
+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
|
92
|
+
internal struct SystemStateResponse
|
|
93
|
+
{
|
|
94
|
+
public SystemState state; // 枚举直接映射
|
|
95
|
+
}
|
|
103
96
|
|
|
104
|
-
|
|
97
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
98
|
+
internal static extern void TapSDK_RegisterCallback(int callbackId, IntPtr callback);
|
|
105
99
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
public struct AuthorizeFinishedResponse
|
|
109
|
-
{
|
|
110
|
-
public int is_cancel ; // 是否取消
|
|
100
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
101
|
+
internal static extern void TapSDK_RunCallbacks();
|
|
111
102
|
|
|
112
|
-
[
|
|
113
|
-
|
|
103
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
104
|
+
internal static extern void TapSDK_UnregisterCallback(int callbackId, IntPtr callback);
|
|
114
105
|
|
|
115
|
-
}
|
|
116
106
|
|
|
117
|
-
|
|
118
|
-
internal static extern bool TapUser_GetOpenID(StringBuilder openId);
|
|
107
|
+
// 登录相关接口
|
|
119
108
|
|
|
120
|
-
|
|
121
|
-
|
|
109
|
+
// 授权返回结果结构体
|
|
110
|
+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
|
111
|
+
public struct AuthorizeFinishedResponse
|
|
112
|
+
{
|
|
113
|
+
public int is_cancel; // 是否取消
|
|
122
114
|
|
|
115
|
+
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
|
|
116
|
+
public string callback_uri; // 256 字节的 C 端字符串
|
|
123
117
|
|
|
124
|
-
|
|
125
|
-
internal static extern int TapUser_AsyncAuthorize([MarshalAs( UnmanagedType.LPStr )] string scopeStrings, [MarshalAs( UnmanagedType.LPStr )] string responseType,
|
|
126
|
-
[MarshalAs( UnmanagedType.LPStr )] string redirectUri, [MarshalAs( UnmanagedType.LPStr )] string codeChallenge, [MarshalAs( UnmanagedType.LPStr )] string state,
|
|
127
|
-
[MarshalAs( UnmanagedType.LPStr )] string codeChallengeMethod, [MarshalAs( UnmanagedType.LPStr )] string versonCode, [MarshalAs( UnmanagedType.LPStr )] string sdkUa, [MarshalAs( UnmanagedType.LPStr )] string info);
|
|
118
|
+
}
|
|
128
119
|
|
|
120
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
121
|
+
internal static extern bool TapUser_GetOpenID(StringBuilder openId);
|
|
129
122
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
StringBuilder errMsgBuffer = new StringBuilder(1024); // 分配 1024 字节缓冲区
|
|
134
|
-
int result = TapSDK_Init(errMsgBuffer, key);
|
|
135
|
-
errMessage = errMsgBuffer.ToString();
|
|
136
|
-
TapLogger.Debug("CheckInitState result = " + result);
|
|
137
|
-
return (TapSDKInitResult)result;
|
|
138
|
-
}
|
|
123
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
124
|
+
internal static extern bool TapSDK_GetClientID(StringBuilder clientId);
|
|
139
125
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
126
|
+
|
|
127
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
128
|
+
internal static extern int TapUser_AsyncAuthorize_internal([MarshalAs(UnmanagedType.LPStr)] string scopeStrings, [MarshalAs(UnmanagedType.LPStr)] string responseType,
|
|
129
|
+
[MarshalAs(UnmanagedType.LPStr)] string redirectUri, [MarshalAs(UnmanagedType.LPStr)] string codeChallenge, [MarshalAs(UnmanagedType.LPStr)] string state,
|
|
130
|
+
[MarshalAs(UnmanagedType.LPStr)] string codeChallengeMethod, [MarshalAs(UnmanagedType.LPStr)] string versonCode, [MarshalAs(UnmanagedType.LPStr)] string sdkUa, [MarshalAs(UnmanagedType.LPStr)] string info);
|
|
131
|
+
|
|
132
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
133
|
+
internal static extern int TapUser_AsyncAuthorize([MarshalAs(UnmanagedType.LPStr)] string scopeStrings);
|
|
134
|
+
|
|
135
|
+
// DLC 接口
|
|
136
|
+
// 检查是否拥有当前游戏
|
|
137
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
138
|
+
internal static extern bool TapApps_IsOwned();
|
|
139
|
+
|
|
140
|
+
// 游戏本体可玩状态变更事件响应结构体
|
|
141
|
+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
|
142
|
+
public struct GamePlayableStatusChangedResponse
|
|
143
|
+
{
|
|
144
|
+
public byte is_playable; // 游戏本体是否可玩
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// 显示指定 DLC 的商店页面
|
|
148
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
149
|
+
internal static extern bool TapDLC_ShowStore([MarshalAs(UnmanagedType.LPStr)] string dlcId);
|
|
150
|
+
|
|
151
|
+
// 查询用户是否拥有指定的 DLC
|
|
152
|
+
[DllImport(DLL_NAME, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
|
153
|
+
internal static extern bool TapDLC_IsOwned([MarshalAs(UnmanagedType.LPStr)] string dlcId);
|
|
154
|
+
|
|
155
|
+
// DLC 授权完成响应结果
|
|
156
|
+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
|
157
|
+
public struct DLCPlayableStatusChangedResponse
|
|
160
158
|
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
_userCallbackInstance = callback;
|
|
167
|
-
break;
|
|
168
|
-
case TapEventID.SystemStateChanged:
|
|
169
|
-
if (_callbackInstance != null)
|
|
170
|
-
{
|
|
171
|
-
UnRegisterCallback(eventID, _callbackInstance);
|
|
172
|
-
}
|
|
173
|
-
_callbackInstance = callback; // 防止被 GC 回收
|
|
174
|
-
break;
|
|
159
|
+
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
|
160
|
+
public string dlc_id; // DLC ID
|
|
161
|
+
|
|
162
|
+
public byte is_playable; // 是否可玩,当用户购买 DLC (外置 DLC 为购买且下载完成后),此值返回 true。其他情况返回 false
|
|
163
|
+
|
|
175
164
|
}
|
|
176
|
-
|
|
177
|
-
TapSDK_RegisterCallback((int)eventID, funcPtr);
|
|
178
|
-
}
|
|
179
165
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
{
|
|
183
|
-
|
|
184
|
-
IntPtr funcPtr = Marshal.GetFunctionPointerForDelegate(callback);
|
|
185
|
-
switch (eventID)
|
|
166
|
+
// 初始化检查
|
|
167
|
+
internal static int CheckInitState(out string errMessage, string key)
|
|
186
168
|
{
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
break;
|
|
169
|
+
StringBuilder errMsgBuffer = new StringBuilder(1024); // 分配 1024 字节缓冲区
|
|
170
|
+
int result = TapSDK_Init(errMsgBuffer, key);
|
|
171
|
+
errMessage = errMsgBuffer.ToString();
|
|
172
|
+
TapLog.Log("CheckInitState result = " + result);
|
|
173
|
+
return result;
|
|
193
174
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
175
|
+
|
|
176
|
+
// 预防 GC 回收的静态变量
|
|
177
|
+
private static CallbackDelegate _dlcCallbackInstance;
|
|
178
|
+
|
|
179
|
+
private static CallbackDelegate _userCallbackInternalInstance;
|
|
180
|
+
|
|
181
|
+
private static CallbackDelegate _userCallbackInstance;
|
|
182
|
+
|
|
183
|
+
private static CallbackDelegate _licenseCallbackInstance;
|
|
184
|
+
internal static void RegisterCallback(TapEventID eventID, CallbackDelegate callback)
|
|
201
185
|
{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
186
|
+
|
|
187
|
+
IntPtr funcPtr = Marshal.GetFunctionPointerForDelegate(callback);
|
|
188
|
+
switch (eventID)
|
|
189
|
+
{
|
|
190
|
+
case TapEventID.DLCPlayableStatusChanged:
|
|
191
|
+
if (_dlcCallbackInstance != null)
|
|
192
|
+
{
|
|
193
|
+
UnRegisterCallback(eventID, _dlcCallbackInstance);
|
|
194
|
+
}
|
|
195
|
+
_dlcCallbackInstance = callback;
|
|
196
|
+
break;
|
|
197
|
+
case TapEventID.GamePlayableStatusChanged:
|
|
198
|
+
if (_licenseCallbackInstance != null)
|
|
199
|
+
{
|
|
200
|
+
UnRegisterCallback(eventID, _licenseCallbackInstance);
|
|
201
|
+
}
|
|
202
|
+
_licenseCallbackInstance = callback;
|
|
203
|
+
break;
|
|
204
|
+
case TapEventID.AuthorizeFinished_internal:
|
|
205
|
+
if (_userCallbackInternalInstance != null)
|
|
206
|
+
{
|
|
207
|
+
UnRegisterCallback(eventID, _userCallbackInternalInstance);
|
|
208
|
+
}
|
|
209
|
+
_userCallbackInternalInstance = callback;
|
|
210
|
+
break;
|
|
211
|
+
case TapEventID.AuthorizeFinished:
|
|
212
|
+
if (_userCallbackInstance != null)
|
|
213
|
+
{
|
|
214
|
+
UnRegisterCallback(eventID, _userCallbackInstance);
|
|
215
|
+
}
|
|
216
|
+
_userCallbackInstance = callback;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
TapSDK_RegisterCallback((int)eventID, funcPtr);
|
|
210
221
|
}
|
|
211
|
-
}
|
|
212
222
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
openId = openIdBuffer.ToString();
|
|
217
|
-
return success;
|
|
218
|
-
}
|
|
223
|
+
// 移除回调
|
|
224
|
+
internal static void UnRegisterCallback(TapEventID eventID, CallbackDelegate callback)
|
|
225
|
+
{
|
|
219
226
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
227
|
+
IntPtr funcPtr = Marshal.GetFunctionPointerForDelegate(callback);
|
|
228
|
+
switch (eventID)
|
|
229
|
+
{
|
|
230
|
+
case TapEventID.DLCPlayableStatusChanged:
|
|
231
|
+
_dlcCallbackInstance = null;
|
|
232
|
+
break;
|
|
233
|
+
case TapEventID.GamePlayableStatusChanged:
|
|
234
|
+
_licenseCallbackInstance = null;
|
|
235
|
+
break;
|
|
236
|
+
case TapEventID.AuthorizeFinished_internal:
|
|
237
|
+
_userCallbackInternalInstance = null;
|
|
238
|
+
break;
|
|
239
|
+
case TapEventID.AuthorizeFinished:
|
|
240
|
+
_userCallbackInstance = null;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
TapSDK_UnregisterCallback((int)eventID, funcPtr);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
internal static AuthorizeResult LoginWithScopesInternal(string[] scopeStrings, string responseType, string redirectUri,
|
|
248
|
+
string codeChallenge, string state, string codeChallengeMethod, string versonCode, string sdkUa, string info)
|
|
249
|
+
{
|
|
250
|
+
try
|
|
251
|
+
{
|
|
252
|
+
TapLog.Log("login start ==== " + string.Join(",", scopeStrings));
|
|
253
|
+
int result = TapUser_AsyncAuthorize_internal(string.Join(",", scopeStrings), responseType, redirectUri,
|
|
254
|
+
codeChallenge, state, codeChallengeMethod, versonCode, sdkUa, info);
|
|
255
|
+
TapLog.Log("login end === " + result);
|
|
256
|
+
return (AuthorizeResult)result;
|
|
257
|
+
}
|
|
258
|
+
catch (Exception ex)
|
|
259
|
+
{
|
|
260
|
+
TapLog.Log("login crash = " + ex.StackTrace);
|
|
261
|
+
return AuthorizeResult.UNKNOWN;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
internal static AuthorizeResult LoginWithScopes(string[] scopeStrings)
|
|
266
|
+
{
|
|
267
|
+
try
|
|
268
|
+
{
|
|
269
|
+
int result = TapUser_AsyncAuthorize(string.Join(",", scopeStrings));
|
|
270
|
+
return (AuthorizeResult)result;
|
|
271
|
+
}
|
|
272
|
+
catch (Exception ex)
|
|
273
|
+
{
|
|
274
|
+
TapLog.Log("login crash = " + ex.Message);
|
|
275
|
+
return AuthorizeResult.UNKNOWN;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
internal static bool GetTapUserOpenId(out string openId)
|
|
280
|
+
{
|
|
281
|
+
StringBuilder openIdBuffer = new StringBuilder(256); // 分配一个足够大的缓冲区
|
|
282
|
+
bool success = TapUser_GetOpenID(openIdBuffer); // 调用 C 函数
|
|
283
|
+
openId = openIdBuffer.ToString();
|
|
284
|
+
return success;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
internal static bool GetClientId(out string clientId)
|
|
288
|
+
{
|
|
289
|
+
StringBuilder clientIDBuffer = new StringBuilder(256); // 分配一个足够大的缓冲区
|
|
290
|
+
bool success = TapSDK_GetClientID(clientIDBuffer); // 调用 C 函数
|
|
291
|
+
clientId = clientIDBuffer.ToString();
|
|
292
|
+
return success;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
internal static bool QueryDLC(string skuId)
|
|
296
|
+
{
|
|
297
|
+
return TapDLC_IsOwned(skuId);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
internal static bool ShowDLCStore(string skuId)
|
|
301
|
+
{
|
|
302
|
+
return TapDLC_ShowStore(skuId);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
internal static bool HasLicense()
|
|
306
|
+
{
|
|
307
|
+
return TapApps_IsOwned();
|
|
308
|
+
}
|
|
226
309
|
|
|
227
310
|
#endif
|
|
228
311
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
+
using TapSDK.Core.Internal.Log;
|
|
2
3
|
using UnityEngine;
|
|
3
4
|
|
|
4
5
|
namespace TapSDK.Core.Standalone.Internal
|
|
@@ -13,7 +14,7 @@ namespace TapSDK.Core.Standalone.Internal
|
|
|
13
14
|
|
|
14
15
|
internal static void StartUp()
|
|
15
16
|
{
|
|
16
|
-
|
|
17
|
+
TapLog.Log("TapClientBridgePoll StartUp " );
|
|
17
18
|
if (current == null)
|
|
18
19
|
{
|
|
19
20
|
GameObject pollGo = new GameObject(TAP_CLIENT_POLL_NAME);
|
|
@@ -4,6 +4,7 @@ using TapSDK.Core.Standalone;
|
|
|
4
4
|
using System.Threading.Tasks;
|
|
5
5
|
using UnityEngine;
|
|
6
6
|
using TapSDK.Core.Internal.Utils;
|
|
7
|
+
using TapSDK.Core.Internal.Log;
|
|
7
8
|
|
|
8
9
|
namespace TapSDK.Core.Standalone.Internal {
|
|
9
10
|
public class Tracker {
|
|
@@ -93,7 +94,7 @@ namespace TapSDK.Core.Standalone.Internal {
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
Dictionary<string, object> dynamicProps = dynamicPropsDelegate?.GetDynamicProperties();
|
|
96
|
-
|
|
97
|
+
TapLog.Log("dynamicProps: " + dynamicProps);
|
|
97
98
|
if (dynamicProps != null) {
|
|
98
99
|
foreach (KeyValuePair<string, object> kv in dynamicProps) {
|
|
99
100
|
props[kv.Key] = kv.Value;
|
|
@@ -101,7 +102,7 @@ namespace TapSDK.Core.Standalone.Internal {
|
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
if (name == Constants.DEVICE_LOGIN) { // Device login 事件带上初始化时的自定义属性
|
|
104
|
-
|
|
105
|
+
TapLog.Log("customProps: " + customProps);
|
|
105
106
|
if (customProps != null) {
|
|
106
107
|
foreach (KeyValuePair<string, object> kv in customProps) {
|
|
107
108
|
props[kv.Key] = kv.Value;
|
|
@@ -117,7 +118,7 @@ namespace TapSDK.Core.Standalone.Internal {
|
|
|
117
118
|
props["open_id"] = open_id;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
TapLog.Log("properties: " + properties);
|
|
121
122
|
if (properties != null) {
|
|
122
123
|
foreach (KeyValuePair<string, object> kv in properties) {
|
|
123
124
|
props[kv.Key] = kv.Value;
|
|
@@ -151,7 +152,7 @@ namespace TapSDK.Core.Standalone.Internal {
|
|
|
151
152
|
/// <param name="properties"></param>
|
|
152
153
|
public void TrackDeviceProperties(string type, Dictionary<string, object> properties) {
|
|
153
154
|
if (string.IsNullOrWhiteSpace(Identity.DeviceId)) {
|
|
154
|
-
|
|
155
|
+
TapLog.Error("DeviceId is NULL.");
|
|
155
156
|
return;
|
|
156
157
|
}
|
|
157
158
|
|
|
@@ -167,7 +168,7 @@ namespace TapSDK.Core.Standalone.Internal {
|
|
|
167
168
|
public void TrackUserProperties(string type, Dictionary<string, object> properties) {
|
|
168
169
|
string userId = TapCoreStandalone.User.Id;
|
|
169
170
|
if (string.IsNullOrWhiteSpace(userId)) {
|
|
170
|
-
|
|
171
|
+
TapLog.Error("UserId is NULL.");
|
|
171
172
|
return;
|
|
172
173
|
}
|
|
173
174
|
|
|
@@ -292,7 +293,7 @@ namespace TapSDK.Core.Standalone.Internal {
|
|
|
292
293
|
private bool IsInitialized {
|
|
293
294
|
get {
|
|
294
295
|
if (string.IsNullOrWhiteSpace(TapCoreStandalone.coreOptions.clientId)) {
|
|
295
|
-
|
|
296
|
+
TapLog.Error("MUST be initialized.");
|
|
296
297
|
return false;
|
|
297
298
|
}
|
|
298
299
|
return true;
|
|
@@ -29,16 +29,16 @@ namespace TapSDK.Core.Standalone.Internal {
|
|
|
29
29
|
okButton.onClick.AddListener(OnOKButtonClicked);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
internal void Show(
|
|
32
|
+
internal void Show(int errorType)
|
|
33
33
|
{
|
|
34
|
-
if (errorType == TapSDKInitResult.NoPlatform){
|
|
34
|
+
if (errorType == (int)TapSDKInitResult.NoPlatform){
|
|
35
35
|
tipText.text = "获取游戏信息失败,请下载 TapTap 客户端后重新启动游戏";
|
|
36
|
-
}else if (errorType == TapSDKInitResult.NotLaunchedByPlatform){
|
|
36
|
+
}else if (errorType == (int)TapSDKInitResult.NotLaunchedByPlatform){
|
|
37
37
|
tipText.text = "获取游戏信息失败,请从 TapTap 客户端重新启动游戏";
|
|
38
|
-
}else if (errorType == TapSDKInitResult.Unknown){
|
|
38
|
+
}else if (errorType == (int)TapSDKInitResult.Unknown){
|
|
39
39
|
tipText.text = "本地发生未知错误,请从 TapTap 客户端重新启动游戏";
|
|
40
|
-
}else if (errorType == TapSDKInitResult.
|
|
41
|
-
tipText.text = "
|
|
40
|
+
}else if (errorType == (int)TapSDKInitResult.PlatformVersionMismatch){
|
|
41
|
+
tipText.text = "客户端版本不匹配,请将 TapTap 客户端升级到最新版本";
|
|
42
42
|
}else {
|
|
43
43
|
tipText.text = "发生未知错误,请从 TapTap 客户端重新启动游戏";
|
|
44
44
|
}
|