コード例 #1
0
 //No record of opening, doesn't mess up last open flow
 public void OutsideOfScreenFlow_CloseSpecific(Animator anim, ScreenTranstitionType transitionType, float transitionSpeed)
 {
     m_Open.SetFloat("transitionSpeed", transitionSpeed);
     m_Open.SetInteger("transitionType", (int)transitionType);
     anim.SetBool(m_OpenParameterId, false);
     StartCoroutine(DisablePanelDelayed(anim));
 }
コード例 #2
0
    public void OutsideOfScreenFlow_OpenPanelOverTop(Animator anim, ScreenTranstitionType transitionType, float transitionSpeed)
    {
        if (m_Open == anim)
        {
            return;
        }

        //Activate the new Screen hierarchy so we can animate it.
        anim.gameObject.SetActive(true);
        //Save the currently selected button that was used to open this Screen. (CloseCurrent will modify it)
        var newPreviouslySelected = EventSystem.current.currentSelectedGameObject;

        //Move the Screen to front.
        anim.transform.SetAsLastSibling();

        m_PreviouslySelected = newPreviouslySelected;

        //Start the open animation
        m_Open.SetFloat("transitionSpeed", transitionSpeed);
        anim.SetInteger("transitionType", (int)transitionType);
        anim.SetBool(m_OpenParameterId, true);

        //Set an element in the new screen as the new Selected one.
        GameObject go = FindFirstEnabledSelectable(anim.gameObject);

        SetSelected(go);
    }
コード例 #3
0
    public void CloseCurrentThenOpen(Animator anim, ScreenTranstitionType transitionType, float transitionSpeed)
    {
        if (m_Open == null)
        {
            return;
        }

        //Start the close animation.
        m_Open.SetBool(m_OpenParameterId, false);

        //Reverting selection to the Selectable used before opening the current screen.
        SetSelected(m_PreviouslySelected);
        //Start Coroutine to disable the hierarchy when closing animation finishes.
        StartCoroutine(DisablePanelDelayedThenOpenOverTop(m_Open, anim, transitionType, transitionSpeed));


        if (last_Open != null)
        {
            m_Open = last_Open;
        }
        else
        {
            //No screen open.
            m_Open = null;
        }
    }
コード例 #4
0
    public void CloseCurrent(ScreenTranstitionType transitionType, float transitionSpeed)
    {
        if (m_Open == null)
        {
            return;
        }

        //Start the close animation.
        m_Open.SetFloat("transitionSpeed", transitionSpeed);
        m_Open.SetInteger("transitionType", (int)transitionType);
        m_Open.SetBool(m_OpenParameterId, false);

        //Reverting selection to the Selectable used before opening the current screen.
        SetSelected(m_PreviouslySelected);
        //Start Coroutine to disable the hierarchy when closing animation finishes.
        StartCoroutine(DisablePanelDelayed(m_Open));

        Animator currentOpen = m_Open;

        if (last_Open != null)
        {
            m_Open = last_Open;
        }
        else
        {
            //No screen open.
            m_Open = null;
        }

        last_Open = currentOpen;
    }
コード例 #5
0
    public void CloseSpecific(Animator anim, ScreenTranstitionType transitionType, float transitionSpeed)
    {
        m_Open.SetFloat("transitionSpeed", transitionSpeed);
        m_Open.SetInteger("transitionType", (int)transitionType);
        anim.SetBool(m_OpenParameterId, false);
        StartCoroutine(DisablePanelDelayed(anim));

        if (last_Open != null)
        {
            m_Open = last_Open;
        }
        else
        {
            //No screen open.
            m_Open = null;
        }

        last_Open = anim;
    }
コード例 #6
0
    IEnumerator DisablePanelDelayedThenOpenOverTop(Animator anim, Animator toOpenAnim, ScreenTranstitionType transitionType, float transitionSpeed)
    {
        bool closedStateReached = false;
        bool wantToClose        = true;

        while (!closedStateReached && wantToClose)
        {
            if (!anim.IsInTransition(0))
            {
                closedStateReached = anim.GetCurrentAnimatorStateInfo(0).IsName(k_ClosedStateName);
            }

            wantToClose = !anim.GetBool(m_OpenParameterId);

            yield return(new WaitForEndOfFrame());
        }

        if (wantToClose)
        {
            anim.gameObject.SetActive(false);

            OpenPanelOverTop(toOpenAnim, transitionType, transitionSpeed);
        }
    }