Esempio n. 1
0
    private void Push(WindowContext context)
    {
        if (context == null)
        {
            return;
        }

        if (context.fixedOrder == 0)
        {
            WindowNav nav = new WindowNav();
            nav.windowState = GetWindowState(context);

            if (context.hideOther)
            {
                using (var it = mWindowContextDic.GetEnumerator())
                {
                    while (it.MoveNext())
                    {
                        var w = it.Current.Value as WindowContext;
                        if (w != null && w != context && w.active)
                        {
                            if (nav.hideWindowStates == null)
                            {
                                nav.hideWindowStates = new List <WindowState>();
                            }
                            WindowState windowState = GetWindowState(w);

                            nav.hideWindowStates.Add(windowState);
                            SetActive(w, false);
                        }
                    }
                }
                if (nav.hideWindowStates != null)
                {
                    nav.hideWindowStates.Sort(SortWindow);
                }
            }
            mWindowStack.Insert(0, nav);
        }
    }
Esempio n. 2
0
    private void Push(Window window)
    {
        if (window == null)
        {
            return;
        }

        if (window.type == WindowType.Normal)
        {
            WindowNav nav = new WindowNav();
            nav.window = window;

            if (window.hideOther)
            {
                var it = mWindowDic.GetEnumerator();
                while (it.MoveNext())
                {
                    var w = it.Current.Value;
                    if (w != window && w.active && w.parent == null)
                    {
                        if (nav.hideWindows == null)
                        {
                            nav.hideWindows = new List <Window>();
                        }
                        nav.hideWindows.Add(w);
                        SetActive(w, false);
                    }
                }

                if (nav.hideWindows != null)
                {
                    nav.hideWindows.Sort(SortWindow);
                }
            }
            mWindowStack.Insert(0, nav);
        }
    }
Esempio n. 3
0
    public void Close(Window window, bool destroy = true)
    {
        if (window == null)
        {
            return;
        }
        if (window.type == WindowType.Normal)
        {
            int index = mWindowStack.FindIndex((nav) => { return(nav.window == window); });
            if (index >= 0 && index < mWindowStack.Count)
            {
                WindowNav current = mWindowStack[index];

                WindowNav previous      = null;
                int       previousIndex = index + 1;
                if (previousIndex < mWindowStack.Count)
                {
                    previous = mWindowStack[previousIndex];
                }

                mWindowStack.RemoveAt(index);
                if (mWindowStack.FindIndex((nav) => { return(nav.window == window); }) < 0 && destroy)
                {
                    DestroyWindow(window);
                }
                else
                {
                    SetActive(window, false);
                }
                if (current != null && current.hideWindows != null)
                {
                    for (int i = 0; i < current.hideWindows.Count; ++i)
                    {
                        SetActive(current.hideWindows[i], true);
                    }
                }

                if (previous != null)
                {
                    if (previous.window.hideOther == false && previousIndex < mWindowStack.Count)
                    {
                        var previousPrevious = mWindowStack[previousIndex];

                        SetActive(previousPrevious.window, true);
                    }
                    SetActive(previous.window, true);
                }
            }
            else
            {
                if (destroy)
                {
                    DestroyWindow(window);
                }
                else
                {
                    SetActive(window, false);
                }
            }
        }
        else
        {
            if (destroy)
            {
                DestroyWindow(window);
            }
            else
            {
                SetActive(window, false);
            }
        }
    }
Esempio n. 4
0
    public void Close(WindowContextBase context)
    {
        if (context == null)
        {
            return;
        }
        if (context.type == WindowType.Normal)
        {
            int index = mWindowStack.FindIndex((nav) => { return(nav.windowState.context == context); });
            if (index >= 0 && index < mWindowStack.Count)
            {
                WindowNav current = mWindowStack[index];

                WindowNav previous      = null;
                int       previousIndex = index + 1;
                if (previousIndex < mWindowStack.Count)
                {
                    previous = mWindowStack[previousIndex];
                }

                mWindowStack.RemoveAt(index);
                if (mWindowStack.FindIndex((nav) => { return(nav.windowState.context == context); }) < 0)
                {
                    DestroyWindow(context);
                }
                else
                {
                    SetActive(context, false);
                }
                mTempList.Clear();
                if (current != null && current.hideWindowStates != null)
                {
                    for (int i = 0; i < current.hideWindowStates.Count; ++i)
                    {
                        SetActive(current.hideWindowStates[i].context, true, current.hideWindowStates[i].widgetsActive);
                        mTempList.Add(current.hideWindowStates[i].context.id);
                    }
                }

                if (previous != null)
                {
                    if (previous.windowState.context.hideOther == false && previousIndex < mWindowStack.Count)
                    {
                        var previousPrevious = mWindowStack[previousIndex];

                        if (mTempList.Contains(previousPrevious.windowState.context.id))
                        {
                            SetActive(previousPrevious.windowState.context, true, previousPrevious.windowState.widgetsActive);
                        }
                    }
                    if (mTempList.Contains(previous.windowState.context.id) == false)
                    {
                        SetActive(previous.windowState.context, true, previous.windowState.widgetsActive);
                    }
                }
                mTempList.Clear();
            }
            else
            {
                DestroyWindow(context);
            }
        }
        else
        {
            DestroyWindow(context);
        }
    }