| | |
| | | public class ReikiFuncOpenWin : Window
|
| | | {
|
| | | [SerializeField] UIAlphaTween m_AlphaTween;
|
| | | [SerializeField] UIAlphaTween m_AlphaTween1;
|
| | | [SerializeField] PositionTween m_PositionTween;
|
| | | [SerializeField] Transform m_ContainerReikiIcon;
|
| | | [SerializeField] Transform m_ContainerFly;
|
| | | [SerializeField] UIEffect m_Effect;
|
| | | [SerializeField] Transform[] m_FlyIcons;
|
| | | [SerializeField] float m_OpenTime = 2f;
|
| | |
|
| | | bool displayAnimation = false;
|
| | |
|
| | | public static Action onFlyComplete;
|
| | |
|
| | | float timer = 0f;
|
| | | #region Built-in
|
| | |
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | m_OpenTime = Mathf.Max(2f, m_OpenTime);
|
| | | timer = 0f;
|
| | |
|
| | | displayAnimation = false;
|
| | |
|
| | | m_PositionTween.SetStartState();
|
| | | m_AlphaTween.SetStartState();
|
| | | m_AlphaTween1.SetStartState();
|
| | | m_ContainerReikiIcon.gameObject.SetActive(true);
|
| | | m_ContainerFly.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | StopAllCoroutines();
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | |
| | | protected override void LateUpdate()
|
| | | {
|
| | | base.LateUpdate();
|
| | | if (timer >= m_OpenTime)
|
| | | if (displayAnimation)
|
| | | {
|
| | | return;
|
| | | }
|
| | | timer += Time.deltaTime;
|
| | | if (timer >= m_OpenTime)
|
| | | {
|
| | | displayAnimation = true;
|
| | | StartAnimation();
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | void StartAnimation()
|
| | | {
|
| | | m_AlphaTween.Play(CloseClick);
|
| | | m_PositionTween.Play(PositionTweenComplete);
|
| | | }
|
| | |
|
| | | private void PositionTweenComplete()
|
| | | {
|
| | | m_AlphaTween.Play();
|
| | | m_AlphaTween1.Play();
|
| | |
|
| | | StartCoroutine(Co_Fly());
|
| | | }
|
| | |
|
| | | IEnumerator Co_Fly()
|
| | | {
|
| | | yield return WaitingForSecondConst.GetWaitForSeconds(m_AlphaTween.delay);
|
| | |
|
| | | m_Effect.Play();
|
| | |
|
| | | yield return null;
|
| | |
|
| | | m_ContainerReikiIcon.gameObject.SetActive(false);
|
| | | m_ContainerFly.gameObject.SetActive(true);
|
| | | var parent = m_Effect.target.transform.Find("Animation/B/JIN");
|
| | | SetParent(m_FlyIcons[0], parent, Vector3.one);
|
| | | parent = m_Effect.target.transform.Find("Animation/B/MU");
|
| | | SetParent(m_FlyIcons[1], parent, Vector3.one);
|
| | | parent = m_Effect.target.transform.Find("Animation/B/SHUI");
|
| | | SetParent(m_FlyIcons[2], parent, Vector3.one);
|
| | | parent = m_Effect.target.transform.Find("Animation/B/HUO");
|
| | | SetParent(m_FlyIcons[3], parent, Vector3.one);
|
| | | parent = m_Effect.target.transform.Find("Animation/B/TU");
|
| | | SetParent(m_FlyIcons[4], parent, Vector3.one);
|
| | |
|
| | | yield return WaitingForSecondConst.WaitMS500;
|
| | | for (int i = 0; i < m_FlyIcons.Length; i++)
|
| | | {
|
| | | SetParent(m_FlyIcons[i], m_ContainerFly, Vector3.zero);
|
| | | }
|
| | |
|
| | | yield return WaitingForSecondConst.WaitMS900;
|
| | | if (onFlyComplete != null)
|
| | | {
|
| | | onFlyComplete();
|
| | | }
|
| | |
|
| | | yield return WaitingForSecondConst.WaitMS1600;
|
| | | CloseClick();
|
| | | }
|
| | |
|
| | | void SetParent(Transform source, Transform dest, Vector3 scale)
|
| | | {
|
| | | source.SetParentEx(dest, Vector3.zero, Quaternion.identity, scale);
|
| | | }
|
| | | }
|
| | |
|