From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/UICommon/XUICommon.cs | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Client/Assets/Scripts/UICommon/XUICommon.cs (limited to 'Client/Assets/Scripts/UICommon/XUICommon.cs') 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 +{ + public UIPanel m_uiRootPanel; + public UIPanel m_inVisiablePanel; + public void Init(Transform uiRoot) + { + m_uiRootPanel = uiRoot.GetComponent(); + 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(); + } + } + public void SetRootPanelUpdateFreq(int count) + { + m_uiRootPanel.updateFrame = count; + } + public static void CloneTplTweens(GameObject tpl, GameObject clone) + { + if (clone.GetComponent() != null) return; + + UIPlayTween[] tweens = tpl.GetComponents(); + + for (int i=0;i(); + 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(); + + for (int i = 0; i < scales.Length; ++i) + { + TweenScale tweenScale = scales[i]; + TweenScale s = clone.AddComponent(); + 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; + } + } + + +} -- cgit v1.1-26-g67d0