public override void RecreateControls(bool constructor)
    {
        base.RecreateControls(constructor);
        m_elementGroup = new MyGuiControlElementGroup();
        AddCaption(MyCustomTexts.OldButtonsAndMenus, null, new Vector2(0f, 0.003f));
        m_backgroundTransition = MySandboxGame.Config.UIBkOpacity;
        m_guiTransition        = MySandboxGame.Config.UIOpacity;
        MyGuiControlSeparatorList myGuiControlSeparatorList = new MyGuiControlSeparatorList();

        myGuiControlSeparatorList.AddHorizontal(-new Vector2(m_size.Value.X * 0.83f / 2f, m_size.Value.Y / 2f - 0.075f), m_size.Value.X * 0.83f);
        Controls.Add(myGuiControlSeparatorList);
        MyGuiControlSeparatorList myGuiControlSeparatorList2 = new MyGuiControlSeparatorList();
        Vector2 start = -new Vector2(m_size.Value.X * 0.83f / 2f, (0f - m_size.Value.Y) / 2f + 0.05f);

        myGuiControlSeparatorList2.AddHorizontal(start, m_size.Value.X * 0.83f);
        Controls.Add(myGuiControlSeparatorList2);
        if (MyGuiScreenGamePlay.Static == null)
        {
            CreateMainMenuControls();
        }
        else
        {
            CreateInGameMenuControls();
        }
        Vector2           minSizeGui        = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
        MyGuiControlLabel myGuiControlLabel = new MyGuiControlLabel(new Vector2(0f, start.Y + minSizeGui.Y / 2f), null, null, null, 0.8f, "Blue", MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

        myGuiControlLabel.Name = MyGuiScreenBase.GAMEPAD_HELP_LABEL_NAME;
        Controls.Add(myGuiControlLabel);
        base.GamepadHelpTextId  = MySpaceTexts.Gamepad_Help_Back;
        base.CloseButtonEnabled = true;
    }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            AddCaption(MyCommonTexts.ScreenCaptionLoadWorld);

            var     origin     = new Vector2(-0.4375f, -0.3f);
            Vector2 buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;

            m_sessionsTable                    = new MyGuiControlTable();
            m_sessionsTable.Position           = origin + new Vector2(buttonSize.X * 1.1f, 0f);
            m_sessionsTable.Size               = new Vector2(1075f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 0.15f);
            m_sessionsTable.OriginAlign        = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_sessionsTable.ColumnsCount       = 2;
            m_sessionsTable.VisibleRowsCount   = 17;
            m_sessionsTable.ItemSelected      += OnTableItemSelected;
            m_sessionsTable.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
            m_sessionsTable.ItemConfirmed     += OnTableItemConfirmedOrDoubleClick;
            m_sessionsTable.SetCustomColumnWidths(new float[] { 0.65f, 0.35f });
            m_sessionsTable.SetColumnComparison(0, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData));
            m_sessionsTable.SetColumnComparison(1, (a, b) => ((DateTime)a.UserData).CompareTo((DateTime)b.UserData));
            Controls.Add(m_sessionsTable);

            Vector2 buttonOrigin = origin + buttonSize * 0.5f;
            Vector2 buttonDelta  = MyGuiConstants.MENU_BUTTONS_POSITION_DELTA;

            // Continue last game
            // Load
            // Edit
            // Save
            // Delete
            Controls.Add(m_continueLastSave = MakeButton(buttonOrigin + buttonDelta * 0, MyCommonTexts.LoadScreenButtonContinueLastGame, OnContinueLastGameClick));
            Controls.Add(m_loadButton       = MakeButton(buttonOrigin + buttonDelta * 1, MyCommonTexts.LoadScreenButtonLoad, OnLoadClick));
            Controls.Add(m_editButton       = MakeButton(buttonOrigin + buttonDelta * 2, MyCommonTexts.LoadScreenButtonEditSettings, OnEditClick));
            Controls.Add(m_saveButton       = MakeButton(buttonOrigin + buttonDelta * 3, MyCommonTexts.LoadScreenButtonSaveAs, OnSaveAsClick));
            Controls.Add(m_deleteButton     = MakeButton(buttonOrigin + buttonDelta * 4, MyCommonTexts.LoadScreenButtonDelete, OnDeleteClick));
            m_publishButton = MakeButton(buttonOrigin + buttonDelta * 6, MyCommonTexts.LoadScreenButtonPublish, OnPublishClick);
            if (!MyFakes.XB1_PREVIEW)
            {
                Controls.Add(m_publishButton);
            }

            m_publishButton.SetToolTip(MyTexts.GetString(MyCommonTexts.LoadScreenButtonTooltipPublish));

            m_continueLastSave.Enabled = false;
            m_continueLastSave.DrawCrossTextureWhenDisabled = false;
            m_loadButton.DrawCrossTextureWhenDisabled       = false;
            m_editButton.DrawCrossTextureWhenDisabled       = false;
            m_deleteButton.DrawCrossTextureWhenDisabled     = false;
            m_saveButton.DrawCrossTextureWhenDisabled       = false;
            m_publishButton.DrawCrossTextureWhenDisabled    = false;

            CloseButtonEnabled = true;

            if (m_state == StateEnum.ListLoaded)
            {
                m_state = StateEnum.ListNeedsReload;
            }
        }
예제 #3
0
        /// <inheritdoc />
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            var     buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
            Vector2 leftButtonPositionOrigin = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM) + new Vector2(buttonSize.X / 2f, 0f);
            var     btn = MakeButton(leftButtonPositionOrigin - 9 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyStringId.GetOrCompute("Torch"), TorchButtonClicked);

            Controls.Add(btn);
        }
예제 #4
0
        /// <inheritdoc />
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            Vector2 minSizeGui = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
            Vector2 value      = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, 54, 54) + new Vector2(minSizeGui.X / 2f, 0f) + new Vector2(15f, 0f) / MyGuiConstants.GUI_OPTIMAL_SIZE;

            MyGuiControlButton myGuiControlButton = MakeButton(value - 9 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                                                               MyStringId.GetOrCompute("Torch"), TorchButtonClicked, MyCommonTexts.ToolTipExitToWindows);

            Controls.Add(myGuiControlButton);
            _elementsGroup.Invoke(this).Add(myGuiControlButton);
        }
예제 #5
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            AddCaption(MyCommonTexts.ScreenCaptionLoadWorld);

            var     origin     = new Vector2(-0.4375f, -0.3f);
            Vector2 buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;

            m_saveBrowser                    = new MyGuiControlSaveBrowser();
            m_saveBrowser.Position           = origin + new Vector2(buttonSize.X * 1.1f, 0f);
            m_saveBrowser.Size               = new Vector2(1075f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 0.15f);
            m_saveBrowser.OriginAlign        = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_saveBrowser.VisibleRowsCount   = 17;
            m_saveBrowser.ItemSelected      += OnTableItemSelected;
            m_saveBrowser.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
            m_saveBrowser.ItemConfirmed     += OnTableItemConfirmedOrDoubleClick;
            Controls.Add(m_saveBrowser);

            Vector2 buttonOrigin = origin + buttonSize * 0.5f;
            Vector2 buttonDelta  = MyGuiConstants.MENU_BUTTONS_POSITION_DELTA;

            // Continue last game
            // Load
            // Edit
            // Save
            // Delete
            Controls.Add(m_continueLastSave = MakeButton(buttonOrigin + buttonDelta * 0, MyCommonTexts.LoadScreenButtonContinueLastGame, OnContinueLastGameClick));
            Controls.Add(m_loadButton       = MakeButton(buttonOrigin + buttonDelta * 1, MyCommonTexts.LoadScreenButtonLoad, OnLoadClick));
            Controls.Add(m_editButton       = MakeButton(buttonOrigin + buttonDelta * 2, MyCommonTexts.LoadScreenButtonEditSettings, OnEditClick));
            Controls.Add(m_saveButton       = MakeButton(buttonOrigin + buttonDelta * 3, MyCommonTexts.LoadScreenButtonSaveAs, OnSaveAsClick));
            Controls.Add(m_deleteButton     = MakeButton(buttonOrigin + buttonDelta * 4, MyCommonTexts.LoadScreenButtonDelete, OnDeleteClick));
            Controls.Add(MakeButton(buttonOrigin + buttonDelta * 6, MyCommonTexts.ScreenMenuButtonSubscribedWorlds, OnWorkshopClick));
            m_publishButton = MakeButton(buttonOrigin + buttonDelta * 7, MyCommonTexts.LoadScreenButtonPublish, OnPublishClick);
            if (!MyFakes.XB1_PREVIEW)
            {
                Controls.Add(m_publishButton);
            }
            Controls.Add(m_backupsButton = MakeButton(buttonOrigin + buttonDelta * 8, MyCommonTexts.LoadScreenButtonBackups, OnBackupsButtonClick));

            m_publishButton.SetToolTip(MyTexts.GetString(MyCommonTexts.LoadScreenButtonTooltipPublish));

            m_continueLastSave.DrawCrossTextureWhenDisabled = false;
            m_loadButton.DrawCrossTextureWhenDisabled       = false;
            m_editButton.DrawCrossTextureWhenDisabled       = false;
            m_deleteButton.DrawCrossTextureWhenDisabled     = false;
            m_saveButton.DrawCrossTextureWhenDisabled       = false;
            m_publishButton.DrawCrossTextureWhenDisabled    = false;

            CloseButtonEnabled = true;
        }
예제 #6
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            new MyGuiControlScreenSwitchPanel(this, MyTexts.Get(MyCommonTexts.WorkshopScreen_Description));

            //AddCaption(MyCommonTexts.ScreenCaptionWorkshop);

            float MARGIN_TOP          = 0.18f;
            float MARGIN_BOTTOM       = 0.05f;
            float MARGIN_LEFT         = 0.23f;
            float MARGIN_RIGHT        = 0.035f;
            float MARGIN_LEFT_BUTTONS = 0.015f;

            var originR = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP);
            var sizeR   = m_size.Value / 2 - originR;

            sizeR.X -= MARGIN_RIGHT;
            sizeR.Y -= MARGIN_BOTTOM;
            var     origin     = -m_size.Value / 2 + new Vector2(MARGIN_LEFT_BUTTONS, MARGIN_TOP);
            Vector2 buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;

            m_worldsTable                    = new MyGuiControlTable();
            m_worldsTable.Position           = originR + new Vector2(0f, 0.004f);
            m_worldsTable.Size               = sizeR;
            m_worldsTable.OriginAlign        = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_worldsTable.ColumnsCount       = 1;
            m_worldsTable.VisibleRowsCount   = 20;
            m_worldsTable.ItemSelected      += OnTableItemSelected;
            m_worldsTable.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
            m_worldsTable.ItemConfirmed     += OnTableItemConfirmedOrDoubleClick;
            m_worldsTable.SetCustomColumnWidths(new float[] { 1.0f });
            m_worldsTable.SetColumnComparison(0, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData));
            Controls.Add(m_worldsTable);

            Vector2 buttonOrigin = origin + buttonSize * 0.5f;
            Vector2 buttonDelta  = MyGuiConstants.MENU_BUTTONS_POSITION_DELTA;

            // Load
            Controls.Add(m_loadButton           = MakeButton(buttonOrigin + buttonDelta * 0, MyCommonTexts.ScreenLoadSubscribedWorldCopyAndLoad, MyCommonTexts.ToolTipWorkshopCopyAndLoad, OnLoadClick));
            Controls.Add(m_copyButton           = MakeButton(buttonOrigin + buttonDelta * 1, MyCommonTexts.ScreenLoadSubscribedWorldCopyWorld, MyCommonTexts.ToolTipWorkshopCopyWorld, OnCopyClick));
            Controls.Add(m_openInWorkshopButton = MakeButton(buttonOrigin + buttonDelta * 2, MyCommonTexts.ScreenLoadSubscribedWorldOpenInWorkshop, MyCommonTexts.ToolTipWorkshopOpenInWorkshop, OnOpenInWorkshopClick));
            Controls.Add(m_refreshButton        = MakeButton(buttonOrigin + buttonDelta * 3, MyCommonTexts.ScreenLoadSubscribedWorldRefresh, MyCommonTexts.ToolTipWorkshopRefresh, OnRefreshClick));
            Controls.Add(m_browseWorkshopButton = MakeButton(buttonOrigin + buttonDelta * 4, MyCommonTexts.ScreenLoadSubscribedWorldBrowseWorkshop, MyCommonTexts.ToolTipWorkshopBrowseWorkshop, OnBrowseWorkshopClick));

            m_loadButton.DrawCrossTextureWhenDisabled           = false;
            m_openInWorkshopButton.DrawCrossTextureWhenDisabled = false;

            CloseButtonEnabled = true;
        }
예제 #7
0
    /// <summary>
    /// Draws the buttons in the main menu or pause menu. Also draws the Keen Software House logo and controllor hints.
    /// </summary>
    /// <param name="constructor"></param>
    public override void RecreateControls(bool constructor)
    {
        base.RecreateControls(constructor);
        m_elementGroup = new MyGuiControlElementGroup();
        Vector2 minSizeGui = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
        Vector2 leftButtonPositionOrigin = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM) + new Vector2(minSizeGui.X / 2f, 0f) + new Vector2(15f, 0f) / MyGuiConstants.GUI_OPTIMAL_SIZE;

        leftButtonPositionOrigin.Y += 0.043f;
        _ = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM) + new Vector2((0f - minSizeGui.X) / 2f, 0f);
        Vector2 lastButtonPosition = Vector2.Zero;

        if (MyGuiScreenGamePlay.Static == null)
        {
            CreateMainMenu(leftButtonPositionOrigin, out lastButtonPosition);
        }
        else
        {
            CreateInGameMenu(leftButtonPositionOrigin, out lastButtonPosition);
        }
        //Draws the controllor hints under the buttons.
        MyGuiControlLabel myGuiControlLabel = new MyGuiControlLabel(lastButtonPosition + new Vector2((0f - minSizeGui.X) / 2f, minSizeGui.Y / 2f));

        myGuiControlLabel.Name = MyGuiScreenBase.GAMEPAD_HELP_LABEL_NAME;
        Controls.Add(myGuiControlLabel);
        //Draws the Keen Software House Logo in the top righthand corner.
        MyGuiControlPanel myGuiControlPanel = new MyGuiControlPanel(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, 49, 82), MyGuiConstants.TEXTURE_KEEN_LOGO.MinSizeGui, null, null, null, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);

        myGuiControlPanel.BackgroundTexture = MyGuiConstants.TEXTURE_KEEN_LOGO;
        Controls.Add(myGuiControlPanel);
        //Refreshes the badges under the game logo.
        m_myBadgeHelper.RefreshGameLogo();
        //Creates the news and Dlc banners on the right of the screen.
        CreateRightSection(minSizeGui);
        CheckLowMemSwitchToLow();
        if (MyGuiScreenGamePlay.Static == null && !MyPlatformGameSettings.FEEDBACK_ON_EXIT && !string.IsNullOrEmpty(MyPlatformGameSettings.FEEDBACK_URL))
        {
            MyGuiSandbox.OpenUrl(MyPlatformGameSettings.FEEDBACK_URL, UrlOpenMode.ExternalWithConfirm, MyTexts.Get(MyCommonTexts.MessageBoxTextBetaFeedback), MyTexts.Get(MyCommonTexts.MessageBoxCaptionBetaFeedback));
        }
    }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            AddCaption(MyCommonTexts.ScreenCaptionWorkshop);

            var     origin     = new Vector2(-0.4375f, -0.3f);
            Vector2 buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;

            m_worldsTable                    = new MyGuiControlTable();
            m_worldsTable.Position           = origin + new Vector2(buttonSize.X * 1.1f, 0f);
            m_worldsTable.Size               = new Vector2(1075f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 1f);
            m_worldsTable.OriginAlign        = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_worldsTable.ColumnsCount       = 1;
            m_worldsTable.VisibleRowsCount   = 17;
            m_worldsTable.ItemSelected      += OnTableItemSelected;
            m_worldsTable.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
            m_worldsTable.ItemConfirmed     += OnTableItemConfirmedOrDoubleClick;
            m_worldsTable.SetCustomColumnWidths(new float[] { 1.0f });
            m_worldsTable.SetColumnComparison(0, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData));
            Controls.Add(m_worldsTable);

            Vector2 buttonOrigin = origin + buttonSize * 0.5f;
            Vector2 buttonDelta  = MyGuiConstants.MENU_BUTTONS_POSITION_DELTA;

            // Load
            Controls.Add(m_loadButton           = MakeButton(buttonOrigin + buttonDelta * 0, MyCommonTexts.ScreenLoadSubscribedWorldCopyAndLoad, MyCommonTexts.ToolTipWorkshopCopyAndLoad, OnLoadClick));
            Controls.Add(m_copyButton           = MakeButton(buttonOrigin + buttonDelta * 1, MyCommonTexts.ScreenLoadSubscribedWorldCopyWorld, MyCommonTexts.ToolTipWorkshopCopyWorld, OnCopyClick));
            Controls.Add(m_openInWorkshopButton = MakeButton(buttonOrigin + buttonDelta * 2, MyCommonTexts.ScreenLoadSubscribedWorldOpenInWorkshop, MyCommonTexts.ToolTipWorkshopOpenInWorkshop, OnOpenInWorkshopClick));
            Controls.Add(m_refreshButton        = MakeButton(buttonOrigin + buttonDelta * 3, MyCommonTexts.ScreenLoadSubscribedWorldRefresh, MyCommonTexts.ToolTipWorkshopRefresh, OnRefreshClick));
            Controls.Add(m_browseWorkshopButton = MakeButton(buttonOrigin + buttonDelta * 4, MyCommonTexts.ScreenLoadSubscribedWorldBrowseWorkshop, MyCommonTexts.ToolTipWorkshopBrowseWorkshop, OnBrowseWorkshopClick));

            m_loadButton.DrawCrossTextureWhenDisabled           = false;
            m_openInWorkshopButton.DrawCrossTextureWhenDisabled = false;

            CloseButtonEnabled = true;
        }
예제 #9
0
        //  Because only main menu's controla depends on fullscreen pixel coordinates (not normalized), after we change
        //  screen resolution we need to recreate controls too. Otherwise they will be still on old/bad positions, and
        //  for example when changing from 1920x1200 to 800x600 they would be out of screen
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);


            // Enable background fade when we're in game, but in main menu we disable it.
            var     buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
            Vector2 leftButtonPositionOrigin  = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM) + new Vector2(buttonSize.X / 2f, 0f);
            Vector2 rightButtonPositionOrigin = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM) + new Vector2(-buttonSize.X / 2f, 0f);

            // In main menu
            if (MyGuiScreenGamePlay.Static == null)
            {
                EnabledBackgroundFade = false;
                // Left main menu part

                var a = MyGuiManager.GetSafeFullscreenRectangle();
                var fullScreenSize = new Vector2(a.Width / (a.Height * (4 / 3f)), 1f);

                // New Game
                // Load world
                // Join world
                // Workshop
                //
                // Options
                // Help
                // Credits
                // Exit to windows
                int buttonIndex = MyPerGameSettings.MultiplayerEnabled ? 9 : 8;
                Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA - MyGuiConstants.MENU_BUTTONS_POSITION_DELTA / 2, MyCommonTexts.ScreenMenuButtonContinueGame, OnContinueGameClicked));
                Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonCampaign, OnClickNewGame));
                Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonLoadGame, OnClickLoad));
                if (MyPerGameSettings.MultiplayerEnabled)
                {
                    Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonJoinGame, OnJoinWorld));
                }
                Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonCustomGame, OnCustomGameClicked));
                --buttonIndex;
                //Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonSubscribedWorlds, OnClickSubscribedWorlds, MyCommonTexts.ToolTipMenuSubscribedWorlds));
                Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonOptions, OnClickOptions));
                Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonHelp, OnClickHelp));
                Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonCredits, OnClickCredits));
                Controls.Add(MakeButton(leftButtonPositionOrigin - (buttonIndex--) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonExitToWindows, OnClickExitToWindows));

                Vector2 textRightTopPosition = MyGuiManager.GetScreenTextRightTopPosition();
                Vector2 position             = textRightTopPosition + 8f * MyGuiConstants.CONTROLS_DELTA + new Vector2(-.1f, .06f);
            }
            else // In-game
            {
                MyAnalyticsHelper.ReportActivityStart(null, "show_main_menu", string.Empty, "gui", string.Empty);

                EnabledBackgroundFade = true;
                int buttonRowIndex = Sync.MultiplayerActive ? 6 : 5;

                // Save
                // Load button (only on dev)
                //
                // Options
                // Help
                // Exit to main menu
                var saveButton   = MakeButton(leftButtonPositionOrigin - ((float)(--buttonRowIndex)) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonSave, OnClickSaveWorld);
                var saveAsButton = MakeButton(leftButtonPositionOrigin - ((float)(--buttonRowIndex)) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.LoadScreenButtonSaveAs, OnClickSaveAs);

                if (!Sync.IsServer || (MySession.Static.Battle))
                {
                    saveButton.Enabled = false;
                    saveButton.ShowTooltipWhenDisabled = true;
                    saveButton.SetToolTip(MyCommonTexts.NotificationClientCannotSave);

                    saveAsButton.Enabled = false;
                    saveButton.ShowTooltipWhenDisabled = true;
                    saveButton.SetToolTip(MyCommonTexts.NotificationClientCannotSave);
                }

                Controls.Add(saveButton);
                Controls.Add(saveAsButton);

                //               --buttonRowIndex; // empty line
                if (Sync.MultiplayerActive)
                {
                    Controls.Add(MakeButton(leftButtonPositionOrigin - ((float)(--buttonRowIndex)) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonPlayers, OnClickPlayers));
                }
                Controls.Add(MakeButton(leftButtonPositionOrigin - ((float)(--buttonRowIndex)) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonOptions, OnClickOptions));
                Controls.Add(MakeButton(leftButtonPositionOrigin - ((float)(--buttonRowIndex)) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonHelp, OnClickHelp));
                Controls.Add(MakeButton(leftButtonPositionOrigin - ((float)(--buttonRowIndex)) * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonExitToMainMenu, OnExitToMainMenuClick));
            }

            var logoPanel = new MyGuiControlPanel(
                position: MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, 54, 84),
                size: MyGuiConstants.TEXTURE_KEEN_LOGO.MinSizeGui,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP
                );

            logoPanel.BackgroundTexture = MyGuiConstants.TEXTURE_KEEN_LOGO;
            Controls.Add(logoPanel);

            // Recommend button
            Vector2 pos = rightButtonPositionOrigin - 8f * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA;

            Controls.Add(MakeButton(pos, MyCommonTexts.ScreenMenuButtonRecommend, OnClickRecommend));
            m_newsControl = new MyGuiControlNews()
            {
                Position    = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM) - 7f * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                Size        = new Vector2(0.4f, 0.28f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
            };
            Controls.Add(m_newsControl);

            var webButton = MakeButton(
                MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM, 70),
                MySpaceTexts.Blank, OnClickGameWeb);

            webButton.Text        = MyPerGameSettings.GameWebUrl;
            webButton.VisualStyle = MyGuiControlButtonStyleEnum.UrlText;
            Controls.Add(webButton);

            var reportButton = MakeButton(
                new Vector2(m_newsControl.Position.X, m_newsControl.Position.Y + m_newsControl.Size.Y),
                //MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, 140,80),
                MyCommonTexts.ReportBug, OnClickReportBug);

            reportButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            reportButton.VisualStyle = MyGuiControlButtonStyleEnum.UrlText;
            Controls.Add(reportButton);

            CheckLowMemSwitchToLow();
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            AddCaption(MyCommonTexts.ScreenCaptionControls);

            MyInput.Static.TakeSnapshot();

            var topCenter    = m_size.Value * new Vector2(0f, -0.5f);
            var bottomCenter = m_size.Value * new Vector2(0f, 0.5f);
            var topLeft      = m_size.Value * -0.5f;

            m_controlsOriginLeft  = topLeft + new Vector2(96f, 122f) / MyGuiConstants.GUI_OPTIMAL_SIZE;
            m_controlsOriginRight = topCenter + new Vector2(-60f, 122f) / MyGuiConstants.GUI_OPTIMAL_SIZE;

            #region Add Revert, OK, Cancel and selection combobox
            var   buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
            float buttonsY   = bottomCenter.Y - 110f / MyGuiConstants.GUI_OPTIMAL_SIZE.Y;
            var   okButton   = new MyGuiControlButton(
                position: new Vector2(-buttonSize.X - 20f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, buttonsY),
                size: MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                text: MyTexts.Get(MyCommonTexts.Ok),
                onButtonClick: OnOkClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            var cancelButton = new MyGuiControlButton(
                position: new Vector2(0f, buttonsY),
                size: MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                text: MyTexts.Get(MyCommonTexts.Cancel),
                onButtonClick: OnCancelClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            var resetButton = new MyGuiControlButton(
                position: new Vector2(buttonSize.X + 20f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, buttonsY),
                size: MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                text: MyTexts.Get(MyCommonTexts.Revert),
                onButtonClick: OnResetDefaultsClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(okButton);
            Controls.Add(cancelButton);
            Controls.Add(resetButton);

            //  Page selection combobox
            m_currentControlType = MyGuiControlTypeEnum.General;
            var cBoxPosition = m_controlsOriginRight + 0.5f * MyGuiConstants.CONTROLS_DELTA +
                               new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0) - new Vector2(0.065f, 0);
            m_controlTypeList = new MyGuiControlCombobox(cBoxPosition);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.General, MyCommonTexts.ControlTypeGeneral);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Navigation, MyCommonTexts.ControlTypeNavigation);

            //by Gregory this is temporary for Medieval Engineers. Do not show Navigation2 screen if Navigation2 tag is not found
            var DoNotAddNavigation2 = true;
            foreach (var control in MyInput.Static.GetGameControlsList())
            {
                if (control.GetControlTypeEnum() == MyGuiControlTypeEnum.Navigation2)
                {
                    DoNotAddNavigation2 = false;
                    break;
                }
            }

            if (!DoNotAddNavigation2)
            {
                m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Navigation2, MyCommonTexts.ControlTypeNavigation2);
            }

            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.ToolsOrWeapons, MyCommonTexts.ControlTypeToolsOrWeapons);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.ToolsOrWeapons2, MyCommonTexts.ControlTypeToolsOrWeapons2);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Systems1, MyCommonTexts.ControlTypeSystems1);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Systems2, MyCommonTexts.ControlTypeSystems2);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Systems3, MyCommonTexts.ControlTypeSystems3);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Spectator, MyCommonTexts.Spectator);
            m_controlTypeList.SelectItemByKey((int)m_currentControlType);
            Controls.Add(m_controlTypeList);

            #endregion

            AddControls();

            ActivateControls(m_currentControlType);

            CloseButtonEnabled = true;
        }
        private void AddControlsByType(MyGuiControlTypeEnum type)
        {
            //  "General" page is little bit too complex, so I need to create it separately.
            if (type == MyGuiControlTypeEnum.General)
            {
                AddGeneralControls();
                return;
            }

            var buttonStyle = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.ControlSetting);

            Vector2 controlsOriginRight = m_controlsOriginRight;

            controlsOriginRight.X -= 0.02f;
            m_allControls[type]    = new List <MyGuiControlBase>();
            float i           = 2;
            float buttonScale = 0.85f;

            var controls = MyInput.Static.GetGameControlsList();

            var keyboardLabel   = MakeLabel(MyCommonTexts.ScreenOptionsControls_Keyboard, Vector2.Zero);
            var keyboard2Label  = MakeLabel(MyCommonTexts.ScreenOptionsControls_Keyboard2, Vector2.Zero);
            var mouseLabel      = MakeLabel(MyCommonTexts.ScreenOptionsControls_Mouse, Vector2.Zero);
            var gamepadLabel    = (MyFakes.ENABLE_JOYSTICK_SETTINGS) ? MakeLabel(MyCommonTexts.ScreenOptionsControls_Gamepad, Vector2.Zero) : null;
            var analogAxesLabel = (MyFakes.ENABLE_JOYSTICK_SETTINGS) ? MakeLabel(MyCommonTexts.ScreenOptionsControls_AnalogAxes, Vector2.Zero) : null;

            float columnWidth = 1.1f * Math.Max(Math.Max(keyboardLabel.Size.X, keyboard2Label.Size.X),
                                                Math.Max(mouseLabel.Size.X, buttonStyle.SizeOverride.Value.X));

            var position = (i - 1) * MyGuiConstants.CONTROLS_DELTA + controlsOriginRight;

            position.X             += columnWidth * 0.5f; // make labels centered
            keyboardLabel.Position  = position; position.X += columnWidth;
            keyboard2Label.Position = position; position.X += columnWidth;
            mouseLabel.Position     = position;

            m_allControls[type].Add(keyboardLabel);
            m_allControls[type].Add(keyboard2Label);
            m_allControls[type].Add(mouseLabel);

            if (MyFakes.ENABLE_JOYSTICK_SETTINGS)
            {
                //position.X += columnWidth; gamepadLabel.Position = position;
                //position.X += columnWidth; analogAxesLabel.Position = position;

                //m_allControls[type].Add(gamepadLabel);
                //m_allControls[type].Add(analogAxesLabel);
            }

            foreach (MyControl control in controls)
            {
                if (control.GetControlTypeEnum() == type)
                {
                    m_allControls[type].Add(new MyGuiControlLabel(
                                                position: m_controlsOriginLeft + i * MyGuiConstants.CONTROLS_DELTA,
                                                text: MyTexts.GetString(control.GetControlName())));

                    position    = controlsOriginRight + i * MyGuiConstants.CONTROLS_DELTA;
                    position.X += columnWidth * 0.5f;

                    // This is column for keyboard 1
                    var key1Button = MakeControlButton(control, position, MyGuiInputDeviceEnum.Keyboard);
                    m_allControls[type].Add(key1Button);
                    m_key1Buttons.Add(key1Button);
                    position.X += columnWidth;

                    // This is column for keyboard 2
                    var key2Button = MakeControlButton(control, position, MyGuiInputDeviceEnum.KeyboardSecond);
                    m_allControls[type].Add(key2Button);
                    m_key2Buttons.Add(key2Button);
                    position.X += columnWidth;

                    // This is column for mouse
                    var mouseButton = MakeControlButton(control, position, MyGuiInputDeviceEnum.Mouse);
                    m_allControls[type].Add(mouseButton);
                    m_mouseButtons.Add(mouseButton);
                    position.X += columnWidth;

                    if (MyFakes.ENABLE_JOYSTICK_SETTINGS)
                    {
                        //// This is column for joystick
                        //var joyButton = MakeControlButton(control, position, MyGuiInputDeviceEnum.Joystick);
                        //m_allControls[type].Add(joyButton);
                        //m_joystickButtons.Add(joyButton);
                        //position.X += columnWidth;

                        //// This is column for joystick axes
                        //var joyAxis = MakeControlButton(control, position, MyGuiInputDeviceEnum.JoystickAxis);
                        //m_allControls[type].Add(joyAxis);
                        //m_joystickAxes.Add(joyAxis);
                        //position.X += columnWidth;
                    }

                    i += buttonScale;
                }
            }
        }
예제 #12
0
    public override void RecreateControls(bool constructor)
    {
        base.RecreateControls(constructor);
        m_elementGroup = new MyGuiControlElementGroup();
        AddCaption(MyCommonTexts.ScreenCaptionOptions, null, new Vector2(0f, 0.003f));
        m_backgroundTransition = MySandboxGame.Config.UIBkOpacity;
        m_guiTransition        = MySandboxGame.Config.UIOpacity;
        MyGuiControlSeparatorList myGuiControlSeparatorList = new MyGuiControlSeparatorList();

        myGuiControlSeparatorList.AddHorizontal(-new Vector2(m_size.Value.X * 0.83f / 2f, m_size.Value.Y / 2f - 0.075f), m_size.Value.X * 0.83f);
        Controls.Add(myGuiControlSeparatorList);
        MyGuiControlSeparatorList myGuiControlSeparatorList2 = new MyGuiControlSeparatorList();
        Vector2 start = -new Vector2(m_size.Value.X * 0.83f / 2f, (0f - m_size.Value.Y) / 2f + 0.05f);

        myGuiControlSeparatorList2.AddHorizontal(start, m_size.Value.X * 0.83f);
        Controls.Add(myGuiControlSeparatorList2);
        MyStringId         optionsScreen_Help_Menu = MySpaceTexts.OptionsScreen_Help_Menu;
        Vector2            vector             = new Vector2(0.001f, (0f - m_size.Value.Y) / 2f + 0.126f);
        int                num                = 0;
        MyGuiControlButton myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonGame), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
        {
            MyGuiSandbox.AddScreen(new MyGuiScreenOptionsGame(m_isLimitedMenu));
        });

        myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu;
        Controls.Add(myGuiControlButton);
        m_elementGroup.Add(myGuiControlButton);
        if (!m_isLimitedMenu)
        {
            myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonDisplay), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
            {
                MyGuiSandbox.AddScreen(new MyGuiScreenOptionsDisplay());
            });
            myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu;
            Controls.Add(myGuiControlButton);
            m_elementGroup.Add(myGuiControlButton);
            myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonGraphics), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
            {
                MyGuiSandbox.AddScreen(new MyGuiScreenOptionsGraphics());
            });
            myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu;
            Controls.Add(myGuiControlButton);
            m_elementGroup.Add(myGuiControlButton);
        }
        myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonAudio), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
        {
            MyGuiSandbox.AddScreen(new MyGuiScreenOptionsAudio(m_isLimitedMenu));
        });
        myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu;
        Controls.Add(myGuiControlButton);
        m_elementGroup.Add(myGuiControlButton);
        myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonControls), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
        {
            MyGuiSandbox.AddScreen(new MyGuiScreenOptionsControls());
        });
        myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu;
        Controls.Add(myGuiControlButton);
        m_elementGroup.Add(myGuiControlButton);
        myGuiControlButton = new MyGuiControlButton(vector + num ++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonCredits), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate(MyGuiControlButton sender)
        {
            OnClickCredits(sender);
        });
        myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu;
        Controls.Add(myGuiControlButton);
        m_elementGroup.Add(myGuiControlButton);
        Vector2           minSizeGui        = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
        MyGuiControlLabel myGuiControlLabel = new MyGuiControlLabel(new Vector2(0f, start.Y + minSizeGui.Y / 2f), null, null, null, 0.8f, "Blue", MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

        myGuiControlLabel.Name = MyGuiScreenBase.GAMEPAD_HELP_LABEL_NAME;
        Controls.Add(myGuiControlLabel);
        base.GamepadHelpTextId  = MySpaceTexts.Gamepad_Help_Back;
        base.CloseButtonEnabled = true;
    }
예제 #13
0
    public override void RecreateControls(bool constructor)
    {
        base.RecreateControls(constructor);

        m_elemtents = new MyGuiControlElementGroup();
        m_elemtents.HighlightChanged += OnHighlightChange;
        if (!m_pauseGame)
        {
            if (MyGuiScreenGamePlay.Static == null)
            {
                MyGuiControlButton button = null;
                foreach (var c in Controls)
                {
                    if (c is MyGuiControlButton)
                    {
                        m_elemtents.Add(c);
                        if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonContinueGame))
                        {
                            button = (MyGuiControlButton)c;
                        }
                    }
                }
                if (button != null)
                {
                    int index = Controls.IndexOf(button);
                    MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonContinueGame, NullButtonAction);
                    Controls.Add(newGameButton);
                    m_elemtents.Add(newGameButton);
                    newGameButton.Name = button.Name;
                    Controls[index]    = newGameButton;
                    newGameButton.SetToolTip(button.Tooltips);
                }
                MyGuiControlButton button2 = null;
                foreach (var c in Controls)
                {
                    if (c is MyGuiControlButton)
                    {
                        m_elemtents.Add(c);
                        if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonCampaign))
                        {
                            button2 = (MyGuiControlButton)c;
                        }
                    }
                }
                if (button2 != null)
                {
                    int index = Controls.IndexOf(button2);
                    MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                    Controls.Add(newGameButton);
                    m_elemtents.Add(newGameButton);
                    newGameButton.Name = button2.Name;
                    Controls[index]    = newGameButton;
                    newGameButton.SetToolTip(button2.Tooltips);
                }
                MyGuiControlButton button3 = null;
                foreach (var c in Controls)
                {
                    if (c is MyGuiControlButton)
                    {
                        m_elemtents.Add(c);
                        if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonLoadGame))
                        {
                            button3 = (MyGuiControlButton)c;
                        }
                    }
                }
                if (button3 != null)
                {
                    int index = Controls.IndexOf(button3);
                    MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                    Controls.Add(newGameButton);
                    m_elemtents.Add(newGameButton);
                    newGameButton.Name = button3.Name;
                    Controls[index]    = newGameButton;
                    newGameButton.SetToolTip(button3.Tooltips);
                }
                MyGuiControlButton button4 = null;
                foreach (var c in Controls)
                {
                    if (c is MyGuiControlButton)
                    {
                        m_elemtents.Add(c);
                        if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonJoinGame))
                        {
                            button4 = (MyGuiControlButton)c;
                        }
                    }
                }
                if (button4 != null)
                {
                    int index = Controls.IndexOf(button4);
                    MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                    Controls.Add(newGameButton);
                    m_elemtents.Add(newGameButton);
                    newGameButton.Name = button4.Name;
                    Controls[index]    = newGameButton;
                    newGameButton.SetToolTip(button4.Tooltips);
                }
                MyGuiControlButton button5 = null;
                foreach (var c in Controls)
                {
                    if (c is MyGuiControlButton)
                    {
                        m_elemtents.Add(c);
                        if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonOptions))
                        {
                            button5 = (MyGuiControlButton)c;
                        }
                    }
                }
                if (button5 != null)
                {
                    int index = Controls.IndexOf(button5);
                    MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                    Controls.Add(newGameButton);
                    m_elemtents.Add(newGameButton);
                    newGameButton.Name = button5.Name;
                    Controls[index]    = newGameButton;
                    newGameButton.SetToolTip(button5.Tooltips);
                }
                MyGuiControlButton button6 = null;
                foreach (var c in Controls)
                {
                    if (c is MyGuiControlButton)
                    {
                        m_elemtents.Add(c);
                        if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonInventory))
                        {
                            button6 = (MyGuiControlButton)c;
                        }
                    }
                }
                if (button6 != null)
                {
                    int index = Controls.IndexOf(button6);
                    MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                    Controls.Add(newGameButton);
                    m_elemtents.Add(newGameButton);
                    newGameButton.Name = button6.Name;
                    Controls[index]    = newGameButton;
                    newGameButton.SetToolTip(button6.Tooltips);
                }
                MyGuiControlButton button7 = null;
                foreach (var c in Controls)
                {
                    if (c is MyGuiControlButton)
                    {
                        m_elemtents.Add(c);
                        if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonExitToWindows))
                        {
                            button7 = (MyGuiControlButton)c;
                        }
                    }
                }
                if (button7 != null)
                {
                    int index = Controls.IndexOf(button7);
                    MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                    Controls.Add(newGameButton);
                    m_elemtents.Add(newGameButton);
                    newGameButton.Name = button7.Name;
                    Controls[index]    = newGameButton;
                    newGameButton.SetToolTip(button7.Tooltips);
                }
            }
        }



        if (m_pauseGame)
        {
            MyGuiControlButton button8 = null;
            foreach (var c in Controls)
            {
                if (c is MyGuiControlButton)
                {
                    m_elemtents.Add(c);
                    if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonSave))
                    {
                        button8 = (MyGuiControlButton)c;
                    }
                }
            }
            if (button8 != null)
            {
                int index = Controls.IndexOf(button8);
                MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonContinueGame, NullButtonAction);
                Controls.Add(newGameButton);
                m_elemtents.Add(newGameButton);
                newGameButton.Name = button8.Name;
                Controls[index]    = newGameButton;
                newGameButton.SetToolTip(button8.Tooltips);
            }
            MyGuiControlButton button9 = null;
            foreach (var c in Controls)
            {
                if (c is MyGuiControlButton)
                {
                    m_elemtents.Add(c);
                    if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.LoadScreenButtonSaveAs))
                    {
                        button9 = (MyGuiControlButton)c;
                    }
                }
            }
            if (button9 != null)
            {
                int index = Controls.IndexOf(button9);
                MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                Controls.Add(newGameButton);
                m_elemtents.Add(newGameButton);
                newGameButton.Name = button9.Name;
                Controls[index]    = newGameButton;
                newGameButton.SetToolTip(button9.Tooltips);
            }
            MyGuiControlButton button10 = null;
            foreach (var c in Controls)
            {
                if (c is MyGuiControlButton)
                {
                    m_elemtents.Add(c);
                    if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonPlayers))
                    {
                        button10 = (MyGuiControlButton)c;
                    }
                }
            }
            if (button10 != null)
            {
                int index = Controls.IndexOf(button10);
                MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                Controls.Add(newGameButton);
                m_elemtents.Add(newGameButton);
                newGameButton.Name = button10.Name;
                Controls[index]    = newGameButton;
                newGameButton.SetToolTip(button10.Tooltips);
            }
            MyGuiControlButton button11 = null;
            foreach (var c in Controls)
            {
                if (c is MyGuiControlButton)
                {
                    m_elemtents.Add(c);
                    if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonOptions))
                    {
                        button11 = (MyGuiControlButton)c;
                    }
                }
            }
            if (button11 != null)
            {
                int index = Controls.IndexOf(button11);
                MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                Controls.Add(newGameButton);
                m_elemtents.Add(newGameButton);
                newGameButton.Name = button11.Name;
                Controls[index]    = newGameButton;
                newGameButton.SetToolTip(button11.Tooltips);
            }
            MyGuiControlButton button12 = null;
            foreach (var c in Controls)
            {
                if (c is MyGuiControlButton)
                {
                    m_elemtents.Add(c);
                    if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonExitToMainMenu))
                    {
                        button12 = (MyGuiControlButton)c;
                    }
                }
            }
            if (button12 != null)
            {
                int index = Controls.IndexOf(button12);
                MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction);
                Controls.Add(newGameButton);
                m_elemtents.Add(newGameButton);
                newGameButton.Name = button12.Name;
                Controls[index]    = newGameButton;
                newGameButton.SetToolTip(button12.Tooltips);
            }
        }
        m_elementGroup = new MyGuiControlElementGroup();
        Vector2 minSizeGui = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
        Vector2 leftButtonPositionOrigin = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM) + new Vector2(minSizeGui.X / 2f, 0f) + new Vector2(15f, 0f) / MyGuiConstants.GUI_OPTIMAL_SIZE;

        leftButtonPositionOrigin.Y += 0.043f;
        _ = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM) + new Vector2((0f - minSizeGui.X) / 2f, 0f);
        Vector2 lastButtonPosition = Vector2.Zero;

        if (MyGuiScreenGamePlay.Static == null)
        {
            CreateMainMenu();
        }
        else
        {
            CreateInGameMenu();
        }
        //Draws the controllor hints under the buttons.
        MyGuiControlLabel myGuiControlLabel = new MyGuiControlLabel(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, 49, 82));

        myGuiControlLabel.Name = MyGuiScreenBase.GAMEPAD_HELP_LABEL_NAME;
        Controls.Add(myGuiControlLabel);
        //Refreshes the badges under the game logo.
        m_myBadgeHelper.RefreshGameLogo();
        CheckLowMemSwitchToLow();
        if (MyGuiScreenGamePlay.Static == null && !MyPlatformGameSettings.FEEDBACK_ON_EXIT && !string.IsNullOrEmpty(MyPlatformGameSettings.FEEDBACK_URL))
        {
            MyGuiSandbox.OpenUrl(MyPlatformGameSettings.FEEDBACK_URL, UrlOpenMode.ExternalWithConfirm, MyTexts.Get(MyCommonTexts.MessageBoxTextBetaFeedback), MyTexts.Get(MyCommonTexts.MessageBoxCaptionBetaFeedback));
        }
    }
예제 #14
0
        void InitPageControls(MyGuiControlTabPage page)
        {
            page.Controls.Clear();

            var     origin     = new Vector2(-0.64f, -0.35f);
            Vector2 buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;

            m_gamesTable                  = new MyGuiControlTable();
            m_gamesTable.Position         = origin + new Vector2(buttonSize.X, 0f);
            m_gamesTable.Size             = new Vector2(1465f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 1f);
            m_gamesTable.OriginAlign      = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_gamesTable.VisibleRowsCount = 16;
            page.Controls.Add(m_gamesTable);


            Vector2 buttonOrigin = origin + new Vector2(0.28f, 0.66f);
            Vector2 buttonDelta  = new Vector2(0.2f, 0.0f);

            int numControls = 0;

            page.Controls.Add(m_joinButton    = MakeButton(buttonOrigin + buttonDelta * numControls++, MyCommonTexts.ScreenMenuButtonJoinWorld, MyCommonTexts.ScreenMenuButtonJoinWorld, null));
            page.Controls.Add(m_refreshButton = MakeButton(buttonOrigin + buttonDelta * numControls++, MyCommonTexts.ScreenLoadSubscribedWorldRefresh, MyCommonTexts.ScreenLoadSubscribedWorldRefresh, null));
            m_joinButton.Enabled = false;

            var checkboxPos   = buttonOrigin + new Vector2(-0.09f, -0.02f) + numControls * buttonDelta;
            var checkBoxDelta = new Vector2(0.0f, 0.04f);

            var blockSearchLabel = new MyGuiControlLabel()
            {
                Position = checkboxPos + new Vector2(0f, -0.04f),
                Size     = new Vector2(0.05f, 0.02f),
                TextEnum = MyCommonTexts.JoinGame_SearchLabel
            };

            page.Controls.Add(blockSearchLabel);

            m_blockSearch = new MyGuiControlTextbox()
            {
                Position = blockSearchLabel.Position + new Vector2(0.255f, 0f),
                Size     = new Vector2(0.27f, 0.02f)
            };
            m_blockSearch.SetToolTip(MyCommonTexts.JoinGame_SearchTooltip);
            m_blockSearch.TextChanged += OnBlockSearchTextChanged;
            page.Controls.Add(m_blockSearch);

            m_blockSearchClear = new MyGuiControlButton()
            {
                Position               = m_blockSearch.Position + new Vector2(0.13f, 0f),
                OriginAlign            = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                VisualStyle            = MyGuiControlButtonStyleEnum.Close,
                ActivateOnMouseRelease = true
            };
            m_blockSearchClear.ButtonClicked += BlockSearchClear_ButtonClicked;
            page.Controls.Add(m_blockSearchClear);

            numControls = 0;

            m_showOnlyCompatibleText = new MyGuiControlButton(
                position: checkboxPos + checkBoxDelta * numControls + new Vector2(buttonSize.Y * 0.5f, 0),
                text: MyTexts.Get(MyCommonTexts.MultiplayerCompatibleVersions),
                toolTip: MyTexts.GetString(MyCommonTexts.MultiplayerCompatibleVersions),
                onButtonClick: OnShowOnlyCompatibleTextClick,
                visualStyle: MyGuiControlButtonStyleEnum.ClickableText,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            page.Controls.Add(m_showOnlyCompatibleText);
            bool compatibleChecked = true;

            if (m_showOnlyCompatibleGames != null)
            {
                compatibleChecked = m_showOnlyCompatibleGames.IsChecked;
            }
            m_showOnlyCompatibleGames           = new MyGuiControlCheckbox(checkboxPos + checkBoxDelta * numControls++, null, null, MySandboxGame.Config.MultiplayerShowCompatible, MyGuiControlCheckboxStyleEnum.Debug, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_showOnlyCompatibleGames.IsChecked = compatibleChecked;
            page.Controls.Add(m_showOnlyCompatibleGames);

            bool showSameMods = true;

            if (m_showOnlyWithSameMods != null)
            {
                showSameMods = m_showOnlyWithSameMods.IsChecked;
            }
            m_showOnlyWithSameMods = new MyGuiControlCheckbox(
                position: checkboxPos + checkBoxDelta * numControls,
                visualStyle: MyGuiControlCheckboxStyleEnum.Debug,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_showOnlyWithSameMods.IsChecked = showSameMods;
            page.Controls.Add(m_showOnlyWithSameMods);

            m_showOnlyWithSameText = new MyGuiControlButton(
                position: checkboxPos + checkBoxDelta * numControls + new Vector2(buttonSize.Y * 0.5f, 0),
                text: MyTexts.Get(MyCommonTexts.MultiplayerJoinSameGameData),
                toolTip: MyTexts.GetString(MyCommonTexts.MultiplayerJoinSameGameData),
                onButtonClick: OnShowOnlySameModsClick,
                visualStyle: MyGuiControlButtonStyleEnum.ClickableText,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            page.Controls.Add(m_showOnlyWithSameText);

            checkboxPos = buttonOrigin + new Vector2(-0.09f, -0.02f) + 3 * buttonDelta;
            numControls = 0;

            bool showOnlyFriends = false;

            if (m_showOnlyFriends != null)
            {
                showOnlyFriends = m_showOnlyFriends.IsChecked;
            }
            m_showOnlyFriends = new MyGuiControlCheckbox(
                position: checkboxPos + checkBoxDelta * numControls + new Vector2(buttonSize.Y * 0.5f, 0),
                visualStyle: MyGuiControlCheckboxStyleEnum.Debug,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_showOnlyFriends.IsChecked = showOnlyFriends;
            page.Controls.Add(m_showOnlyFriends);

            m_showOnlyFriendsText = new MyGuiControlButton(
                position: checkboxPos + checkBoxDelta * numControls++ + new Vector2(buttonSize.Y, 0),
                text: MyTexts.Get(MyCommonTexts.MultiplayerJoinFriendsGames),
                toolTip: MyTexts.GetString(MyCommonTexts.MultiplayerJoinFriendsGames),
                onButtonClick: OnFriendsOnlyTextClick,
                visualStyle: MyGuiControlButtonStyleEnum.ClickableText,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            page.Controls.Add(m_showOnlyFriendsText);

            bool allowedGroups = true;

            if (m_allowedGroups != null)
            {
                allowedGroups = m_allowedGroups.IsChecked;
            }
            m_allowedGroups = new MyGuiControlCheckbox(
                position: checkboxPos + checkBoxDelta * numControls + new Vector2(buttonSize.Y * 0.5f, 0),
                visualStyle: MyGuiControlCheckboxStyleEnum.Debug,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_allowedGroups.IsChecked = allowedGroups;
            page.Controls.Add(m_allowedGroups);

            m_allowedGroupsText = new MyGuiControlButton(
                position: checkboxPos + checkBoxDelta * numControls++ + new Vector2(buttonSize.Y, 0),
                text: MyTexts.Get(MyCommonTexts.MultiplayerJoinAllowedGroups),
                toolTip: MyTexts.GetString(MyCommonTexts.MultiplayerJoinAllowedGroups),
                onButtonClick: OnAllowedGroupsTextClick,
                visualStyle: MyGuiControlButtonStyleEnum.ClickableText,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            page.Controls.Add(m_allowedGroupsText);
        }