Пример #1
0
        void joinGameTabs_OnPageChanged()
        {
            var serversPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageServersPanel");
            var lobbiesPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageLobbiesPanel");
            var favoritesPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageFavoritesPanel");
            var historyPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageHistoryPanel");
            var LANPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageLANPanel");
            var friendsPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageFriendsPanel");

            if (m_selectedPage == serversPage)
            {
                CloseServersPage();
            }
            else if (m_selectedPage == lobbiesPage)
            {
                CloseLobbyPage();
            }
            else if (m_selectedPage == favoritesPage)
            {
                CloseFavoritesPage();
            }
            else if (m_selectedPage == LANPage)
            {
                CloseLANPage();
            }
            else if (m_selectedPage == historyPage)
            {
                CloseHistoryPage();
            }
            else if (m_selectedPage == friendsPage)
            {
                CloseFriendsPage();
            }

            m_selectedPage = m_joinGameTabs.GetTabSubControl(m_joinGameTabs.SelectedPage);

            InitPageControls(m_selectedPage);
            if (m_selectedPage == serversPage)
            {
                InitServersPage();
                m_showOnlyFriends.Enabled = false;
                m_showOnlyFriendsText.Enabled = false;
            }
            else if (m_selectedPage == lobbiesPage)
            {
                InitLobbyPage();
                m_showOnlyFriends.Enabled = true;
                m_showOnlyFriendsText.Enabled = true;
            }
            else if (m_selectedPage == favoritesPage)
            {
                InitFavoritesPage();
                m_showOnlyFriends.Enabled = false;
                m_showOnlyFriendsText.Enabled = false;
            }
            else if (m_selectedPage == historyPage)
            {
                InitHistoryPage();
                m_showOnlyFriends.Enabled = false;
                m_showOnlyFriendsText.Enabled = false;
            }
            else if (m_selectedPage == LANPage)
            {
                InitLANPage();
                m_showOnlyFriends.Enabled = false;
                m_showOnlyFriendsText.Enabled = false;
            }
            else if (m_selectedPage == friendsPage)
            {
                InitFriendsPage();
                m_showOnlyFriends.Enabled = false;
                m_showOnlyFriendsText.Enabled = false;
            }

            if(m_contextMenu != null)
            {
                m_contextMenu.Deactivate();
                m_contextMenu = null;
            }

            m_contextMenu = new MyGuiControlContextMenu();
            m_contextMenu.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            m_contextMenu.Deactivate();
            m_contextMenu.ItemClicked += OnContextMenu_ItemClicked;
            Controls.Add(m_contextMenu);
        }
Пример #2
0
        private void RecreateControls(bool contructor)
        {
            m_toolbarItemsGrid = new MyGuiControlGrid()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM,
                VisualStyle = MyGuiControlGridStyleEnum.Toolbar,
                ColumnsCount = MyToolbarComponent.CurrentToolbar.SlotCount + 1,
                RowsCount = 1
            };
            m_toolbarItemsGrid.ItemDoubleClicked += grid_ItemDoubleClicked;
            m_toolbarItemsGrid.ItemClickedWithoutDoubleClick += grid_ItemClicked;

            m_selectedItemLabel = new MyGuiControlLabel();
            m_colorVariantPanel = new MyGuiControlPanel(size: new Vector2(0.1f, 0.025f));
            m_colorVariantPanel.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;

            m_contextMenu = new MyGuiControlContextMenu();
            m_contextMenu.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            m_contextMenu.Deactivate();
            m_contextMenu.ItemClicked += contextMenu_ItemClicked;

            Elements.Add(m_colorVariantPanel);
            Elements.Add(m_selectedItemLabel);
            Elements.Add(m_toolbarItemsGrid);
            Elements.Add(m_contextMenu);

            m_colorVariantPanel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
            m_selectedItemLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
            m_toolbarItemsGrid.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
            m_contextMenu.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;

            RefreshInternals();
        }
Пример #3
0
        public override void RecreateControls(bool constructor)
        {
            //This is probably very wrong!
            m_screenScale = (MyGuiManager.GetHudSize().X / MyGuiManager.GetHudSize().Y) / MyGuiConstants.SAFE_ASPECT_RATIO;

            m_size = new Vector2(m_screenScale, 0.5f);

            base.RecreateControls(constructor);
            Vector4 consoleTextColor = new Vector4(1, 1, 0, 1);
            float consoleTextScale = 1f;
            
            m_commandLine = new MyGuiControlTextbox
            (
                position: new Vector2(0, 0.25f),
                textColor: consoleTextColor
            );

            m_commandLine.Position -= new Vector2(0, m_commandLine.Size.Y + m_margin.Y/2);
            m_commandLine.Size = new Vector2(m_screenScale, m_commandLine.Size.Y) - 2 * m_margin;
            m_commandLine.ColorMask = new Vector4(0, 0, 0, 0.5f);
            m_commandLine.VisualStyle = MyGuiControlTextboxStyleEnum.Debug;
            m_commandLine.TextChanged += commandLine_TextChanged;
            m_commandLine.Name = "CommandLine";


            m_autoComplete = new MyGuiControlContextMenu();
            m_autoComplete.ItemClicked += autoComplete_ItemClicked;
            m_autoComplete.Deactivate();
            m_autoComplete.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_autoComplete.ColorMask = new Vector4(0, 0, 0, .5f);
            m_autoComplete.AllowKeyboardNavigation = true;
            m_autoComplete.Name = "AutoComplete";

            m_displayScreen = new MyGuiControlMultilineText
            (
                position: new Vector2(-0.5f * m_screenScale, -0.25f) + m_margin,
                size: new Vector2(m_screenScale, 0.5f - m_commandLine.Size.Y) - 2 * m_margin,
                font: MyFontEnum.Debug,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                selectable: true
            );

            m_displayScreen.TextColor = Color.Yellow;
            m_displayScreen.TextScale = consoleTextScale;
            m_displayScreen.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_displayScreen.Text = MyConsole.DisplayScreen;
            m_displayScreen.ColorMask = new Vector4(0, 0, 0, .5f);
            m_displayScreen.Name = "DisplayScreen";

            Controls.Add(m_displayScreen);
            Controls.Add(m_commandLine);
            Controls.Add(m_autoComplete);
        }