Ejemplo n.º 1
0
        public void ClearGroup(UIGroup i_Group)
        {
            List <UIBasePanel> openedPanels = m_OpenedPanels[i_Group];

            if (openedPanels == null)
            {
                return;
            }

            for (int panelIndex = 0; panelIndex < openedPanels.Count; ++panelIndex)
            {
                UIBasePanel panel = openedPanels[panelIndex];

                if (panel == null)
                {
                    continue;
                }

                UI.ClosePanel(panel);
            }

            openedPanels.Clear();
        }
Ejemplo n.º 2
0
 public void SwitchPanels(UIGroup i_Group, UIBasePanel i_First, UIBasePanel i_Second)
 {
     UIBasePanel[] panels = new UIBasePanel[] { i_First, i_Second };
     SwitchPanels(i_Group, panels);
 }
Ejemplo n.º 3
0
 public void SwitchPanels(UIGroup i_Group, UIBasePanel i_Panel)
 {
     UIBasePanel[] panels = new UIBasePanel[] { i_Panel };
     SwitchPanels(i_Group, panels);
 }
Ejemplo n.º 4
0
        // INTERNALS

        private IEnumerator Switch(UIGroup i_Group, UIBasePanel[] i_Panels)
        {
            if (i_Panels != null)
            {
                List <UIBasePanel> openedPanels = m_OpenedPanels[i_Group];
                if (openedPanels != null)
                {
                    // Close panels

                    int    closingPanelsCount  = 0;
                    int    closedPanelsCount   = 0;
                    Action panelClosedCallback = () => { ++closedPanelsCount; };

                    for (int panelIndex = 0; panelIndex < openedPanels.Count; ++panelIndex)
                    {
                        UIBasePanel panel = openedPanels[panelIndex];

                        if (panel == null)
                        {
                            continue;
                        }

                        bool shouldBeClosed = true;
                        for (int index = 0; index < i_Panels.Length; ++index)
                        {
                            UIBasePanel current = i_Panels[index];
                            if (current == panel)
                            {
                                shouldBeClosed = false;
                                break;
                            }
                        }

                        if (shouldBeClosed)
                        {
                            ++closingPanelsCount;
                            UI.ClosePanel(panel, panelClosedCallback);
                        }
                    }

                    // Remove closed panels

                    for (int panelIndex = 0; panelIndex < openedPanels.Count;)
                    {
                        UIBasePanel panel = openedPanels[panelIndex];

                        if (panel == null)
                        {
                            continue;
                        }

                        if (!panel.isOpen)
                        {
                            openedPanels.Remove(panel);
                            panelIndex = 0;
                        }
                        else
                        {
                            ++panelIndex;
                        }
                    }

                    // Wait animations.

                    yield return(new WaitUntil(() => (closedPanelsCount == closingPanelsCount)));

                    // Open new panels.

                    int    openingPanelsCount  = 0;
                    int    openedPanelsCount   = 0;
                    Action panelOpenedCallback = () => { ++openedPanelsCount; };

                    for (int panelIndex = 0; panelIndex < i_Panels.Length; ++panelIndex)
                    {
                        UIBasePanel panel = i_Panels[panelIndex];

                        if (panel == null)
                        {
                            continue;
                        }

                        if (!openedPanels.Contains(panel))
                        {
                            ++openingPanelsCount;
                            UI.OpenPanel(panel, panelOpenedCallback);
                            openedPanels.Add(panel);
                        }
                    }

                    // Wait animations.

                    yield return(new WaitUntil(() => (openedPanelsCount == openingPanelsCount)));
                }
            }

            Callback(i_Group);
        }
Ejemplo n.º 5
0
 public void SequentialSwitchPanels(UIGroup i_Group, UIBasePanel i_First, UIBasePanel i_Second, Action i_Callback = null)
 {
     UIBasePanel[] panels = new UIBasePanel[] { i_First, i_Second };
     SequentialSwitchPanels(i_Group, panels, i_Callback);
 }
 public WaitUntilOpened(UIBasePanel i_Panel)
 {
     m_Panel = i_Panel;
 }