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

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,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 753f42bc9ae8a4035ae94f4733957527
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: 02106d3e1676c4ae283349aad59eaf9d
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,385 @@
1
+ using System;
2
+ using System.Collections;
3
+ using UnityEngine;
4
+ using UnityEngine.UI;
5
+
6
+ namespace TapSDK.UI
7
+ {
8
+ /// <summary>
9
+ /// base panel of TapSDK UI module
10
+ /// </summary>
11
+ [RequireComponent(typeof(CanvasGroup))]
12
+ [RequireComponent(typeof(GraphicRaycaster))]
13
+ public abstract class BasePanelController : MonoBehaviour
14
+ {
15
+ protected virtual float GetToastSlideInOffset() => 300;
16
+ /// <summary>
17
+ /// the canvas related to this panel
18
+ /// </summary>
19
+ [HideInInspector]
20
+ public Canvas canvas;
21
+
22
+ /// <summary>
23
+ /// the canvas group related to this panel
24
+ /// </summary>
25
+ [HideInInspector]
26
+ public CanvasGroup canvasGroup;
27
+
28
+ /// <summary>
29
+ /// fade in/out time
30
+ /// </summary>
31
+ protected float fadeAnimationTime = 0.15f;
32
+
33
+ /// <summary>
34
+ /// animation elapse time
35
+ /// </summary>
36
+ private float _animationElapse;
37
+
38
+ private Vector2 _screenSize;
39
+ private Vector2 _cachedAnchorPos;
40
+
41
+ private RectTransform _rectTransform;
42
+
43
+ private Coroutine _animationCoroutine;
44
+
45
+ /// <summary>
46
+ /// open parameter
47
+ /// </summary>
48
+ protected internal AbstractOpenPanelParameter openParam;
49
+
50
+ /// <summary>
51
+ /// settings about this panel
52
+ /// </summary>
53
+ public BasePanelConfig panelConfig;
54
+
55
+ /// <summary>
56
+ /// 特殊面板需要一直保持置顶的,需要填写 toppedOrder, toppedOrder 越大越置顶
57
+ /// </summary>
58
+ public int toppedOrder;
59
+
60
+ /// <summary>
61
+ /// the transform parent when created it would be attached to
62
+ /// </summary>
63
+ /// <value></value>
64
+ public virtual Transform AttachedParent => UIManager.Instance.GetUIRootTransform(this);
65
+
66
+ #region Load
67
+ protected virtual void Awake()
68
+ {
69
+ canvas = GetComponent<Canvas>();
70
+ canvasGroup = GetComponent<CanvasGroup>();
71
+ _rectTransform = transform as RectTransform;
72
+
73
+ _screenSize = new Vector2(Screen.width, Screen.height);
74
+
75
+ #if UNITY_EDITOR
76
+ if (canvas == null)
77
+ {
78
+ Debug.LogErrorFormat("[TapSDK UI] BasePanel Must Be Related To Canvas Component!");
79
+ }
80
+ #endif
81
+ }
82
+
83
+ /// <summary>
84
+ /// bind ugui components for every panel
85
+ /// </summary>
86
+ protected virtual void BindComponents() {}
87
+
88
+ /// <summary>
89
+ /// create the prefab instance
90
+ /// </summary>
91
+ /// <param name="param"></param>
92
+ public void OnLoaded(AbstractOpenPanelParameter param = null)
93
+ {
94
+ openParam = param;
95
+ // 寻找组件
96
+ BindComponents();
97
+
98
+ // 添加到控制层
99
+ UIManager.Instance.AddUI(this);
100
+
101
+ // 更新层级信息
102
+ InitCanvasSetting();
103
+ // 开始动画效果
104
+ OnShowEffectStart();
105
+
106
+ // 调用加载成功方法
107
+ OnLoadSuccess();
108
+ }
109
+
110
+ private void InitCanvasSetting()
111
+ {
112
+ if (canvas.renderMode != RenderMode.ScreenSpaceOverlay)
113
+ {
114
+ var camera = UIManager.Instance.GetUICamera();
115
+ if (camera != null)
116
+ {
117
+ canvas.worldCamera = camera;
118
+ }
119
+ }
120
+
121
+ canvas.pixelPerfect = true;
122
+ // canvas.overrideSorting = true;
123
+ }
124
+
125
+ /// <summary>
126
+ /// init panel logic here
127
+ /// </summary>
128
+ protected virtual void OnLoadSuccess()
129
+ {
130
+
131
+ }
132
+
133
+ #endregion
134
+
135
+ #region Animation
136
+
137
+ protected virtual void OnShowEffectStart()
138
+ {
139
+ if (panelConfig.animationType == EAnimationMode.None)
140
+ {
141
+ return;
142
+ }
143
+
144
+ if ((panelConfig.animationType & EAnimationMode.Alpha) == EAnimationMode.Alpha)
145
+ {
146
+ canvasGroup.alpha = 0;
147
+ }
148
+
149
+ if ((panelConfig.animationType & EAnimationMode.Scale) == EAnimationMode.Scale)
150
+ {
151
+ transform.localScale = Vector3.zero;
152
+ }
153
+ if ((panelConfig.animationType & EAnimationMode.RightSlideIn) == EAnimationMode.RightSlideIn)
154
+ {
155
+ _cachedAnchorPos = _rectTransform.anchoredPosition;
156
+ _rectTransform.anchoredPosition += new Vector2(_screenSize.x, 0);
157
+ }
158
+
159
+ if ((panelConfig.animationType & EAnimationMode.UpSlideIn) == EAnimationMode.UpSlideIn) {
160
+ _cachedAnchorPos = _rectTransform.anchoredPosition;
161
+ _rectTransform.anchoredPosition += new Vector2(0, _screenSize.y);
162
+ }
163
+
164
+ if ((panelConfig.animationType & EAnimationMode.ToastSlideIn) == EAnimationMode.ToastSlideIn) {
165
+ _cachedAnchorPos = _rectTransform.anchoredPosition;
166
+ _rectTransform.anchoredPosition += new Vector2(0, GetToastSlideInOffset());
167
+ }
168
+ OnEffectStart();
169
+ _animationCoroutine = StartCoroutine(FadeInCoroutine(fadeAnimationTime));
170
+ }
171
+
172
+ protected virtual void OnShowEffectEnd()
173
+ {
174
+ OnEffectEnd();
175
+ }
176
+
177
+ protected virtual void OnCloseEffectStart()
178
+ {
179
+ OnEffectStart();
180
+
181
+ if ((panelConfig.animationType & EAnimationMode.Alpha) == EAnimationMode.Alpha)
182
+ {
183
+ canvasGroup.alpha = 1;
184
+ }
185
+ if ((panelConfig.animationType & EAnimationMode.Scale) == EAnimationMode.Scale)
186
+ {
187
+ transform.localScale = Vector3.one;
188
+ }
189
+ if ((panelConfig.animationType & EAnimationMode.RightSlideIn) == EAnimationMode.RightSlideIn)
190
+ {
191
+ _rectTransform.anchoredPosition = _cachedAnchorPos;
192
+ }
193
+ if ((panelConfig.animationType & EAnimationMode.UpSlideIn) == EAnimationMode.UpSlideIn)
194
+ {
195
+ _rectTransform.anchoredPosition = _cachedAnchorPos;
196
+ }
197
+ if ((panelConfig.animationType & EAnimationMode.ToastSlideIn) == EAnimationMode.ToastSlideIn)
198
+ {
199
+ _rectTransform.anchoredPosition = _cachedAnchorPos;
200
+ }
201
+ _animationCoroutine = StartCoroutine(FadeOutCoroutine(fadeAnimationTime));
202
+ }
203
+
204
+ protected virtual void OnCloseEffectEnd()
205
+ {
206
+ OnEffectEnd();
207
+ GameObject.Destroy(gameObject);
208
+ }
209
+
210
+ private void OnEffectStart()
211
+ {
212
+ _animationElapse = 0;
213
+ if (_animationCoroutine != null)
214
+ {
215
+ StopCoroutine(_animationCoroutine);
216
+ _animationCoroutine = null;
217
+ }
218
+ canvasGroup.interactable = false;
219
+ }
220
+
221
+ private void OnEffectEnd()
222
+ {
223
+ canvasGroup.interactable = true;
224
+ _animationElapse = 0;
225
+ _animationCoroutine = null;
226
+ }
227
+
228
+ private IEnumerator FadeInCoroutine(float time)
229
+ {
230
+ while (_animationElapse < time)
231
+ {
232
+ yield return null;
233
+ _animationElapse += Time.deltaTime;
234
+ float value = Mathf.Clamp01(_animationElapse / time);
235
+
236
+ if ((panelConfig.animationType & EAnimationMode.Alpha) == EAnimationMode.Alpha)
237
+ {
238
+ canvasGroup.alpha = value;
239
+ }
240
+ if ((panelConfig.animationType & EAnimationMode.Scale) == EAnimationMode.Scale)
241
+ {
242
+ transform.localScale = new Vector3(value, value, value);
243
+ }
244
+ if ((panelConfig.animationType & EAnimationMode.RightSlideIn) == EAnimationMode.RightSlideIn)
245
+ {
246
+ var temp = (1 - value) * _screenSize.x;
247
+ _rectTransform.anchoredPosition = new Vector2(_cachedAnchorPos.x + temp, _cachedAnchorPos.y);
248
+ }
249
+ if ((panelConfig.animationType & EAnimationMode.UpSlideIn) == EAnimationMode.UpSlideIn)
250
+ {
251
+ var temp = (1 - value) * _screenSize.y;
252
+ _rectTransform.anchoredPosition = new Vector2(_cachedAnchorPos.x, _cachedAnchorPos.y + + temp);
253
+ }
254
+ if ((panelConfig.animationType & EAnimationMode.ToastSlideIn) == EAnimationMode.ToastSlideIn)
255
+ {
256
+ var temp = (1 - value) * GetToastSlideInOffset();
257
+ _rectTransform.anchoredPosition = new Vector2(_cachedAnchorPos.x, _cachedAnchorPos.y + + temp);
258
+ }
259
+ }
260
+
261
+ if ((panelConfig.animationType & EAnimationMode.Alpha) == EAnimationMode.Alpha)
262
+ {
263
+ canvasGroup.alpha = 1;
264
+ }
265
+ if ((panelConfig.animationType & EAnimationMode.Scale) == EAnimationMode.Scale)
266
+ {
267
+ transform.localScale = Vector3.one;
268
+ }
269
+ if ((panelConfig.animationType & EAnimationMode.RightSlideIn) == EAnimationMode.RightSlideIn)
270
+ {
271
+ _rectTransform.anchoredPosition = _cachedAnchorPos;
272
+ }
273
+ if ((panelConfig.animationType & EAnimationMode.UpSlideIn) == EAnimationMode.UpSlideIn)
274
+ {
275
+ _rectTransform.anchoredPosition = _cachedAnchorPos;
276
+ }
277
+ if ((panelConfig.animationType & EAnimationMode.ToastSlideIn) == EAnimationMode.ToastSlideIn)
278
+ {
279
+ _rectTransform.anchoredPosition = _cachedAnchorPos;
280
+ }
281
+
282
+ OnShowEffectEnd();
283
+ }
284
+
285
+ private IEnumerator FadeOutCoroutine(float time)
286
+ {
287
+ while (_animationElapse < time)
288
+ {
289
+ yield return null;
290
+ _animationElapse += Time.deltaTime;
291
+ float value = 1 - Mathf.Clamp01(_animationElapse / time);
292
+
293
+ if ((panelConfig.animationType & EAnimationMode.Alpha) == EAnimationMode.Alpha)
294
+ {
295
+ canvasGroup.alpha = value;
296
+ }
297
+ if ((panelConfig.animationType & EAnimationMode.Scale) == EAnimationMode.Scale)
298
+ {
299
+ transform.localScale = new Vector3(value, value, value);
300
+ }
301
+ if ((panelConfig.animationType & EAnimationMode.RightSlideIn) == EAnimationMode.RightSlideIn)
302
+ {
303
+ var temp = (1 - value) * _screenSize.x;
304
+ _rectTransform.anchoredPosition = new Vector2(_cachedAnchorPos.x + temp, _cachedAnchorPos.y);
305
+ }
306
+ if ((panelConfig.animationType & EAnimationMode.UpSlideIn) == EAnimationMode.UpSlideIn)
307
+ {
308
+ var temp = (1 - value) * _screenSize.y;
309
+ _rectTransform.anchoredPosition = new Vector2(_cachedAnchorPos.x, _cachedAnchorPos.y + temp);
310
+ }
311
+ if ((panelConfig.animationType & EAnimationMode.ToastSlideIn) == EAnimationMode.ToastSlideIn)
312
+ {
313
+ var temp = (1 - value) * GetToastSlideInOffset();
314
+ _rectTransform.anchoredPosition = new Vector2(_cachedAnchorPos.x, _cachedAnchorPos.y + temp);
315
+ }
316
+ }
317
+
318
+ if ((panelConfig.animationType & EAnimationMode.Alpha) == EAnimationMode.Alpha)
319
+ {
320
+ canvasGroup.alpha = 0;
321
+ }
322
+ if ((panelConfig.animationType & EAnimationMode.Scale) == EAnimationMode.Scale)
323
+ {
324
+ transform.localScale = Vector3.zero;
325
+ }
326
+ if ((panelConfig.animationType & EAnimationMode.RightSlideIn) == EAnimationMode.RightSlideIn)
327
+ {
328
+ _rectTransform.anchoredPosition = new Vector2(_cachedAnchorPos.x + _screenSize.x, _cachedAnchorPos.y);
329
+ }
330
+ if ((panelConfig.animationType & EAnimationMode.UpSlideIn) == EAnimationMode.UpSlideIn)
331
+ {
332
+ _rectTransform.anchoredPosition = new Vector2(_cachedAnchorPos.x, _cachedAnchorPos.y + _screenSize.y);
333
+ }
334
+ if ((panelConfig.animationType & EAnimationMode.ToastSlideIn) == EAnimationMode.ToastSlideIn)
335
+ {
336
+ _rectTransform.anchoredPosition = new Vector2(_cachedAnchorPos.x, _cachedAnchorPos.y + GetToastSlideInOffset());
337
+ }
338
+
339
+ OnCloseEffectEnd();
340
+ }
341
+
342
+ #endregion
343
+
344
+
345
+ /// <summary>
346
+ /// on receive resolution change event
347
+ /// </summary>
348
+ /// <param name="res"></param>
349
+ protected virtual void UIAdapt(Vector2Int res) {}
350
+
351
+ /// <summary>
352
+ /// common close api
353
+ /// </summary>
354
+ public virtual void Close()
355
+ {
356
+ UIManager.Instance.RemoveUI(this);
357
+ }
358
+
359
+ /// <summary>
360
+ /// set canvas sorting order
361
+ /// </summary>
362
+ /// <param name="openOrder"></param>
363
+ public void SetOpenOrder(int openOrder)
364
+ {
365
+ if (canvas != null)
366
+ {
367
+ canvas.sortingOrder = openOrder;
368
+ }
369
+ }
370
+
371
+ /// <summary>
372
+ /// also would destroy panel gameObject
373
+ /// </summary>
374
+ public virtual void Dispose()
375
+ {
376
+ if (panelConfig.animationType == EAnimationMode.None)
377
+ {
378
+ GameObject.Destroy(gameObject);
379
+ return;
380
+ }
381
+
382
+ OnCloseEffectStart();
383
+ }
384
+ }
385
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 607d7f7e1e2a44319bfc7d85788fd805
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: 930467091d41f45c09b2d67e0a3ced30
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,18 @@
1
+ using UnityEngine;
2
+
3
+ namespace TapSDK.UI
4
+ {
5
+ [System.Serializable]
6
+ public struct BasePanelConfig
7
+ {
8
+ /// <summary>
9
+ /// animation effect related to opening and closing
10
+ /// </summary>
11
+ public EAnimationMode animationType;
12
+
13
+ public BasePanelConfig(EAnimationMode animationMode = EAnimationMode.None)
14
+ {
15
+ animationType = animationMode;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 35a0b66e8719e4104bf30ae06108d41a
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,7 @@
1
+ namespace TapSDK.UI
2
+ {
3
+ public abstract class AbstractOpenPanelParameter
4
+ {
5
+ public virtual bool NeedConstantResolution => false;
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a5b19f6b895fa4059a0e3b7aaf9581c0
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: 00f81d135c9e44ec4b4a064781b1bcd0
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,76 @@
1
+ // -----------------------------------------------------------------------
2
+ // <copyright file="SimpleObjPool.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 System.Collections.Generic;
11
+
12
+ public class SimpleObjPool<T>
13
+ {
14
+ private readonly Stack<T> stack;
15
+ private readonly Func<T> ctor;
16
+ private readonly Action<T> onRecycle;
17
+ private int size;
18
+ private int usedCount;
19
+
20
+ public SimpleObjPool(int max = 7, Action<T> onRecycle = null, Func<T> ctor = null)
21
+ {
22
+ this.stack = new Stack<T>(max);
23
+ this.size = max;
24
+ this.onRecycle = onRecycle;
25
+ this.ctor = ctor;
26
+ }
27
+
28
+ public T Get()
29
+ {
30
+ T item;
31
+ if (this.stack.Count == 0)
32
+ {
33
+ if (this.ctor != null)
34
+ {
35
+ item = this.ctor();
36
+ }
37
+ else
38
+ {
39
+ item = Activator.CreateInstance<T>();
40
+ }
41
+ }
42
+ else
43
+ {
44
+ item = this.stack.Pop();
45
+ }
46
+
47
+ this.usedCount++;
48
+ return item;
49
+ }
50
+
51
+ public void Recycle(T item)
52
+ {
53
+ if (this.onRecycle != null)
54
+ {
55
+ this.onRecycle.Invoke(item);
56
+ }
57
+
58
+ if (this.stack.Count < this.size)
59
+ {
60
+ this.stack.Push(item);
61
+ }
62
+
63
+ this.usedCount--;
64
+ }
65
+
66
+ public void Purge()
67
+ {
68
+ // TODO
69
+ }
70
+
71
+ public override string ToString()
72
+ {
73
+ return $"SimpleObjPool: item=[{typeof(T)}], inUse=[{this.usedCount}], restInPool=[{this.stack.Count}/{this.size}] ";
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,12 @@
1
+ fileFormatVersion: 2
2
+ guid: 88625144948bd48d296916f8b0e9b41a
3
+ timeCreated: 1533284979
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: 765cb640e73334f7a9ccc676064c70be
3
+ folderAsset: yes
4
+ timeCreated: 1533284978
5
+ licenseType: Free
6
+ DefaultImporter:
7
+ userData:
8
+ assetBundleName:
9
+ assetBundleVariant: