コード例 #1
0
    public void SwitchToMenuImmediate(MenuBase baseMenu, bool playEffect = true)
    {
        if (playEffect && UIConfirm)
        {
            UIConfirm.Play();
        }

        PreviousMenu = CurrentMenu;

        if (SkipLocalAnim)
        {
            SkipLocalAnim = false;

            if (PreviousMenu)
            {
                PreviousMenu.End();
            }
            CurrentMenu = baseMenu;
            if (CurrentMenu)
            {
                CurrentMenu.Begin();
            }
        }
        else
        {
            StartCoroutine(CoSwitchAnimWorker(baseMenu));
        }
    }
コード例 #2
0
    IEnumerator CoSwitchAnimWorker(MenuBase baseMenu)
    {
        IsDuringSwitch = true;

        // override local anim
        if (PreviousMenu && PreviousMenu.IsHideAnim)
        {
            PreviousMenu.OnHide.Play();
            yield return(new WaitForSeconds(PreviousMenu.OnHide.Duration));
        }
        else if (Local.Hide.DoPlay)
        {
            Local.Hide.Play();
            switch (Local.Hide.AlphaMode)
            {
            case AlphaMode.Custom:
                yield return(new WaitForSeconds(Local.Hide.Duration));

                break;

            case AlphaMode.Snap:
            {
                yield return(new WaitForSeconds(Local.Hide.Duration));

                if (PreviousMenu)
                {
                    PreviousMenu.Hide();
                }

                break;
            }

            case AlphaMode.Animate:
            {
                if (CurrentMenu)
                {
                    yield return(StartCoroutine(CoHandleAlphaAnim(1, 0, Local.Hide.Duration, PreviousMenu.Canvas)));

                    PreviousMenu.Hide();
                }
                else
                {
                    yield return(new WaitForSeconds(Local.Hide.Duration));
                }

                break;
            }
            }
        }
        else
        {
            if (PreviousMenu)
            {
                PreviousMenu.Hide();
            }
        }

        if (PreviousMenu)
        {
            PreviousMenu.End();
        }

        CurrentMenu = baseMenu;

        if (CurrentMenu)
        {
            CurrentMenu.gameObject.SetActive(true);
        }

        if (CurrentMenu && CurrentMenu.IsShowAnim)
        {
            CurrentMenu.OnShow.Play();
            yield return(new WaitForSeconds(CurrentMenu.OnShow.Duration));
        }
        else if (Local.Show.DoPlay)
        {
            Local.Show.Play();
            switch (Local.Show.AlphaMode)
            {
            case AlphaMode.Custom:
                yield return(new WaitForSeconds(Local.Show.Duration));

                break;

            case AlphaMode.Snap:
            {
                yield return(new WaitForSeconds(Local.Show.Duration));

                if (CurrentMenu)
                {
                    CurrentMenu.Show();
                }

                break;
            }

            case AlphaMode.Animate:
            {
                if (CurrentMenu)
                {
                    yield return(StartCoroutine(CoHandleAlphaAnim(1, 0, Local.Show.Duration, CurrentMenu.Canvas)));

                    CurrentMenu.Show();
                }
                else
                {
                    yield return(new WaitForSeconds(Local.Show.Duration));
                }

                break;
            }
            }
        }
        else
        {
            if (CurrentMenu)
            {
                CurrentMenu.Show();
            }
        }

        if (CurrentMenu)
        {
            CurrentMenu.Begin();
        }

        IsDuringSwitch = false;
    }