Exemplo n.º 1
0
    private IEnumerator IECloseSub(bool immediate)
    {
        // Nothing to close
        if (m_StackSub.Count == 0)
        {
            m_IsBusy = false;
            yield break;
        }

        // Lowest layer: Quit
        if (m_StackSub.Count == 1)
        {
            m_IsBusy = false;
            Debug.Log("Application.Quit");
            Application.Quit();
            yield break;
        }

        // Current state of shield 0
        bool isShieldActived = IsShieldActive(0);

        // Active Empty shield
        ShieldOn(0, new Color(0, 0, 0, 0));

        // Stack pop
        string sn = m_StackSub.Pop();

        // Deactive Scene
        CloseScene(sn, immediate, ForceType.NO_FORCE, AnimType.HIDE, () =>
        {
            // Deactive Empty shield
            if (!isShieldActived)
            {
                ShieldOff();
            }

            // Focus back
            if (m_StackSub.Count > 0)
            {
                string s       = m_StackSub.Peek();
                SSController c = m_Dict[s].GetComponentInChildren <SSController>();
                if (c != null)
                {
                    BgmSceneClose(c);
                    c.OnFocusBack();
                }
            }

            // Busy off
            m_IsBusy = false;

            // Event
            if (m_StackSub.Count > 0)
            {
                string s = m_StackSub.Peek();
                if (onSceneActived != null)
                {
                    onSceneActived(s);
                }
            }

            // Check queue
            Dequeue();
        });

        // Top of stack
        sn = m_StackSub.Peek();

        // Active scene
        ActiveScene(sn);
        StartCoroutine(IEPlayAnimation(sn, AnimType.SHOW_BACK));
    }
Exemplo n.º 2
0
    private IEnumerator IEClose(bool immediate)
    {
        // Nothing to close
        if (m_Stack.Count == 0)
        {
            m_IsBusy = false;
            yield break;
        }

        // Lowest layer: Quit
        if (m_Stack.Count == 1)
        {
            m_IsBusy = false;
            Debug.Log("Application.Quit");
            Application.Quit();
            yield break;
        }

        // Active Empty shield
        ShieldOn(m_Stack.Count - 1, new Color(0, 0, 0, 0));

        // Stack peek
        string sn = m_Stack.Peek();

        // Deactive Scene
        CloseScene(sn, immediate, ForceType.NO_FORCE, AnimType.HIDE, () =>
        {
            // Deactive Empty shield
            ShieldOff();

            // Stack pop
            sn = m_Stack.Pop();

            // Focus back
            if (m_Stack.Count > 0)
            {
                string s       = m_Stack.Peek();
                SSController c = m_Dict[s].GetComponentInChildren <SSController>();
                if (c != null)
                {
                    BgmSceneClose(c);
                    c.OnFocusBack();
                }
            }

            // Deactive Shield
            ShieldOff();

            // Busy off
            m_IsBusy = false;

            // Event
            if (m_Stack.Count > 0)
            {
                string s = m_Stack.Peek();
                if (onSceneActived != null)
                {
                    onSceneActived(s);
                }
            }

            // Check queue
            Dequeue();
        });
    }