Exemplo n.º 1
0
        public static void Close(UISystemScreen screen)
        {
            if (screen == null)
            {
                return;
            }
            if (screen.CurrentState == UISystemScreen.States.Closed || screen.CurrentState == UISystemScreen.States.Closing)
            {
                return;
            }
            switch (screen.Type)
            {
            case UISystemScreen.Types.Window:
                if (Windows.Contains(screen) && screen.NoFootprint)
                {
                    Windows.Remove(screen);
                }
                break;

            case UISystemScreen.Types.Dialog:
                if (Dialogs.Contains(screen))
                {
                    Dialogs.Remove(screen);
                }
                break;

            default:
                throw new System.NotSupportedException(screen.name + " have not supported type!");
            }
            screen.CurrentState = UISystemScreen.States.Closing;
        }
Exemplo n.º 2
0
        public static void Open(UISystemScreen screen)
        {
            if (screen == null || screen == CurrentScreen)
            {
                return;
            }
            if (screen.CurrentState == UISystemScreen.States.Opened || screen.CurrentState == UISystemScreen.States.Opening)
            {
                return;
            }
            switch (screen.Type)
            {
            case UISystemScreen.Types.Window:
                if (screen == CurrentWindow)
                {
                    return;
                }
                for (int i = 0; i < Dialogs.Count; i++)
                {
                    if (!Dialogs[i].PersistendDialog)
                    {
                        Close(Dialogs[i]);
                        i--;
                    }
                }
                Close(CurrentWindow);
                if (Windows.Contains(screen))
                {
                    int index = Windows.FindIndex(window => window == screen);
                    Windows.RemoveFromIndex(index);
                }
                else
                {
                    Windows.Add(screen);
                }
                break;

            case UISystemScreen.Types.Dialog:
                if (screen == CurrentDialog)
                {
                    return;
                }
                if (!Dialogs.Contains(screen))
                {
                    Dialogs.Add(screen);
                }
                screen.transform.SetAsLastSibling();
                break;

            default:
                throw new System.NotSupportedException(screen.name + " have not supported type!");
            }
            screen.CurrentState = UISystemScreen.States.Opening;
        }