com.taptap.sdk.compliance 4.3.0-aplha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/Mobile/Editor/NativeDependencies.xml +18 -0
  2. package/Mobile/Editor/NativeDependencies.xml.meta +7 -0
  3. package/Mobile/Editor/TapComplianceMobileProcessBuild.cs +21 -0
  4. package/Mobile/Editor/TapComplianceMobileProcessBuild.cs.meta +3 -0
  5. package/Mobile/Editor/TapSDK.Compliance.Mobile.Editor.asmdef +17 -0
  6. package/Mobile/Editor/TapSDK.Compliance.Mobile.Editor.asmdef.meta +7 -0
  7. package/Mobile/Editor/iOS/BuidPostProcessor.cs +45 -0
  8. package/Mobile/Editor/iOS/BuidPostProcessor.cs.meta +11 -0
  9. package/Mobile/Editor/iOS.meta +8 -0
  10. package/Mobile/Editor.meta +8 -0
  11. package/Mobile/Runtime/ComplianceMobileBridge.cs +319 -0
  12. package/Mobile/Runtime/ComplianceMobileBridge.cs.meta +11 -0
  13. package/Mobile/Runtime/ComplianceMobileOldJob.cs +81 -0
  14. package/Mobile/Runtime/ComplianceMobileOldJob.cs.meta +11 -0
  15. package/Mobile/Runtime/TapSDK.Compliance.Mobile.Runtime.asmdef +19 -0
  16. package/Mobile/Runtime/TapSDK.Compliance.Mobile.Runtime.asmdef.meta +7 -0
  17. package/Mobile/Runtime.meta +3 -0
  18. package/Mobile.meta +8 -0
  19. package/Resources/BillingMode.json +1 -0
  20. package/Resources/BillingMode.json.meta +7 -0
  21. package/Resources/Config/ComplianceLocalization.json +116 -0
  22. package/Resources/Config/ComplianceLocalization.json.meta +7 -0
  23. package/Resources/Config.meta +8 -0
  24. package/Resources/Prefabs/Mobile/TapTapAntiAddictionRetryAlert.prefab +803 -0
  25. package/Resources/Prefabs/Mobile/TapTapAntiAddictionRetryAlert.prefab.meta +7 -0
  26. package/Resources/Prefabs/Mobile/TapTapHealthPaymentPanel.prefab +820 -0
  27. package/Resources/Prefabs/Mobile/TapTapHealthPaymentPanel.prefab.meta +7 -0
  28. package/Resources/Prefabs/Mobile/TapTapHealthReminderPanel.prefab +988 -0
  29. package/Resources/Prefabs/Mobile/TapTapHealthReminderPanel.prefab.meta +7 -0
  30. package/Resources/Prefabs/Mobile/TapTapVietnamTimeSelectorPanel.prefab +3176 -0
  31. package/Resources/Prefabs/Mobile/TapTapVietnamTimeSelectorPanel.prefab.meta +7 -0
  32. package/Resources/Prefabs/Mobile.meta +8 -0
  33. package/Resources/Prefabs.meta +8 -0
  34. package/Resources/Textures/Background.png +0 -0
  35. package/Resources/Textures/Background.png.meta +128 -0
  36. package/Resources/Textures/Button.png +0 -0
  37. package/Resources/Textures/Button.png.meta +128 -0
  38. package/Resources/Textures/Checkmark.png +0 -0
  39. package/Resources/Textures/Checkmark.png.meta +128 -0
  40. package/Resources/Textures/Dropdown.png +0 -0
  41. package/Resources/Textures/Dropdown.png.meta +128 -0
  42. package/Resources/Textures/DropdownH.png +0 -0
  43. package/Resources/Textures/DropdownH.png.meta +128 -0
  44. package/Resources/Textures/Loading.png +0 -0
  45. package/Resources/Textures/Loading.png.meta +128 -0
  46. package/Resources/Textures/On.png +0 -0
  47. package/Resources/Textures/On.png.meta +128 -0
  48. package/Resources/Textures/Scrollview.png +0 -0
  49. package/Resources/Textures/Scrollview.png.meta +128 -0
  50. package/Resources/Textures/WhiteButton.png +0 -0
  51. package/Resources/Textures/WhiteButton.png.meta +128 -0
  52. package/Resources/Textures/error_tip.png +0 -0
  53. package/Resources/Textures/error_tip.png.meta +128 -0
  54. package/Resources/Textures/off.png +0 -0
  55. package/Resources/Textures/off.png.meta +128 -0
  56. package/Resources/Textures/taptap-antiaddiction-input.png +0 -0
  57. package/Resources/Textures/taptap-antiaddiction-input.png.meta +128 -0
  58. package/Resources/Textures/taptap-antiaddiction-largebutton.png +0 -0
  59. package/Resources/Textures/taptap-antiaddiction-largebutton.png.meta +128 -0
  60. package/Resources/Textures/taptap-antiaddiction-mobile-button.png +0 -0
  61. package/Resources/Textures/taptap-antiaddiction-mobile-button.png.meta +128 -0
  62. package/Resources/Textures.meta +8 -0
  63. package/Resources.meta +8 -0
  64. package/Runtime/Internal/ComplianceJobManager.cs +85 -0
  65. package/Runtime/Internal/ComplianceJobManager.cs.meta +11 -0
  66. package/Runtime/Internal/ComplianceResult.cs +89 -0
  67. package/Runtime/Internal/ComplianceResult.cs.meta +3 -0
  68. package/Runtime/Internal/IComplianceJob.cs +51 -0
  69. package/Runtime/Internal/IComplianceJob.cs.meta +11 -0
  70. package/Runtime/Internal/Init/ComplianceInitTask.cs +46 -0
  71. package/Runtime/Internal/Init/ComplianceInitTask.cs.meta +3 -0
  72. package/Runtime/Internal/Init.meta +3 -0
  73. package/Runtime/Internal/Model/StartUpResult.cs +28 -0
  74. package/Runtime/Internal/Model/StartUpResult.cs.meta +11 -0
  75. package/Runtime/Internal/Model.meta +8 -0
  76. package/Runtime/Internal.meta +8 -0
  77. package/Runtime/Public/TapTapCompliance.cs +119 -0
  78. package/Runtime/Public/TapTapCompliance.cs.meta +11 -0
  79. package/Runtime/Public/TapTapComplianceOption.cs +52 -0
  80. package/Runtime/Public/TapTapComplianceOption.cs.meta +3 -0
  81. package/Runtime/Public.meta +3 -0
  82. package/Runtime/TapSDK.Compliance.Runtime.asmdef +16 -0
  83. package/Runtime/TapSDK.Compliance.Runtime.asmdef.meta +7 -0
  84. package/Runtime.meta +3 -0
  85. package/Standalone/Editor/TapComplianceStandaloneProcessBuild.cs +20 -0
  86. package/Standalone/Editor/TapComplianceStandaloneProcessBuild.cs.meta +3 -0
  87. package/Standalone/Editor/TapSDK.Compliance.Standalone.Editor.asmdef +17 -0
  88. package/Standalone/Editor/TapSDK.Compliance.Standalone.Editor.asmdef.meta +7 -0
  89. package/Standalone/Editor.meta +3 -0
  90. package/Standalone/Resources/Prefabs/Standalone/TapTapAntiAddictionRetryAlert.prefab +835 -0
  91. package/Standalone/Resources/Prefabs/Standalone/TapTapAntiAddictionRetryAlert.prefab.meta +7 -0
  92. package/Standalone/Resources/Prefabs/Standalone/TapTapChinaIDInputPanel.prefab +1646 -0
  93. package/Standalone/Resources/Prefabs/Standalone/TapTapChinaIDInputPanel.prefab.meta +7 -0
  94. package/Standalone/Resources/Prefabs/Standalone/TapTapChinaQuickVerifyTipPanel.prefab +1591 -0
  95. package/Standalone/Resources/Prefabs/Standalone/TapTapChinaQuickVerifyTipPanel.prefab.meta +7 -0
  96. package/Standalone/Resources/Prefabs/Standalone/TapTapHealthPaymentPanel.prefab +897 -0
  97. package/Standalone/Resources/Prefabs/Standalone/TapTapHealthPaymentPanel.prefab.meta +7 -0
  98. package/Standalone/Resources/Prefabs/Standalone/TapTapHealthReminderPanel.prefab +1065 -0
  99. package/Standalone/Resources/Prefabs/Standalone/TapTapHealthReminderPanel.prefab.meta +7 -0
  100. package/Standalone/Resources/Prefabs/Standalone.meta +8 -0
  101. package/Standalone/Resources/Prefabs.meta +8 -0
  102. package/Standalone/Resources/Textures/QuickVerifyTip.png +0 -0
  103. package/Standalone/Resources/Textures/QuickVerifyTip.png.meta +128 -0
  104. package/Standalone/Resources/Textures/taptap-antiaddiction-largebutton.png +0 -0
  105. package/Standalone/Resources/Textures/taptap-antiaddiction-largebutton.png.meta +128 -0
  106. package/Standalone/Resources/Textures.meta +8 -0
  107. package/Standalone/Resources.meta +8 -0
  108. package/Standalone/Runtime/ComplianceWorker.cs +524 -0
  109. package/Standalone/Runtime/ComplianceWorker.cs.meta +11 -0
  110. package/Standalone/Runtime/Internal/AccessTokenJsonConverter.cs +58 -0
  111. package/Standalone/Runtime/Internal/AccessTokenJsonConverter.cs.meta +3 -0
  112. package/Standalone/Runtime/Internal/ComplianceConst.cs +73 -0
  113. package/Standalone/Runtime/Internal/ComplianceConst.cs.meta +11 -0
  114. package/Standalone/Runtime/Internal/ComplianceException.cs +24 -0
  115. package/Standalone/Runtime/Internal/ComplianceException.cs.meta +11 -0
  116. package/Standalone/Runtime/Internal/ComplianceNewJob.cs +174 -0
  117. package/Standalone/Runtime/Internal/ComplianceNewJob.cs.meta +11 -0
  118. package/Standalone/Runtime/Internal/CompliancePoll.cs +136 -0
  119. package/Standalone/Runtime/Internal/CompliancePoll.cs.meta +11 -0
  120. package/Standalone/Runtime/Internal/Config.cs +137 -0
  121. package/Standalone/Runtime/Internal/Config.cs.meta +11 -0
  122. package/Standalone/Runtime/Internal/Http/ComplianceHttpClient.cs +215 -0
  123. package/Standalone/Runtime/Internal/Http/ComplianceHttpClient.cs.meta +11 -0
  124. package/Standalone/Runtime/Internal/Http.meta +8 -0
  125. package/Standalone/Runtime/Internal/Model/BaseResponse.cs +14 -0
  126. package/Standalone/Runtime/Internal/Model/BaseResponse.cs.meta +11 -0
  127. package/Standalone/Runtime/Internal/Model/ErrorResponse.cs +27 -0
  128. package/Standalone/Runtime/Internal/Model/ErrorResponse.cs.meta +11 -0
  129. package/Standalone/Runtime/Internal/Model/Payable.cs +23 -0
  130. package/Standalone/Runtime/Internal/Model/Payable.cs.meta +11 -0
  131. package/Standalone/Runtime/Internal/Model/Playable.cs +48 -0
  132. package/Standalone/Runtime/Internal/Model/Playable.cs.meta +11 -0
  133. package/Standalone/Runtime/Internal/Model/RealNameConfig.cs +73 -0
  134. package/Standalone/Runtime/Internal/Model/RealNameConfig.cs.meta +11 -0
  135. package/Standalone/Runtime/Internal/Model/ServerTime.cs +19 -0
  136. package/Standalone/Runtime/Internal/Model/ServerTime.cs.meta +11 -0
  137. package/Standalone/Runtime/Internal/Model/StandaloneResponse.cs +12 -0
  138. package/Standalone/Runtime/Internal/Model/StandaloneResponse.cs.meta +11 -0
  139. package/Standalone/Runtime/Internal/Model/SubmitPayment.cs +8 -0
  140. package/Standalone/Runtime/Internal/Model/SubmitPayment.cs.meta +11 -0
  141. package/Standalone/Runtime/Internal/Model/UserComplianceConfig.cs +109 -0
  142. package/Standalone/Runtime/Internal/Model/UserComplianceConfig.cs.meta +11 -0
  143. package/Standalone/Runtime/Internal/Model/Verification.cs +88 -0
  144. package/Standalone/Runtime/Internal/Model/Verification.cs.meta +11 -0
  145. package/Standalone/Runtime/Internal/Model.meta +8 -0
  146. package/Standalone/Runtime/Internal/Network.cs +296 -0
  147. package/Standalone/Runtime/Internal/Network.cs.meta +11 -0
  148. package/Standalone/Runtime/Internal/Persistence.cs +91 -0
  149. package/Standalone/Runtime/Internal/Persistence.cs.meta +11 -0
  150. package/Standalone/Runtime/Internal/TapComplianceUI.cs +68 -0
  151. package/Standalone/Runtime/Internal/TapComplianceUI.cs.meta +11 -0
  152. package/Standalone/Runtime/Internal/TapLoginPermissionProvider.cs +24 -0
  153. package/Standalone/Runtime/Internal/TapLoginPermissionProvider.cs.meta +11 -0
  154. package/Standalone/Runtime/Internal/TapTapComplianceManager.cs +253 -0
  155. package/Standalone/Runtime/Internal/TapTapComplianceManager.cs.meta +11 -0
  156. package/Standalone/Runtime/Internal/Tool.cs +211 -0
  157. package/Standalone/Runtime/Internal/Tool.cs.meta +11 -0
  158. package/Standalone/Runtime/Internal/UI/Controller/TapTapChinaVerifyFinishPanelController.cs +81 -0
  159. package/Standalone/Runtime/Internal/UI/Controller/TapTapChinaVerifyFinishPanelController.cs.meta +11 -0
  160. package/Standalone/Runtime/Internal/UI/Controller/TapTapComplianceQuickVerifyTipController.cs +119 -0
  161. package/Standalone/Runtime/Internal/UI/Controller/TapTapComplianceQuickVerifyTipController.cs.meta +3 -0
  162. package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceHealthPaymentController.cs +105 -0
  163. package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceHealthPaymentController.cs.meta +11 -0
  164. package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceHealthReminderController.cs +129 -0
  165. package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceHealthReminderController.cs.meta +11 -0
  166. package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceIDInputController.cs +218 -0
  167. package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceIDInputController.cs.meta +11 -0
  168. package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceRetryAlertController.cs +46 -0
  169. package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceRetryAlertController.cs.meta +11 -0
  170. package/Standalone/Runtime/Internal/UI/Controller.meta +8 -0
  171. package/Standalone/Runtime/Internal/UI.meta +8 -0
  172. package/Standalone/Runtime/Internal/Verification.cs +315 -0
  173. package/Standalone/Runtime/Internal/Verification.cs.meta +11 -0
  174. package/Standalone/Runtime/Internal/Worker/BaseComplianceWorker.cs +489 -0
  175. package/Standalone/Runtime/Internal/Worker/BaseComplianceWorker.cs.meta +11 -0
  176. package/Standalone/Runtime/Internal/Worker.meta +8 -0
  177. package/Standalone/Runtime/Internal.meta +3 -0
  178. package/Standalone/Runtime/TapTap.AntiAddiction.Standalone.Runtime.asmdef +26 -0
  179. package/Standalone/Runtime/TapTap.AntiAddiction.Standalone.Runtime.asmdef.meta +3 -0
  180. package/Standalone/Runtime/gen/ComplianceLocalizationItems.cs +121 -0
  181. package/Standalone/Runtime/gen/ComplianceLocalizationItems.cs.meta +11 -0
  182. package/Standalone/Runtime/gen.meta +8 -0
  183. package/Standalone/Runtime.meta +3 -0
  184. package/Standalone.meta +3 -0
  185. package/package.json +12 -0
  186. package/package.json.meta +7 -0
@@ -0,0 +1,253 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.IO;
4
+ using System.Linq;
5
+ using System.Threading.Tasks;
6
+ using TapSDK.Compliance.Internal;
7
+ using TapSDK.Compliance.Localization;
8
+ using TapSDK.UI;
9
+ using TapSDK.Compliance.Model;
10
+ using TapSDK.Core;
11
+ using UnityEngine;
12
+ using TapSDK.Login;
13
+ using Network = TapSDK.Compliance.Internal.Network;
14
+
15
+ namespace TapSDK.Compliance
16
+ {
17
+ public class TapTapComplianceManager
18
+ {
19
+ public static string UserId;
20
+
21
+ public static string ClientId { get; private set; }
22
+
23
+ public static TapTapComplianceOption config;
24
+
25
+ private static bool needResumePoll;
26
+
27
+ public static TapTapComplianceOption ComplianceConfig => config == null ? config = new TapTapComplianceOption() : config;
28
+
29
+ public static ComplianceLocalizationItems LocalizationItems
30
+ {
31
+ get
32
+ {
33
+ if (_ComplianceLocalizationItems == null)
34
+ {
35
+ var textAsset = Resources.Load<TextAsset>(ComplianceLocalizationItems.PATH);
36
+ _ComplianceLocalizationItems = ComplianceLocalizationItems.FromJson(textAsset.text);
37
+ }
38
+ return _ComplianceLocalizationItems;
39
+ }
40
+ }
41
+ private static ComplianceLocalizationItems _ComplianceLocalizationItems;
42
+ public static bool CanPlay = false;
43
+
44
+ private static PlayableResult _currentPlayableResult;
45
+ internal static PlayableResult CurrentPlayableResult
46
+ {
47
+ get => _currentPlayableResult;
48
+ set
49
+ {
50
+ if (CurrentRemainSeconds == null)
51
+ {
52
+ CompliancePoll.StartCountdownRemainTime();
53
+ }
54
+
55
+ if (value != null)
56
+ {
57
+ CurrentRemainSeconds = value.RemainTime;
58
+ }
59
+ _currentPlayableResult = value;
60
+ }
61
+ }
62
+
63
+ private static UserComplianceConfigResult _currentUserAntiResult;
64
+ public static UserComplianceConfigResult CurrentUserAntiResult
65
+ {
66
+ get => _currentUserAntiResult;
67
+ set
68
+ {
69
+ Config.userLocalConfig = value.localConfig;
70
+ _currentUserAntiResult = value;
71
+ }
72
+ }
73
+
74
+ internal static string CurrentSession = "";
75
+
76
+ internal static int? CurrentRemainSeconds {get; set; }
77
+
78
+ private static BaseComplianceWorker worker;
79
+
80
+ /// <summary>
81
+ /// 初始化, 建议使用这个接口,因为默认调用了 SetRegion,如果使用另一个 Init 接口,需要在 Init 之后,手动调用 SetRegion
82
+ /// </summary>
83
+ /// <param name="config"></param>
84
+ public static void Init(string clientId, string clientToken, TapTapComplianceOption config)
85
+ {
86
+ if (config == null)
87
+ {
88
+ throw new ArgumentNullException(nameof(config));
89
+ }
90
+
91
+ TapTapComplianceManager.config = config;
92
+ if (string.IsNullOrEmpty(clientId))
93
+ {
94
+ throw new ArgumentNullException(nameof(clientId));
95
+ }
96
+ TapTapComplianceManager.ClientId = clientId;
97
+ Network.SetGameInfo(clientId, clientToken);
98
+ Network.InitSetting();
99
+ var textAsset = Resources.Load<TextAsset>(ComplianceLocalizationItems.PATH);
100
+ _ComplianceLocalizationItems = ComplianceLocalizationItems.FromJson(textAsset.text);
101
+ }
102
+
103
+ public static void SetTestEnvironment(bool enable) {
104
+ Network.SetTestEnvironment(enable);
105
+ if (enable)
106
+ UIManager.Instance.OpenTip("当前处于防沉迷调试模式", Color.red, TextAnchor.UpperRight);
107
+ else {
108
+ UIManager.Instance.CloseTip();
109
+ }
110
+ }
111
+ /// <summary>
112
+ /// 启动
113
+ /// </summary>
114
+ /// <param name="userId">用户名</param>
115
+ /// <returns></returns>
116
+ public static async Task<int> StartUp(string userId) {
117
+ if (string.IsNullOrEmpty(userId))
118
+ {
119
+ throw new ArgumentNullException(nameof(userId));
120
+ }
121
+
122
+ UserId = userId;
123
+ UIManager.Instance.OpenLoading();
124
+ InitWorker();
125
+ bool isSuccess = await UpdateConfig(userId);
126
+ if(isSuccess){
127
+ return await Worker.StartUp(UserId);
128
+ }else{
129
+ UIManager.Instance.CloseLoading();
130
+ return StartUpResult.INVALID_CLIENT_OR_NETWORK_ERROR;
131
+ }
132
+ }
133
+
134
+ private static void InitWorker() {
135
+ var worker = Worker;
136
+ TapTapComplianceManager.worker = worker;
137
+ }
138
+
139
+ private static async Task<bool> UpdateConfig(string userId) {
140
+ return await worker.FetchConfigAsync(userId);
141
+ }
142
+
143
+ /// <summary>
144
+ /// 登出
145
+ /// </summary>
146
+ public static void Logout()
147
+ {
148
+ CurrentRemainSeconds = null;
149
+ CurrentPlayableResult = null;
150
+ Worker.Logout();
151
+ }
152
+
153
+ internal static void ClearUserCache(){
154
+ CurrentRemainSeconds = null;
155
+ CurrentPlayableResult = null;
156
+ Worker.Logout(false);
157
+ }
158
+
159
+
160
+ /// <summary>
161
+ /// 检查支付
162
+ /// </summary>
163
+ /// <param name="amount"></param>
164
+ /// <returns></returns>
165
+ public static async Task<PayableResult> CheckPayLimit(long amount)
166
+ {
167
+ return await Worker.CheckPayableAsync(amount);
168
+ }
169
+
170
+ /// <summary>
171
+ /// 上报支付
172
+ /// </summary>
173
+ /// <param name="amount"></param>
174
+ /// <returns></returns>
175
+ public static Task SubmitPayResult(long amount)
176
+ {
177
+ return Worker.SubmitPayResult(amount);
178
+ }
179
+
180
+ /// <summary>
181
+ /// 轮询时,检查可玩性
182
+ /// </summary>
183
+ /// <returns></returns>
184
+ internal static async Task<PlayableResult> CheckPlayableOnPolling()
185
+ {
186
+ CurrentPlayableResult = await Worker.CheckPlayableOnPollingAsync();
187
+ return CurrentPlayableResult;
188
+ }
189
+
190
+ public static void EnterGame()
191
+ {
192
+ if (CanPlay && needResumePoll)
193
+ {
194
+ TapLogger.Debug("enter game in antiAddiciton " );
195
+ CompliancePoll.StartUp();
196
+ needResumePoll = false;
197
+ }
198
+ }
199
+
200
+ public static void LeaveGame()
201
+ {
202
+ if (CanPlay && CompliancePoll.StartPoll)
203
+ {
204
+ TapLogger.Debug("leave game in antiAddiciton ");
205
+ CompliancePoll.Logout();
206
+ needResumePoll = true;
207
+ }
208
+ }
209
+
210
+ /// <summary>
211
+ /// 是否使用移动版 UI,否则就是用 Standalone 版本 UI
212
+ /// </summary>
213
+ /// <returns></returns>
214
+ public static bool IsUseMobileUI()
215
+ {
216
+ return false;
217
+ }
218
+
219
+ public static bool? useMobileUI;
220
+
221
+ #region Worker
222
+
223
+ private static BaseComplianceWorker currentWorker ;
224
+
225
+ private static BaseComplianceWorker GetWorker()
226
+ {
227
+ if (currentWorker == null){
228
+ currentWorker = GetChinaWorker();
229
+ }
230
+ return currentWorker;
231
+
232
+ }
233
+
234
+ private static BaseComplianceWorker Worker => GetWorker();
235
+
236
+ private static BaseComplianceWorker GetChinaWorker() {
237
+ // get ChinaComplianceWorker from TapSDK.Compliance.Standalone.Runtime dll
238
+ Type baseWorkerType = typeof(BaseComplianceWorker);
239
+ Type[] chinaWorkerType = AppDomain.CurrentDomain.GetAssemblies()
240
+ .Where(asssembly => asssembly.GetName().FullName.StartsWith("TapSDK.Compliance.Standalone.Runtime"))
241
+ .SelectMany(assembly => assembly.GetTypes())
242
+ .Where(clazz => baseWorkerType.IsAssignableFrom(clazz) && clazz.IsClass)
243
+ .ToArray();
244
+ if (chinaWorkerType != null && chinaWorkerType.Length > 0) {
245
+ return Activator.CreateInstance(chinaWorkerType[0]) as BaseComplianceWorker;
246
+ }
247
+
248
+ return null;
249
+ }
250
+
251
+ #endregion
252
+ }
253
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: f21050346037b4fb38b4cd2bd97bf676
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,211 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.IO;
4
+ using System.Linq;
5
+ using System.Security.Cryptography;
6
+ using System.Text;
7
+ using UnityEngine;
8
+
9
+ namespace TapSDK.Compliance.Internal
10
+ {
11
+ public static class Tool
12
+ {
13
+ public static int GetMonthDayCount(int year, int month)
14
+ {
15
+ switch (month)
16
+ {
17
+ case 1:
18
+ case 3:
19
+ case 5:
20
+ case 7:
21
+ case 8:
22
+ case 10:
23
+ case 12:
24
+ return 31;
25
+ case 2:
26
+ return IsLeapYear(year) ? 29 : 28;
27
+ default:
28
+ return 30;
29
+ }
30
+ }
31
+
32
+ public static bool IsLeapYear(int year)
33
+ {
34
+ return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
35
+ }
36
+
37
+ /// <summary>
38
+ /// md5加密
39
+ /// </summary>
40
+ /// <param name="str"></param>
41
+ /// <returns></returns>
42
+ public static string EncryptString(string str)
43
+ {
44
+ MD5 md5 = MD5.Create();
45
+ // 将字符串转换成字节数组
46
+ byte[] byteOld = Encoding.UTF8.GetBytes(str);
47
+ // 调用加密方法
48
+ byte[] byteNew = md5.ComputeHash(byteOld);
49
+ // 将加密结果转换为字符串
50
+ StringBuilder sb = new StringBuilder();
51
+ foreach (byte b in byteNew)
52
+ {
53
+ // 将字节转换成16进制表示的字符串,
54
+ sb.Append(b.ToString("x2"));
55
+ }
56
+
57
+ // 返回加密的字符串
58
+ return sb.ToString();
59
+ }
60
+
61
+ /// <summary>
62
+ /// Encrypt the content with public key (in string)
63
+ /// </summary>
64
+ /// <param name="input"></param>
65
+ /// <param name="key"></param>
66
+ /// <returns></returns>
67
+ public static string RsaEncrypt(string input, string key)
68
+ {
69
+ //https://stackoverflow.com/questions/11506891/how-to-load-the-rsa-public-key-from-file-in-c-sharp
70
+ try
71
+ {
72
+ var base64Info = Convert.FromBase64String(key);
73
+ RSACryptoServiceProvider rsa = DecodeX509PublicKey(base64Info);
74
+ int chunckSize = 245;
75
+ var encodeInfo = Encoding.UTF8.GetBytes(input);
76
+
77
+ // 用来存储加密后的数据的列表
78
+ List<byte[]> encryptedDataList = new List<byte[]>();
79
+
80
+ // 分段加密
81
+ for (int i = 0; i < encodeInfo.Length; i += chunckSize) {
82
+ int blockSize = Math.Min(chunckSize, encodeInfo.Length - i);
83
+ byte[] blockData = new byte[blockSize];
84
+ Buffer.BlockCopy(encodeInfo, i, blockData, 0, blockSize);
85
+ byte[] encryptedBlock = rsa.Encrypt(blockData, false);
86
+ encryptedDataList.Add(encryptedBlock);
87
+ }
88
+ // 将加密后的数据拼接在一起
89
+ byte[] encryptedData = encryptedDataList.SelectMany(x => x).ToArray();
90
+ // 最终的加密结果可以保存到文件或通过网络传输
91
+ string encryptedString = Convert.ToBase64String(encryptedData);
92
+ return encryptedString;
93
+ }
94
+ catch (Exception e)
95
+ {
96
+ Debug.LogErrorFormat("RSA Encrypt Error! input: {0} key: {1}\n Msg: {2}", input, key, e.Message);
97
+ return null;
98
+ }
99
+ }
100
+
101
+ private static bool CompareBytearrays(byte[] a, byte[] b)
102
+ {
103
+ if (a.Length != b.Length)
104
+ return false;
105
+ int i = 0;
106
+ foreach (byte c in a)
107
+ {
108
+ if (c != b[i])
109
+ return false;
110
+ i++;
111
+ }
112
+
113
+ return true;
114
+ }
115
+
116
+ private static RSACryptoServiceProvider DecodeX509PublicKey(byte[] x509Key)
117
+ {
118
+ // encoded OID sequence for PKCS #1 rsaEncryption szOID_RSA_RSA = "1.2.840.113549.1.1.1"
119
+ byte[] seqOid = { 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 };
120
+ // --------- Set up stream to read the asn.1 encoded SubjectPublicKeyInfo blob ------
121
+ MemoryStream mem = new MemoryStream(x509Key);
122
+ BinaryReader binaryReader = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading
123
+
124
+ try
125
+ {
126
+
127
+ var twoBytes = binaryReader.ReadUInt16();
128
+ if (twoBytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81)
129
+ binaryReader.ReadByte(); //advance 1 byte
130
+ else if (twoBytes == 0x8230)
131
+ binaryReader.ReadInt16(); //advance 2 bytes
132
+ else
133
+ return null;
134
+
135
+ var seq = binaryReader.ReadBytes(15);
136
+ if (!CompareBytearrays(seq, seqOid)) //make sure Sequence for OID is correct
137
+ return null;
138
+
139
+ twoBytes = binaryReader.ReadUInt16();
140
+ if (twoBytes == 0x8103) //data read as little endian order (actual data order for Bit String is 03 81)
141
+ binaryReader.ReadByte(); //advance 1 byte
142
+ else if (twoBytes == 0x8203)
143
+ binaryReader.ReadInt16(); //advance 2 bytes
144
+ else
145
+ return null;
146
+
147
+ var bt = binaryReader.ReadByte();
148
+ if (bt != 0x00) //expect null byte next
149
+ return null;
150
+
151
+ twoBytes = binaryReader.ReadUInt16();
152
+ if (twoBytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81)
153
+ binaryReader.ReadByte(); //advance 1 byte
154
+ else if (twoBytes == 0x8230)
155
+ binaryReader.ReadInt16(); //advance 2 bytes
156
+ else
157
+ return null;
158
+
159
+ twoBytes = binaryReader.ReadUInt16();
160
+ byte lowByte;
161
+ byte highByte = 0x00;
162
+
163
+ if (twoBytes == 0x8102) //data read as little endian order (actual data order for Integer is 02 81)
164
+ lowByte = binaryReader.ReadByte(); // read next bytes which is bytes in modulus
165
+ else if (twoBytes == 0x8202)
166
+ {
167
+ highByte = binaryReader.ReadByte(); //advance 2 bytes
168
+ lowByte = binaryReader.ReadByte();
169
+ }
170
+ else
171
+ return null;
172
+ byte[] modInt = { lowByte, highByte, 0x00, 0x00 }; //reverse byte order since asn.1 key uses big endian order
173
+ int modSize = BitConverter.ToInt32(modInt, 0);
174
+
175
+ byte firstByte = binaryReader.ReadByte();
176
+ binaryReader.BaseStream.Seek(-1, SeekOrigin.Current);
177
+
178
+ if (firstByte == 0x00)
179
+ { //if first byte (highest order) of modulus is zero, don't include it
180
+ binaryReader.ReadByte(); //skip this null byte
181
+ modSize -= 1; //reduce modulus buffer size by 1
182
+ }
183
+
184
+ byte[] modulus = binaryReader.ReadBytes(modSize); //read the modulus bytes
185
+
186
+ if (binaryReader.ReadByte() != 0x02) //expect an Integer for the exponent data
187
+ return null;
188
+ int expBytes = binaryReader.ReadByte(); // should only need one byte for actual exponent data (for all useful values)
189
+ byte[] exponent = binaryReader.ReadBytes(expBytes);
190
+
191
+ // ------- create RSACryptoServiceProvider instance and initialize with public key -----
192
+ RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
193
+ RSAParameters rsaKeyInfo = new RSAParameters
194
+ {
195
+ Modulus = modulus,
196
+ Exponent = exponent
197
+ };
198
+ rsa.ImportParameters(rsaKeyInfo);
199
+ return rsa;
200
+ }
201
+ catch (Exception)
202
+ {
203
+ return null;
204
+ }
205
+
206
+ finally { binaryReader.Close(); }
207
+
208
+ }
209
+ }
210
+ }
211
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: b8d08e31271604fae8aaa759475dddee
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,81 @@
1
+ using System;
2
+ using System.Collections;
3
+ using TapSDK.UI;
4
+ using TapSDK.Compliance.Model;
5
+ using UnityEngine;
6
+ using UnityEngine.UI;
7
+
8
+ namespace TapSDK.Compliance.Internal {
9
+ public class TapTapChinaVerifyFinishPanelController : BasePanelController
10
+ {
11
+ public Text titleText;
12
+ public Text contentText;
13
+ public Text closeTipText;
14
+ public Button okButton;
15
+ public Button closeButton;
16
+
17
+ private float _closeTime = 5.0f;
18
+ private float _elapse;
19
+
20
+ private Action OnOk;
21
+
22
+ /// <summary>
23
+ /// bind ugui components for every panel
24
+ /// </summary>
25
+ protected override void BindComponents()
26
+ {
27
+ titleText = transform.Find("Root/TitleText").GetComponent<Text>();
28
+ contentText = transform.Find("Root/ContentText").GetComponent<Text>();
29
+ closeTipText = transform.Find("Root/CloseTipText").GetComponent<Text>();
30
+ okButton = transform.Find("Root/OKButton").GetComponent<Button>();
31
+ closeButton = transform.Find("Root/CloseButton").GetComponent<Button>();
32
+ }
33
+
34
+ protected override void OnLoadSuccess()
35
+ {
36
+ base.OnLoadSuccess();
37
+
38
+ okButton.onClick.AddListener(OnOKButtonClicked);
39
+ closeButton.onClick.AddListener(OnOKButtonClicked);
40
+
41
+ _elapse = 0;
42
+
43
+ StartCoroutine(Countdown());
44
+ }
45
+
46
+ internal void Show(PayableResult payable, Action onOk = null)
47
+ {
48
+ // if (payable != null)
49
+ // {
50
+ // titleText.text = payable.Title;
51
+ // contentText.text = payable.Content
52
+ // ?.Replace("<font color=", "<color=")
53
+ // .Replace("</font>", "</color>")
54
+ // .Replace("<br>", "\n");
55
+ // }
56
+ OnOk = onOk;
57
+ }
58
+
59
+ private void OnOKButtonClicked()
60
+ {
61
+ Close();
62
+ OnOk?.Invoke();
63
+ }
64
+
65
+ IEnumerator Countdown()
66
+ {
67
+ int remainTime = 0;
68
+ do
69
+ {
70
+ remainTime = Mathf.CeilToInt(_closeTime - _elapse);
71
+ closeTipText.text = $"即将关闭当前页面({remainTime}s)";
72
+ yield return new WaitForSeconds(1);
73
+ _elapse++;
74
+
75
+ } while (remainTime > 0);
76
+
77
+ Close();
78
+ OnOk?.Invoke();
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d4cba54da43b540a6bfd0eefe26b39fb
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: