com.taptap.sdk.core 4.3.0-aplha.5

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 (273) hide show
  1. package/Editor/BuildTargetUtils.cs +14 -0
  2. package/Editor/BuildTargetUtils.cs.meta +11 -0
  3. package/Editor/LinkXMLGenerator.cs +70 -0
  4. package/Editor/LinkXMLGenerator.cs.meta +11 -0
  5. package/Editor/Plist.cs +954 -0
  6. package/Editor/Plist.cs.meta +3 -0
  7. package/Editor/SDKLinkProcessBuild.cs +119 -0
  8. package/Editor/SDKLinkProcessBuild.cs.meta +11 -0
  9. package/Editor/TapFileHelper.cs +168 -0
  10. package/Editor/TapFileHelper.cs.meta +3 -0
  11. package/Editor/TapSDK.Core.Editor.asmdef +15 -0
  12. package/Editor/TapSDK.Core.Editor.asmdef.meta +7 -0
  13. package/Editor/TapSDKCoreCompile.cs +284 -0
  14. package/Editor/TapSDKCoreCompile.cs.meta +3 -0
  15. package/Editor/TapSDKCoreIOSProcessor.cs +74 -0
  16. package/Editor/TapSDKCoreIOSProcessor.cs.meta +3 -0
  17. package/Editor/UI/ScrollViewEditor.cs +267 -0
  18. package/Editor/UI/ScrollViewEditor.cs.meta +12 -0
  19. package/Editor/UI/ScrollViewExEditor.cs +34 -0
  20. package/Editor/UI/ScrollViewExEditor.cs.meta +12 -0
  21. package/Editor/UI/TapSDK.UI.Editor.asmdef +17 -0
  22. package/Editor/UI/TapSDK.UI.Editor.asmdef.meta +7 -0
  23. package/Editor/UI.meta +9 -0
  24. package/Editor.meta +8 -0
  25. package/Mobile/Editor/NativeDependencies.xml +22 -0
  26. package/Mobile/Editor/NativeDependencies.xml.meta +7 -0
  27. package/Mobile/Editor/TapCommonMobileProcessBuild.cs +20 -0
  28. package/Mobile/Editor/TapCommonMobileProcessBuild.cs.meta +11 -0
  29. package/Mobile/Editor/TapSDK.Core.Mobile.Editor.asmdef +17 -0
  30. package/Mobile/Editor/TapSDK.Core.Mobile.Editor.asmdef.meta +7 -0
  31. package/Mobile/Editor.meta +8 -0
  32. package/Mobile/Runtime/AndroidNativeWrapper.cs +50 -0
  33. package/Mobile/Runtime/AndroidNativeWrapper.cs.meta +11 -0
  34. package/Mobile/Runtime/Bridge.cs +84 -0
  35. package/Mobile/Runtime/Bridge.cs.meta +11 -0
  36. package/Mobile/Runtime/BridgeAndroid.cs +73 -0
  37. package/Mobile/Runtime/BridgeAndroid.cs.meta +11 -0
  38. package/Mobile/Runtime/BridgeCallback.cs +35 -0
  39. package/Mobile/Runtime/BridgeCallback.cs.meta +11 -0
  40. package/Mobile/Runtime/BridgeIOS.cs +113 -0
  41. package/Mobile/Runtime/BridgeIOS.cs.meta +11 -0
  42. package/Mobile/Runtime/Command.cs +119 -0
  43. package/Mobile/Runtime/Command.cs.meta +11 -0
  44. package/Mobile/Runtime/Constants.cs +9 -0
  45. package/Mobile/Runtime/Constants.cs.meta +11 -0
  46. package/Mobile/Runtime/EngineBridgeInitializer.cs +33 -0
  47. package/Mobile/Runtime/EngineBridgeInitializer.cs.meta +11 -0
  48. package/Mobile/Runtime/IBridge.cs +15 -0
  49. package/Mobile/Runtime/IBridge.cs.meta +11 -0
  50. package/Mobile/Runtime/IOSNativeWrapper.cs +273 -0
  51. package/Mobile/Runtime/IOSNativeWrapper.cs.meta +11 -0
  52. package/Mobile/Runtime/Result.cs +37 -0
  53. package/Mobile/Runtime/Result.cs.meta +11 -0
  54. package/Mobile/Runtime/TapCoreMobile.cs +71 -0
  55. package/Mobile/Runtime/TapCoreMobile.cs.meta +11 -0
  56. package/Mobile/Runtime/TapEventMobile.cs +265 -0
  57. package/Mobile/Runtime/TapEventMobile.cs.meta +11 -0
  58. package/Mobile/Runtime/TapSDK.Core.Mobile.Runtime.asmdef +18 -0
  59. package/Mobile/Runtime/TapSDK.Core.Mobile.Runtime.asmdef.meta +7 -0
  60. package/Mobile/Runtime/TapUUID.cs +9 -0
  61. package/Mobile/Runtime/TapUUID.cs.meta +11 -0
  62. package/Mobile/Runtime.meta +8 -0
  63. package/Mobile.meta +8 -0
  64. package/Plugins/iOS.meta +8 -0
  65. package/Plugins.meta +8 -0
  66. package/Resources/Fonts/taptap-sdk-bold.ttf +0 -0
  67. package/Resources/Fonts/taptap-sdk-bold.ttf.meta +22 -0
  68. package/Resources/Fonts/taptap-sdk.ttf +0 -0
  69. package/Resources/Fonts/taptap-sdk.ttf.meta +21 -0
  70. package/Resources/Fonts.meta +8 -0
  71. package/Resources/Loading.prefab +260 -0
  72. package/Resources/Loading.prefab.meta +7 -0
  73. package/Resources/TapCommonTip.prefab +194 -0
  74. package/Resources/TapCommonTip.prefab.meta +7 -0
  75. package/Resources/TapCommonToastBlack.prefab +528 -0
  76. package/Resources/TapCommonToastBlack.prefab.meta +7 -0
  77. package/Resources/TapCommonToastWhite.prefab +411 -0
  78. package/Resources/TapCommonToastWhite.prefab.meta +7 -0
  79. package/Resources/TapSDKCommonTapIcon-v2.png +0 -0
  80. package/Resources/TapSDKCommonTapIcon-v2.png.meta +128 -0
  81. package/Resources/TapSDKCommonTapIcon.png +0 -0
  82. package/Resources/TapSDKCommonTapIcon.png.meta +128 -0
  83. package/Resources/TapSDKCommonToastBg.png +0 -0
  84. package/Resources/TapSDKCommonToastBg.png.meta +128 -0
  85. package/Resources/TapSDKConstantUIRoot.prefab +100 -0
  86. package/Resources/TapSDKConstantUIRoot.prefab.meta +7 -0
  87. package/Resources/TapSDKUIRoot.prefab +100 -0
  88. package/Resources/TapSDKUIRoot.prefab.meta +7 -0
  89. package/Resources/TapTapBtn_White.png +0 -0
  90. package/Resources/TapTapBtn_White.png.meta +128 -0
  91. package/Resources/TapTapBtn_White_2.png +0 -0
  92. package/Resources/TapTapBtn_White_2.png.meta +128 -0
  93. package/Resources/ToastBackground.png +0 -0
  94. package/Resources/ToastBackground.png.meta +128 -0
  95. package/Resources/detail_bg.png +0 -0
  96. package/Resources/detail_bg.png.meta +92 -0
  97. package/Resources/success.png +0 -0
  98. package/Resources/success.png.meta +128 -0
  99. package/Resources/taptap-bg.png +0 -0
  100. package/Resources/taptap-bg.png.meta +140 -0
  101. package/Resources/taptap-close.png +0 -0
  102. package/Resources/taptap-close.png.meta +146 -0
  103. package/Resources/taptap-router-v2.png +0 -0
  104. package/Resources/taptap-router-v2.png.meta +128 -0
  105. package/Resources/taptap-router.png +0 -0
  106. package/Resources/taptap-router.png.meta +146 -0
  107. package/Resources/taptap-sdk-refresh 1.png +0 -0
  108. package/Resources/taptap-sdk-refresh 1.png.meta +128 -0
  109. package/Resources/taptap-toast-error.png +0 -0
  110. package/Resources/taptap-toast-error.png.meta +128 -0
  111. package/Resources/taptap-toast-info.png +0 -0
  112. package/Resources/taptap-toast-info.png.meta +128 -0
  113. package/Resources/taptap-toast-success.png +0 -0
  114. package/Resources/taptap-toast-success.png.meta +128 -0
  115. package/Resources/taptap-toast-warning.png +0 -0
  116. package/Resources/taptap-toast-warning.png.meta +128 -0
  117. package/Resources.meta +8 -0
  118. package/Runtime/Internal/Http/TapHttpClient.cs +176 -0
  119. package/Runtime/Internal/Http/TapHttpClient.cs.meta +11 -0
  120. package/Runtime/Internal/Http/TapHttpUtils.cs +83 -0
  121. package/Runtime/Internal/Http/TapHttpUtils.cs.meta +11 -0
  122. package/Runtime/Internal/Http.meta +8 -0
  123. package/Runtime/Internal/Init/IInitTask.cs +18 -0
  124. package/Runtime/Internal/Init/IInitTask.cs.meta +11 -0
  125. package/Runtime/Internal/Init.meta +8 -0
  126. package/Runtime/Internal/Json/TapJsonConverter.cs +40 -0
  127. package/Runtime/Internal/Json/TapJsonConverter.cs.meta +11 -0
  128. package/Runtime/Internal/Json.meta +8 -0
  129. package/Runtime/Internal/Platform/ITapCorePlatform.cs +12 -0
  130. package/Runtime/Internal/Platform/ITapCorePlatform.cs.meta +11 -0
  131. package/Runtime/Internal/Platform/ITapEventPlatform.cs +37 -0
  132. package/Runtime/Internal/Platform/ITapEventPlatform.cs.meta +11 -0
  133. package/Runtime/Internal/Platform/PlatformTypeUtils.cs +46 -0
  134. package/Runtime/Internal/Platform/PlatformTypeUtils.cs.meta +11 -0
  135. package/Runtime/Internal/Platform.meta +8 -0
  136. package/Runtime/Internal/UI/Base/Const.cs +27 -0
  137. package/Runtime/Internal/UI/Base/Const.cs.meta +11 -0
  138. package/Runtime/Internal/UI/Base/GraphicRaycasterBugFixed.cs +240 -0
  139. package/Runtime/Internal/UI/Base/GraphicRaycasterBugFixed.cs.meta +3 -0
  140. package/Runtime/Internal/UI/Base/LoadingPanelController.cs +29 -0
  141. package/Runtime/Internal/UI/Base/LoadingPanelController.cs.meta +11 -0
  142. package/Runtime/Internal/UI/Base/MonoSingleton.cs +102 -0
  143. package/Runtime/Internal/UI/Base/MonoSingleton.cs.meta +11 -0
  144. package/Runtime/Internal/UI/Base/Singleton.cs +29 -0
  145. package/Runtime/Internal/UI/Base/Singleton.cs.meta +11 -0
  146. package/Runtime/Internal/UI/Base/TipPanelController.cs +45 -0
  147. package/Runtime/Internal/UI/Base/TipPanelController.cs.meta +3 -0
  148. package/Runtime/Internal/UI/Base/ToastBlackPanelController.cs +95 -0
  149. package/Runtime/Internal/UI/Base/ToastBlackPanelController.cs.meta +11 -0
  150. package/Runtime/Internal/UI/Base/ToastWhitePanelController.cs +79 -0
  151. package/Runtime/Internal/UI/Base/ToastWhitePanelController.cs.meta +3 -0
  152. package/Runtime/Internal/UI/Base/UIManager.cs +724 -0
  153. package/Runtime/Internal/UI/Base/UIManager.cs.meta +11 -0
  154. package/Runtime/Internal/UI/Base.meta +8 -0
  155. package/Runtime/Internal/UI/BasePanel/BasePanelController.cs +385 -0
  156. package/Runtime/Internal/UI/BasePanel/BasePanelController.cs.meta +11 -0
  157. package/Runtime/Internal/UI/BasePanel.meta +8 -0
  158. package/Runtime/Internal/UI/Params/BasePanelConfig.cs +18 -0
  159. package/Runtime/Internal/UI/Params/BasePanelConfig.cs.meta +11 -0
  160. package/Runtime/Internal/UI/Params/IOpenPanelParameter.cs +7 -0
  161. package/Runtime/Internal/UI/Params/IOpenPanelParameter.cs.meta +11 -0
  162. package/Runtime/Internal/UI/Params.meta +8 -0
  163. package/Runtime/Internal/UI/ScrollViewEx/ObjPool/SimpleObjPool.cs +76 -0
  164. package/Runtime/Internal/UI/ScrollViewEx/ObjPool/SimpleObjPool.cs.meta +12 -0
  165. package/Runtime/Internal/UI/ScrollViewEx/ObjPool.meta +9 -0
  166. package/Runtime/Internal/UI/ScrollViewEx/ScrollView/ScrollView.cs +828 -0
  167. package/Runtime/Internal/UI/ScrollViewEx/ScrollView/ScrollView.cs.meta +12 -0
  168. package/Runtime/Internal/UI/ScrollViewEx/ScrollView/ScrollViewEx.cs +245 -0
  169. package/Runtime/Internal/UI/ScrollViewEx/ScrollView/ScrollViewEx.cs.meta +12 -0
  170. package/Runtime/Internal/UI/ScrollViewEx/ScrollView.meta +9 -0
  171. package/Runtime/Internal/UI/ScrollViewEx.meta +8 -0
  172. package/Runtime/Internal/UI.meta +8 -0
  173. package/Runtime/Internal/Utils/BridgeUtils.cs +29 -0
  174. package/Runtime/Internal/Utils/BridgeUtils.cs.meta +11 -0
  175. package/Runtime/Internal/Utils/ImageUtils.cs +147 -0
  176. package/Runtime/Internal/Utils/ImageUtils.cs.meta +11 -0
  177. package/Runtime/Internal/Utils/TapLoom.cs +155 -0
  178. package/Runtime/Internal/Utils/TapLoom.cs.meta +11 -0
  179. package/Runtime/Internal/Utils/UrlUtils.cs +34 -0
  180. package/Runtime/Internal/Utils/UrlUtils.cs.meta +11 -0
  181. package/Runtime/Internal/Utils.meta +8 -0
  182. package/Runtime/Internal.meta +8 -0
  183. package/Runtime/Public/DataStorage.cs +141 -0
  184. package/Runtime/Public/DataStorage.cs.meta +11 -0
  185. package/Runtime/Public/ITapPropertiesProxy.cs +6 -0
  186. package/Runtime/Public/ITapPropertiesProxy.cs.meta +11 -0
  187. package/Runtime/Public/Json.cs +636 -0
  188. package/Runtime/Public/Json.cs.meta +11 -0
  189. package/Runtime/Public/Log/TapLogLevel.cs +7 -0
  190. package/Runtime/Public/Log/TapLogLevel.cs.meta +11 -0
  191. package/Runtime/Public/Log/TapLogger.cs +48 -0
  192. package/Runtime/Public/Log/TapLogger.cs.meta +11 -0
  193. package/Runtime/Public/Log.meta +8 -0
  194. package/Runtime/Public/Platform.cs +27 -0
  195. package/Runtime/Public/Platform.cs.meta +11 -0
  196. package/Runtime/Public/RegionType.cs +8 -0
  197. package/Runtime/Public/RegionType.cs.meta +11 -0
  198. package/Runtime/Public/SafeDictionary.cs +27 -0
  199. package/Runtime/Public/SafeDictionary.cs.meta +11 -0
  200. package/Runtime/Public/TapError.cs +62 -0
  201. package/Runtime/Public/TapError.cs.meta +11 -0
  202. package/Runtime/Public/TapErrorCode.cs +44 -0
  203. package/Runtime/Public/TapErrorCode.cs.meta +11 -0
  204. package/Runtime/Public/TapException.cs +24 -0
  205. package/Runtime/Public/TapException.cs.meta +11 -0
  206. package/Runtime/Public/TapLanguage.cs +21 -0
  207. package/Runtime/Public/TapLanguage.cs.meta +11 -0
  208. package/Runtime/Public/TapLocalizeManager.cs +128 -0
  209. package/Runtime/Public/TapLocalizeManager.cs.meta +11 -0
  210. package/Runtime/Public/TapTapEvent.cs +93 -0
  211. package/Runtime/Public/TapTapEvent.cs.meta +11 -0
  212. package/Runtime/Public/TapTapSDK.cs +96 -0
  213. package/Runtime/Public/TapTapSDK.cs.meta +11 -0
  214. package/Runtime/Public/TapTapSDKCoreOptions.cs +104 -0
  215. package/Runtime/Public/TapTapSDKCoreOptions.cs.meta +11 -0
  216. package/Runtime/Public.meta +8 -0
  217. package/Runtime/TapSDK.Core.Runtime.asmdef +3 -0
  218. package/Runtime/TapSDK.Core.Runtime.asmdef.meta +7 -0
  219. package/Runtime.meta +8 -0
  220. package/Standalone/Editor/TapCoreStandaloneProcessBuild.cs +20 -0
  221. package/Standalone/Editor/TapCoreStandaloneProcessBuild.cs.meta +11 -0
  222. package/Standalone/Editor/TapSDK.Core.Standalone.Editor.asmdef +17 -0
  223. package/Standalone/Editor/TapSDK.Core.Standalone.Editor.asmdef.meta +7 -0
  224. package/Standalone/Editor.meta +8 -0
  225. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/Info.plist +46 -0
  226. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/Info.plist.meta +7 -0
  227. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/MacOS/TapDBDeviceInfo +0 -0
  228. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/MacOS/TapDBDeviceInfo.meta +7 -0
  229. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/MacOS.meta +8 -0
  230. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/_CodeSignature/CodeResources +115 -0
  231. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/_CodeSignature/CodeResources.meta +7 -0
  232. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/_CodeSignature.meta +8 -0
  233. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents.meta +8 -0
  234. package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle.meta +33 -0
  235. package/Standalone/Plugins/macOS.meta +8 -0
  236. package/Standalone/Plugins.meta +8 -0
  237. package/Standalone/Runtime/Internal/Constants.cs +37 -0
  238. package/Standalone/Runtime/Internal/Constants.cs.meta +11 -0
  239. package/Standalone/Runtime/Internal/DeviceInfo.cs +152 -0
  240. package/Standalone/Runtime/Internal/DeviceInfo.cs.meta +11 -0
  241. package/Standalone/Runtime/Internal/EventSender.cs +239 -0
  242. package/Standalone/Runtime/Internal/EventSender.cs.meta +11 -0
  243. package/Standalone/Runtime/Internal/Http/HttpClient.cs +211 -0
  244. package/Standalone/Runtime/Internal/Http/HttpClient.cs.meta +11 -0
  245. package/Standalone/Runtime/Internal/Http/NetUtils.cs +48 -0
  246. package/Standalone/Runtime/Internal/Http/NetUtils.cs.meta +11 -0
  247. package/Standalone/Runtime/Internal/Http/TimeUtil.cs +30 -0
  248. package/Standalone/Runtime/Internal/Http/TimeUtil.cs.meta +11 -0
  249. package/Standalone/Runtime/Internal/Http.meta +8 -0
  250. package/Standalone/Runtime/Internal/Identity.cs +43 -0
  251. package/Standalone/Runtime/Internal/Identity.cs.meta +11 -0
  252. package/Standalone/Runtime/Internal/PlayRecorder.cs +53 -0
  253. package/Standalone/Runtime/Internal/PlayRecorder.cs.meta +11 -0
  254. package/Standalone/Runtime/Internal/Prefs.cs +85 -0
  255. package/Standalone/Runtime/Internal/Prefs.cs.meta +11 -0
  256. package/Standalone/Runtime/Internal/Tracker.cs +318 -0
  257. package/Standalone/Runtime/Internal/Tracker.cs.meta +11 -0
  258. package/Standalone/Runtime/Internal/User.cs +51 -0
  259. package/Standalone/Runtime/Internal/User.cs.meta +11 -0
  260. package/Standalone/Runtime/Internal.meta +8 -0
  261. package/Standalone/Runtime/Public/EventManager.cs +41 -0
  262. package/Standalone/Runtime/Public/EventManager.cs.meta +11 -0
  263. package/Standalone/Runtime/Public/TapCoreStandalone.cs +197 -0
  264. package/Standalone/Runtime/Public/TapCoreStandalone.cs.meta +11 -0
  265. package/Standalone/Runtime/Public/TapEventStandalone.cs +281 -0
  266. package/Standalone/Runtime/Public/TapEventStandalone.cs.meta +11 -0
  267. package/Standalone/Runtime/Public.meta +8 -0
  268. package/Standalone/Runtime/TapSDK.Core.Standalone.Runtime.asmdef +21 -0
  269. package/Standalone/Runtime/TapSDK.Core.Standalone.Runtime.asmdef.meta +7 -0
  270. package/Standalone/Runtime.meta +8 -0
  271. package/Standalone.meta +8 -0
  272. package/package.json +8 -0
  273. package/package.json.meta +7 -0
@@ -0,0 +1,41 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using TapSDK.UI;
4
+
5
+ namespace TapSDK.Core.Standalone
6
+ {
7
+ public sealed class EventManager : Singleton<EventManager>
8
+ {
9
+ private Dictionary<string, Action<object>> eventRegistries = new Dictionary<string, Action<object>>();
10
+
11
+ public static void AddListener(string eventName, Action<object> listener) {
12
+ if (listener == null) return;
13
+ if (string.IsNullOrEmpty(eventName)) return;
14
+ Action<object> thisEvent;
15
+ if (Instance.eventRegistries.TryGetValue(eventName, out thisEvent)) {
16
+ thisEvent += listener;
17
+ Instance.eventRegistries[eventName] = thisEvent;
18
+ } else {
19
+ thisEvent += listener;
20
+ Instance.eventRegistries.Add(eventName, thisEvent);
21
+ }
22
+ }
23
+
24
+ public static void RemoveListener(string eventName, Action<object> listener) {
25
+ if (listener == null) return;
26
+ if (string.IsNullOrEmpty(eventName)) return;
27
+ Action<object> thisEvent;
28
+ if (Instance.eventRegistries.TryGetValue(eventName, out thisEvent)) {
29
+ thisEvent -= listener;
30
+ Instance.eventRegistries[eventName] = thisEvent;
31
+ }
32
+ }
33
+
34
+ public static void TriggerEvent(string eventName, object message) {
35
+ Action<object> thisEvent = null;
36
+ if (Instance.eventRegistries.TryGetValue(eventName, out thisEvent)) {
37
+ thisEvent.Invoke(message);
38
+ }
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 95f6670809a3746c3b679b19441b1f6e
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,197 @@
1
+ using TapSDK.Core.Internal;
2
+ using UnityEngine;
3
+ using TapSDK.Core.Standalone.Internal;
4
+ using System.Collections.Generic;
5
+ using UnityEditor;
6
+ using System.IO;
7
+ using TapSDK.Core.Internal.Utils;
8
+
9
+ namespace TapSDK.Core.Standalone
10
+ {
11
+ /// <summary>
12
+ /// Represents the standalone implementation of the TapCore SDK.
13
+ /// </summary>
14
+ public class TapCoreStandalone : ITapCorePlatform
15
+ {
16
+ internal static Prefs Prefs;
17
+ internal static Tracker Tracker;
18
+ internal static User User;
19
+ internal static TapTapSDKCoreOptions coreOptions;
20
+ public static bool isRnd = false;
21
+ internal static bool enableAutoEvent = true;
22
+
23
+ internal static Dictionary<string, object> gatekeeperData = new Dictionary<string, object>();
24
+
25
+ /// <summary>
26
+ /// Initializes a new instance of the <see cref="TapCoreStandalone"/> class.
27
+ /// </summary>
28
+ public TapCoreStandalone()
29
+ {
30
+ Debug.Log("TapCoStandalone constructor");
31
+ // Instantiate modules
32
+ Prefs = new Prefs();
33
+ Tracker = new Tracker();
34
+ User = new User();
35
+ TapLoom.Initialize();
36
+ }
37
+
38
+ private static void SetRND(bool isRnd)
39
+ {
40
+ Debug.Log("SetRND called" + isRnd);
41
+ TapCoreStandalone.isRnd = isRnd;
42
+ }
43
+
44
+ /// <summary>
45
+ /// Initializes the TapCore SDK with the specified options.
46
+ /// </summary>
47
+ /// <param name="options">The TapCore SDK options.</param>
48
+ public void Init(TapTapSDKCoreOptions options)
49
+ {
50
+ Init(options, null);
51
+ }
52
+
53
+ /// <summary>
54
+ /// Initializes the TapCore SDK with the specified core options and additional options.
55
+ /// </summary>
56
+ /// <param name="coreOption">The TapCore SDK core options.</param>
57
+ /// <param name="otherOptions">Additional TapCore SDK options.</param>
58
+ public void Init(TapTapSDKCoreOptions coreOption, TapTapSDKBaseOption[] otherOptions)
59
+ {
60
+ Debug.Log("SDK inited with other options + " + coreOption.ToString() + coreOption.ToString());
61
+ coreOptions = coreOption;
62
+
63
+ var path = Path.Combine(Application.persistentDataPath, Constants.ClientSettingsFileName);
64
+ if (File.Exists(path))
65
+ {
66
+ var clientSettings = File.ReadAllText(path);
67
+ Debug.Log("本地 clientSettings: " + clientSettings);
68
+ SetAutoEvent(Json.Deserialize(clientSettings) as Dictionary<string, object>);
69
+
70
+ try
71
+ {
72
+ gatekeeperData = Json.Deserialize(clientSettings) as Dictionary<string, object>;
73
+ }
74
+ catch (System.Exception e)
75
+ {
76
+ Debug.LogError("TriggerEvent error: " + e.Message);
77
+ }
78
+ }
79
+
80
+ Tracker.Init();
81
+
82
+ requestClientSetting();
83
+ }
84
+
85
+ public void UpdateLanguage(TapTapLanguageType language)
86
+ {
87
+ if (coreOptions == null)
88
+ {
89
+ Debug.Log("coreOptions is null");
90
+ return;
91
+ }
92
+ Debug.Log("UpdateLanguage called with language: " + language);
93
+ coreOptions.preferredLanguage = language;
94
+ }
95
+
96
+ public static string getGatekeeperConfigUrl(string key)
97
+ {
98
+ if (gatekeeperData != null)
99
+ {
100
+ var urlsData = gatekeeperData["urls"] as Dictionary<string, object>;
101
+ if (urlsData != null && urlsData.ContainsKey(key))
102
+ {
103
+ var keyData = urlsData[key] as Dictionary<string, object>;
104
+ if (keyData != null)
105
+ {
106
+ return (string)keyData["browser"];
107
+ }
108
+ }
109
+ }
110
+ return null;
111
+ }
112
+
113
+ private async void requestClientSetting()
114
+ {
115
+ // 使用 httpclient 请求 /sdk-core/v1/gatekeeper 获取配置
116
+ HttpClientConfig config = new HttpClientConfig(Constants.TAPSDK_HOST, null, true);
117
+ var httpClient = new HttpClient(config);
118
+ #if UNITY_EDITOR
119
+ var bundleIdentifier = PlayerSettings.applicationIdentifier;
120
+ #else
121
+ var bundleIdentifier = Application.identifier;
122
+ #endif
123
+ var path = $"sdk-core/v1/gatekeeper?client_id={coreOptions.clientId}";
124
+ var body = new Dictionary<string, object> {
125
+ { "platform", "pc" },
126
+ { "bundle_id", bundleIdentifier }
127
+ };
128
+ var response = await httpClient.Post(path, body, headers: NetUtils.commonHeaders);
129
+ if (response != null)
130
+ {
131
+ var responseJson = Json.Deserialize(response) as Dictionary<string, object>;
132
+ if (responseJson != null)
133
+ {
134
+ /**
135
+ * {
136
+ * "data": {
137
+ * "check": {},
138
+ * "switch": {
139
+ * "auto_event": true,
140
+ * "heartbeat": true
141
+ * },
142
+ * "urls": {
143
+ * "achievement_my_list_url": {
144
+ * "webview": "https://tapsdk.xdrnd.cn/achievement/me?client_id=rfciqabirt4vqav7io",
145
+ * "browser": "https://www.xdrnd.cn/app/70253/achievement/6"
146
+ * }
147
+ * },
148
+ * "webview": {
149
+ * "js_bridge": {
150
+ * "host_allowlist": [
151
+ * "tapsdk.xdrnd.cn"
152
+ * ]
153
+ * }
154
+ * }
155
+ * },
156
+ * "now": 1719972670,
157
+ * "success": true
158
+ * }
159
+ */
160
+ var isSuccess = (bool)responseJson["success"];
161
+ if (isSuccess)
162
+ {
163
+ var data = responseJson["data"] as Dictionary<string, object>;
164
+ SetAutoEvent(data);
165
+ gatekeeperData = data;
166
+ // 把 data 存储在本地
167
+ saveClientSettings(data);
168
+ // 发通知
169
+ EventManager.TriggerEvent(Constants.ClientSettingsEventKey, data);
170
+ }
171
+ }
172
+ }
173
+ }
174
+
175
+ private void saveClientSettings(Dictionary<string, object> settings)
176
+ {
177
+ string json = Json.Serialize(settings);
178
+ Debug.Log("saveClientSettings: " + json);
179
+ File.WriteAllText(Path.Combine(Application.persistentDataPath, Constants.ClientSettingsFileName), json);
180
+ }
181
+
182
+ private void SetAutoEvent(Dictionary<string, object> data)
183
+ {
184
+ if (data != null)
185
+ {
186
+ var switchData = data["switch"] as Dictionary<string, object>;
187
+ enableAutoEvent = (bool)switchData["auto_event"];
188
+ }
189
+ Debug.Log("SetAutoEvent enableAutoEvent is: " + enableAutoEvent);
190
+ }
191
+ }
192
+
193
+ public interface IOpenIDProvider
194
+ {
195
+ string GetOpenID();
196
+ }
197
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: e53020dc505c04b53a9fe5365cae8114
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,281 @@
1
+ using System;
2
+ using TapSDK.Core.Internal;
3
+ using TapSDK.Core.Standalone.Internal;
4
+ using System.Collections.Generic;
5
+ using System.Text.RegularExpressions;
6
+ using UnityEngine;
7
+
8
+ namespace TapSDK.Core.Standalone
9
+ {
10
+ /// <summary>
11
+ /// Represents the standalone implementation of the Tap event.
12
+ /// </summary>
13
+ public class TapEventStandalone : ITapEventPlatform
14
+ {
15
+ private readonly Tracker Tracker = TapCoreStandalone.Tracker;
16
+ private readonly User User = TapCoreStandalone.User;
17
+
18
+ /// <summary>
19
+ /// Sets the user ID for tracking events.
20
+ /// </summary>
21
+ /// <param name="userID">The user ID to set.</param>
22
+ public void SetUserID(string userID)
23
+ {
24
+ SetUserID(userID, null);
25
+ }
26
+
27
+ /// <summary>
28
+ /// Sets the user ID and additional properties for tracking events.
29
+ /// </summary>
30
+ /// <param name="userID">The user ID to set.</param>
31
+ /// <param name="properties">Additional properties to associate with the user.</param>
32
+ public void SetUserID(string userID, string properties)
33
+ {
34
+ if (!IsValidUserID(userID))
35
+ {
36
+ TapLogger.Error("Invalid user ID, length should be 1-160 and only contains a-zA-Z0-9_+/=.,:");
37
+ return;
38
+ }
39
+
40
+ Dictionary<string, object> prop = Json.Deserialize(properties) as Dictionary<string, object>;
41
+ User.Login(userID, filterProperties(prop));
42
+ }
43
+
44
+ /// <summary>
45
+ /// Clears the current user.
46
+ /// </summary>
47
+ public void ClearUser()
48
+ {
49
+ User.Logout();
50
+ }
51
+
52
+ /// <summary>
53
+ /// Gets the device ID.
54
+ /// </summary>
55
+ /// <returns>The device ID.</returns>
56
+ public string GetDeviceId()
57
+ {
58
+ return Identity.DeviceId;
59
+ }
60
+
61
+ /// <summary>
62
+ /// Logs an event with the specified name and properties.
63
+ /// </summary>
64
+ /// <param name="name">The name of the event.</param>
65
+ /// <param name="properties">Additional properties to associate with the event.</param>
66
+ public void LogEvent(string name, string properties)
67
+ {
68
+ // name 长度256非空,不符合的丢事件,打log
69
+ if (!checkLength(name)) {
70
+ Debug.LogError(name + " Event name length should be less than or equal to 256 characters.");
71
+ return;
72
+ }
73
+ Dictionary<string, object> prop = Json.Deserialize(properties) as Dictionary<string, object>;
74
+ Tracker.TrackEvent(name, filterProperties(prop));
75
+ }
76
+
77
+ /// <summary>
78
+ /// Tracks device initialization with the specified properties.
79
+ /// </summary>
80
+ /// <param name="properties">Additional properties to associate with the device initialization.</param>
81
+ public void DeviceInitialize(string properties)
82
+ {
83
+ Dictionary<string, object> prop = Json.Deserialize(properties) as Dictionary<string, object>;
84
+ Tracker.TrackDeviceProperties(Constants.PROPERTY_INITIALIZE_TYPE, filterProperties(prop));
85
+ }
86
+
87
+ /// <summary>
88
+ /// Tracks device update with the specified properties.
89
+ /// </summary>
90
+ /// <param name="properties">Additional properties to associate with the device update.</param>
91
+ public void DeviceUpdate(string properties)
92
+ {
93
+ Dictionary<string, object> prop = Json.Deserialize(properties) as Dictionary<string, object>;
94
+ Tracker.TrackDeviceProperties(Constants.PROPERTY_UPDATE_TYPE, filterProperties(prop));
95
+ }
96
+
97
+ /// <summary>
98
+ /// Tracks device addition with the specified properties.
99
+ /// </summary>
100
+ /// <param name="properties">Additional properties to associate with the device addition.</param>
101
+ public void DeviceAdd(string properties)
102
+ {
103
+ Dictionary<string, object> prop = Json.Deserialize(properties) as Dictionary<string, object>;
104
+ Tracker.TrackDeviceProperties(Constants.PROPERTY_ADD_TYPE, filterProperties(prop));
105
+ }
106
+
107
+ /// <summary>
108
+ /// Tracks user initialization with the specified properties.
109
+ /// </summary>
110
+ /// <param name="properties">Additional properties to associate with the user initialization.</param>
111
+ public void UserInitialize(string properties)
112
+ {
113
+ Dictionary<string, object> prop = Json.Deserialize(properties) as Dictionary<string, object>;
114
+ Tracker.TrackUserProperties(Constants.PROPERTY_INITIALIZE_TYPE, filterProperties(prop));
115
+ }
116
+
117
+ /// <summary>
118
+ /// Tracks user update with the specified properties.
119
+ /// </summary>
120
+ /// <param name="properties">Additional properties to associate with the user update.</param>
121
+ public void UserUpdate(string properties)
122
+ {
123
+ Dictionary<string, object> prop = Json.Deserialize(properties) as Dictionary<string, object>;
124
+ Tracker.TrackUserProperties(Constants.PROPERTY_UPDATE_TYPE, filterProperties(prop));
125
+ }
126
+
127
+ /// <summary>
128
+ /// Tracks user addition with the specified properties.
129
+ /// </summary>
130
+ /// <param name="properties">Additional properties to associate with the user addition.</param>
131
+ public void UserAdd(string properties)
132
+ {
133
+ Dictionary<string, object> prop = Json.Deserialize(properties) as Dictionary<string, object>;
134
+ Tracker.TrackUserProperties(Constants.PROPERTY_ADD_TYPE, filterProperties(prop));
135
+ }
136
+
137
+ /// <summary>
138
+ /// Adds a common property with the specified key and value.
139
+ /// </summary>
140
+ /// <param name="key">The key of the common property.</param>
141
+ /// <param name="value">The value of the common property.</param>
142
+ public void AddCommonProperty(string key, string value)
143
+ {
144
+ if (!checkLength(key)){
145
+ Debug.LogError(key + " Property key length should be less than or equal to 256 characters.");
146
+ return;
147
+ }
148
+ if (!checkLength(value)){
149
+ Debug.LogError(value + " Property value length should be less than or equal to 256 characters.");
150
+ return;
151
+ }
152
+ Tracker.AddCommonProperty(key, value);
153
+ }
154
+
155
+ /// <summary>
156
+ /// Adds common properties with the specified JSON string.
157
+ /// </summary>
158
+ /// <param name="properties">The JSON string containing the common properties.</param>
159
+ public void AddCommon(string properties)
160
+ {
161
+ Dictionary<string, object> prop = Json.Deserialize(properties) as Dictionary<string, object>;
162
+ Tracker.AddCommon(filterProperties(prop));
163
+ }
164
+
165
+ /// <summary>
166
+ /// Clears the common property with the specified key.
167
+ /// </summary>
168
+ /// <param name="key">The key of the common property to clear.</param>
169
+ public void ClearCommonProperty(string key)
170
+ {
171
+ Tracker.ClearCommonProperty(key);
172
+ }
173
+
174
+ /// <summary>
175
+ /// Clears the common properties with the specified keys.
176
+ /// </summary>
177
+ /// <param name="keys">The keys of the common properties to clear.</param>
178
+ public void ClearCommonProperties(string[] keys)
179
+ {
180
+ Tracker.ClearCommonProperties(keys);
181
+ }
182
+
183
+ /// <summary>
184
+ /// Clears all common properties.
185
+ /// </summary>
186
+ public void ClearAllCommonProperties()
187
+ {
188
+ Tracker.ClearAllCommonProperties();
189
+ }
190
+
191
+ /// <summary>
192
+ /// Logs a charge event with the specified details and properties.
193
+ /// </summary>
194
+ /// <param name="orderID">The ID of the order.</param>
195
+ /// <param name="productName">The name of the product.</param>
196
+ /// <param name="amount">The amount of the charge.</param>
197
+ /// <param name="currencyType">The currency type of the charge.</param>
198
+ /// <param name="paymentMethod">The payment method used for the charge.</param>
199
+ /// <param name="properties">Additional properties to associate with the charge event.</param>
200
+ public void LogChargeEvent(string orderID, string productName, long amount, string currencyType, string paymentMethod, string properties)
201
+ {
202
+ if (amount <= 0 || amount > 100000000000) {
203
+ UnityEngine.Debug.LogError(amount + " is invalid, amount should be in range (0, 100000000000]");
204
+ return;
205
+ }
206
+ Tracker.LogPurchasedEvent(orderID, productName, amount, currencyType, paymentMethod, properties);
207
+ }
208
+
209
+ /// <summary>
210
+ /// Registers a callback function for retrieving dynamic properties.
211
+ /// </summary>
212
+ /// <param name="callback">The callback function that returns a JSON string containing the dynamic properties.</param>
213
+ public void RegisterDynamicProperties(Func<string> callback)
214
+ {
215
+ DynamicProperties dynamicProperties = new DynamicProperties(callback);
216
+ Tracker.RegisterDynamicPropsDelegate(dynamicProperties);
217
+ }
218
+
219
+ /// <summary>
220
+ /// Represents the implementation of dynamic properties for the Tap event platform.
221
+ /// </summary>
222
+ public class DynamicProperties : Tracker.IDynamicProperties
223
+ {
224
+ readonly Func<string> callback;
225
+
226
+ /// <summary>
227
+ /// Initializes a new instance of the <see cref="DynamicProperties"/> class with the specified callback function.
228
+ /// </summary>
229
+ /// <param name="callback">The callback function that returns a JSON string containing the dynamic properties.</param>
230
+ public DynamicProperties(Func<string> callback)
231
+ {
232
+ this.callback = callback;
233
+ }
234
+
235
+ /// <summary>
236
+ /// Gets the dynamic properties.
237
+ /// </summary>
238
+ /// <returns>A dictionary containing the dynamic properties.</returns>
239
+ public Dictionary<string, object> GetDynamicProperties()
240
+ {
241
+ var jsonString = callback();
242
+ return Json.Deserialize(jsonString) as Dictionary<string, object>;
243
+ }
244
+ }
245
+
246
+ private bool checkLength(string value){
247
+ var maxLength = 256;
248
+ if (value.Length <= 0 || value.Length > maxLength){
249
+ return false;
250
+ }
251
+ return true;
252
+ }
253
+
254
+ private bool IsValidUserID(string userID)
255
+ {
256
+ string pattern = @"^[a-zA-Z0-9_+/=.,:]{1,160}$";
257
+ Regex regex = new Regex(pattern);
258
+ return regex.IsMatch(userID);
259
+ }
260
+
261
+ private Dictionary<string, object> filterProperties(Dictionary<string, object> properties)
262
+ {
263
+ Dictionary<string, object> filteredProperties = new Dictionary<string, object>();
264
+ foreach (var property in properties)
265
+ {
266
+ if (property.Key.Length <= 0 || property.Key.Length > 256)
267
+ {
268
+ Debug.Log(property.Key + " Property key length should be more then 0 and less than or equal to 256 characters.");
269
+ continue;
270
+ }
271
+ if (property.Value.ToString().Length > 256)
272
+ {
273
+ Debug.Log(property.Value + " Property value length should be less than or equal to 256 characters.");
274
+ continue;
275
+ }
276
+ filteredProperties.Add(property.Key, property.Value);
277
+ }
278
+ return filteredProperties;
279
+ }
280
+ }
281
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c6287ed7f2e5a41e69024cb87cef792c
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,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 75cc82e9a12884d5c9ac299e6695f804
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "TapSDK.Core.Standalone.Runtime",
3
+ "references": [
4
+ "GUID:7d5ef2062f3704e1ab74aac0e4d5a1a7"
5
+ ],
6
+ "includePlatforms": [
7
+ "Editor",
8
+ "LinuxStandalone64",
9
+ "macOSStandalone",
10
+ "WindowsStandalone32",
11
+ "WindowsStandalone64"
12
+ ],
13
+ "excludePlatforms": [],
14
+ "allowUnsafeCode": false,
15
+ "overrideReferences": false,
16
+ "precompiledReferences": [],
17
+ "autoReferenced": true,
18
+ "defineConstraints": [],
19
+ "versionDefines": [],
20
+ "noEngineReferences": false
21
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: cdf1346592073467a860c3effd9679d4
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 8f9383e2313414222b398988ccddf3fb
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 21630d052faa249cfa7be42de75e1fee
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/package.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "com.taptap.sdk.core",
3
+ "displayName": "TapTapSDK Core",
4
+ "description": "TapTap Develop Service",
5
+ "version": "4.3.0-aplha.5",
6
+ "unity": "2019.4",
7
+ "license": "MIT"
8
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 9b6954ad3044f4d79b276bb75392e04a
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant: