示例#1
0
        public MyGuiScreenGameChat(bool sendToTeam)
            : base(Vector2.Zero, null, null)
        {
            m_closeOnEsc           = true;
            m_enableBackgroundFade = true;
            m_teamOnly             = sendToTeam;

            m_positionOffset = new Vector2(MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(0, 0)).X - 920 / 1920f / 2 - 0.04f, -0.2f);

            m_panelTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ChatBackground", flags: TextureFlags.IgnoreQuality);

            MyGuiControlPanel panel = new MyGuiControlPanel(this, new Vector2(0.5f, 0.85f) + m_positionOffset, new Vector2(920 / 1920f, 388 / 1200f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, m_panelTexture, null, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);

            Controls.Add(panel);

            Vector2 menuPositionOrigin = new Vector2(0.423f, 0.939f) + m_positionOffset;
            Vector2 delta = new Vector2(0.17f, 0f);
            const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            m_textbox = new MyGuiControlTextbox(this, menuPositionOrigin, MyGuiControlPreDefinedSize.MEDIUM, "", MyGuiConstants.CHAT_WINDOW_MAX_MESSAGE_LENGTH, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE * 0.75f, MyGuiControlTextboxType.NORMAL, true, false);
            Controls.Add(m_textbox);

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + delta,
                                                MyGuiConstants.MAIN_MENU_BUTTON_SIZE * new Vector2(0.41f, 0.78f), MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\ButtonChatEnter", flags: TextureFlags.IgnoreQuality), null, null,
                                                sendToTeam ? MyTextsWrapperEnum.SendToTeam : MyTextsWrapperEnum.SendToAll, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE * 0.65f,
                                                menuButtonTextAlignement, OnSendClick, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                                                true, true, MyGuiControlHighlightType.WHEN_ACTIVE));
        }
        private void RecreateControls(bool contructor)
        {
            m_toolbarItemsGrid = new MyGuiControlGrid()
            {
                OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM,
                VisualStyle  = MyGuiControlGridStyleEnum.Toolbar,
                ColumnsCount = MyToolbarComponent.CurrentToolbar.SlotCount + 1,
                RowsCount    = 1
            };
            m_toolbarItemsGrid.ItemDoubleClicked             += grid_ItemDoubleClicked;
            m_toolbarItemsGrid.ItemClickedWithoutDoubleClick += grid_ItemClicked;

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

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

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

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

            RefreshInternals();
        }
            public void RecreateControls()
            {
                Elements.Clear();

                var guiTextScale     = (float)Math.Pow(1.2f, m_stat.StatDefinition.GuiDef.HeightMultiplier - 1.0f);
                var guiArrowScale    = (float)Math.Pow(1.3f, m_stat.StatDefinition.GuiDef.HeightMultiplier - 1.0f) / m_stat.StatDefinition.GuiDef.HeightMultiplier;
                var textScale        = MyGuiConstants.HUD_TEXT_SCALE * 0.6f * guiTextScale;
                var barLength        = 0.0875f;
                var arrowIconSize    = new Vector2(Size.Y * 1.5f, Size.Y) * 0.5f * guiArrowScale;
                var leftTextWidth    = 0.16f;
                var textHeightOffset = -0.1f;

                var leftTextOffset  = -1.0f / 2.0f + leftTextWidth;
                var barOffset       = leftTextOffset + 0.025f;
                var arrowIconOffset = barOffset + barLength / Size.X + 0.05f;
                var rightTextOffset = arrowIconOffset + arrowIconSize.X + 0.035f;

                m_statNameLabel = new MyGuiControlLabel(position: Size * new Vector2(leftTextOffset, textHeightOffset),
                                                        text: m_stat.StatId.ToString(),
                                                        textScale: textScale,
                                                        size: new Vector2(leftTextWidth * Size.X, 1.0f),
                                                        originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
                Elements.Add(m_statNameLabel);

                var vecColor = m_stat.StatDefinition.GuiDef.Color;
                var barColor = new Color(vecColor.X, vecColor.Y, vecColor.Z);

                m_progressBar = new MyGuiControlProgressBar(position: Size * new Vector2(barOffset, 0.0f),
                                                            originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                                                            size: new Vector2(barLength, Size.Y),
                                                            backgroundTexture: new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_STAT_BAR_BG.Texture),
                                                            progressBarColor: barColor);
                if (m_stat != null)
                {
                    m_progressBar.Value = m_stat.CurrentRatio;
                }
                Elements.Add(m_progressBar);

                m_effectArrow = new MyGuiControlPanel(position: Size * new Vector2(arrowIconOffset, 0.0f),
                                                      originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                                                      size: arrowIconSize,
                                                      texture: MyGuiConstants.TEXTURE_HUD_STAT_EFFECT_ARROW_UP.Texture);
                Elements.Add(m_effectArrow);

                StringBuilder statText = new StringBuilder();

                statText.AppendDecimal((int)m_stat.Value, 0);
                statText.Append("/");
                statText.AppendDecimal(m_stat.MaxValue, 0);
                m_statValueLabel = new MyGuiControlLabel(position: Size * new Vector2(rightTextOffset, textHeightOffset),
                                                         text: statText.ToString(),
                                                         textScale: textScale,
                                                         originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                Elements.Add(m_statValueLabel);
            }
示例#4
0
        private void RecreateControls(bool contructor)
        {
            m_toolbarItemsGrid = new MyGuiControlGrid()
            {
                OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM,
                VisualStyle  = MyGuiControlGridStyleEnum.Toolbar,
                ColumnsCount = MyToolbarComponent.CurrentToolbar.SlotCount + 1,
                RowsCount    = 1
            };
            m_toolbarItemsGrid.ItemDoubleClicked             += grid_ItemDoubleClicked;
            m_toolbarItemsGrid.ItemClickedWithoutDoubleClick += grid_ItemClicked;

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

            //grid size image (left from toolbar)
            m_gridSize             = new MyGuiControlImage(size: m_toolbarItemsGrid.ItemSize * 0.6f);
            m_gridSize.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
            m_gridSize.SetTexture(MyGuiConstants.TEXTURE_ICON_LARGE_BLOCK);
            m_gridSize.Visible           = false;
            m_gridSize.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;
            Elements.Add(m_gridSize);

            //grid size label (above grid size image)
            m_gridSizeLabel                   = new MyGuiControlLabel();
            m_gridSizeLabel.Text              = "";
            m_gridSizeLabel.Visible           = false;
            m_gridSizeLabel.Size              = new Vector2(m_toolbarItemsGrid.ItemSize.X * 3f, m_toolbarItemsGrid.ItemSize.Y / 2f);
            m_gridSizeLabel.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
            m_gridSizeLabel.BackgroundTexture = null;
            m_gridSizeLabel.TextScale         = 0.75f;
            Elements.Add(m_gridSizeLabel);

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

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

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

            RefreshInternals();
        }
示例#5
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

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

            logoPanel.BackgroundTexture = MyGuiConstants.TEXTURE_KEEN_LOGO;
            Controls.Add(logoPanel);
        }
            public WarningArea(string name, bool graphicsButton)
            {
                Warnings = new List <WarningLine>();

                m_header          = new MyGuiControlParent();
                m_titleBackground = new MyGuiControlPanel(texture: @"Textures\GUI\Controls\item_highlight_dark.dds");
                m_title           = new MyGuiControlLabel(text: name);
                m_lastOccurence   = new MyGuiControlLabel(text: MyTexts.GetString(MyCommonTexts.PerformanceWarningLastOccurrence), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
                m_separator       = new MyGuiControlSeparatorList();
                m_separator.AddHorizontal(new Vector2(-0.45f, 0.018f), 0.9f);

                m_title.Position         = new Vector2(-0.43f, 0f);
                m_lastOccurence.Position = new Vector2(0.43f, 0f);
                m_titleBackground.Size   = new Vector2(m_titleBackground.Size.X, 0.035f);
                m_header.Size            = new Vector2(m_header.Size.X, m_titleBackground.Size.Y);
                if (graphicsButton)
                {
                    m_graphicsButton = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.ScreenCaptionGraphicsOptions), onButtonClick: (sender) => { MyGuiSandbox.AddScreen(new MyGuiScreenOptionsGraphics()); });
                }
            }
示例#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 MyGuiControlScenarioButton(MyScenarioDefinition scenario) :
            base(key: MyDefinitionManager.Static.GetScenarioDefinitions().IndexOf(scenario))
        {
            VisualStyle    = MyGuiControlRadioButtonStyleEnum.ScenarioButton;
            OriginAlign    = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            Scenario       = scenario;
            m_titleLabel   = new MyGuiControlLabel(text: scenario.DisplayNameText, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            m_previewPanel = new MyGuiControlPanel(texture: scenario.Icon, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            MyGuiSizedTexture image = new MyGuiSizedTexture()
            {
                SizePx = new Vector2(229f, 128f),
            };

            m_previewPanel.Size          = image.SizeGui;
            m_previewPanel.BorderEnabled = true;
            m_previewPanel.BorderColor   = MyGuiConstants.THEMED_GUI_LINE_COLOR.ToVector4();
            SetToolTip(scenario.DescriptionText);
            Size = new Vector2(Math.Max(m_titleLabel.Size.X, m_previewPanel.Size.X),
                               m_titleLabel.Size.Y + m_previewPanel.Size.Y);
            Elements.Add(m_titleLabel);
            Elements.Add(m_previewPanel);
        }
示例#9
0
        private void BuildPlanetMenu()
        {
            ClearControls();
            Vector2 controlPadding = new Vector2(0.02f, 0.02f);
            float   num            = SCREEN_SIZE.X - HIDDEN_PART_RIGHT - controlPadding.X * 2f;
            float   num2           = (SCREEN_SIZE.Y - 1f) / 2f;

            BuildPluginMenuHeader();

            MyGuiControlLabel listBoxLabel = new MyGuiControlLabel
            {
                Position    = new Vector2(-0.153f, -0.334f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "List of Planet definitions"
            };

            MyGuiControlPanel listBoxLabelBg = new MyGuiControlPanel(new Vector2(listBoxLabel.PositionX - 0.0085f, listBoxLabel.Position.Y - 0.005f), new Vector2(0.2865f, 0.035f), null, null, null, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
            {
                BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK_BORDER
            };

            Controls.Add(listBoxLabelBg);
            Controls.Add(listBoxLabel);

            m_currentPosition.Y += 0.020f;

            m_planetDefListBox                  = new MyGuiControlListbox(Vector2.Zero, VRage.Game.MyGuiControlListboxStyleEnum.Blueprints);
            m_planetDefListBox.Size             = new Vector2(num, 0f);
            m_planetDefListBox.Enabled          = true;
            m_planetDefListBox.VisibleRowsCount = 8;
            m_planetDefListBox.Position         = m_planetDefListBox.Size / 2f + m_currentPosition;
            m_planetDefListBox.ItemClicked     += PlanetDefListItemClicked;
            m_planetDefListBox.MultiSelect      = false;

            MyGuiControlSeparatorList separator = new MyGuiControlSeparatorList();

            separator.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.83f / 2f, -0.00f), m_size.Value.X * 0.73f);
            Controls.Add(separator);

            m_currentPosition    = m_planetDefListBox.GetPositionAbsoluteBottomLeft();
            m_currentPosition.Y += 0.045f;

            MyGuiControlLabel planetSizeLabel = new MyGuiControlLabel
            {
                Position    = m_currentPosition + new Vector2(0.001f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "PlanetSize"
            };

            Controls.Add(planetSizeLabel);

            m_planetSizeValue = new MyGuiControlLabel
            {
                Position    = m_currentPosition + new Vector2(0.285f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text        = "0"
            };
            Controls.Add(m_planetSizeValue);

            m_currentPosition.Y += 0.025f;

            m_planetSizeSlider              = new MyGuiControlClickableSlider(m_currentPosition + new Vector2(0.001f, 0f), 120f, 2400f, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_PLANET_SIZE);
            m_planetSizeSlider.Size         = new Vector2(0.285f, 1f);
            m_planetSizeSlider.DefaultValue = 1200f;
            m_planetSizeSlider.Value        = m_planetSizeSlider.DefaultValue.Value;
            m_planetSizeSlider.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_planetSizeSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_planetSizeSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_planetSizeValue.Text = s.Value.ToString();
            });

            m_planetSizeValue.Text = m_planetSizeSlider.Value.ToString();

            Controls.Add(m_planetSizeSlider);

            m_currentPosition.Y += 0.055f + 0.035f;

            m_spawnPlanetButton         = CreateDebugButton(0.284f, "Spawn planet", OnSpawnPlanetButton, true, MyPluginTexts.TOOLTIPS.ADMIN_ADD_RING_BUTTON);
            m_spawnPlanetButton.Enabled = false;

            Controls.Add(m_planetDefListBox);

            LoadPlanetDefinitions();
        }
示例#10
0
        private void BuildRingMenu()
        {
            ClearControls();

            Vector2 controlPadding = new Vector2(0.02f, 0.02f);
            float   num            = SCREEN_SIZE.X - HIDDEN_PART_RIGHT - controlPadding.X * 2f;

            BuildPluginMenuHeader();

            MyGuiControlLabel listBoxLabel = new MyGuiControlLabel
            {
                Position    = new Vector2(-0.153f, -0.334f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "List of Planets"
            };

            MyGuiControlPanel listBoxLabelBg = new MyGuiControlPanel(new Vector2(listBoxLabel.PositionX - 0.0085f, listBoxLabel.Position.Y - 0.005f), new Vector2(0.2865f, 0.035f), null, null, null, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
            {
                BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK_BORDER
            };

            Controls.Add(listBoxLabelBg);
            Controls.Add(listBoxLabel);

            m_currentPosition.Y += 0.020f;

            m_planetListBox                  = new MyGuiControlListbox(Vector2.Zero, VRage.Game.MyGuiControlListboxStyleEnum.Blueprints);
            m_planetListBox.Size             = new Vector2(num, 0f);
            m_planetListBox.Enabled          = true;
            m_planetListBox.VisibleRowsCount = 8;
            m_planetListBox.Position         = m_planetListBox.Size / 2f + m_currentPosition;
            m_planetListBox.ItemClicked     += PlanetListItemClicked;
            m_planetListBox.MultiSelect      = false;

            MyGuiControlSeparatorList separator = new MyGuiControlSeparatorList();

            separator.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.83f / 2f, -0.00f), m_size.Value.X * 0.73f);
            Controls.Add(separator);

            m_currentPosition    = m_planetListBox.GetPositionAbsoluteBottomLeft();
            m_currentPosition.Y += 0.045f;

            MyGuiControlParent myGuiControlParent = new MyGuiControlParent
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position    = Vector2.Zero,
                Size        = new Vector2(0.32f, 0.56f)
            };

            MyGuiControlScrollablePanel m_optionsGroup = new MyGuiControlScrollablePanel(myGuiControlParent)
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position    = m_currentPosition,
                Size        = new Vector2(0.32f, 0.32f)
            };

            m_optionsGroup.ScrollbarVEnabled = true;
            m_optionsGroup.ScrollBarOffset   = new Vector2(-0.01f, 0f);
            Controls.Add(m_optionsGroup);

            Vector2 vector = -myGuiControlParent.Size * 0.5f;

            MyGuiControlLabel ringDistLabel = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.001f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "Ring distance"
            };

            myGuiControlParent.Controls.Add(ringDistLabel);

            m_ringDistanceValue = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.285f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text        = "0"
            };
            myGuiControlParent.Controls.Add(m_ringDistanceValue);

            vector.Y += 0.025f;

            m_ringDistanceSlider              = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), 5000f, 1000000f, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_DISTANCE, showLabel: false);//Make dynamic
            m_ringDistanceSlider.Size         = new Vector2(0.285f, 1f);
            m_ringDistanceSlider.DefaultValue = 100000;
            m_ringDistanceSlider.Value        = m_ringDistanceSlider.DefaultValue.Value;
            m_ringDistanceSlider.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_ringDistanceSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringDistanceSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                UpdateRingVisual();
                m_ringDistanceValue.Text = s.Value.ToString();
            });

            m_ringDistanceValue.Text = m_ringDistanceSlider.Value.ToString();

            myGuiControlParent.Controls.Add(m_ringDistanceSlider);

            vector.Y += 0.055f;

            MyGuiControlLabel ringWidthLabel = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.001f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "Ring width"
            };

            myGuiControlParent.Controls.Add(ringWidthLabel);

            m_ringWidthValue = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.285f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text        = "0"
            };
            myGuiControlParent.Controls.Add(m_ringWidthValue);

            vector.Y += 0.025f;

            m_ringWidthSlider              = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.RingSettings.MinPlanetRingWidth, SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.RingSettings.MaxPlanetRingWidth, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_WIDTH, showLabel: false);
            m_ringWidthSlider.Size         = new Vector2(0.285f, 1f);
            m_ringWidthSlider.DefaultValue = (SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.RingSettings.MinPlanetRingWidth + SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.RingSettings.MaxPlanetRingWidth) / 2;
            m_ringWidthSlider.Value        = m_ringWidthSlider.DefaultValue.Value;
            m_ringWidthSlider.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_ringWidthSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringWidthSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                UpdateRingVisual();
                m_ringWidthValue.Text = s.Value.ToString();
            });

            m_ringWidthValue.Text = m_ringWidthSlider.Value.ToString();

            myGuiControlParent.Controls.Add(m_ringWidthSlider);

            vector.Y += 0.055f;

            MyGuiControlLabel ringAngleXLabel = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.001f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "Ring angle X"
            };

            myGuiControlParent.Controls.Add(ringAngleXLabel);

            m_ringAngleXValue = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.285f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text        = "0.00"
            };
            myGuiControlParent.Controls.Add(m_ringAngleXValue);

            vector.Y += 0.025f;

            m_ringAngleXSlider              = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), -90, 90, intValue: false, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ANGLE);
            m_ringAngleXSlider.Size         = new Vector2(0.285f, 1f);
            m_ringAngleXSlider.DefaultValue = 0;
            m_ringAngleXSlider.Value        = m_ringAngleXSlider.DefaultValue.Value;
            m_ringAngleXSlider.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_ringAngleXSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringAngleXSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                UpdateRingVisual();
                m_ringAngleXValue.Text = String.Format("{0:0.00}", s.Value);
            });

            m_ringAngleXValue.Text = String.Format("{0:0.00}", m_ringAngleXSlider.Value);

            myGuiControlParent.Controls.Add(m_ringAngleXSlider);

            vector.Y += 0.055f;

            MyGuiControlLabel ringAngleYLabel = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.001f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "Ring angle Y"
            };

            myGuiControlParent.Controls.Add(ringAngleYLabel);

            m_ringAngleYValue = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.285f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text        = "0.00"
            };
            myGuiControlParent.Controls.Add(m_ringAngleYValue);

            vector.Y += 0.025f;

            m_ringAngleYSlider              = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), -90, 90, intValue: false, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ANGLE);
            m_ringAngleYSlider.Size         = new Vector2(0.285f, 1f);
            m_ringAngleYSlider.DefaultValue = 0;
            m_ringAngleYSlider.Value        = m_ringAngleYSlider.DefaultValue.Value;
            m_ringAngleYSlider.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_ringAngleYSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringAngleYSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                UpdateRingVisual();
                m_ringAngleYValue.Text = String.Format("{0:0.00}", s.Value);
            });

            m_ringAngleYValue.Text = String.Format("{0:0.00}", m_ringAngleYSlider.Value);

            myGuiControlParent.Controls.Add(m_ringAngleYSlider);

            vector.Y += 0.055f;

            MyGuiControlLabel ringAngleZLabel = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.001f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "Ring angle Z"
            };

            myGuiControlParent.Controls.Add(ringAngleZLabel);

            m_ringAngleZValue = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.285f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text        = "0.00"
            };
            myGuiControlParent.Controls.Add(m_ringAngleZValue);

            vector.Y += 0.025f;

            m_ringAngleZSlider              = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), -90, 90, intValue: false, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ANGLE);
            m_ringAngleZSlider.Size         = new Vector2(0.285f, 1f);
            m_ringAngleZSlider.DefaultValue = 0;
            m_ringAngleZSlider.Value        = m_ringAngleZSlider.DefaultValue.Value;
            m_ringAngleZSlider.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_ringAngleZSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringAngleZSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                UpdateRingVisual();
                m_ringAngleZValue.Text = String.Format("{0:0.00}", s.Value);
            });

            m_ringAngleZValue.Text = String.Format("{0:0.00}", m_ringAngleZSlider.Value);

            myGuiControlParent.Controls.Add(m_ringAngleZSlider);

            vector.Y += 0.055f;

            MyGuiControlLabel ringRoidSizeLabel = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.001f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "Asteroid min size"
            };

            myGuiControlParent.Controls.Add(ringRoidSizeLabel);

            m_ringRoidSizeValue = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.285f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text        = "0"
            };
            myGuiControlParent.Controls.Add(m_ringRoidSizeValue);

            vector.Y += 0.025f;

            m_ringRoidSizeSlider              = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), 128, 1024, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ROID_SIZE);
            m_ringRoidSizeSlider.Size         = new Vector2(0.285f, 1f);
            m_ringRoidSizeSlider.DefaultValue = 128;
            m_ringRoidSizeSlider.Value        = m_ringRoidSizeSlider.DefaultValue.Value;
            m_ringRoidSizeSlider.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_ringRoidSizeSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringRoidSizeSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_ringRoidSizeValue.Text = s.Value.ToString();
                if (s.Value > m_ringRoidSizeMaxSlider.Value)
                {
                    m_ringRoidSizeSlider.Value = m_ringRoidSizeMaxSlider.Value;
                }
            });

            m_ringRoidSizeValue.Text = m_ringRoidSizeSlider.Value.ToString();

            myGuiControlParent.Controls.Add(m_ringRoidSizeSlider);

            vector.Y += 0.055f;

            MyGuiControlLabel ringRoidSizeMaxLabel = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.001f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text        = "Asteroid max size"
            };

            myGuiControlParent.Controls.Add(ringRoidSizeMaxLabel);

            m_ringRoidSizeMaxValue = new MyGuiControlLabel
            {
                Position    = vector + new Vector2(0.285f, 0f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text        = "0"
            };
            myGuiControlParent.Controls.Add(m_ringRoidSizeMaxValue);

            vector.Y += 0.025f;

            m_ringRoidSizeMaxSlider              = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), 128, 1024, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ROID_SIZE_MAX);
            m_ringRoidSizeMaxSlider.Size         = new Vector2(0.285f, 1f);
            m_ringRoidSizeMaxSlider.DefaultValue = 1028;
            m_ringRoidSizeMaxSlider.Value        = m_ringRoidSizeSlider.DefaultValue.Value;
            m_ringRoidSizeMaxSlider.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_ringRoidSizeMaxSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringRoidSizeMaxSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_ringRoidSizeMaxValue.Text = s.Value.ToString();
                if (s.Value < m_ringRoidSizeSlider.Value)
                {
                    m_ringRoidSizeMaxSlider.Value = m_ringRoidSizeSlider.Value;
                }
            });

            m_ringRoidSizeMaxValue.Text = m_ringRoidSizeMaxSlider.Value.ToString();

            myGuiControlParent.Controls.Add(m_ringRoidSizeMaxSlider);

            m_optionsGroup.RefreshInternals();

            m_currentPosition.Y += m_optionsGroup.Size.Y;

            MyGuiControlSeparatorList separator2 = new MyGuiControlSeparatorList();

            separator2.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.83f / 2f, -0.00f), m_size.Value.X * 0.73f);
            Controls.Add(separator2);

            m_addRingButton = CreateDebugButton(0.284f, "Add ring to planet", OnAddRingToPlanetButton, true, MyPluginTexts.TOOLTIPS.ADMIN_ADD_RING_BUTTON);

            m_currentPosition.Y += 0.003f;

            m_removeRingButton = CreateDebugButton(0.284f, "Remove ring from planet", OnRemoveRingFromPlanetButton, true, MyPluginTexts.TOOLTIPS.ADMIN_REMOVE_RING_BUTTON);

            m_currentPosition.Y += 0.003f;

            m_teleportToRingButton         = CreateDebugButton(0.284f, "Teleport to ring", OnTeleportToRingButton, true, MyPluginTexts.TOOLTIPS.ADMIN_TP_RING_BUTTON);
            m_teleportToRingButton.Enabled = false;

            Controls.Add(m_planetListBox);

            m_ringAngleXSlider.Enabled     = false;
            m_ringAngleYSlider.Enabled     = false;
            m_ringAngleZSlider.Enabled     = false;
            m_ringDistanceSlider.Enabled   = false;
            m_ringWidthSlider.Enabled      = false;
            m_ringRoidSizeSlider.Enabled   = false;
            m_addRingButton.Enabled        = false;
            m_removeRingButton.Enabled     = false;
            m_teleportToRingButton.Enabled = false;

            LoadPlanetsInWorld();
        }
        public MyGuiControlNews() :
            base(isActiveControl: true,
                 canHaveFocus: false,
                 allowFocusingElements: true)
        {
            m_news = new List <MyNewsEntry>();

            m_labelTitle = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
            {
                Name = "Title"
            };
            m_labelDate = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)
            {
                Name = "Date"
            };
            m_separator = new MyGuiControlSeparatorList()
            {
                Name        = "Separator",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER
            };
            m_textNewsEntry = new MyGuiControlMultilineText(
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.85f,
                drawScrollbar: true)
            {
                Name        = "NewsEntry",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            };
            m_textNewsEntry.OnLinkClicked += OnLinkClicked;
            m_bottomPanel = new MyGuiControlPanel()
            {
                OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM,
                BackgroundTexture = MyGuiConstants.TEXTURE_NEWS_PAGING_BACKGROUND,
                Name = "BottomPanel",
            };
            m_labelPages = new MyGuiControlLabel(
                text: new StringBuilder("{0}/{1}  ").ToString(),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM)
            {
                Name = "Pages"
            };
            m_buttonPrev = new MyGuiControlButton(
                visualStyle: MyGuiControlButtonStyleEnum.ArrowLeft,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM,
                onButtonClick: (b) => UpdateCurrentEntryIndex(-1))
            {
                Name = "Previous"
            };
            m_buttonNext = new MyGuiControlButton(
                visualStyle: MyGuiControlButtonStyleEnum.ArrowRight,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM,
                onButtonClick: (b) => UpdateCurrentEntryIndex(+1))
            {
                Name = "Next"
            };
            m_textError = new MyGuiControlMultilineText(
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                font: MyFontEnum.Red)
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                Name        = "Error"
            };
            m_backgroundPanel = new MyGuiControlCompositePanel()
            {
                ColorMask         = new Vector4(1f, 1f, 1f, 0.69f),
                BackgroundTexture = MyGuiConstants.TEXTURE_NEWS_BACKGROUND
            };

            m_wheelLoading = new MyGuiControlRotatingWheel(multipleSpinningWheels: MyPerGameSettings.GUI.MultipleSpinningWheels);

            Elements.Add(m_backgroundPanel);
            Elements.Add(m_labelTitle);
            Elements.Add(m_labelDate);
            Elements.Add(m_separator);
            Elements.Add(m_textNewsEntry);
            Elements.Add(m_bottomPanel);
            Elements.Add(m_labelPages);
            Elements.Add(m_buttonPrev);
            Elements.Add(m_buttonNext);
            Elements.Add(m_textError);
            Elements.Add(m_wheelLoading);

            if (false)
            {
                m_textNewsEntry.BorderEnabled = true;
                m_labelPages.BorderEnabled    = true;
                m_bottomPanel.BorderEnabled   = true;
                m_buttonPrev.BorderEnabled    = true;
                m_buttonNext.BorderEnabled    = true;
                m_textError.BorderEnabled     = true;
                m_wheelLoading.BorderEnabled  = true;
            }

            RefreshState();
            UpdatePositionsAndSizes();
            RefreshShownEntry();
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            Vector2 cbOffset         = new Vector2(-0.05f, 0.0f);
            Vector2 controlPadding   = new Vector2(0.02f, 0.02f);   // X: Left & Right, Y: Bottom & Top
            Vector2 multilinePadding = new Vector2(0.008f, 0.005f); // X: Left, Y: Bottom & Top

            float textScale     = 0.8f;
            float separatorSize = 0.02f;
            float usableWidth   = SCREEN_SIZE.X - HIDDEN_PART_RIGHT - controlPadding.X * 2;
            float hiddenPartTop = (SCREEN_SIZE.Y - 1.0f) / 2.0f;

            m_currentPosition    = -m_size.Value / 2.0f;
            m_currentPosition   += controlPadding;
            m_currentPosition.Y += hiddenPartTop;
            m_scale              = textScale;

            var caption = AddCaption(MyCommonTexts.ScreenDebugOfficial_Caption, Color.White.ToVector4(), controlPadding + new Vector2(-HIDDEN_PART_RIGHT, hiddenPartTop));

            m_currentPosition.Y += MyGuiConstants.SCREEN_CAPTION_DELTA_Y * 2.0f;

            AddCheckBox(MyCommonTexts.ScreenDebugOfficial_EnableDebugDraw, () => MyDebugDrawSettings.ENABLE_DEBUG_DRAW, (bool b) => MyDebugDrawSettings.ENABLE_DEBUG_DRAW = b, color: Color.White.ToVector4(), checkBoxOffset: cbOffset);

            m_currentPosition.Y += separatorSize;

            AddCheckBox(MyCommonTexts.ScreenDebugOfficial_ModelDummies, () => MyDebugDrawSettings.DEBUG_DRAW_MODEL_DUMMIES, (bool b) => MyDebugDrawSettings.DEBUG_DRAW_MODEL_DUMMIES = b, color: Color.White.ToVector4(), checkBoxOffset: cbOffset);
            AddCheckBox(MyCommonTexts.ScreenDebugOfficial_MountPoints, () => MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS, (bool b) => MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS    = b, color: Color.White.ToVector4(), checkBoxOffset: cbOffset);
            AddCheckBox(MyCommonTexts.ScreenDebugOfficial_PhysicsPrimitives, () => MyDebugDrawSettings.DEBUG_DRAW_PHYSICS_SHAPES, (bool b) => { MyDebugDrawSettings.DEBUG_DRAW_PHYSICS |= b; MyDebugDrawSettings.DEBUG_DRAW_PHYSICS_SHAPES = b; }, color: Color.White.ToVector4(), checkBoxOffset: cbOffset);

            m_currentPosition.Y += separatorSize;

            CreateDebugButton(usableWidth, MyCommonTexts.ScreenDebugOfficial_ReloadTextures, ReloadTextures);
            CreateDebugButton(usableWidth, MyCommonTexts.ScreenDebugOfficial_ReloadModels, ReloadModels);
            CreateDebugButton(usableWidth, MyCommonTexts.ScreenDebugOfficial_SavePrefab, SavePrefab, MyClipboardComponent.Static != null ? MyClipboardComponent.Static.Clipboard.HasCopiedGrids() : false, MyCommonTexts.ToolTipSaveShip);

            // Don't enable the SE bot debugging in official builds yet
            if (MyPerGameSettings.Game == GameEnum.ME_GAME || !MyFinalBuildConstants.IS_OFFICIAL)
            {
                CreateDebugButton(usableWidth, MyCommonTexts.ScreenDebugOfficial_BotSettings, OpenBotsScreen);
            }

            AddSubcaption(MyTexts.GetString(MyCommonTexts.ScreenDebugOfficial_ErrorLogCaption), Color.White.ToVector4(), new Vector2(-HIDDEN_PART_RIGHT, 0.0f));

            CreateDebugButton(usableWidth, MyCommonTexts.ScreenDebugOfficial_OpenErrorLog, CreateErrorLogScreen);
            CreateDebugButton(usableWidth, MyCommonTexts.ScreenDebugOfficial_CopyErrorLogToClipboard, CopyErrorLogToClipboard);

            m_currentPosition.Y += separatorSize;

            Vector2 textboxSize = (MyGuiManager.GetMaxMouseCoord() / 2.0f) - m_currentPosition;

            textboxSize.X        = usableWidth;
            textboxSize.Y       -= controlPadding.Y;
            m_currentPosition.X += multilinePadding.X / 2.0f;

            // Because multiline text does not allow padding
            var textBackground = new MyGuiControlPanel(m_currentPosition - multilinePadding, textboxSize + new Vector2(multilinePadding.X, multilinePadding.Y * 2.0f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);

            textBackground.BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST;
            Controls.Add(textBackground);

            var text = AddMultilineText(size: textboxSize);

            if (MyDefinitionErrors.GetErrors().Count() == 0)
            {
                text.AppendText(MyTexts.Get(MyCommonTexts.ScreenDebugOfficial_NoErrorText));
            }
            else
            {
                var errors          = MyDefinitionErrors.GetErrors();
                var errorDictionary = new Dictionary <string, Tuple <int, TErrorSeverity> >();

                // Count the number of most severe error per mod
                // Errors are already sorted by severity, so the first one per mod is the most severe
                foreach (var error in errors)
                {
                    var modName = error.ModName ?? "Local Content";

                    if (errorDictionary.ContainsKey(modName))
                    {
                        if (errorDictionary[modName].Item2 == error.Severity)
                        {
                            var info = errorDictionary[modName];
                            errorDictionary[modName] = new Tuple <int, TErrorSeverity>(info.Item1 + 1, info.Item2);
                        }
                    }
                    else
                    {
                        errorDictionary[modName] = new Tuple <int, TErrorSeverity>(1, error.Severity);
                    }
                }

                // Convert to list and sort to make sure most severe is displayed first
                var errorList = new List <Tuple <string, int, TErrorSeverity> >();
                foreach (var entry in errorDictionary)
                {
                    errorList.Add(new Tuple <string, int, TErrorSeverity>(entry.Key, entry.Value.Item1, entry.Value.Item2));
                }

                Comparison <Tuple <string, int, TErrorSeverity> > comp = (e1, e2) => e2.Item3 - e1.Item3;
                errorList.Sort(comp);

                foreach (var error in errorList)
                {
                    var errorText = new StringBuilder();
                    errorText.Append(error.Item1);
                    errorText.Append(" [");
                    if (error.Item3 == TErrorSeverity.Critical)
                    {
                        errorText.Append(MyDefinitionErrors.Error.GetSeverityName(error.Item3, false));
                        errorText.Append("]");
                    }
                    else
                    {
                        errorText.Append(error.Item2.ToString());
                        errorText.Append(" ");
                        errorText.Append(MyDefinitionErrors.Error.GetSeverityName(error.Item3, error.Item2 != 1));
                        errorText.Append("]");
                    }
                    text.AppendText(errorText, text.Font, text.TextScaleWithLanguage, MyDefinitionErrors.Error.GetSeverityColor(error.Item3).ToVector4());
                    text.AppendLine();
                }
            }
        }
示例#13
0
        void CreateControls(Vector2 controlsOrigin)
        {
            var panel = new MyGuiControlPanel(m_parent, m_position, m_size, m_backgroundColor.Value, 2, m_backgroundColor.Value * 2f);

            m_controls.Add(panel);

            float dPos = -1;
            float dPosFalloff;

            MyTextsWrapperEnum[] colorNames = { MyTextsWrapperEnum.Red, MyTextsWrapperEnum.Green, MyTextsWrapperEnum.Blue };

            Vector2 sliderOffset = new Vector2(0.21f, 0f);

            float buttonsY = m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f;

            AddControl(true, new MyGuiControlButton(m_parent, new Vector2(m_position.X, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                    MyTextsWrapperEnum.SwitchToSpotLight, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnSpotClick,
                                                    MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            ++dPos;

            m_controls.Add(new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.EachlightHasInternallyTwoLightsPointAndSpot, MyGuiConstants.LABEL_TEXT_COLOR,
                                                 MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            /*
             *
             * Point light
             *
             *
             */
            // Checkboxes for Disabled/Point/Hemisphere

            Vector2 checkBoxOffset = new Vector2(0.14f, 0);

            dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Point enabled"), MyGuiConstants.LABEL_TEXT_COLOR,
                                                   MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_pointLightCheckbox = new MyGuiControlCheckbox(m_parent, (checkBoxOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            AddControl(true, m_pointLightCheckbox);

            //dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.2f, 0), null, new StringBuilder("Hemispheric enabled"), MyGuiConstants.LABEL_TEXT_COLOR,
                                                   MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_hemisphereLightCheckbox = new MyGuiControlCheckbox(m_parent, (checkBoxOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.26f, 0), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            AddControl(true, m_hemisphereLightCheckbox);

            //text
            dPos += 0.9f;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.DiffuseColor, MyGuiConstants.LABEL_TEXT_COLOR,
                                                   MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            Vector2 buttonsColumn            = new Vector2(0.165f, 0.0025f);
            Vector2 copyPasteButtonScale     = MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE * new Vector2(0.7f, 0.7f);
            float   copyPasteButtonFontScale = MyGuiConstants.BUTTON_TEXT_SCALE * 0.75f;
            Vector2 pasteButtonShift         = new Vector2(0.115f, 0f);

            AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                    MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnCopyPointDiffuseColor,
                                                    MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));

            AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn + pasteButtonShift, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                    MyTextsWrapperEnum.Paste, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnPastePointDiffuseColor,
                                                    MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
            dPos += 0.1f;

            //point color sliders
            for (int i = 0; i < 3; i++)
            {
                dPos += 0.75f;
                AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR,
                                                       MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_pointNormalLightColorSlider[i] = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                                          MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                                          new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f);
                AddControl(true, m_pointNormalLightColorSlider[i]);
            }

            //text
            dPos += 0.9f;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SpecularColor, MyGuiConstants.LABEL_TEXT_COLOR,
                                                   MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                    MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnCopyPointSpecularColor,
                                                    MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));

            AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn + pasteButtonShift, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                    MyTextsWrapperEnum.Paste, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnPastePointSpecularColor,
                                                    MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
            dPos += 0.1f;

            // specular color sliders
            for (int i = 0; i < 3; i++)
            {
                dPos += 0.75f;
                AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR,
                                                       MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_specularLightColorSlider[i] = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                                       MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                                       new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f);
                AddControl(true, m_specularLightColorSlider[i]);
            }

            /*
             * Effect
             */

            //effect
            dPos += 1.25f;
            m_controls.Add(new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Options, MyGuiConstants.LABEL_TEXT_COLOR,
                                                 MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_effectComboBox = new MyGuiControlCombobox(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + sliderOffset + new Vector2(0.03f, 0f),
                                                        MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);

            foreach (MyLightEffectTypeEnum enumValue in Enum.GetValues(typeof(MyLightEffectTypeEnum)))
            {
                m_effectComboBox.AddItem((int)enumValue, MyPrefabLight.GetStringFromMyLightEffectTypeEnum(enumValue));
            }

            m_effectComboBox.SelectItemByKey(0);
            m_effectComboBox.OnSelect += OnComboBoxChange;
            //m_controls.Add(m_effectComboBox);
            m_controls.Add(m_effectComboBox);

            //falloff slider
            dPos       += 1.25f;
            dPosFalloff = dPos;

            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Falloff"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_pointFallOffSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                          0.1f, 5.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                          new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(true, m_pointFallOffSlider);

            //range slider
            dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Range"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_pointRangeSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                        0.1f, MyLightsConstants.MAX_POINTLIGHT_RADIUS, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                        new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(true, m_pointRangeSlider);

            //intensity slider
            dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Intensity"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_pointIntensitySlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                            0.1f, 10.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                            new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);

            AddControl(true, m_pointIntensitySlider);

            // Offset slider
            dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Offset"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_pointOffsetSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                         -0.5f, 1.5f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                         new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);

            AddControl(true, m_pointOffsetSlider);


            dPos++;
            AddControl(true, m_flashOffsetLabel = new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Flash Ofst."), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_flashOffsetSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                         0f, 1f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                         new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);

            AddControl(true, m_flashOffsetSlider);

            /*
             *
             * Reflector spot light
             *
             *
             */



            dPos = -1;



            AddControl(false, new MyGuiControlButton(m_parent, new Vector2(m_position.X, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                     MyTextsWrapperEnum.SwitchToPointLight, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnPointClick,
                                                     MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));


            dPos = 1;

            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Enabled, MyGuiConstants.LABEL_TEXT_COLOR,
                                                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotLightCheckbox = new MyGuiControlCheckbox(m_parent, (checkBoxOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            AddControl(false, m_spotLightCheckbox);



            //text
            dPos += 0.9f;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.DiffuseColor, MyGuiConstants.LABEL_TEXT_COLOR,
                                                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            AddControl(false, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                     MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnCopySpotDiffuseColor,
                                                     MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));

            AddControl(false, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn + pasteButtonShift, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                     MyTextsWrapperEnum.Paste, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnPasteSpotDiffuseColor,
                                                     MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
            dPos += 0.1f;

            //color sliders
            for (int i = 0; i < 3; i++)
            {
                dPos += 0.75f;
                AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR,
                                                        MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_spotNormalLightColorSlider[i] = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                                         MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                                         new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f);
                AddControl(false, m_spotNormalLightColorSlider[i]);
            }


            dPos++;


            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Shadows Distance"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            dPos++;
            m_spotLightShadowDistance = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                               0.0f, MyLightsConstants.MAX_SPOTLIGHT_SHADOW_RANGE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                               new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotLightShadowDistance);


            //angle slider
            dPos = dPosFalloff;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Angle"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotAngleSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                       0.1f, MyLightsConstants.MAX_SPOTLIGHT_ANGLE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                       new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotAngleSlider);

            //falloff slider
            dPos++;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Falloff"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotFallOffSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                         0.1f, 5.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                         new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotFallOffSlider);

            //range slider
            dPos++;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Range"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotRangeSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                       0.1f, MyLightsConstants.MAX_SPOTLIGHT_RANGE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                       new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotRangeSlider);

            //intensity slider
            dPos++;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Intensity"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotIntensitySlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                           0.1f, 10.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                           new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotIntensitySlider);

            dPos = 15;
            m_controls.Add(new MyGuiControlButton(m_parent, new Vector2(m_position.X - 0.05f, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                  MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick,
                                                  MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, true));

            m_controls.Add(new MyGuiControlButton(m_parent, new Vector2(m_position.X + 0.05f, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                  MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick,
                                                  MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));



            ActivateLightType(true);
            //m_tabControl.ActivateTab((int)MyGuiLightPrefabTypeEnum.PointLight);
        }
        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)
        {
            base.RecreateControls(constructor);

            var left       = -0.23f;
            var top        = -0.23f;
            var spacingV   = 0.045f;
            var buttonSize = new Vector2(0.29f, 0.052f);

            var composite = new MyGuiControlCompositePanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position    = new Vector2(left, top),
                Size        = new Vector2(0.46f, 0.46f)
            };

            left += 0.005f;
            top  += 0.007f;

            var panel = new MyGuiControlPanel()
            {
                OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position          = new Vector2(left, top),
                Size              = new Vector2(0.451f, 0.038f),
                BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK
            };

            left += 0.005f;
            top  += 0.003f;

            // LABELS
            var headerText  = MyTexts.GetString((m_editFaction == null) ? MySpaceTexts.TerminalTab_Factions_CreateFaction : MySpaceTexts.TerminalTab_Factions_EditFaction);
            var headerLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top), text: headerText);

            top += 0.01f;
            var shortcutLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionTag));
            var nameLabel     = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + 2f * spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionName));
            var descLabel     = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + 3f * spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionDescription));
            var secretLabel   = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + 4f * spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionPrivateInfo));

            shortcutLabel.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionTagToolTip);
            secretLabel.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionPrivateInfoToolTip);

            Controls.Add(composite);
            Controls.Add(panel);
            Controls.Add(headerLabel);
            Controls.Add(shortcutLabel);
            Controls.Add(nameLabel);
            Controls.Add(descLabel);
            Controls.Add(secretLabel);

            // INPUTS
            var iLeft = 0.06f;
            var iTop  = -0.15f;

            m_shortcut = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop), maxLength: 3, defaultText: (m_editFaction != null) ? m_editFaction.Tag : "");
            m_name     = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop + spacingV), maxLength: 64, defaultText: (m_editFaction != null) ? m_editFaction.Name : "");
            m_desc     = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop + 2f * spacingV), maxLength: 512, defaultText: (m_editFaction != null) ? m_editFaction.Description : "");
            m_privInfo = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop + 3f * spacingV), maxLength: 512, defaultText: (m_editFaction != null) ? m_editFaction.PrivateInfo : "");

            m_shortcut.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionTagToolTip);
            m_privInfo.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionPrivateInfoToolTip);

            Controls.Add(m_shortcut);
            Controls.Add(m_name);
            Controls.Add(m_desc);
            Controls.Add(m_privInfo);

            // BUTTONS
            top -= 0.003f;

            Controls.Add(new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, size: buttonSize, position: new Vector2(left, -top), text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkClick));
            Controls.Add(new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, size: buttonSize, position: new Vector2(-left, -top), text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelClick));
        }
        protected virtual void CreateControls()
        {
            CreateButtons();
            var screenZero = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(0, 0));
            var screenMax  = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(MyMinerGame.ScreenSize.X, MyMinerGame.ScreenSize.Y));

            var textBoxSize  = MyGuiConstants.TEXTBOX_MEDIUM_SIZE + new Vector2(30f / 1600f, 0);
            var treeViewSize = new Vector2(textBoxSize.X, screenMax.Y - (MyGuiConstants.TOOLBAR_PADDING.Y * 6 + textBoxSize.Y + MyGuiConstants.TOOLBAR_BUTTON_SIZE.Y));
            var panelSize    = treeViewSize + new Vector2(MyGuiConstants.TOOLBAR_PADDING.X * 2, MyGuiConstants.TOOLBAR_PADDING.Y * 3) + new Vector2(0, textBoxSize.Y);

            var textBoxPosition  = screenZero + new Vector2(MyGuiConstants.TOOLBAR_PADDING.Y * 2, MyGuiConstants.TOOLBAR_PADDING.Y * 3 + MyGuiConstants.TOOLBAR_BUTTON_SIZE.Y);
            var treeViewPosition = textBoxPosition + new Vector2(0, textBoxSize.Y + MyGuiConstants.TOOLBAR_PADDING.Y);
            var panelPosition    = textBoxPosition - new Vector2(MyGuiConstants.TOOLBAR_PADDING.Y, MyGuiConstants.TOOLBAR_PADDING.Y);

            // Add treeview and add button panel
            m_controlPanel = new MyGuiControlPanel(m_parentScreen,
                                                   panelPosition + panelSize / 2,
                                                   panelSize,
                                                   MyGuiConstants.TREEVIEW_BACKGROUND_COLOR,
                                                   null, null, null, null,
                                                   MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            m_editorControls.Add(m_controlPanel);

            m_addObjectTreeViewdragDrop      = new MyTreeViewItemDragAndDrop(m_parentScreen);
            m_addObjectTreeViewdragDrop.Drop = OnDragDrop;

            // Add object treeView
            m_addObjectTreeView = new MyGuiControlTreeView(
                m_parentScreen,
                treeViewPosition + treeViewSize / 2,
                treeViewSize,
                MyGuiConstants.TREEVIEW_BACKGROUND_COLOR,
                false);
            m_editorControls.Add(m_addObjectTreeView);

            // Add treeView filter textBox
            m_filterTextbox = new MyGuiControlTextbox(m_parentScreen,
                                                      textBoxPosition + textBoxSize / 2,
                                                      MyGuiControlPreDefinedSize.MEDIUM,
                                                      string.Empty, 80,
                                                      MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL, false);
            m_editorControls.Add(m_filterTextbox);
            MyGuiScreenGamePlay.Static.SetControlIndex(1);

            // Dragdrop Control must be last (draw over other controls)
            m_editorControls.Add(m_addObjectTreeViewdragDrop);

            Vector2 editVoxelHandPanelSize = new Vector2(panelSize.X * 1.4f, panelSize.Y);

            m_editVoxelHand = new MyGuiControlEditVoxelHand(m_parentScreen, panelPosition + editVoxelHandPanelSize / 2f, editVoxelHandPanelSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR);
            m_editorControls.Add(m_editVoxelHand);

            Vector2 editLightsSize = new Vector2(0.48f, 0.925f);

            m_editLights = new MyGuiControlEditLights(m_parentScreen, panelPosition + editLightsSize / 2, editLightsSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR);
            m_editorControls.Add(m_editLights);
            m_editLights.Visible = false;
            foreach (MyGuiControlBase control in m_editorControls)
            {
                control.DrawWhilePaused = false;
            }
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            AddCaption("Color picker");



            m_hueSlider = new MyGuiControlSlider(
                position: new Vector2(x / 1600f, (y + 50) / 1200f),
                width: 0.25f,
                minValue: 0,
                maxValue: 360,
                labelText: String.Empty,
                labelDecimalPlaces: 0,
                labelSpaceWidth: 50 / 1200f,
                intValue: true,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                visualStyle: MyGuiControlSliderStyleEnum.Hue
                );
            m_saturationSlider = new MyGuiControlSlider(
                position: new Vector2(x / 1600f, (y + 150) / 1200f),
                width: 0.25f,
                minValue: -100,
                maxValue: 100,
                defaultValue: 0,
                labelText: String.Empty,
                labelDecimalPlaces: 0,
                labelSpaceWidth: 50 / 1200f,
                intValue: true,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
                );
            m_valueSlider = new MyGuiControlSlider(
                position: new Vector2(x / 1600f, (y + 250) / 1200f),
                width: 0.25f,
                minValue: -100,
                maxValue: 100,
                defaultValue: 0,
                labelText: String.Empty,
                labelDecimalPlaces: 0,
                labelSpaceWidth: 50 / 1200f,
                intValue: true,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
                );

            m_hueSlider.ValueChanged        += OnValueChange;
            m_saturationSlider.ValueChanged += OnValueChange;
            m_valueSlider.ValueChanged      += OnValueChange;

            m_hueLabel        = new MyGuiControlLabel(position: new Vector2(100 / 1600f, y / 1200f), text: String.Empty, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_saturationLabel = new MyGuiControlLabel(position: new Vector2(100 / 1600f, (y + 100) / 1200f), text: String.Empty, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_valueLabel      = new MyGuiControlLabel(position: new Vector2(100 / 1600f, (y + 200) / 1200f), text: String.Empty, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);



            Controls.Add(new MyGuiControlLabel(position: new Vector2(x / 1600f, y / 1200f), text: "Hue:", originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_hueLabel);
            Controls.Add(m_hueSlider);
            Controls.Add(new MyGuiControlLabel(position: new Vector2(x / 1600f, (y + 100) / 1200f), text: "Saturation:", originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_saturationLabel);
            Controls.Add(m_saturationSlider);
            Controls.Add(new MyGuiControlLabel(position: new Vector2(x / 1600f, (y + 200) / 1200f), text: "Value:", originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_valueLabel);
            Controls.Add(m_valueSlider);
            Controls.Add(new MyGuiControlButton(
                             size: new Vector2(100f, 0.1f),
                             position: new Vector2(0 / 1600f, (y + 285 + (MyPlayer.BuildColorSlotCount / 7 + 1) * 36) / 1200f),
                             text: new StringBuilder("Defaults"),
                             onButtonClick: OnDefaultsClick));
            Controls.Add(new MyGuiControlButton(
                             size: new Vector2(100f, 0.1f),
                             position: new Vector2(0 / 1600f, (y + 360 + (MyPlayer.BuildColorSlotCount / 7 + 1) * 36) / 1200f),
                             text: new StringBuilder("OK"),
                             onButtonClick: OnOkClick));
            Controls.Add(new MyGuiControlButton(
                             position: new Vector2(0 / 1600f, (y + 435 + (MyPlayer.BuildColorSlotCount / 7 + 1) * 36) / 1200f),
                             text: new StringBuilder("Cancel"),
                             onButtonClick: OnCancelClick));

            Color c = Color.White;
            int   j = 0;

            m_highlightControlPanel = new MyGuiControlPanel(
                size: new Vector2(0.03f, 0.03f),
                position: new Vector2(((x + defColCol) / 1600f) + (MyPlayer.SelectedColorSlot % 7) * 0.03f, (y + defColLine) / 1200f + (MyPlayer.SelectedColorSlot / 7) * 0.03f));
            m_highlightControlPanel.ColorMask         = c.ToVector4();
            m_highlightControlPanel.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;
            Controls.Add(m_highlightControlPanel);
            int tmpx = MyPlayer.BuildColorSlotCount;

            for (int i = 0; i < MyPlayer.BuildColorSlotCount;)
            {
                MyGuiControlPanel tmpPanel = new MyGuiControlPanel(
                    size: new Vector2(0.025f, 0.025f),
                    position: new Vector2(((x + defColCol) / 1600f) + (i % 7) * 0.03f, (y + defColLine) / 1200f + j * 0.03f));
                tmpPanel.ColorMask         = (prev(MyPlayer.ColorSlots.ItemAt(i))).HSVtoColor().ToVector4();
                tmpPanel.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;
                m_colorPaletteControlsList.Add(tmpPanel);
                Controls.Add(tmpPanel);
                i++;
                if (i % 7 == 0)
                {
                    j++;
                }
            }
        }
示例#18
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();
        }
        private void InitRightSide()
        {
            var originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT_INFO, MARGIN_TOP);

            var screenSize         = m_size.Value;
            var layoutSize         = new Vector2(screenSize.X / 2 - originL.X, screenSize.Y - MARGIN_TOP - MARGIN_BOTTOM) - new Vector2(MARGIN_RIGHT, 0.05f);
            var columnWidthLabel   = layoutSize.X * 0.43f;
            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
            };

            m_descriptionPanel = 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(m_descriptionPanel, 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;

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

            // The bulgarian constant is offset from side to match the size of the layout
            var buttonsOrigin           = m_size.Value / 2; buttonsOrigin.X -= MARGIN_RIGHT; buttonsOrigin.Y -= 0.03f;
            var buttonSize              = MyGuiConstants.BACK_BUTTON_SIZE;
            var buttonHorizontalPadding = MyGuiConstants.GENERIC_BUTTON_SPACING.X;
            var buttonVerticalPadding   = MyGuiConstants.GENERIC_BUTTON_SPACING.Y;

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

            // Start hidden, because shrinking
            m_publishButton.Visible         = false;
            m_descriptionPanel.Size         = new Vector2(m_descriptionPanel.Size.X, m_descriptionPanel.Size.Y + MyGuiConstants.BACK_BUTTON_SIZE.Y);
            m_descriptionMultilineText.Size = new Vector2(m_descriptionMultilineText.Size.X, m_descriptionMultilineText.Size.Y + MyGuiConstants.BACK_BUTTON_SIZE.Y);

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

            CloseButtonEnabled = true;
        }