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

            AddCaption(MyStringId.GetOrCompute("Waiting for other players"));

            var label = new MyGuiControlLabel(text: "Game will start when all players join the world", originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

            m_timeOutLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

            m_leaveButton = new MyGuiControlButton(text: new StringBuilder("Leave"), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE,
                                                   size: new Vector2(190f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnLeaveClicked);

            const float colMargin = 60f;
            const float rowHeight = 65f;
            var         layout    = new MyLayoutTable(this);

            layout.SetColumnWidths(colMargin, 680, colMargin);
            layout.SetRowHeights(110, rowHeight, rowHeight, rowHeight, rowHeight, rowHeight);

            layout.Add(label, MyAlignH.Center, MyAlignV.Center, 1, 1);
            layout.Add(m_timeOutLabel, MyAlignH.Center, MyAlignV.Center, 2, 1);
            layout.Add(m_leaveButton, MyAlignH.Center, MyAlignV.Center, 3, 1);
        }
        protected virtual void BuildControls()
        {
            AddCaption(ScreenCaption);

            // side menu
            {
                var nameLabel        = MakeLabel(MyCommonTexts.Name);
                var descriptionLabel = MakeLabel(MyCommonTexts.Description);

                m_nameTextbox                = new MyGuiControlTextbox(maxLength: MySession.MAX_NAME_LENGTH);
                m_nameTextbox.Enabled        = false;
                m_descriptionTextbox         = new MyGuiControlTextbox(maxLength: MySession.MAX_DESCRIPTION_LENGTH);
                m_descriptionTextbox.Enabled = false;

                Vector2 originL;
                Vector2 controlsDelta = new Vector2(0f, 0.052f);
                originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP);

                var screenSize         = m_size.Value;
                var layoutSize         = screenSize / 2 - originL;
                var columnWidthLabel   = layoutSize.X * 0.25f;
                var columnWidthControl = layoutSize.X - columnWidthLabel;
                var rowHeight          = 0.052f;
                layoutSize.Y = rowHeight * 5;

                m_sideMenuLayout = new MyLayoutTable(this, originL, layoutSize);
                m_sideMenuLayout.SetColumnWidthsNormalized(columnWidthLabel, columnWidthControl);
                m_sideMenuLayout.SetRowHeightsNormalized(rowHeight, rowHeight, rowHeight, rowHeight, rowHeight);

                m_sideMenuLayout.Add(nameLabel, MyAlignH.Left, MyAlignV.Top, 0, 0);
                m_sideMenuLayout.Add(m_nameTextbox, MyAlignH.Left, MyAlignV.Top, 0, 1);
                m_sideMenuLayout.Add(descriptionLabel, MyAlignH.Left, MyAlignV.Top, 1, 0);
                m_sideMenuLayout.Add(m_descriptionTextbox, MyAlignH.Left, MyAlignV.Top, 1, 1);
            }

            // briefing
            {
                var briefingPanel = new MyGuiControlPanel()
                {
                    Name              = "BriefingPanel",
                    Position          = new Vector2(-0.02f, -0.12f),
                    Size              = new Vector2(0.43f, 0.422f),
                    OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST
                };
                Controls.Add(briefingPanel);

                m_descriptionBox = new MyGuiControlMultilineText(
                    selectable: false,
                    font: MyFontEnum.Blue)
                {
                    Name         = "BriefingMultilineText",
                    Position     = new Vector2(-0.009f, -0.115f),
                    Size         = new Vector2(0.419f, 0.412f),
                    OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    TextAlign    = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                };
                Controls.Add(m_descriptionBox);
            }

            // buttons
            {
                int     buttonRowCount    = 2;
                int     buttonColumnCount = 4;
                Vector2 buttonSize        = new Vector2(300f / 1600f, 70f / 1200f);
                Vector2 buttonsOrigin     = m_size.Value / 2 - new Vector2(0.83f, 0.16f);
                Vector2 buttonOffset      = new Vector2(0.01f, 0.01f);
                Vector2 buttonLayoutSize  = new Vector2((buttonSize.X + buttonOffset.X) * (buttonColumnCount), (buttonSize.Y + buttonOffset.Y) * (buttonRowCount));
                m_buttonsLayout = new MyLayoutTable(this, buttonsOrigin, buttonLayoutSize);

                float[] columnWidths = Enumerable.Repeat(buttonSize.X + buttonOffset.X, buttonColumnCount).ToArray();
                m_buttonsLayout.SetColumnWidthsNormalized(columnWidths);
                float[] rowHeights = Enumerable.Repeat(buttonSize.Y + buttonOffset.Y, buttonRowCount).ToArray();
                m_buttonsLayout.SetRowHeightsNormalized(rowHeights);

                m_okButton     = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClick);
                m_cancelButton = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick);

                m_buttonsLayout.Add(m_okButton, MyAlignH.Left, MyAlignV.Top, 1, 2);
                m_buttonsLayout.Add(m_cancelButton, MyAlignH.Left, MyAlignV.Top, 1, 3);
            }

            // left menu
            {
                m_scenarioTable = CreateScenarioTable();
                Controls.Add(m_scenarioTable);
            }
        }
        public override void RecreateControls(bool constructor)
        {
            if (!constructor)
            {
                return;
            }

            base.RecreateControls(constructor);

            AddCaption(MyTexts.GetString(MyCommonTexts.ScreenCaptionGraphicsOptions));

            const float TEXT_SCALE = Sandbox.Graphics.GUI.MyGuiConstants.DEFAULT_TEXT_SCALE * 0.85f;

            var labelRenderer               = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MySpaceTexts.ScreenGraphicsOptions_Renderer));
            var labelHwCursor               = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.HardwareCursor));
            var labelFov                    = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.FieldOfView));
            var labelFovDefault             = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.DefaultFOV));
            var labelRenderInterpolation    = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.RenderIterpolation));
            var labelAntiAliasing           = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_AntiAliasing));
            var labelShadowMapResolution    = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MySpaceTexts.ScreenGraphicsOptions_ShadowMapResolution));
            var labelMultithreadedRendering = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_MultiThreadedRendering));
            //var labelTonemapping            = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_Tonemapping));
            var labelTextureQuality       = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_TextureQuality));
            var labelVoxelQuality         = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MySpaceTexts.ScreenGraphicsOptions_VoxelQuality));
            var labelAnisotropicFiltering = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_AnisotropicFiltering));
            var labelGraphicsPresets      = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_QualityPreset));
            var labelFoliageDetails       = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_FoliageDetails));
            var labelGrassDensity         = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MyCommonTexts.WorldSettings_GrassDensity));
            var labelEnableDamageEffects  = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MySpaceTexts.EnableDamageEffects));
            var labelDx9RenderQuality     = new MyGuiControlLabel(textScale: TEXT_SCALE, text: MyTexts.GetString(MySpaceTexts.RenderQuality));

            m_comboRenderer               = new MyGuiControlCombobox(toolTip: MyTexts.GetString(MySpaceTexts.ToolTipVideoOptionsRenderer));
            m_comboGraphicsPresets        = new MyGuiControlCombobox();
            m_comboAntialiasing           = new MyGuiControlCombobox();
            m_comboShadowMapResolution    = new MyGuiControlCombobox();
            m_comboTextureQuality         = new MyGuiControlCombobox();
            m_comboAnisotropicFiltering   = new MyGuiControlCombobox();
            m_comboDx9RenderQuality       = new MyGuiControlCombobox(toolTip: MyTexts.GetString(MyCommonTexts.ToolTipVideoOptionsRenderQuality));
            m_checkboxHardwareCursor      = new MyGuiControlCheckbox(toolTip: MyTexts.GetString(MyCommonTexts.ToolTipVideoOptionsHardwareCursor));
            m_checkboxRenderInterpolation = new MyGuiControlCheckbox(toolTip: MyTexts.GetString(MyCommonTexts.ToolTipVideoOptionRenderIterpolation));
            //m_checkboxMultithreadedRender = new MyGuiControlCheckbox();
            //m_checkboxTonemapping         = new MyGuiControlCheckbox();
            m_checkboxEnableDamageEffects = new MyGuiControlCheckbox(toolTip: MyTexts.GetString(MySpaceTexts.ToolTipVideoOptionsEnableDamageEffects));
            m_sliderFov = new MyGuiControlSlider(toolTip: MyTexts.GetString(MyCommonTexts.ToolTipVideoOptionsFieldOfView),
                                                 labelText: new StringBuilder("{0}").ToString(),
                                                 labelSpaceWidth: 0.035f,
                                                 labelScale: TEXT_SCALE,
                                                 labelFont: MyFontEnum.Blue);

            m_comboVoxelQuality = new MyGuiControlCombobox();

            m_comboFoliageDetails = new MyGuiControlCombobox();
            m_grassDensitySlider  = new MyGuiControlSlider(minValue: 0f, maxValue: 10f,
                                                           labelText: new StringBuilder("{0}").ToString(),
                                                           labelSpaceWidth: 0.035f,
                                                           labelScale: TEXT_SCALE,
                                                           labelFont: MyFontEnum.Blue);

            var okButton     = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkClick);
            var cancelButton = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelClick);

            m_comboDx9RenderQuality.AddItem((int)MyRenderQualityEnum.NORMAL, MySpaceTexts.RenderQualityNormal);
            m_comboDx9RenderQuality.AddItem((int)MyRenderQualityEnum.HIGH, MySpaceTexts.RenderQualityHigh);
            m_comboDx9RenderQuality.AddItem((int)MyRenderQualityEnum.EXTREME, MySpaceTexts.RenderQualityExtreme);

            m_comboGraphicsPresets.AddItem((int)PresetEnum.Low, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_QualityPreset_Low));
            m_comboGraphicsPresets.AddItem((int)PresetEnum.Medium, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_QualityPreset_Medium));
            m_comboGraphicsPresets.AddItem((int)PresetEnum.High, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_QualityPreset_High));
            m_comboGraphicsPresets.AddItem((int)PresetEnum.Custom, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_QualityPreset_Custom));

            m_comboAntialiasing.AddItem((int)MyAntialiasingMode.NONE, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_AntiAliasing_None));
            m_comboAntialiasing.AddItem((int)MyAntialiasingMode.FXAA, "FXAA");
            m_comboAntialiasing.AddItem((int)MyAntialiasingMode.MSAA_2, "MSAA 2x");
            m_comboAntialiasing.AddItem((int)MyAntialiasingMode.MSAA_4, "MSAA 4x");
            m_comboAntialiasing.AddItem((int)MyAntialiasingMode.MSAA_8, "MSAA 8x");

            m_comboShadowMapResolution.AddItem((int)MyShadowsQuality.LOW, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_ShadowMapResolution_Low));
            m_comboShadowMapResolution.AddItem((int)MyShadowsQuality.MEDIUM, MyTexts.GetString(MySpaceTexts.ScreenGraphicsOptions_ShadowMapResolution_Medium));
            m_comboShadowMapResolution.AddItem((int)MyShadowsQuality.HIGH, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_ShadowMapResolution_High));

            m_comboTextureQuality.AddItem((int)MyTextureQuality.LOW, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_TextureQuality_Low));
            m_comboTextureQuality.AddItem((int)MyTextureQuality.MEDIUM, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_TextureQuality_Medium));
            m_comboTextureQuality.AddItem((int)MyTextureQuality.HIGH, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_TextureQuality_High));

            m_comboAnisotropicFiltering.AddItem((int)MyTextureAnisoFiltering.NONE, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_AnisotropicFiltering_Off));
            m_comboAnisotropicFiltering.AddItem((int)MyTextureAnisoFiltering.ANISO_1, "1x");
            m_comboAnisotropicFiltering.AddItem((int)MyTextureAnisoFiltering.ANISO_4, "4x");
            m_comboAnisotropicFiltering.AddItem((int)MyTextureAnisoFiltering.ANISO_8, "8x");
            m_comboAnisotropicFiltering.AddItem((int)MyTextureAnisoFiltering.ANISO_16, "16x");

            m_comboFoliageDetails.AddItem((int)MyFoliageDetails.DISABLED, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_FoliageDetails_Disabled));
            m_comboFoliageDetails.AddItem((int)MyFoliageDetails.LOW, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_FoliageDetails_Low));
            m_comboFoliageDetails.AddItem((int)MyFoliageDetails.MEDIUM, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_FoliageDetails_Medium));
            m_comboFoliageDetails.AddItem((int)MyFoliageDetails.HIGH, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_FoliageDetails_High));

            m_comboVoxelQuality.AddItem((int)MyRenderQualityEnum.LOW, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_FoliageDetails_Low));
            m_comboVoxelQuality.AddItem((int)MyRenderQualityEnum.NORMAL, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_FoliageDetails_Medium));
            m_comboVoxelQuality.AddItem((int)MyRenderQualityEnum.HIGH, MyTexts.GetString(MyCommonTexts.ScreenGraphicsOptions_FoliageDetails_High));

            for (int i = 0; i < m_renderers.Length; i++)
            {
                m_comboRenderer.AddItem(i, m_renderers[i]);
            }

            labelFovDefault.UpdateFormatParams(MathHelper.ToDegrees(MyConstants.FIELD_OF_VIEW_CONFIG_DEFAULT));


            var table = new MyLayoutTable(this);
            {
                const float h = 60f;
                table.SetColumnWidths(60f, 400f, 460f);
                table.SetRowHeights(100f, h, h, h, h, h, 40f, h, h, h, h, h, h, h, h, h, 120f);
            }
            int            row      = 1;
            const int      leftCol  = 1;
            const int      rightCol = 2;
            const MyAlignH hAlign   = MyAlignH.Left;
            const MyAlignV vAlign   = MyAlignV.Center;

            table.Add(labelRenderer, hAlign, vAlign, row, leftCol);
            table.Add(m_comboRenderer, hAlign, vAlign, row++, rightCol);
            table.Add(labelHwCursor, hAlign, vAlign, row, leftCol);
            table.Add(m_checkboxHardwareCursor, hAlign, vAlign, row++, rightCol);
            table.Add(labelRenderInterpolation, hAlign, vAlign, row, leftCol);
            table.Add(m_checkboxRenderInterpolation, hAlign, vAlign, row++, rightCol);
            table.Add(labelEnableDamageEffects, hAlign, vAlign, row, leftCol);
            table.Add(m_checkboxEnableDamageEffects, hAlign, vAlign, row++, rightCol);
            table.Add(labelFov, hAlign, vAlign, row, leftCol);
            table.Add(m_sliderFov, hAlign, vAlign, row++, rightCol);
            table.Add(labelFovDefault, hAlign, MyAlignV.Top, row++, rightCol);
            int moveWhenDirX9 = 0;

            if (MyVideoSettingsManager.RunningGraphicsRenderer == MySandboxGame.DirectX11RendererKey)
            {
                table.Add(labelGraphicsPresets, hAlign, vAlign, row, leftCol);
                table.Add(m_comboGraphicsPresets, hAlign, vAlign, row++, rightCol);
                table.Add(labelAntiAliasing, hAlign, vAlign, row, leftCol);
                table.Add(m_comboAntialiasing, hAlign, vAlign, row++, rightCol);
                table.Add(labelShadowMapResolution, hAlign, vAlign, row, leftCol);
                table.Add(m_comboShadowMapResolution, hAlign, vAlign, row++, rightCol);
                table.Add(labelTextureQuality, hAlign, vAlign, row, leftCol);
                table.Add(m_comboTextureQuality, hAlign, vAlign, row++, rightCol);
                table.Add(labelVoxelQuality, hAlign, vAlign, row, leftCol);
                table.Add(m_comboVoxelQuality, hAlign, vAlign, row++, rightCol);
                table.Add(labelAnisotropicFiltering, hAlign, vAlign, row, leftCol);
                table.Add(m_comboAnisotropicFiltering, hAlign, vAlign, row++, rightCol);
                //table.Add(labelMultithreadedRendering, hAlign, vAlign, row, leftCol);
                //table.Add(m_checkboxMultithreadedRender, hAlign, vAlign, row++, rightCol);
                //table.Add(labelTonemapping, hAlign, vAlign, row, leftCol);
                //table.Add(m_checkboxTonemapping, hAlign, vAlign, row++, rightCol);
                if (MyFakes.ENABLE_PLANETS)
                {
                    table.Add(labelFoliageDetails, hAlign, vAlign, row, leftCol);
                    table.Add(m_comboFoliageDetails, hAlign, vAlign, row++, rightCol);
                    table.Add(labelGrassDensity, hAlign, vAlign, row, leftCol);
                    table.Add(m_grassDensitySlider, hAlign, vAlign, row++, rightCol);
                }
            }
            else // Dx9 or nothing specified
            {
                table.Add(labelDx9RenderQuality, hAlign, vAlign, row, leftCol);
                table.Add(m_comboDx9RenderQuality, hAlign, vAlign, row++, rightCol);
                moveWhenDirX9 = 1;
            }

            table.Add(okButton, MyAlignH.Left, MyAlignV.Bottom, table.LastRow - moveWhenDirX9, leftCol);
            table.Add(cancelButton, MyAlignH.Right, MyAlignV.Bottom, table.LastRow - moveWhenDirX9, rightCol);

            { // Set FoV bounds based on current display setting.
                float fovMin, fovMax;
                MyVideoSettingsManager.GetFovBounds(out fovMin, out fovMax);
                m_sliderFov.SetBounds(MathHelper.ToDegrees(fovMin), MathHelper.ToDegrees(fovMax));
            }

            {
                m_grassDensitySlider.SetBounds(0f, 10f);
            }

            //  Update controls with values from config file
            m_settingsOld = MyVideoSettingsManager.CurrentGraphicsSettings;
            m_settingsNew = m_settingsOld;
            WriteSettingsToControls(m_settingsOld);

            //  Update OLD settings
            ReadSettingsFromControls(ref m_settingsOld);
            ReadSettingsFromControls(ref m_settingsNew);

            {
                MyGuiControlCombobox.ItemSelectedDelegate onComboItemSelected = OnSettingsChanged;
                Action <MyGuiControlCheckbox>             onCheckboxChanged   = (checkbox) => OnSettingsChanged();

                m_comboGraphicsPresets.ItemSelected      += OnPresetSelected;
                m_comboAnisotropicFiltering.ItemSelected += onComboItemSelected;
                m_comboAntialiasing.ItemSelected         += onComboItemSelected;
                m_comboShadowMapResolution.ItemSelected  += onComboItemSelected;
                m_comboFoliageDetails.ItemSelected       += onComboItemSelected;
                m_comboVoxelQuality.ItemSelected         += onComboItemSelected;
                m_comboTextureQuality.ItemSelected       += onComboItemSelected;
                m_comboDx9RenderQuality.ItemSelected     += onComboItemSelected;

                m_checkboxHardwareCursor.IsCheckedChanged = onCheckboxChanged;
                //m_checkboxMultithreadedRender.IsCheckedChanged = onCheckboxChanged;
                m_checkboxRenderInterpolation.IsCheckedChanged = onCheckboxChanged;
                //m_checkboxTonemapping.IsCheckedChanged = onCheckboxChanged;
                m_checkboxEnableDamageEffects.IsCheckedChanged = onCheckboxChanged;

                m_sliderFov.ValueChanged = (slider) => OnSettingsChanged();
                //          m_grassDensitySlider.ValueChanged = (slider) => OnSettingsChanged();
            }
            RefreshPresetCombo(m_settingsOld.Render);

            CloseButtonEnabled = true;
            CloseButtonOffset  = new Vector2(-50f, 50f) / MyGuiConstants.GUI_OPTIMAL_SIZE;
        }
Пример #4
0
        private void InitRightSide()
        {
            Vector2 originL;

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

            var screenSize         = m_size.Value;
            var layoutSize         = new Vector2(screenSize.X / 2 - originL.X, screenSize.Y - MARGIN_TOP - MARGIN_BOTTOM);
            var columnWidthLabel   = layoutSize.X * 0.25f;
            var columnWidthControl = layoutSize.X - columnWidthLabel;
            var rowHeight          = 0.052f;
            var leftHeight         = layoutSize.Y - 4 * rowHeight;
            var descriptionMargin  = 0.005f;

            m_tableLayout = new MyLayoutTable(this, originL, layoutSize);
            m_tableLayout.SetColumnWidthsNormalized(columnWidthLabel, columnWidthControl);
            m_tableLayout.SetRowHeightsNormalized(rowHeight, rowHeight, rowHeight, rowHeight, leftHeight);

            m_nameLabel               = new MyGuiControlLabel(text: MyTexts.GetString(MyCommonTexts.Name), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, position: new Vector2(0, 0.2f));
            m_nameTextbox             = new MyGuiControlTextbox(maxLength: MySession.MAX_NAME_LENGTH);
            m_nameTextbox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP;
            m_nameTextbox.Enabled     = false;

            float width = m_nameTextbox.Size.X;

            m_difficultyLabel         = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.Difficulty), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            m_difficultyCombo         = new MyGuiControlCombobox(size: new Vector2(width, 0.04f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            m_difficultyCombo.Enabled = false;
            m_difficultyCombo.AddItem((int)0, MySpaceTexts.DifficultyEasy);
            m_difficultyCombo.AddItem((int)1, MySpaceTexts.DifficultyNormal);
            m_difficultyCombo.AddItem((int)2, MySpaceTexts.DifficultyHard);

            m_onlineModeLabel    = new MyGuiControlLabel(text: MyTexts.GetString(MyCommonTexts.WorldSettings_OnlineMode), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            m_onlineMode         = new MyGuiControlCheckbox(originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            m_onlineMode.Enabled = false;

            m_descriptionMultilineText = new MyGuiControlMultilineText(
                selectable: false,
                font: MyFontEnum.Blue)
            {
                Name         = "BriefingMultilineText",
                Position     = new Vector2(-0.009f, -0.115f),
                Size         = new Vector2(0.419f, 0.412f),
                OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                TextAlign    = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            };

            var panel = new MyGuiControlCompositePanel()
            {
                BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK,
            };


            m_tableLayout.Add(m_nameLabel, MyAlignH.Left, MyAlignV.Center, 0, 0);
            m_tableLayout.Add(m_difficultyLabel, MyAlignH.Left, MyAlignV.Center, 2, 0);
            m_tableLayout.Add(m_onlineModeLabel, MyAlignH.Left, MyAlignV.Center, 3, 0);

            m_tableLayout.Add(m_nameTextbox, MyAlignH.Left, MyAlignV.Center, 0, 1);
            m_tableLayout.Add(m_difficultyCombo, MyAlignH.Left, MyAlignV.Center, 2, 1);
            m_tableLayout.Add(m_onlineMode, MyAlignH.Left, MyAlignV.Center, 3, 1);

            m_tableLayout.Add(panel, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2);
            m_tableLayout.Add(m_descriptionMultilineText, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2);
            m_descriptionMultilineText.Position = new Vector2(panel.Position.X + descriptionMargin, panel.Position.Y);
            panel.Size = new Vector2(m_nameTextbox.Size.X + columnWidthLabel, m_tableLayout.GetCellSize(4, 0).Y + 0.01f);
            m_descriptionMultilineText.Size = new Vector2(panel.Size.X - descriptionMargin, m_tableLayout.GetCellSize(4, 0).Y - descriptionMargin + 0.01f);

            var buttonsOrigin = m_size.Value / 2 - new Vector2(0.365f, 0.03f);
            var buttonSize    = MyGuiConstants.BACK_BUTTON_SIZE;
            // Ok/Cancel
            var okButton     = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.055f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            var cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.055f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);

            Controls.Add(okButton);
            Controls.Add(cancelButton);

            CloseButtonEnabled = true;
        }
        private void InitRightSide()
        {
            var originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP);

            var screenSize         = m_size.Value;
            var layoutSize         = new Vector2(screenSize.X / 2 - originL.X, screenSize.Y - MARGIN_TOP - MARGIN_BOTTOM) - new Vector2(0.05f, 0.05f);
            var columnWidthLabel   = layoutSize.X * 0.4f;
            var columnWidthControl = layoutSize.X - columnWidthLabel;
            var rowHeight          = 0.052f;
            var leftHeight         = layoutSize.Y - 4 * rowHeight;
            var descriptionMargin  = 0.005f;

            m_tableLayout = new MyLayoutTable(this, originL, layoutSize);
            m_tableLayout.SetColumnWidthsNormalized(columnWidthLabel, columnWidthControl);
            m_tableLayout.SetRowHeightsNormalized(rowHeight, rowHeight, rowHeight, rowHeight, leftHeight);

            // Name
            m_nameLabel = new MyGuiControlLabel
            {
                Text        = MyTexts.GetString(MyCommonTexts.Name),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
            };

            m_nameTextbox = new MyGuiControlTextbox
            {
                MaxLength   = MySession.MAX_NAME_LENGTH,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                Enabled     = false
            };

            // Difficulty
            m_difficultyLabel = new MyGuiControlLabel
            {
                Text        = MyTexts.GetString(MySpaceTexts.Difficulty),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP
            };

            m_difficultyCombo = new MyGuiControlCombobox
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                Enabled     = false
            };
            m_difficultyCombo.AddItem((int)0, MySpaceTexts.DifficultyEasy);
            m_difficultyCombo.AddItem((int)1, MySpaceTexts.DifficultyNormal);
            m_difficultyCombo.AddItem((int)2, MySpaceTexts.DifficultyHard);

            // Online
            m_onlineModeLabel = new MyGuiControlLabel
            {
                Text        = MyTexts.GetString(MyCommonTexts.WorldSettings_OnlineMode),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP
            };
            m_onlineMode = new MyGuiControlCheckbox
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                Enabled     = false
            };

            // Description
            m_descriptionMultilineText = new MyGuiControlMultilineText(
                selectable: false)
            {
                Name         = "BriefingMultilineText",
                Position     = new Vector2(-0.009f, -0.115f),
                Size         = new Vector2(0.419f, 0.412f),
                OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                TextAlign    = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            };

            var panel = new MyGuiControlCompositePanel
            {
                BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK,
            };


            m_tableLayout.Add(m_nameLabel, MyAlignH.Left, MyAlignV.Center, 0, 0);
            m_tableLayout.Add(m_difficultyLabel, MyAlignH.Left, MyAlignV.Center, 2, 0);
            m_tableLayout.Add(m_onlineModeLabel, MyAlignH.Left, MyAlignV.Center, 3, 0);

            m_tableLayout.AddWithSize(m_nameTextbox, MyAlignH.Left, MyAlignV.Center, 0, 1);
            m_tableLayout.AddWithSize(m_difficultyCombo, MyAlignH.Left, MyAlignV.Center, 2, 1);
            m_tableLayout.AddWithSize(m_onlineMode, MyAlignH.Left, MyAlignV.Center, 3, 1);

            m_tableLayout.AddWithSize(panel, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2);
            m_tableLayout.AddWithSize(m_descriptionMultilineText, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2);

            // Panel offset from text
            var bothSidesOffset = 0.003f;

            panel.Position = new Vector2(panel.PositionX - bothSidesOffset, panel.PositionY - bothSidesOffset);
            panel.Size     = new Vector2(panel.Size.X + bothSidesOffset, panel.Size.Y + bothSidesOffset * 2);

            // The bulgarian constant is offset from side to match the size of the layout
            var buttonsOrigin           = panel.Position + new Vector2(panel.Size.X, panel.Size.Y + 0.02f);
            var buttonSize              = MyGuiConstants.BACK_BUTTON_SIZE;
            var buttonHorizontalSpacing = 0.02f;

            // Ok/Cancel/Publish
            m_publishButton = new MyGuiControlButton(position: buttonsOrigin, size: buttonSize, text: MyTexts.Get(MyCommonTexts.LoadScreenButtonPublish), onButtonClick: OnPublishButtonOnClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            var cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0, buttonSize.Y), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            var okButton     = new MyGuiControlButton(position: buttonsOrigin + new Vector2(-buttonSize.X - buttonHorizontalSpacing, buttonSize.Y), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);

            Controls.Add(m_publishButton);
            Controls.Add(okButton);
            Controls.Add(cancelButton);

            CloseButtonEnabled = true;
        }