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.
- package/Editor/BuildTargetUtils.cs +14 -0
- package/Editor/BuildTargetUtils.cs.meta +11 -0
- package/Editor/LinkXMLGenerator.cs +70 -0
- package/Editor/LinkXMLGenerator.cs.meta +11 -0
- package/Editor/Plist.cs +954 -0
- package/Editor/Plist.cs.meta +3 -0
- package/Editor/SDKLinkProcessBuild.cs +119 -0
- package/Editor/SDKLinkProcessBuild.cs.meta +11 -0
- package/Editor/TapFileHelper.cs +168 -0
- package/Editor/TapFileHelper.cs.meta +3 -0
- package/Editor/TapSDK.Core.Editor.asmdef +15 -0
- package/Editor/TapSDK.Core.Editor.asmdef.meta +7 -0
- package/Editor/TapSDKCoreCompile.cs +284 -0
- package/Editor/TapSDKCoreCompile.cs.meta +3 -0
- package/Editor/TapSDKCoreIOSProcessor.cs +74 -0
- package/Editor/TapSDKCoreIOSProcessor.cs.meta +3 -0
- package/Editor/UI/ScrollViewEditor.cs +267 -0
- package/Editor/UI/ScrollViewEditor.cs.meta +12 -0
- package/Editor/UI/ScrollViewExEditor.cs +34 -0
- package/Editor/UI/ScrollViewExEditor.cs.meta +12 -0
- package/Editor/UI/TapSDK.UI.Editor.asmdef +17 -0
- package/Editor/UI/TapSDK.UI.Editor.asmdef.meta +7 -0
- package/Editor/UI.meta +9 -0
- package/Editor.meta +8 -0
- package/Mobile/Editor/NativeDependencies.xml +22 -0
- package/Mobile/Editor/NativeDependencies.xml.meta +7 -0
- package/Mobile/Editor/TapCommonMobileProcessBuild.cs +20 -0
- package/Mobile/Editor/TapCommonMobileProcessBuild.cs.meta +11 -0
- package/Mobile/Editor/TapSDK.Core.Mobile.Editor.asmdef +17 -0
- package/Mobile/Editor/TapSDK.Core.Mobile.Editor.asmdef.meta +7 -0
- package/Mobile/Editor.meta +8 -0
- package/Mobile/Runtime/AndroidNativeWrapper.cs +50 -0
- package/Mobile/Runtime/AndroidNativeWrapper.cs.meta +11 -0
- package/Mobile/Runtime/Bridge.cs +84 -0
- package/Mobile/Runtime/Bridge.cs.meta +11 -0
- package/Mobile/Runtime/BridgeAndroid.cs +73 -0
- package/Mobile/Runtime/BridgeAndroid.cs.meta +11 -0
- package/Mobile/Runtime/BridgeCallback.cs +35 -0
- package/Mobile/Runtime/BridgeCallback.cs.meta +11 -0
- package/Mobile/Runtime/BridgeIOS.cs +113 -0
- package/Mobile/Runtime/BridgeIOS.cs.meta +11 -0
- package/Mobile/Runtime/Command.cs +119 -0
- package/Mobile/Runtime/Command.cs.meta +11 -0
- package/Mobile/Runtime/Constants.cs +9 -0
- package/Mobile/Runtime/Constants.cs.meta +11 -0
- package/Mobile/Runtime/EngineBridgeInitializer.cs +33 -0
- package/Mobile/Runtime/EngineBridgeInitializer.cs.meta +11 -0
- package/Mobile/Runtime/IBridge.cs +15 -0
- package/Mobile/Runtime/IBridge.cs.meta +11 -0
- package/Mobile/Runtime/IOSNativeWrapper.cs +273 -0
- package/Mobile/Runtime/IOSNativeWrapper.cs.meta +11 -0
- package/Mobile/Runtime/Result.cs +37 -0
- package/Mobile/Runtime/Result.cs.meta +11 -0
- package/Mobile/Runtime/TapCoreMobile.cs +71 -0
- package/Mobile/Runtime/TapCoreMobile.cs.meta +11 -0
- package/Mobile/Runtime/TapEventMobile.cs +265 -0
- package/Mobile/Runtime/TapEventMobile.cs.meta +11 -0
- package/Mobile/Runtime/TapSDK.Core.Mobile.Runtime.asmdef +18 -0
- package/Mobile/Runtime/TapSDK.Core.Mobile.Runtime.asmdef.meta +7 -0
- package/Mobile/Runtime/TapUUID.cs +9 -0
- package/Mobile/Runtime/TapUUID.cs.meta +11 -0
- package/Mobile/Runtime.meta +8 -0
- package/Mobile.meta +8 -0
- package/Plugins/iOS.meta +8 -0
- package/Plugins.meta +8 -0
- package/Resources/Fonts/taptap-sdk-bold.ttf +0 -0
- package/Resources/Fonts/taptap-sdk-bold.ttf.meta +22 -0
- package/Resources/Fonts/taptap-sdk.ttf +0 -0
- package/Resources/Fonts/taptap-sdk.ttf.meta +21 -0
- package/Resources/Fonts.meta +8 -0
- package/Resources/Loading.prefab +260 -0
- package/Resources/Loading.prefab.meta +7 -0
- package/Resources/TapCommonTip.prefab +194 -0
- package/Resources/TapCommonTip.prefab.meta +7 -0
- package/Resources/TapCommonToastBlack.prefab +528 -0
- package/Resources/TapCommonToastBlack.prefab.meta +7 -0
- package/Resources/TapCommonToastWhite.prefab +411 -0
- package/Resources/TapCommonToastWhite.prefab.meta +7 -0
- package/Resources/TapSDKCommonTapIcon-v2.png +0 -0
- package/Resources/TapSDKCommonTapIcon-v2.png.meta +128 -0
- package/Resources/TapSDKCommonTapIcon.png +0 -0
- package/Resources/TapSDKCommonTapIcon.png.meta +128 -0
- package/Resources/TapSDKCommonToastBg.png +0 -0
- package/Resources/TapSDKCommonToastBg.png.meta +128 -0
- package/Resources/TapSDKConstantUIRoot.prefab +100 -0
- package/Resources/TapSDKConstantUIRoot.prefab.meta +7 -0
- package/Resources/TapSDKUIRoot.prefab +100 -0
- package/Resources/TapSDKUIRoot.prefab.meta +7 -0
- package/Resources/TapTapBtn_White.png +0 -0
- package/Resources/TapTapBtn_White.png.meta +128 -0
- package/Resources/TapTapBtn_White_2.png +0 -0
- package/Resources/TapTapBtn_White_2.png.meta +128 -0
- package/Resources/ToastBackground.png +0 -0
- package/Resources/ToastBackground.png.meta +128 -0
- package/Resources/detail_bg.png +0 -0
- package/Resources/detail_bg.png.meta +92 -0
- package/Resources/success.png +0 -0
- package/Resources/success.png.meta +128 -0
- package/Resources/taptap-bg.png +0 -0
- package/Resources/taptap-bg.png.meta +140 -0
- package/Resources/taptap-close.png +0 -0
- package/Resources/taptap-close.png.meta +146 -0
- package/Resources/taptap-router-v2.png +0 -0
- package/Resources/taptap-router-v2.png.meta +128 -0
- package/Resources/taptap-router.png +0 -0
- package/Resources/taptap-router.png.meta +146 -0
- package/Resources/taptap-sdk-refresh 1.png +0 -0
- package/Resources/taptap-sdk-refresh 1.png.meta +128 -0
- package/Resources/taptap-toast-error.png +0 -0
- package/Resources/taptap-toast-error.png.meta +128 -0
- package/Resources/taptap-toast-info.png +0 -0
- package/Resources/taptap-toast-info.png.meta +128 -0
- package/Resources/taptap-toast-success.png +0 -0
- package/Resources/taptap-toast-success.png.meta +128 -0
- package/Resources/taptap-toast-warning.png +0 -0
- package/Resources/taptap-toast-warning.png.meta +128 -0
- package/Resources.meta +8 -0
- package/Runtime/Internal/Http/TapHttpClient.cs +176 -0
- package/Runtime/Internal/Http/TapHttpClient.cs.meta +11 -0
- package/Runtime/Internal/Http/TapHttpUtils.cs +83 -0
- package/Runtime/Internal/Http/TapHttpUtils.cs.meta +11 -0
- package/Runtime/Internal/Http.meta +8 -0
- package/Runtime/Internal/Init/IInitTask.cs +18 -0
- package/Runtime/Internal/Init/IInitTask.cs.meta +11 -0
- package/Runtime/Internal/Init.meta +8 -0
- package/Runtime/Internal/Json/TapJsonConverter.cs +40 -0
- package/Runtime/Internal/Json/TapJsonConverter.cs.meta +11 -0
- package/Runtime/Internal/Json.meta +8 -0
- package/Runtime/Internal/Platform/ITapCorePlatform.cs +12 -0
- package/Runtime/Internal/Platform/ITapCorePlatform.cs.meta +11 -0
- package/Runtime/Internal/Platform/ITapEventPlatform.cs +37 -0
- package/Runtime/Internal/Platform/ITapEventPlatform.cs.meta +11 -0
- package/Runtime/Internal/Platform/PlatformTypeUtils.cs +46 -0
- package/Runtime/Internal/Platform/PlatformTypeUtils.cs.meta +11 -0
- package/Runtime/Internal/Platform.meta +8 -0
- package/Runtime/Internal/UI/Base/Const.cs +27 -0
- package/Runtime/Internal/UI/Base/Const.cs.meta +11 -0
- package/Runtime/Internal/UI/Base/GraphicRaycasterBugFixed.cs +240 -0
- package/Runtime/Internal/UI/Base/GraphicRaycasterBugFixed.cs.meta +3 -0
- package/Runtime/Internal/UI/Base/LoadingPanelController.cs +29 -0
- package/Runtime/Internal/UI/Base/LoadingPanelController.cs.meta +11 -0
- package/Runtime/Internal/UI/Base/MonoSingleton.cs +102 -0
- package/Runtime/Internal/UI/Base/MonoSingleton.cs.meta +11 -0
- package/Runtime/Internal/UI/Base/Singleton.cs +29 -0
- package/Runtime/Internal/UI/Base/Singleton.cs.meta +11 -0
- package/Runtime/Internal/UI/Base/TipPanelController.cs +45 -0
- package/Runtime/Internal/UI/Base/TipPanelController.cs.meta +3 -0
- package/Runtime/Internal/UI/Base/ToastBlackPanelController.cs +95 -0
- package/Runtime/Internal/UI/Base/ToastBlackPanelController.cs.meta +11 -0
- package/Runtime/Internal/UI/Base/ToastWhitePanelController.cs +79 -0
- package/Runtime/Internal/UI/Base/ToastWhitePanelController.cs.meta +3 -0
- package/Runtime/Internal/UI/Base/UIManager.cs +724 -0
- package/Runtime/Internal/UI/Base/UIManager.cs.meta +11 -0
- package/Runtime/Internal/UI/Base.meta +8 -0
- package/Runtime/Internal/UI/BasePanel/BasePanelController.cs +385 -0
- package/Runtime/Internal/UI/BasePanel/BasePanelController.cs.meta +11 -0
- package/Runtime/Internal/UI/BasePanel.meta +8 -0
- package/Runtime/Internal/UI/Params/BasePanelConfig.cs +18 -0
- package/Runtime/Internal/UI/Params/BasePanelConfig.cs.meta +11 -0
- package/Runtime/Internal/UI/Params/IOpenPanelParameter.cs +7 -0
- package/Runtime/Internal/UI/Params/IOpenPanelParameter.cs.meta +11 -0
- package/Runtime/Internal/UI/Params.meta +8 -0
- package/Runtime/Internal/UI/ScrollViewEx/ObjPool/SimpleObjPool.cs +76 -0
- package/Runtime/Internal/UI/ScrollViewEx/ObjPool/SimpleObjPool.cs.meta +12 -0
- package/Runtime/Internal/UI/ScrollViewEx/ObjPool.meta +9 -0
- package/Runtime/Internal/UI/ScrollViewEx/ScrollView/ScrollView.cs +828 -0
- package/Runtime/Internal/UI/ScrollViewEx/ScrollView/ScrollView.cs.meta +12 -0
- package/Runtime/Internal/UI/ScrollViewEx/ScrollView/ScrollViewEx.cs +245 -0
- package/Runtime/Internal/UI/ScrollViewEx/ScrollView/ScrollViewEx.cs.meta +12 -0
- package/Runtime/Internal/UI/ScrollViewEx/ScrollView.meta +9 -0
- package/Runtime/Internal/UI/ScrollViewEx.meta +8 -0
- package/Runtime/Internal/UI.meta +8 -0
- package/Runtime/Internal/Utils/BridgeUtils.cs +29 -0
- package/Runtime/Internal/Utils/BridgeUtils.cs.meta +11 -0
- package/Runtime/Internal/Utils/ImageUtils.cs +147 -0
- package/Runtime/Internal/Utils/ImageUtils.cs.meta +11 -0
- package/Runtime/Internal/Utils/TapLoom.cs +155 -0
- package/Runtime/Internal/Utils/TapLoom.cs.meta +11 -0
- package/Runtime/Internal/Utils/UrlUtils.cs +34 -0
- package/Runtime/Internal/Utils/UrlUtils.cs.meta +11 -0
- package/Runtime/Internal/Utils.meta +8 -0
- package/Runtime/Internal.meta +8 -0
- package/Runtime/Public/DataStorage.cs +141 -0
- package/Runtime/Public/DataStorage.cs.meta +11 -0
- package/Runtime/Public/ITapPropertiesProxy.cs +6 -0
- package/Runtime/Public/ITapPropertiesProxy.cs.meta +11 -0
- package/Runtime/Public/Json.cs +636 -0
- package/Runtime/Public/Json.cs.meta +11 -0
- package/Runtime/Public/Log/TapLogLevel.cs +7 -0
- package/Runtime/Public/Log/TapLogLevel.cs.meta +11 -0
- package/Runtime/Public/Log/TapLogger.cs +48 -0
- package/Runtime/Public/Log/TapLogger.cs.meta +11 -0
- package/Runtime/Public/Log.meta +8 -0
- package/Runtime/Public/Platform.cs +27 -0
- package/Runtime/Public/Platform.cs.meta +11 -0
- package/Runtime/Public/RegionType.cs +8 -0
- package/Runtime/Public/RegionType.cs.meta +11 -0
- package/Runtime/Public/SafeDictionary.cs +27 -0
- package/Runtime/Public/SafeDictionary.cs.meta +11 -0
- package/Runtime/Public/TapError.cs +62 -0
- package/Runtime/Public/TapError.cs.meta +11 -0
- package/Runtime/Public/TapErrorCode.cs +44 -0
- package/Runtime/Public/TapErrorCode.cs.meta +11 -0
- package/Runtime/Public/TapException.cs +24 -0
- package/Runtime/Public/TapException.cs.meta +11 -0
- package/Runtime/Public/TapLanguage.cs +21 -0
- package/Runtime/Public/TapLanguage.cs.meta +11 -0
- package/Runtime/Public/TapLocalizeManager.cs +128 -0
- package/Runtime/Public/TapLocalizeManager.cs.meta +11 -0
- package/Runtime/Public/TapTapEvent.cs +93 -0
- package/Runtime/Public/TapTapEvent.cs.meta +11 -0
- package/Runtime/Public/TapTapSDK.cs +96 -0
- package/Runtime/Public/TapTapSDK.cs.meta +11 -0
- package/Runtime/Public/TapTapSDKCoreOptions.cs +104 -0
- package/Runtime/Public/TapTapSDKCoreOptions.cs.meta +11 -0
- package/Runtime/Public.meta +8 -0
- package/Runtime/TapSDK.Core.Runtime.asmdef +3 -0
- package/Runtime/TapSDK.Core.Runtime.asmdef.meta +7 -0
- package/Runtime.meta +8 -0
- package/Standalone/Editor/TapCoreStandaloneProcessBuild.cs +20 -0
- package/Standalone/Editor/TapCoreStandaloneProcessBuild.cs.meta +11 -0
- package/Standalone/Editor/TapSDK.Core.Standalone.Editor.asmdef +17 -0
- package/Standalone/Editor/TapSDK.Core.Standalone.Editor.asmdef.meta +7 -0
- package/Standalone/Editor.meta +8 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/Info.plist +46 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/Info.plist.meta +7 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/MacOS/TapDBDeviceInfo +0 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/MacOS/TapDBDeviceInfo.meta +7 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/MacOS.meta +8 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/_CodeSignature/CodeResources +115 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/_CodeSignature/CodeResources.meta +7 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents/_CodeSignature.meta +8 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle/Contents.meta +8 -0
- package/Standalone/Plugins/macOS/TapDBDeviceInfo.bundle.meta +33 -0
- package/Standalone/Plugins/macOS.meta +8 -0
- package/Standalone/Plugins.meta +8 -0
- package/Standalone/Runtime/Internal/Constants.cs +37 -0
- package/Standalone/Runtime/Internal/Constants.cs.meta +11 -0
- package/Standalone/Runtime/Internal/DeviceInfo.cs +152 -0
- package/Standalone/Runtime/Internal/DeviceInfo.cs.meta +11 -0
- package/Standalone/Runtime/Internal/EventSender.cs +239 -0
- package/Standalone/Runtime/Internal/EventSender.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Http/HttpClient.cs +211 -0
- package/Standalone/Runtime/Internal/Http/HttpClient.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Http/NetUtils.cs +48 -0
- package/Standalone/Runtime/Internal/Http/NetUtils.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Http/TimeUtil.cs +30 -0
- package/Standalone/Runtime/Internal/Http/TimeUtil.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Http.meta +8 -0
- package/Standalone/Runtime/Internal/Identity.cs +43 -0
- package/Standalone/Runtime/Internal/Identity.cs.meta +11 -0
- package/Standalone/Runtime/Internal/PlayRecorder.cs +53 -0
- package/Standalone/Runtime/Internal/PlayRecorder.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Prefs.cs +85 -0
- package/Standalone/Runtime/Internal/Prefs.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Tracker.cs +318 -0
- package/Standalone/Runtime/Internal/Tracker.cs.meta +11 -0
- package/Standalone/Runtime/Internal/User.cs +51 -0
- package/Standalone/Runtime/Internal/User.cs.meta +11 -0
- package/Standalone/Runtime/Internal.meta +8 -0
- package/Standalone/Runtime/Public/EventManager.cs +41 -0
- package/Standalone/Runtime/Public/EventManager.cs.meta +11 -0
- package/Standalone/Runtime/Public/TapCoreStandalone.cs +197 -0
- package/Standalone/Runtime/Public/TapCoreStandalone.cs.meta +11 -0
- package/Standalone/Runtime/Public/TapEventStandalone.cs +281 -0
- package/Standalone/Runtime/Public/TapEventStandalone.cs.meta +11 -0
- package/Standalone/Runtime/Public.meta +8 -0
- package/Standalone/Runtime/TapSDK.Core.Standalone.Runtime.asmdef +21 -0
- package/Standalone/Runtime/TapSDK.Core.Standalone.Runtime.asmdef.meta +7 -0
- package/Standalone/Runtime.meta +8 -0
- package/Standalone.meta +8 -0
- package/package.json +8 -0
- package/package.json.meta +7 -0
|
@@ -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,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,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:
|