diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/UICommon/XUICommon.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/UICommon/XUICommon.cs')
-rw-r--r-- | Client/Assets/Scripts/UICommon/XUICommon.cs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/UICommon/XUICommon.cs b/Client/Assets/Scripts/UICommon/XUICommon.cs new file mode 100644 index 00000000..09ffcc97 --- /dev/null +++ b/Client/Assets/Scripts/UICommon/XUICommon.cs @@ -0,0 +1,63 @@ +using UnityEngine;
+using XUtliPoolLib;
+
+public class XUICommon : XSingleton<XUICommon>
+{
+ public UIPanel m_uiRootPanel;
+ public UIPanel m_inVisiablePanel;
+ public void Init(Transform uiRoot)
+ {
+ m_uiRootPanel = uiRoot.GetComponent<UIPanel>();
+ m_uiRootPanel.updateFrame = 3;
+
+ m_inVisiablePanel = null;
+ Transform inVisablePanel = m_uiRootPanel != null ? m_uiRootPanel.transform.Find("InVisiblePanel") : null;
+ if (inVisablePanel != null)
+ {
+ m_inVisiablePanel = inVisablePanel.GetComponent<UIPanel>();
+ }
+ }
+ public void SetRootPanelUpdateFreq(int count)
+ {
+ m_uiRootPanel.updateFrame = count;
+ }
+ public static void CloneTplTweens(GameObject tpl, GameObject clone)
+ {
+ if (clone.GetComponent<UIPlayTween>() != null) return;
+
+ UIPlayTween[] tweens = tpl.GetComponents<UIPlayTween>();
+
+ for (int i=0;i<tweens.Length;++i)
+ {
+ UIPlayTween tween = tweens[i];
+ UIPlayTween t = clone.AddComponent<UIPlayTween>();
+ t.tweenGroup = tween.tweenGroup;
+ t.trigger = tween.trigger;
+ t.playDirection = tween.playDirection;
+ t.resetIfDisabled = tween.resetIfDisabled;
+ t.resetOnPlay = tween.resetOnPlay;
+ t.ifDisabledOnPlay = tween.ifDisabledOnPlay;
+ t.disableWhenFinished = tween.disableWhenFinished;
+ }
+
+ TweenScale[] scales = tpl.GetComponents<TweenScale>();
+
+ for (int i = 0; i < scales.Length; ++i)
+ {
+ TweenScale tweenScale = scales[i];
+ TweenScale s = clone.AddComponent<TweenScale>();
+ s.from = tweenScale.from;
+ s.to = tweenScale.to;
+ s.style = tweenScale.style;
+ s.animationCurve = tweenScale.animationCurve;
+ s.duration = tweenScale.duration;
+ s.delay = tweenScale.delay;
+ s.tweenGroup = tweenScale.tweenGroup;
+ s.ignoreTimeScale = tweenScale.ignoreTimeScale;
+
+ s.enabled = false;
+ }
+ }
+
+
+}
|