Пример #1
0
        BasePanel GetPanelFromManager(UIComponentManager manager)
        {
            BasePanel panel = manager.GetComponent <BasePanel>();

            if (panel == null)
            {
                PopUpWindow popup = manager.GetComponent <PopUpWindow>();
                if (popup != null)
                {
                    return(popup.GetParentPanel());
                }
            }
            return(panel);
        }
Пример #2
0
        public void SendMessageToComponents(UIComponent.ComponentMessage type, int param)
        {
            // TODO : Remove the direct calls to popups and panels.  They shouldn't
            // be required to store page state information.
            PopUpWindow parentPopUp = GetComponent <PopUpWindow>();

            if (parentPopUp)
            {
                switch (type)
                {
                case UIComponent.ComponentMessage.NextPage: parentPopUp.AdvancePage(1); break;

                case UIComponent.ComponentMessage.PrevPage: parentPopUp.AdvancePage(-1); break;

                case UIComponent.ComponentMessage.GotoPage: parentPopUp.GotoPage(param); break;

                case UIComponent.ComponentMessage.ClosePopup:
                    parentPopUp.RequestClose(bForceClose: true); break;
                }
            }
            else
            {
                BasePanel parentPanel = GetComponent <BasePanel>();
                if (parentPanel)
                {
                    switch (type)
                    {
                    case UIComponent.ComponentMessage.NextPage: parentPanel.AdvancePage(1); break;

                    case UIComponent.ComponentMessage.PrevPage: parentPanel.AdvancePage(-1); break;

                    case UIComponent.ComponentMessage.GotoPage: parentPanel.GotoPage(param); break;
                    }
                }
                else
                {
                    UIComponent uiComponent = GetComponent <UIComponent>();
                    if (uiComponent)
                    {
                        uiComponent.ReceiveMessage(type, param);
                    }
                }
            }

            for (int i = 0; i < m_UIComponents.Count; ++i)
            {
                m_UIComponents[i].ReceiveMessage(type, param);
            }
        }