summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/UICommon/XUIPlayTweenGroup.cs
blob: d2be095fdcd8ac496d93517f577be1b9cce9be93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using AnimationOrTween;
using UILib;
using UnityEngine;

public class XUIPlayTweenGroup : MonoBehaviour,IXUIPlayTweenGroup
{
    public UIPlayTween[] m_tweenControls;
    void Awake()
    {
        if(m_tweenControls == null || m_tweenControls.Length == 0)
            m_tweenControls = GetComponentsInChildren<UIPlayTween>();
        
    }

    [ContextMenu("Execute")]
    void Excute()
    {

        ResetTween(true);
        PlayTween(false);
    }

    public void PlayTween(bool bForward)
    {
        if (m_tweenControls == null || m_tweenControls.Length == 0) return;
        for (int i = 0, length = m_tweenControls.Length; i < length; i++)
            m_tweenControls[i].Play(bForward);
    }

    public void ResetTween(bool bForward)
    {
        if (m_tweenControls == null || m_tweenControls.Length == 0) return;
        for (int i = 0, length = m_tweenControls.Length; i < length; i++)
            m_tweenControls[i].Reset(bForward);
    }

    public void StopTween()
    {
        if (m_tweenControls == null || m_tweenControls.Length == 0) return;
        for (int i = 0, length = m_tweenControls.Length; i < length; i++)
            m_tweenControls[i].Stop();
    }
}