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,12 @@
1
+ fileFormatVersion: 2
2
+ guid: bac7eb1be8f6f40459d388c929d1946f
3
+ timeCreated: 1533042733
4
+ licenseType: Free
5
+ MonoImporter:
6
+ serializedVersion: 2
7
+ defaultReferences: []
8
+ executionOrder: 0
9
+ icon: {instanceID: 0}
10
+ userData:
11
+ assetBundleName:
12
+ assetBundleVariant:
@@ -0,0 +1,245 @@
1
+ // -----------------------------------------------------------------------
2
+ // <copyright file="ScrollViewEx.cs" company="AillieoTech">
3
+ // Copyright (c) AillieoTech. All rights reserved.
4
+ // </copyright>
5
+ // -----------------------------------------------------------------------
6
+
7
+ namespace TapSDK.UI.AillieoTech
8
+ {
9
+ using System;
10
+ using UnityEngine;
11
+ using UnityEngine.EventSystems;
12
+ using UnityEngine.Serialization;
13
+
14
+ [RequireComponent(typeof(RectTransform))]
15
+ [DisallowMultipleComponent]
16
+ public class ScrollViewEx : ScrollView
17
+ {
18
+ [SerializeField]
19
+ [FormerlySerializedAs("m_pageSize")]
20
+ private int pageSize = 50;
21
+
22
+ private int startOffset = 0;
23
+
24
+ private Func<int> realItemCountFunc;
25
+
26
+ private Vector2 lastPosition;
27
+
28
+ private bool reloadFlag = false;
29
+
30
+ public override void SetUpdateFunc(Action<int, RectTransform> func)
31
+ {
32
+ if (func != null)
33
+ {
34
+ var f = func;
35
+ func = (index, rect) =>
36
+ {
37
+ f(index + this.startOffset, rect);
38
+ };
39
+ }
40
+
41
+ base.SetUpdateFunc(func);
42
+ }
43
+
44
+ public override void SetItemSizeFunc(Func<int, Vector2> func)
45
+ {
46
+ if (func != null)
47
+ {
48
+ var f = func;
49
+ func = (index) =>
50
+ {
51
+ return f(index + this.startOffset);
52
+ };
53
+ }
54
+
55
+ base.SetItemSizeFunc(func);
56
+ }
57
+
58
+ public override void SetItemCountFunc(Func<int> func)
59
+ {
60
+ this.realItemCountFunc = func;
61
+ if (func != null)
62
+ {
63
+ var f = func;
64
+ func = () => Mathf.Min(f(), this.pageSize);
65
+ }
66
+
67
+ base.SetItemCountFunc(func);
68
+ }
69
+
70
+ public override void OnDrag(PointerEventData eventData)
71
+ {
72
+ if (this.reloadFlag)
73
+ {
74
+ this.reloadFlag = false;
75
+ this.OnEndDrag(eventData);
76
+ this.OnBeginDrag(eventData);
77
+
78
+ return;
79
+ }
80
+
81
+ base.OnDrag(eventData);
82
+ }
83
+
84
+ protected override void Awake()
85
+ {
86
+ base.Awake();
87
+
88
+ this.lastPosition = Vector2.up;
89
+ this.onValueChanged.AddListener(this.OnValueChanged);
90
+ }
91
+
92
+ protected override void InternalScrollTo(int index)
93
+ {
94
+ var count = 0;
95
+ if (this.realItemCountFunc != null)
96
+ {
97
+ count = this.realItemCountFunc();
98
+ }
99
+
100
+ index = Mathf.Clamp(index, 0, count - 1);
101
+ this.startOffset = Mathf.Clamp(index - (this.pageSize / 2), 0, count - this.itemCountFunc());
102
+ this.UpdateData(true);
103
+ base.InternalScrollTo(index - this.startOffset);
104
+ }
105
+
106
+ private void OnValueChanged(Vector2 position)
107
+ {
108
+ int toShow;
109
+ int critical;
110
+ bool downward;
111
+ int pin;
112
+
113
+ Vector2 delta = position - this.lastPosition;
114
+ this.lastPosition = position;
115
+
116
+ this.reloadFlag = false;
117
+
118
+ if (((int)this.layoutType & flagScrollDirection) == 1)
119
+ {
120
+ // 垂直滚动 只计算y向
121
+ if (delta.y < 0)
122
+ {
123
+ // 向上
124
+ toShow = this.criticalItemIndex[CriticalItemType.DownToShow];
125
+ critical = this.pageSize - 1;
126
+ if (toShow < critical)
127
+ {
128
+ return;
129
+ }
130
+
131
+ pin = critical - 1;
132
+ downward = false;
133
+ }
134
+ else if (delta.y > 0)
135
+ {
136
+ // 向下
137
+ toShow = this.criticalItemIndex[CriticalItemType.UpToShow];
138
+ critical = 0;
139
+ if (toShow > critical)
140
+ {
141
+ return;
142
+ }
143
+
144
+ pin = critical + 1;
145
+ downward = true;
146
+ }
147
+ else
148
+ {
149
+ return;
150
+ }
151
+ }
152
+ else
153
+ {
154
+ // = 0
155
+ // 水平滚动 只计算x向
156
+ if (delta.x > 0)
157
+ {
158
+ // 向右
159
+ toShow = this.criticalItemIndex[CriticalItemType.UpToShow];
160
+ critical = 0;
161
+ if (toShow > critical)
162
+ {
163
+ return;
164
+ }
165
+
166
+ pin = critical + 1;
167
+ downward = true;
168
+ }
169
+ else if (delta.x < 0)
170
+ {
171
+ // 向左
172
+ toShow = this.criticalItemIndex[CriticalItemType.DownToShow];
173
+ critical = this.pageSize - 1;
174
+ if (toShow < critical)
175
+ {
176
+ return;
177
+ }
178
+
179
+ pin = critical - 1;
180
+ downward = false;
181
+ }
182
+ else
183
+ {
184
+ return;
185
+ }
186
+ }
187
+
188
+ // 该翻页了 翻半页吧
189
+ var old = this.startOffset;
190
+ if (downward)
191
+ {
192
+ this.startOffset -= this.pageSize / 2;
193
+ }
194
+ else
195
+ {
196
+ this.startOffset += this.pageSize / 2;
197
+ }
198
+
199
+ var realDataCount = 0;
200
+ if (this.realItemCountFunc != null)
201
+ {
202
+ realDataCount = this.realItemCountFunc();
203
+ }
204
+
205
+ this.startOffset = Mathf.Clamp(this.startOffset, 0, Mathf.Max(realDataCount - this.pageSize, 0));
206
+
207
+ if (old != this.startOffset)
208
+ {
209
+ this.reloadFlag = true;
210
+
211
+ // 记录 原先的速度
212
+ Vector2 oldVelocity = this.velocity;
213
+
214
+ // 计算 pin元素的世界坐标
215
+ Rect rect = this.GetItemLocalRect(pin);
216
+
217
+ Vector2 oldWorld = this.content.TransformPoint(rect.position);
218
+ var dataCount = 0;
219
+ if (this.itemCountFunc != null)
220
+ {
221
+ dataCount = this.itemCountFunc();
222
+ }
223
+
224
+ if (dataCount > 0)
225
+ {
226
+ this.EnsureItemRect(0);
227
+ if (dataCount > 1)
228
+ {
229
+ this.EnsureItemRect(dataCount - 1);
230
+ }
231
+ }
232
+
233
+ // 根据 pin元素的世界坐标 计算出content的position
234
+ var pin2 = pin + old - this.startOffset;
235
+ Rect rect2 = this.GetItemLocalRect(pin2);
236
+ Vector2 newWorld = this.content.TransformPoint(rect2.position);
237
+ Vector2 deltaWorld = newWorld - oldWorld;
238
+ Vector2 deltaLocal = this.content.InverseTransformVector(deltaWorld);
239
+ this.SetContentAnchoredPosition(this.content.anchoredPosition - deltaLocal);
240
+ this.UpdateData(true);
241
+ this.velocity = oldVelocity;
242
+ }
243
+ }
244
+ }
245
+ }
@@ -0,0 +1,12 @@
1
+ fileFormatVersion: 2
2
+ guid: 17ff80d59e3504ef385ee40177f0b4a4
3
+ timeCreated: 1533042733
4
+ licenseType: Free
5
+ MonoImporter:
6
+ serializedVersion: 2
7
+ defaultReferences: []
8
+ executionOrder: 0
9
+ icon: {instanceID: 0}
10
+ userData:
11
+ assetBundleName:
12
+ assetBundleVariant:
@@ -0,0 +1,9 @@
1
+ fileFormatVersion: 2
2
+ guid: ab23454192f22412c8ae6f7699645396
3
+ folderAsset: yes
4
+ timeCreated: 1533284978
5
+ licenseType: Free
6
+ DefaultImporter:
7
+ userData:
8
+ assetBundleName:
9
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 5124d8bb5646548db8970683b0a33abd
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: dd5e6d0a0a3084dbe9172f6644b9afee
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,29 @@
1
+ using System;
2
+ using System.Linq;
3
+ using UnityEngine;
4
+
5
+ namespace TapSDK.Core.Internal.Utils {
6
+ public static class BridgeUtils {
7
+ public static bool IsSupportMobilePlatform => Application.platform == RuntimePlatform.Android ||
8
+ Application.platform == RuntimePlatform.IPhonePlayer;
9
+
10
+ public static bool IsSupportStandalonePlatform => Application.platform == RuntimePlatform.OSXPlayer ||
11
+ Application.platform == RuntimePlatform.WindowsPlayer ||
12
+ Application.platform == RuntimePlatform.LinuxPlayer;
13
+
14
+ public static object CreateBridgeImplementation(Type interfaceType, string startWith) {
15
+ // 跳过初始化直接使用 TapLoom会在子线程被TapSDK.Core.BridgeCallback.Invoke 初始化
16
+ TapLoom.Initialize();
17
+ Type bridgeImplementationType = AppDomain.CurrentDomain.GetAssemblies()
18
+ .Where(asssembly => asssembly.GetName().FullName.StartsWith(startWith))
19
+ .SelectMany(assembly => assembly.GetTypes())
20
+ .SingleOrDefault(clazz => interfaceType.IsAssignableFrom(clazz) && clazz.IsClass);
21
+ if (bridgeImplementationType == null){
22
+ Debug.LogWarningFormat(
23
+ $"[TapTap] TapSDK Can't find bridge implementation for {interfaceType} on platform {Application.platform}.");
24
+ return null;
25
+ }
26
+ return Activator.CreateInstance(bridgeImplementationType);
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 56e7026e809cb4a4ead9bf6479d212a3
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,147 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Threading.Tasks;
4
+ using System.Security.Cryptography;
5
+ using System.Text;
6
+ using System.IO;
7
+ using UnityEngine;
8
+ using UnityEngine.Networking;
9
+
10
+ namespace TapSDK.Core.Internal.Utils {
11
+ public class ImageUtils {
12
+ private readonly static string CacheDirName = "tap-cache";
13
+
14
+ private readonly static MD5 md5 = MD5.Create();
15
+
16
+ private readonly static Dictionary<string, WeakReference<Texture>> cachedTextures = new Dictionary<string, WeakReference<Texture>>();
17
+
18
+ public static async Task<Texture> LoadImage(string url, int timeout = 30, bool useMemoryCache = true) {
19
+ if (string.IsNullOrEmpty(url)) {
20
+ TapLogger.Warn(string.Format($"ImageUtils Fetch image is null! url is null or empty!"));
21
+ return null;
22
+ }
23
+
24
+ if (cachedTextures.TryGetValue(url, out WeakReference<Texture> refTex) &&
25
+ refTex.TryGetTarget(out Texture tex)) {
26
+ // 从内存加载
27
+ return tex;
28
+ } else {
29
+ try {
30
+ // 从本地缓存加载
31
+ Texture cachedImage = await LoadCachedImaged(url, timeout);
32
+
33
+ if (useMemoryCache) {
34
+ cachedTextures[url] = new WeakReference<Texture>(cachedImage);
35
+ }
36
+
37
+ return cachedImage;
38
+ } catch (Exception e) {
39
+ TapLogger.Warn(e.Message);
40
+ try {
41
+ // 从网络加载
42
+ Texture2D newTex = await FetchImage(url, timeout);
43
+
44
+ if (useMemoryCache) {
45
+ cachedTextures[url] = new WeakReference<Texture>(newTex);
46
+ }
47
+
48
+ // 缓存到本地
49
+ _ = CacheImage(url, newTex);
50
+
51
+ return newTex;
52
+ } catch (Exception ex) {
53
+ TapLogger.Warn(ex.Message);
54
+ return null;
55
+ }
56
+ }
57
+ }
58
+ }
59
+
60
+ public static async Task<Texture2D> FetchImage(string url, int timeout = 30) {
61
+ using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(url)) {
62
+ request.timeout = timeout;
63
+ UnityWebRequestAsyncOperation operation = request.SendWebRequest();
64
+ while (!operation.isDone) {
65
+ await Task.Delay(30);
66
+ }
67
+
68
+ if (request.isNetworkError || request.isHttpError) {
69
+ throw new Exception("Fetch image error.");
70
+ } else {
71
+ Texture2D texture = ((DownloadHandlerTexture)request.downloadHandler)?.texture;
72
+ if (texture == null) {
73
+ TapLogger.Warn($"ImageUtils Fetch image is null! url: {url}");
74
+ }
75
+ return texture;
76
+ }
77
+ }
78
+ }
79
+
80
+ static async Task<Texture> LoadCachedImaged(string url, int timeout = 30) {
81
+ string cachedImagePath = GetCachedPath(url);
82
+ if (!File.Exists(cachedImagePath)) {
83
+ throw new Exception("No cached image.");
84
+ }
85
+ string cachedImageUrl = $"file://{cachedImagePath}";
86
+ using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(cachedImageUrl)) {
87
+ request.timeout = timeout;
88
+ UnityWebRequestAsyncOperation operation = request.SendWebRequest();
89
+ while (!operation.isDone) {
90
+ await Task.Delay(30);
91
+ }
92
+
93
+ if (request.isNetworkError || request.isHttpError) {
94
+ RemoveCachedImage(cachedImagePath);
95
+ throw new Exception("Load cache image error.");
96
+ } else {
97
+ var texture = ((DownloadHandlerTexture)request.downloadHandler)?.texture;
98
+ if (texture == null) {
99
+ RemoveCachedImage(cachedImagePath);
100
+ throw new Exception("Cached image is invalid.");
101
+ }
102
+ return texture;
103
+ }
104
+ }
105
+ }
106
+
107
+ static async Task CacheImage(string url, Texture2D tex) {
108
+ string cacheImagePath = GetCachedPath(url);
109
+ // 写入缓存
110
+ byte[] imageData = tex.EncodeToPNG();
111
+ using (FileStream fileStream = new FileStream(cacheImagePath, FileMode.Create, FileAccess.Write, FileShare.None, bufferSize: 4096, useAsync: true)) {
112
+ await fileStream.WriteAsync(imageData, 0, imageData.Length);
113
+ }
114
+ }
115
+
116
+ static void RemoveCachedImage(string cachedImagePath) {
117
+ try {
118
+ File.Delete(cachedImagePath);
119
+ } finally {
120
+
121
+ }
122
+ }
123
+
124
+ static string ToHex(byte[] bytes) {
125
+ StringBuilder sb = new StringBuilder();
126
+ for (int i = 0; i < bytes.Length; i++) {
127
+ sb.Append(bytes[i].ToString("x2"));
128
+ }
129
+ return sb.ToString();
130
+ }
131
+
132
+ static string GetCachedPath(string url) {
133
+ string cachedHashName = ToHex(md5.ComputeHash(Encoding.UTF8.GetBytes(url)));
134
+ return Path.Combine(CacheDirPath, cachedHashName);
135
+ }
136
+
137
+ static string CacheDirPath {
138
+ get {
139
+ string path = Path.Combine(Application.persistentDataPath, CacheDirName);
140
+ if (!Directory.Exists(path)) {
141
+ Directory.CreateDirectory(path);
142
+ }
143
+ return path;
144
+ }
145
+ }
146
+ }
147
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 82045c1fa54ce4e6ab3e286669044f15
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,155 @@
1
+ using UnityEngine;
2
+ using System.Collections;
3
+ using System.Collections.Generic;
4
+ using System;
5
+ using System.Threading;
6
+ using System.Linq;
7
+
8
+ namespace TapSDK.Core.Internal.Utils
9
+ {
10
+ public class TapLoom : MonoBehaviour
11
+ {
12
+ public static int maxThreads = 8;
13
+ static int numThreads;
14
+
15
+ private static TapLoom _current;
16
+ private int _count;
17
+ public static TapLoom Current
18
+ {
19
+ get
20
+ {
21
+ Initialize();
22
+ return _current;
23
+ }
24
+ }
25
+
26
+ void Awake()
27
+ {
28
+ _current = this;
29
+ initialized = true;
30
+ }
31
+
32
+ static bool initialized;
33
+
34
+ public static void Initialize()
35
+ {
36
+ if (!initialized)
37
+ {
38
+
39
+ if (!Application.isPlaying)
40
+ return;
41
+ initialized = true;
42
+ var g = new GameObject("Loom");
43
+ DontDestroyOnLoad(g);
44
+ _current = g.AddComponent<TapLoom>();
45
+ }
46
+
47
+ }
48
+
49
+ private List<Action> _actions = new List<Action>();
50
+ public struct DelayedQueueItem
51
+ {
52
+ public float time;
53
+ public Action action;
54
+ }
55
+ private List<DelayedQueueItem> _delayed = new List<DelayedQueueItem>();
56
+
57
+ List<DelayedQueueItem> _currentDelayed = new List<DelayedQueueItem>();
58
+
59
+ public static void QueueOnMainThread(Action action)
60
+ {
61
+ QueueOnMainThread(action, 0f);
62
+ }
63
+ public static void QueueOnMainThread(Action action, float time)
64
+ {
65
+ if (time != 0)
66
+ {
67
+ lock (Current._delayed)
68
+ {
69
+ Current._delayed.Add(new DelayedQueueItem { time = Time.time, action = action });
70
+ }
71
+ }
72
+ else
73
+ {
74
+ lock (Current._actions)
75
+ {
76
+ Current._actions.Add(action);
77
+ }
78
+ }
79
+ }
80
+
81
+ public static Thread RunAsync(Action a)
82
+ {
83
+ Initialize();
84
+ while (numThreads >= maxThreads)
85
+ {
86
+ Thread.Sleep(1);
87
+ }
88
+ Interlocked.Increment(ref numThreads);
89
+ ThreadPool.QueueUserWorkItem(RunAction, a);
90
+ return null;
91
+ }
92
+
93
+ private static void RunAction(object action)
94
+ {
95
+ try
96
+ {
97
+ ((Action)action)();
98
+ }
99
+ catch
100
+ {
101
+ }
102
+ finally
103
+ {
104
+ Interlocked.Decrement(ref numThreads);
105
+ }
106
+
107
+ }
108
+
109
+
110
+ void OnDisable()
111
+ {
112
+ if (_current == this)
113
+ {
114
+
115
+ _current = null;
116
+ }
117
+ }
118
+
119
+
120
+
121
+ // Use this for initialization
122
+ void Start()
123
+ {
124
+
125
+ }
126
+
127
+ List<Action> _currentActions = new List<Action>();
128
+
129
+ // Update is called once per frame
130
+ void Update()
131
+ {
132
+ lock (_actions)
133
+ {
134
+ _currentActions.Clear();
135
+ _currentActions.AddRange(_actions);
136
+ _actions.Clear();
137
+ }
138
+ foreach (var a in _currentActions)
139
+ {
140
+ a();
141
+ }
142
+ lock (_delayed)
143
+ {
144
+ _currentDelayed.Clear();
145
+ _currentDelayed.AddRange(_delayed.Where(d => d.time <= Time.time));
146
+ foreach (var item in _currentDelayed)
147
+ _delayed.Remove(item);
148
+ }
149
+ foreach (var delayed in _currentDelayed)
150
+ {
151
+ delayed.action();
152
+ }
153
+ }
154
+ }
155
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 9b2d946237d1b489c8e6f14fd553878e
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: