public MyGuiScreenTriggerLives(MyTrigger trg)
            : base(trg, new Vector2(WINSIZEX + 0.1f, WINSIZEY))
        {
            float left = m_textboxMessage.Position.X-m_textboxMessage.Size.X/2;
            float top = -WINSIZEY / 2f + MIDDLE_PART_ORIGIN.Y;
            m_labelLives = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.GuiTriggersLives).ToString()
            );
            left += m_labelLives.Size.X + spacingH;
            m_lives = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelLives.Size.X, 0.035f),
                Type = MyGuiControlTextboxType.DigitsOnly,
                Name = "lives"
            };
            m_lives.TextChanged += OnLivesChanged;

            AddCaption(MySpaceTexts.GuiTriggerCaptionLives);
            Controls.Add(m_labelLives);
            Controls.Add(m_lives);

            m_lives.Text = ((MyTriggerLives)trg).LivesLeft.ToString();
        }
        public MyGuiScreenTriggerTime(MyTrigger trg, MyStringId labelText)
            : base(trg, new Vector2(WINSIZEX + 0.1f, WINSIZEY))
        {
            float left = m_textboxMessage.Position.X-m_textboxMessage.Size.X/2;
            float top = -WINSIZEY / 2f + MIDDLE_PART_ORIGIN.Y;
            m_labelTime = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.013f, 0.035f),
                text: MyTexts.Get(labelText).ToString()//text: MyTexts.Get(MySpaceTexts.GuiTriggerTimeLimit).ToString()
            );
            left += m_labelTime.Size.X + spacingH;
            m_textboxTime = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(0.05f, 0.035f),
                Type = MyGuiControlTextboxType.DigitsOnly,
                Name = "time"
            };
            m_textboxTime.TextChanged += OnTimeChanged;

            Controls.Add(m_labelTime);
            Controls.Add(m_textboxTime);

        }
        void LoadControls()
        {
            // Background texture unloaded in base
            m_wheelTexture = MyGuiConstants.LOADING_TEXTURE;

            m_size = new Vector2(598 / 1600f, 368 / 1200f);
            m_progressTextLabel = new MyGuiControlLabel(
                position: new Vector2(0.0f, -0.07f),
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.86f,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            m_progressTextLabel.TextEnum = m_progressText;
            Controls.Add(m_progressTextLabel);

            float deltaX = 0;// (m_enableCancel) ? 0.08f : 0.0f;
            float deltaY = 0.015f;

            m_rotatingWheel = new MyGuiControlRotatingWheel(new Vector2(-deltaX, deltaY), MyGuiConstants.ROTATING_WHEEL_COLOR, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, m_wheelTexture);

            Controls.Add(m_rotatingWheel);

            //  Sometimes we don't want to allow user to cancel pending progress screen
            if (m_cancelText.HasValue)
            {
                var cancelButton = new MyGuiControlButton(
                    position: new Vector2(deltaX, deltaY + 0.09f),
                    size: MyGuiConstants.BACK_BUTTON_SIZE,
                    text: MyTexts.Get(m_cancelText.Value),
                    visualStyle: Common.ObjectBuilders.Gui.MyGuiControlButtonStyleEnum.ControlSetting,
                    onButtonClick: OnCancelClick);
                Controls.Add(cancelButton);
            }
            m_controlsCreated = true;
        }
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            var fileName = MakeScreenFilepath("DialogAmount");
            var fsPath = Path.Combine(MyFileSystem.ContentPath, fileName);

            MyObjectBuilder_GuiScreen objectBuilder;
            Sandbox.Common.ObjectBuilders.Serializer.MyObjectBuilderSerializer.DeserializeXML<MyObjectBuilder_GuiScreen>(fsPath, out objectBuilder);
            Init(objectBuilder);

            m_amountTextbox = (MyGuiControlTextbox)Controls.GetControlByName("AmountTextbox");
            m_increaseButton = (MyGuiControlButton)Controls.GetControlByName("IncreaseButton");
            m_decreaseButton = (MyGuiControlButton)Controls.GetControlByName("DecreaseButton");
            m_confirmButton  = (MyGuiControlButton)Controls.GetControlByName("ConfirmButton");
            m_cancelButton   = (MyGuiControlButton)Controls.GetControlByName("CancelButton");
            m_errorLabel     = (MyGuiControlLabel)Controls.GetControlByName("ErrorLabel");
            m_captionLabel = (MyGuiControlLabel)Controls.GetControlByName("CaptionLabel");
            m_captionLabel.Text = null;
            m_captionLabel.TextEnum = m_caption;

            m_errorLabel.Visible = false;

            m_amountTextbox.TextChanged    += amountTextbox_TextChanged;
            m_increaseButton.ButtonClicked += increaseButton_OnButtonClick;
            m_decreaseButton.ButtonClicked += decreaseButton_OnButtonClick;
            m_confirmButton.ButtonClicked  += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked   += cancelButton_OnButtonClick;

            RefreshAmountTextbox();
        }
            public WarningLine(MySimpleProfiler.PerformanceWarning warning, MyGuiScreenPerformanceWarnings screen)
            {
                Parent = new MyGuiControlParent();
                m_name = new MyGuiControlLabel(text: Truncate(warning.Block.DisplayName), position: new Vector2(-0.43f, 0), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, font: VRage.Game.MyFontEnum.Red);
                m_description = new MyGuiControlLabel
                    (
                    text: String.IsNullOrEmpty(warning.Block.Description.String) ? MyTexts.GetString(MyCommonTexts.PerformanceWarningTooManyBlocks) : MyTexts.GetString(warning.Block.Description), 
                    position: new Vector2(-0.24f, 0), 
                    originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
                    );
                m_separator = new MyGuiControlSeparatorList();
                Parent.Size = new Vector2(Parent.Size.X, m_description.Size.Y);
                m_separator.AddVertical(new Vector2(-0.25f, -Parent.Size.Y / 2 - 0.006f), Parent.Size.Y + 0.016f);
                m_separator.AddVertical(new Vector2(0.35f, -Parent.Size.Y / 2 - 0.006f), Parent.Size.Y + 0.016f);
                m_time = new MyGuiControlLabel(position: new Vector2(0.43f, 0), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);

                switch (warning.Block.type)
                {
                    case MySimpleProfiler.MySimpleProfilingBlock.ProfilingBlockType.GRAPHICS:
                        screen.m_areaTitleGraphics.Warnings.Add(this);
                        break;
                    case MySimpleProfiler.MySimpleProfilingBlock.ProfilingBlockType.BLOCK:
                        screen.m_areaTitleBlocks.Warnings.Add(this);
                        break;
                    case MySimpleProfiler.MySimpleProfilingBlock.ProfilingBlockType.OTHER:
                        screen.m_areaTitleOther.Warnings.Add(this);
                        break;
                }
                this.Warning = warning;
            }
            public MyGuiControlItem(MyAbstractControlMenuItem item, Vector2? size = null)
                : base(size: size)
            {
                m_item = item;
                m_item.UpdateValue();
                m_label = new MyGuiControlLabel(text: item.ControlLabel, textScale: 0.8f);
                m_value = new MyGuiControlLabel(text: item.CurrentValue, textScale: 0.8f);

                MyLayoutVertical layout = new MyLayoutVertical(this, 28);
                layout.Add(m_label, m_value);
            }
            public ComponentLineControl(Vector2 size, float iconSize)
                : base(size: size, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
            {
                var m_iconSize = new Vector2(iconSize) * new Vector2(0.75f, 1);
                var middleLeft = new Vector2(-this.Size.X / 2, 0);
                var middleRight = new Vector2(this.Size.X / 2, 0);
                var iconPos = middleLeft - new Vector2(0, m_iconSize.Y / 2);

                //IconPanel = new MyGuiControlPanel();
                //IconPanelBackground = new MyGuiControlPanel();
                IconImage = new MyGuiControlImage();
                IconPanelProgress = new MyGuiControlPanel();
                NameLabel = new MyGuiControlLabel(text: String.Empty);
                NumbersLabel = new MyGuiControlLabel(text: String.Empty);
                
                //IconPanel.Size = m_iconSize;
                //IconPanel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                //IconPanel.Position = iconPos;

                //IconPanelBackground.Size = m_iconSize;
                //IconPanelBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                //IconPanelBackground.Position = iconPos;
                //IconPanelBackground.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);

                IconImage.Size = m_iconSize;
                IconImage.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                IconImage.Position = iconPos;
                IconImage.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);

                IconPanelProgress.Size = m_iconSize;
                IconPanelProgress.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                IconPanelProgress.Position = iconPos;
                IconPanelProgress.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;
                float gray = 0.1f;
                IconPanelProgress.ColorMask = new Vector4(gray, gray, gray, 0.5f);

                NameLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
                NameLabel.Position = middleLeft + new Vector2(m_iconSize.X + 0.01225f, 0);

                NameLabel.AutoEllipsis = true;

                NumbersLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
                NumbersLabel.Position = middleRight + new Vector2(-0.033f, 0); //topRight + new Vector2(-0.02f, 0.004f);

                //Elements.Add(IconPanelBackground);
                //Elements.Add(IconPanel);
                Elements.Add(IconImage);
                Elements.Add(IconPanelProgress);
                Elements.Add(NameLabel);
                Elements.Add(NumbersLabel);
            }
        public MyGuiControlComponentList():
            base(isActiveControl: false)
        {
            m_padding = new MyGuiBorderThickness(0.02f, 0.008f);

            m_valuesLabel = new MyGuiControlLabel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text = "Required / Available",
                TextScale = 0.75f * MyGuiConstants.DEFAULT_TEXT_SCALE,
            };
            Elements.Add(m_valuesLabel);
            UpdatePositions();
        }
        public MyGuiControlVoxelHandSettings()
            : base(size: new Vector2(0.25f, 0.4f),
                   backgroundTexture: new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_LARGE_DEFAULT.Texture),
                   originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
        {
            m_labelSettings = new MyGuiControlLabel()
            {
                Position = new Vector2(-0.1f, -0.1875f),
                TextEnum = MyCommonTexts.VoxelHandSettingScreen_ShapeSettings,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Font = MyFontEnum.ScreenCaption,
            };

            OKButton = new MyGuiControlButton() { Position = new Vector2(0f, 0.19f), TextEnum = MyCommonTexts.Ok, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM };
        }
        public MyGuiControlBlockProperty(String title, String tooltip, MyGuiControlBase propertyControl,
            MyGuiControlBlockPropertyLayoutEnum layout = MyGuiControlBlockPropertyLayoutEnum.Vertical, bool showExtraInfo = true)
            : base(toolTip: tooltip, canHaveFocus: true, isActiveControl: false, allowFocusingElements: true)
        {
            const float LABEL_TEXT_SCALE = MyGuiConstants.DEFAULT_TEXT_SCALE * 0.95f;
            m_title = new MyGuiControlLabel(text: title, textScale: LABEL_TEXT_SCALE);
            if (title.Length > 0)
            {
                Elements.Add(m_title);
            }
            
            m_extraInfo = new MyGuiControlLabel(textScale: LABEL_TEXT_SCALE);
            if (showExtraInfo)
            {
                Elements.Add(m_extraInfo);
            }

            m_propertyControl = propertyControl;
            Elements.Add(m_propertyControl);

            titleHeight = title.Length > 0 || showExtraInfo ? m_title.Size.Y : 0;

            m_layout = layout;
            switch (layout)
            {
                case MyGuiControlBlockPropertyLayoutEnum.Horizontal:                    
                    MinSize = new Vector2(m_propertyControl.Size.X + m_title.Size.X * 1.1f, Math.Max(m_propertyControl.Size.Y, 2.1f * titleHeight));
                    Size = MinSize;

                    m_title.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                    m_propertyControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
                    m_extraInfo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                    break;
                case MyGuiControlBlockPropertyLayoutEnum.Vertical:
                    MinSize = new Vector2(Math.Max(m_propertyControl.Size.X, m_title.Size.X), m_propertyControl.Size.Y + titleHeight * 1.1f);
                    Size = MinSize;

                    m_title.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                    m_propertyControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                    m_extraInfo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
                    break;
            }

            RefreshPositionsAndSizes();

            m_extraInfo.Text = "";
            m_extraInfo.Visible = false;
        }
        public MyGuiScreenTriggerBlockDestroyed(MyTrigger trig) : base(trig,new Vector2(0.5f,0.8f))
        {
            trigger=(MyTriggerBlockDestroyed)trig;
            AddCaption(MySpaceTexts.GuiTriggerCaptionBlockDestroyed);

            var layout = new MyLayoutTable(this);
            layout.SetColumnWidthsNormalized(10, 30, 3, 30, 10);
            layout.SetRowHeightsNormalized(20, 35, 6, 4, 4, 5, 33);

            m_selectedBlocks = new MyGuiControlTable();
            m_selectedBlocks.VisibleRowsCount = 8;
            m_selectedBlocks.ColumnsCount = 1;
            m_selectedBlocks.SetCustomColumnWidths(new float[]{1});
            m_selectedBlocks.SetColumnName(0, MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyed_ColumnName));

            layout.AddWithSize(m_selectedBlocks, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 1, colSpan: 3);

            m_buttonPaste = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerPasteBlocks),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                onButtonClick: OnPasteButtonClick
                );
            m_buttonPaste.SetToolTip(MySpaceTexts.GuiTriggerPasteBlocksTooltip);
            layout.AddWithSize(m_buttonPaste, MyAlignH.Left, MyAlignV.Top, 2, 1, rowSpan: 1, colSpan: 1);

            m_buttonDelete = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerDeleteBlocks),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                onButtonClick: OnDeleteButtonClick);
            layout.AddWithSize(m_buttonDelete, MyAlignH.Left, MyAlignV.Top, 2, 3, rowSpan: 1, colSpan: 1);

            m_labelSingleMessage = new MyGuiControlLabel(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyedSingleMessage).ToString()
                );
            layout.AddWithSize(m_labelSingleMessage, MyAlignH.Left, MyAlignV.Top, 3, 1, rowSpan: 1, colSpan: 1);
            m_textboxSingleMessage = new MyGuiControlTextbox(
                defaultText: trigger.SingleMessage,
                maxLength: 85);
            layout.AddWithSize(m_textboxSingleMessage, MyAlignH.Left, MyAlignV.Top, 4, 1, rowSpan: 1, colSpan: 3);

            foreach(var block in trigger.Blocks)
                AddRow(block.Key);
            m_tempSb.Clear().Append(trigger.SingleMessage);
            m_textboxSingleMessage.SetText(m_tempSb);

        }
 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);
 }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            var layout = new MyLayoutTable(this);
            layout.SetColumnWidthsNormalized(50, 250, 150, 250, 50);
            layout.SetRowHeightsNormalized(50, 450, 30, 50);

            m_mainLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.GuiScenarioDescription), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            layout.AddWithSize(m_mainLabel, MyAlignH.Left, MyAlignV.Center, 0, 1, colSpan: 3);
            //BRIEFING:
            m_descriptionBox = new MyGuiControlMultilineText(
                position: new Vector2(0.0f, 0.0f),
                size: new Vector2(0.2f, 0.2f),
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                selectable: false);
            layout.AddWithSize(m_descriptionBox, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 1, colSpan: 3);

            m_okButton = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.Ok), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE,
                size: new Vector2(200, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnOkClicked);
            layout.AddWithSize(m_okButton, MyAlignH.Left, MyAlignV.Top, 2, 2);
        }
        public MyGuiControlInventoryOwner(IMyInventoryOwner owner, Vector4 labelColorMask)
            : base(backgroundTexture: new MyGuiCompositeTexture() { Center = new MyGuiSizedTexture() { Texture = @"Textures\GUI\Controls\item_highlight_dark.dds" } },
                    canHaveFocus: true,
                    allowFocusingElements: true,
                    isActiveControl: false)
        {
            Debug.Assert(owner != null);

            m_nameLabel = MakeLabel();
            m_nameLabel.ColorMask = labelColorMask;
            m_massLabels = new List<MyGuiControlLabel>();
            m_volumeLabels = new List<MyGuiControlLabel>();
            m_inventoryGrids = new List<MyGuiControlGrid>();
            ShowTooltipWhenDisabled = true;

            m_nameLabel.Name = "NameLabel";

            Elements.Add(m_nameLabel);

            InventoryOwner = owner;
        }
        public MyGuiScreenTrigger(MyTrigger trg, Vector2 size)
            : base(size, MyGuiConstants.SCREEN_BACKGROUND_COLOR, size)
        {
            Vector2 m_itemPos=new Vector2();
            m_itemPos.Y = - size.Y / 2 + 0.1f;
            m_textboxName=new MyGuiControlLabel(
                position: m_itemPos,
                text: MyTexts.Get(MySpaceTexts.GuiTriggerMessage).ToString()
                );
            m_itemPos.Y += m_textboxName.Size.Y + VERTICAL_OFFSET;

            m_trigger = trg;
            m_textbox = new MyGuiControlTextbox(
                position: m_itemPos,
                defaultText: trg.Message,
                maxLength: 85);
            m_itemPos.Y += m_textbox.Size.Y + VERTICAL_OFFSET + 0.2f;
            //line to the left of textbox
            m_textboxName.Position = m_textboxName.Position-new Vector2(m_textbox.Size.X / 2 , 0);

            Vector2 buttonOrigin = new Vector2(0f, Size.Value.Y * 0.4f);
            Vector2 buttonOffset = new Vector2(0.01f, 0f); 
            
            m_okButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Ok),
                onButtonClick: OnOkButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_okButton.Position = buttonOrigin - buttonOffset;

            m_cancelButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Cancel),
                onButtonClick: OnCancelButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            m_cancelButton.Position = buttonOrigin + buttonOffset;

            Controls.Add(m_textboxName);
            Controls.Add(m_textbox);
            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

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

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

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

            const float colMargin = 60f;
            const float rowHeight = 65f;
            var layout = new MyLayoutTable(this);
            layout.SetColumnWidths(colMargin, 680, colMargin);
            layout.SetRowHeights(110, rowHeight, rowHeight, rowHeight, rowHeight, rowHeight);

            layout.Add(label, MyAlignH.Center, MyAlignV.Center, 1, 1);
            layout.Add(m_timeOutLabel, MyAlignH.Center, MyAlignV.Center, 2, 1);
            layout.Add(m_leaveButton, MyAlignH.Center, MyAlignV.Center, 3, 1);
        }
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            var fileName = MakeScreenFilepath("DialogText");
            var fsPath = Path.Combine(MyFileSystem.ContentPath, fileName);

            MyObjectBuilder_GuiScreen objectBuilder;
            MyObjectBuilderSerializer.DeserializeXML<MyObjectBuilder_GuiScreen>(fsPath, out objectBuilder);
            Init(objectBuilder);

            m_valueTextbox = (MyGuiControlTextbox)Controls.GetControlByName("ValueTextbox");
            m_confirmButton  = (MyGuiControlButton)Controls.GetControlByName("ConfirmButton");
            m_cancelButton   = (MyGuiControlButton)Controls.GetControlByName("CancelButton");
            m_captionLabel = (MyGuiControlLabel)Controls.GetControlByName("CaptionLabel");
            m_captionLabel.Text = null;
            m_captionLabel.TextEnum = m_caption;

            m_confirmButton.ButtonClicked  += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked   += cancelButton_OnButtonClick;

            m_valueTextbox.Text = m_value;
        }
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            var fileName = MakeScreenFilepath("DialogAmount");
            var fsPath = Path.Combine(MyFileSystem.ContentPath, fileName);

            MyObjectBuilder_GuiScreen objectBuilder;
            MyObjectBuilderSerializer.DeserializeXML<MyObjectBuilder_GuiScreen>(fsPath, out objectBuilder);
            Init(objectBuilder);

            m_amountTextbox = (MyGuiControlTextbox)Controls.GetControlByName("AmountTextbox");
            m_increaseButton = (MyGuiControlButton)Controls.GetControlByName("IncreaseButton");
            m_decreaseButton = (MyGuiControlButton)Controls.GetControlByName("DecreaseButton");
            m_confirmButton = (MyGuiControlButton)Controls.GetControlByName("ConfirmButton");
            m_cancelButton = (MyGuiControlButton)Controls.GetControlByName("CancelButton");
            m_errorLabel = (MyGuiControlLabel)Controls.GetControlByName("ErrorLabel");
            m_captionLabel = (MyGuiControlLabel)Controls.GetControlByName("CaptionLabel");
            m_captionLabel.Text = null;
            m_captionLabel.TextEnum = m_caption;

            m_errorLabel.Visible = false;

            m_amountTextbox.TextChanged += amountTextbox_TextChanged;
            m_increaseButton.ButtonClicked += increaseButton_OnButtonClick;
            m_decreaseButton.ButtonClicked += decreaseButton_OnButtonClick;
            m_confirmButton.ButtonClicked += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked += cancelButton_OnButtonClick;

            m_confirmButton.TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER;
            m_cancelButton.TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER;

            RefreshAmountTextbox();
            //GR: in int have all text selected
            m_amountTextbox.SelectAll();
        }
        public override void RecreateControls(bool constructor) 
        {
            base.RecreateControls(constructor);
            m_openWorkshopButton = new MyGuiControlButton(position: new Vector2(0.384f, 0.4f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.ScreenLoadSubscribedWorldBrowseWorkshop), toolTip: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_BrowseWorkshop_Tooltip), onButtonClick: OpenWorkshopButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_openWorkshopButton);

            m_okButton.Position = new Vector2(-0.016f, 0.4f);
            m_okButton.SetToolTip(MyTexts.GetString(MySpaceTexts.ProgrammableBlock_CodeEditor_SaveExit_Tooltip));

            m_saveChanges = new MyGuiControlButton(position: new Vector2(0.184f, 0.4f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_RememberCode), toolTip: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_RememberCode_Tooltip), onButtonClick: SaveCodeButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_saveChanges);

            m_checkCodeButton = new MyGuiControlButton(position: new Vector2(-0.216f, 0.4f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_CheckCode), toolTip: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_CheckCode_Tooltip), onButtonClick: CheckCodeButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_checkCodeButton);

            m_help = new MyGuiControlButton(position: new Vector2(0.384f, -0.4f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_Help), toolTip: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_HelpTooltip), onButtonClick: HelpButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_help);

            m_descriptionBox.Position = Vector2.Zero;
            m_descriptionBackgroundPanel.Size *= new Vector2(1.01f, 1.01f);
            m_descriptionBackgroundPanel.Position  = new Vector2(-0.48f,-0.37f);


            m_titleLabel.Position = new Vector2(0.0f, -0.4f);


            m_lineCounter = new MyGuiControlLabel(new Vector2(-0.479f, 0.4f), null, string.Format(MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_LineNo), 1, m_editorWindow.GetTotalNumLines()));
            Elements.Add(m_lineCounter);
            m_LetterCounter = new MyGuiControlLabel(new Vector2(-0.479f, -0.4f));
            Elements.Add(m_LetterCounter);
            m_TextTooLongMessage = new MyGuiControlLabel(new Vector2(-0.34f, -0.4f), font: MyFontEnum.Red);
            Elements.Add(m_TextTooLongMessage);

            EnableButtons();
            FocusedControl = m_descriptionBox;
        }
        // mk:TODO Modify MyGuiControlList to allow different alignments and remove scale from this control.
        public MyGuiControlOnOffSwitch(
            bool initialValue = false,
            String onText = null,
            String offText = null)
        : base(canHaveFocus: true)
        {
            m_onButton = new MyGuiControlCheckbox(
                visualStyle: MyGuiControlCheckboxStyleEnum.SwitchOnOffLeft,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);

            m_offButton = new MyGuiControlCheckbox(
                visualStyle: MyGuiControlCheckboxStyleEnum.SwitchOnOffRight,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            m_onLabel = new MyGuiControlLabel(
                position: new Vector2(m_onButton.Size.X * -0.5f, 0.0f),
                text: onText ?? MyTexts.GetString(MySpaceTexts.SwitchText_On),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

            m_offLabel = new MyGuiControlLabel(
                position: new Vector2(m_onButton.Size.X * 0.5f, 0.0f),
                text: offText ?? MyTexts.GetString(MySpaceTexts.SwitchText_Off),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

            // Set the size to contain the 2 buttons and space between them.
            // Buttons should not overlap, otherwise this will give us wrong results.
            Size = new Vector2(m_onButton.Size.X + m_offButton.Size.X, Math.Max(m_onButton.Size.Y, m_offButton.Size.Y));

            Elements.Add(m_onButton);
            Elements.Add(m_offButton);
            Elements.Add(m_onLabel);
            Elements.Add(m_offLabel);

            m_value = initialValue;
            UpdateButtonState();
        }
        private void CreateObjectsSpawnMenu(float separatorSize, float usableWidth)
        {
            AddSubcaption(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_Items), Color.White.ToVector4(), new Vector2(-HIDDEN_PART_RIGHT, 0.0f));

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ItemType), Vector4.One, m_scale);
            m_physicalObjectCombobox = AddCombo();
            {
                foreach (var definition in MyDefinitionManager.Static.GetAllDefinitions())
                {
                    if (!definition.Public)
                        continue;
                    var physicalItemDef = definition as MyPhysicalItemDefinition;
                    if (physicalItemDef == null || physicalItemDef.CanSpawnFromScreen == false)
                        continue;

                    int key = m_physicalItemDefinitions.Count;
                    m_physicalItemDefinitions.Add(physicalItemDef);
                    m_physicalObjectCombobox.AddItem(key, definition.DisplayNameText);
                }
                m_physicalObjectCombobox.SortItemsByValueText();
                m_physicalObjectCombobox.SelectItemByIndex(m_lastSelectedFloatingObjectIndex);
                m_physicalObjectCombobox.ItemSelected += OnPhysicalObjectCombobox_ItemSelected;
            }

            m_currentPosition.Y += separatorSize;

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ItemAmount), Vector4.One, m_scale);
            m_amountTextbox = new MyGuiControlTextbox(m_currentPosition, m_amount.ToString(), 6, null, m_scale, MyGuiControlTextboxType.DigitsOnly);
            m_amountTextbox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_amountTextbox.TextChanged += OnAmountTextChanged;
            Controls.Add(m_amountTextbox);

            m_currentPosition.Y += separatorSize + m_amountTextbox.Size.Y;
            m_errorLabel = AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_InvalidAmount), Color.Red.ToVector4(), m_scale);
            m_errorLabel.Visible = false;
            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnObject, OnSpawnPhysicalObject);

            m_currentPosition.Y += separatorSize;
        }
        private void CreateProceduralAsteroidsSpawnMenu(float separatorSize, float usableWidth)
        {
            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ProceduralSize), Vector4.One, m_scale);

            m_procAsteroidSize = new MyGuiControlSlider(
                position: m_currentPosition,
                width: 400f / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
                minValue: 5.0f,
                maxValue: 500f,
                labelText: String.Empty,
                labelDecimalPlaces: 2,
                labelScale: 0.75f * m_scale,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                labelFont: MyFontEnum.Debug);
            m_procAsteroidSize.DebugScale = m_sliderDebugScale;
            m_procAsteroidSize.ColorMask = Color.White.ToVector4();
            Controls.Add(m_procAsteroidSize);

            MyGuiControlLabel label = new MyGuiControlLabel(
                position: m_currentPosition + new Vector2(m_procAsteroidSize.Size.X + 0.005f, m_procAsteroidSize.Size.Y / 2),
                text: String.Empty,
                colorMask: Color.White.ToVector4(),
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.8f * m_scale,
                font: MyFontEnum.Debug);
            label.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            Controls.Add(label);
            m_procAsteroidSize.ValueChanged += (MyGuiControlSlider s) => { label.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2) + "m"; m_procAsteroidSizeValue = s.Value; };

            m_procAsteroidSize.Value = m_procAsteroidSizeValue;

            m_currentPosition.Y += m_procAsteroidSize.Size.Y;
            m_currentPosition.Y += separatorSize;

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ProceduralSeed), Color.White.ToVector4(), m_scale);

            m_procAsteroidSeed = new MyGuiControlTextbox(m_currentPosition, m_procAsteroidSeedValue, 20, Color.White.ToVector4(), m_scale, MyGuiControlTextboxType.Normal);
            m_procAsteroidSeed.TextChanged += (MyGuiControlTextbox t) => { m_procAsteroidSeedValue = t.Text; };
            m_procAsteroidSeed.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            Controls.Add(m_procAsteroidSeed);
            m_currentPosition.Y += m_procAsteroidSize.Size.Y + separatorSize;

            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_GenerateSeed, generateSeedButton_OnButtonClick);
            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_AsteroidGenerationCanTakeLong), Color.Red.ToVector4(), m_scale);
            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnAsteroid, OnSpawnProceduralAsteroid);

            m_currentPosition.Y += separatorSize;
        }
        private MyGuiControlLabel MakeLabel(MyStringId textEnum, Vector2 position)
        {
            var label = new MyGuiControlLabel(
                position: position,
                text: MyTexts.GetString(textEnum),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);

            return label;
        }
Example #24
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            Vector2 buttonSize  = MyGuiControlButton.GetVisualStyle(m_style.ButtonStyle).NormalTexture.MinSizeGui;
            Vector2 captionSize = MyGuiManager.MeasureString(m_style.CaptionFont, m_messageCaption, MyGuiConstants.DEFAULT_TEXT_SCALE);

            //  Message box caption
            var padding = m_style.BackgroundTexture.PaddingSizeGui;
            MyGuiControlLabel captionLabel = new MyGuiControlLabel(
                position: new Vector2(0, -0.5f * m_size.Value.Y + padding.Y),
                text: m_messageCaption.ToString(),
                font: m_style.CaptionFont,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);

            Controls.Add(captionLabel);

            //  Message box text
            m_messageBoxText = new MyGuiControlMultilineText(
                position: Vector2.Zero,
                size: new Vector2(m_size.Value.X - 2 * padding.X, m_size.Value.Y - (2 * padding.Y + captionSize.Y + buttonSize.Y)),
                backgroundColor: Vector4.One,
                contents: m_messageText,
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                font: m_style.TextFont);

            Controls.Add(m_messageBoxText);

            //  Buttons
            float            buttonY       = 0.5f * m_size.Value.Y - padding.Y;
            float            buttonOffsetX = 0.05f;
            MyGuiControlBase yesButton     = null;
            MyGuiControlBase noButton      = null;
            MyGuiControlBase cancelButton  = null;

            switch (m_buttonType)
            {
            case MyMessageBoxButtonsType.NONE:
            case MyMessageBoxButtonsType.NONE_TIMEOUT:
                break;

            case MyMessageBoxButtonsType.OK:
                Controls.Add(yesButton = MakeButton(new Vector2(0, buttonY), m_style, m_okButtonText, OnYesClick, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM));
                break;

            case MyMessageBoxButtonsType.YES_NO:
            case MyMessageBoxButtonsType.YES_NO_TIMEOUT:
                Controls.Add(yesButton = MakeButton(new Vector2(-buttonOffsetX, buttonY), m_style, m_yesButtonText, OnYesClick, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM));
                Controls.Add(noButton  = MakeButton(new Vector2(buttonOffsetX, buttonY), m_style, m_noButtonText, OnNoClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM));
                break;

            case MyMessageBoxButtonsType.YES_NO_CANCEL:
                Controls.Add(yesButton    = MakeButton(new Vector2(-(buttonOffsetX + buttonSize.X * 0.5f), buttonY), m_style, m_yesButtonText, OnYesClick, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM));
                Controls.Add(noButton     = MakeButton(new Vector2(0, buttonY), m_style, m_noButtonText, OnNoClick, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM));
                Controls.Add(cancelButton = MakeButton(new Vector2((buttonOffsetX + buttonSize.X * 0.5f), buttonY), m_style, m_cancelButtonText, OnCancelClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM));
                break;

            default:
                throw new InvalidBranchException();
                break;
            }

            switch (m_focusedResult)
            {
            case ResultEnum.YES:
                FocusedControl = yesButton;
                break;

            case ResultEnum.NO:
                FocusedControl = noButton;
                break;

            case ResultEnum.CANCEL:
                FocusedControl = cancelButton;
                break;
            }
        }
 private MyGuiControlLabel MakeLabel(MyStringId? text = null,
     MyGuiDrawAlignEnum labelAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
 {
     float labelTextScale = 0.85f;
     var res = new MyGuiControlLabel(
         text: (text.HasValue) ? MyTexts.GetString(text.Value) : null,
         textScale: labelTextScale,
         originAlign: labelAlign);
     res.AutoEllipsis = true;
     return res;
 }
        public MyGuiControlBlockInfo(MyControlBlockInfoStyle style, bool progressMode = true, bool largeBlockInfo = true)
            : base(backgroundTexture: new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_LARGE_DEFAULT.Texture))
        {
            m_style        = style;
            m_progressMode = progressMode;

            m_leftColumnBackground             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
            m_leftColumnBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            Elements.Add(m_leftColumnBackground);

            m_titleBackground             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
            m_titleBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            Elements.Add(m_titleBackground);

            if (m_progressMode)
            {
                m_integrityBackground             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
                m_integrityBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                Elements.Add(m_integrityBackground);

                m_integrityForeground             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
                m_integrityForeground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                Elements.Add(m_integrityForeground);

                m_integrityCriticalLine             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
                m_integrityCriticalLine.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                Elements.Add(m_integrityCriticalLine);
            }

            m_blockIconPanelBackground                   = new MyGuiControlPanel();
            m_blockIconPanelBackground.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockIconPanelBackground.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);
            m_blockIconPanelBackground.Size              = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            m_blockIconPanelBackground.Size             *= new Vector2(0.75f, 1);
            Elements.Add(m_blockIconPanelBackground);

            m_blockIconPanel             = new MyGuiControlPanel();
            m_blockIconPanel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockIconPanel.Size        = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            m_blockIconPanel.Size       *= new Vector2(0.75f, 1);
            Elements.Add(m_blockIconPanel);

            m_blockTypePanelBackground                   = new MyGuiControlPanel();
            m_blockTypePanelBackground.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            m_blockTypePanelBackground.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);
            m_blockTypePanelBackground.Size              = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            m_blockTypePanelBackground.Size             *= new Vector2(0.75f, 1);
            Elements.Add(m_blockTypePanelBackground);

            m_blockTypePanel                   = new MyGuiControlPanel();
            m_blockTypePanel.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            m_blockTypePanel.Size              = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            m_blockTypePanel.Size             *= new Vector2(0.75f, 1);
            m_blockTypePanel.BackgroundTexture = new MyGuiCompositeTexture(largeBlockInfo ? @"Textures\GUI\Icons\Cubes\LargeBlock.dds" : @"Textures\GUI\Icons\Cubes\SmallBlock.dds");
            Elements.Add(m_blockTypePanel);

            m_blockNameLabel              = new MyGuiControlLabel(text: String.Empty);
            m_blockNameLabel.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockNameLabel.TextScale    = 1 * baseScale;
            m_blockNameLabel.Font         = m_style.BlockNameLabelFont;
            m_blockNameLabel.AutoEllipsis = true;
            Elements.Add(m_blockNameLabel);

            String blockTypeLabelText = String.Empty;

            if (style.EnableBlockTypeLabel)
            {
                blockTypeLabelText = MyTexts.GetString(largeBlockInfo ? MySpaceTexts.HudBlockInfo_LargeShip_Station : MySpaceTexts.HudBlockInfo_SmallShip);
            }
            m_blockTypeLabel             = new MyGuiControlLabel(text: blockTypeLabelText);
            m_blockTypeLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockTypeLabel.TextScale   = 1 * baseScale;
            m_blockTypeLabel.Font        = MyFontEnum.White;
            Elements.Add(m_blockTypeLabel);

            m_componentsLabel             = new MyGuiControlLabel(text: MyTexts.GetString(m_style.ComponentsLabelText));
            m_componentsLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_componentsLabel.TextScale   = m_smallerFontSize * baseScale;
            m_componentsLabel.Font        = m_style.ComponentsLabelFont;
            Elements.Add(m_componentsLabel);

            m_installedRequiredLabel             = new MyGuiControlLabel(text: MyTexts.GetString(m_style.InstalledRequiredLabelText));
            m_installedRequiredLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            m_installedRequiredLabel.TextScale   = m_smallerFontSize * baseScale;
            m_installedRequiredLabel.Font        = m_style.InstalledRequiredLabelFont;
            Elements.Add(m_installedRequiredLabel);

            if (m_progressMode)
            {
                m_integrityLabel             = new MyGuiControlLabel(text: String.Empty);
                m_integrityLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM;
                m_integrityLabel.Font        = m_style.IntegrityLabelFont;
                m_integrityLabel.TextScale   = 0.75f * baseScale;
                Elements.Add(m_integrityLabel);
            }

            m_separator = new MyGuiControlSeparatorList();
            Elements.Add(m_separator);

            EnsureLineControls(m_componentLines.Capacity);
            Size = m_progressMode ? new Vector2(0.325f, 0.4f) : new Vector2(0.22f, 0.4f);
        }
Example #27
0
        public MyGuiControlColor(
            String text,
            float textScale,
            Vector2 position,
            Color color,
            Color defaultColor,
            MyStringId dialogAmountCaption,
            bool placeSlidersVertically = false,
            string font = MyFontEnum.Blue)
            : base(position: position,
                   toolTip: null,
                   isActiveControl: false)
        {
            m_color = color;
            m_placeSlidersVertically = placeSlidersVertically;
            m_textLabel      = MakeLabel(textScale, font);
            m_textLabel.Text = text.ToString();
            m_caption        = dialogAmountCaption;

            m_RSlider = MakeSlider(font, defaultColor.R);
            m_GSlider = MakeSlider(font, defaultColor.G);
            m_BSlider = MakeSlider(font, defaultColor.B);

            m_RSlider.ValueChanged += delegate(MyGuiControlSlider sender)
            {
                if (m_canChangeColor)
                {
                    m_color.R = (byte)sender.Value;
                    UpdateTexts();
                    if (OnChange != null)
                    {
                        OnChange(this);
                    }
                }
            };
            m_GSlider.ValueChanged += delegate(MyGuiControlSlider sender)
            {
                if (m_canChangeColor)
                {
                    m_color.G = (byte)sender.Value;
                    UpdateTexts();
                    if (OnChange != null)
                    {
                        OnChange(this);
                    }
                }
            };
            m_BSlider.ValueChanged += delegate(MyGuiControlSlider sender)
            {
                if (m_canChangeColor)
                {
                    m_color.B = (byte)sender.Value;
                    UpdateTexts();
                    if (OnChange != null)
                    {
                        OnChange(this);
                    }
                }
            };

            m_RLabel = MakeLabel(textScale, font);
            m_GLabel = MakeLabel(textScale, font);
            m_BLabel = MakeLabel(textScale, font);

            m_RSlider.Value = m_color.R;
            m_GSlider.Value = m_color.G;
            m_BSlider.Value = m_color.B;

            Elements.Add(m_textLabel);

            Elements.Add(m_RSlider);
            Elements.Add(m_GSlider);
            Elements.Add(m_BSlider);

            Elements.Add(m_RLabel);
            Elements.Add(m_GLabel);
            Elements.Add(m_BLabel);

            UpdateTexts();
            RefreshInternals();
            Size = m_minSize;
        }
            public override void RecreateControls(bool constructor)
            {
                base.RecreateControls(constructor);

                m_sizeCombobox = new MyGuiControlCombobox()
                {
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                    Position = Vector2.Zero,
                };
                foreach (var val in typeof(MyCubeSize).GetEnumValues())
                {
                    m_sizeCombobox.AddItem((int)(MyCubeSize)val, new StringBuilder(val.ToString()));
                }
                m_sizeCombobox.SelectItemByKey((int)MyCubeSize.Large);

                m_staticCheckbox = new MyGuiControlCheckbox()
                {
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                    IsChecked = true,
                };
                var staticLabel = new MyGuiControlLabel()
                {
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                    Position = new Vector2(m_staticCheckbox.Size.X, 0f),
                    Text = "Static grid"
                };

                var okButton = new MyGuiControlButton()
                {
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP,
                    Text = "Ok",
                    Position = new Vector2(0f, 0.05f),
                };
                okButton.ButtonClicked += okButton_ButtonClicked;

                Elements.Add(m_sizeCombobox);
                Elements.Add(m_staticCheckbox);
                Elements.Add(staticLabel);
                Elements.Add(okButton);

            }
        private void CreatePlanetsSpawnMenu(float separatorSize, float usableWidth)
        {
            float min = MyFakes.ENABLE_EXTENDED_PLANET_OPTIONS ? 100 : 19000;
            float max = /*MyFakes.ENABLE_EXTENDED_PLANET_OPTIONS ? (6378.1f * 1000 * 2) :*/ 120000f;
            MyGuiControlSlider slider = null;
            slider = new MyGuiControlSlider(
                position: m_currentPosition,
                width: 400f / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
                minValue: min,
                maxValue: max,
                labelText: String.Empty,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                labelFont: MyFontEnum.Debug,
                intValue: true);
            slider.DebugScale = m_sliderDebugScale;
            slider.ColorMask = Color.White.ToVector4();
            Controls.Add(slider);

            var label = new MyGuiControlLabel(
                position: m_currentPosition + new Vector2(slider.Size.X + 0.005f, slider.Size.Y / 2),
                text: String.Empty,
                colorMask: Color.White.ToVector4(),
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.8f * m_scale,
                font: MyFontEnum.Debug);
            label.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            Controls.Add(label);

            m_currentPosition.Y += slider.Size.Y;
            m_currentPosition.Y += separatorSize;

            slider.ValueChanged += (MyGuiControlSlider s) =>
            {
                StringBuilder sb = new StringBuilder();
                MyValueFormatter.AppendDistanceInBestUnit(s.Value, sb);
                label.Text = sb.ToString();
                m_procAsteroidSizeValue = s.Value;
            };
            slider.Value = 8000;

            m_procAsteroidSeed = CreateSeedButton(m_procAsteroidSeedValue, usableWidth);
            m_planetCombobox = AddCombo();
            {
                foreach (var definition in MyDefinitionManager.Static.GetPlanetsGeneratorsDefinitions())
                {
                    m_planetCombobox.AddItem((int)definition.Id.SubtypeId, definition.Id.SubtypeId.ToString());
                }
                m_planetCombobox.ItemSelected += OnPlanetCombobox_ItemSelected;
                m_planetCombobox.SortItemsByValueText();
                m_planetCombobox.SelectItemByIndex(0);
            }

            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnAsteroid, x =>
            {
                int seed = GetProceduralAsteroidSeed(m_procAsteroidSeed);
                CreatePlanet(seed, slider.Value);
                CloseScreenNow();
            });
        }
        internal MyGuiControlGenericFunctionalBlock(MyTerminalBlock[] blocks) :
            base(canHaveFocus: true,
                 allowFocusingElements: true,
                 isActiveControl: false)
        {
            this.m_currentBlocks = blocks;

            m_separatorList = new MyGuiControlSeparatorList();
            Elements.Add(m_separatorList);

            m_terminalControlList             = new MyGuiControlList();
            m_terminalControlList.VisualStyle = MyGuiControlListStyleEnum.Simple;
            m_terminalControlList.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP;
            m_terminalControlList.Position    = new Vector2(0.1f, 0.1f);
            Elements.Add(m_terminalControlList);

            m_blockPropertiesLabel = new MyGuiControlMultilineText(
                position: new Vector2(0.049f, -0.195f),
                size: new Vector2(0.39f, 0.635f),
                backgroundColor: null,
                font: MyFontEnum.Blue,
                textScale: 0.95f,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                contents: null);
            m_blockPropertiesLabel.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockPropertiesLabel.TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            Elements.Add(m_blockPropertiesLabel);

            m_transferToCombobox = new MyGuiControlCombobox(
                Vector2.Zero,
                new Vector2(0.15f, 0.1f),
                null, null);
            m_transferToCombobox.ItemSelected += m_transferToCombobox_ItemSelected;
            Elements.Add(m_transferToCombobox);

            m_shareModeCombobox = new MyGuiControlCombobox(
                Vector2.Zero,
                new Vector2(0.25f, 0.1f),
                null, null);
            m_shareModeCombobox.ItemSelected += m_shareModeCombobox_ItemSelected;
            Elements.Add(m_shareModeCombobox);

            m_ownershipLabel = new MyGuiControlLabel(
                Vector2.Zero, null, MyTexts.GetString(MySpaceTexts.BlockOwner_Owner) + ":");
            Elements.Add(m_ownershipLabel);

            m_ownerLabel = new MyGuiControlLabel(
                Vector2.Zero, null, String.Empty);
            Elements.Add(m_ownerLabel);

            m_transferToLabel = new MyGuiControlLabel(
                Vector2.Zero, null, MyTexts.GetString(MySpaceTexts.BlockOwner_TransferTo));
            Elements.Add(m_transferToLabel);

            if (MySession.Static.CreativeMode)
            {
                var     topLeftRelative = Vector2.One * -0.5f;
                Vector2 leftColumnSize  = new Vector2(0.3f, 0.55f);
                var     position        = topLeftRelative + new Vector2(leftColumnSize.X + 0.503f, 0.42f);

                m_npcButton = new MyGuiControlButton(
                    position,
                    MyGuiControlButtonStyleEnum.Tiny,
                    new Vector2(0.1f, 0.1f),
                    null, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, MyTexts.GetString(MySpaceTexts.AddNewNPC), new StringBuilder("+"),
                    MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_ACTIVE, true,
                    OnNewNpcClick, GuiSounds.MouseClick, 0.75f);
                Elements.Add(m_npcButton);
            }


            RecreateBlockControls();
            RecreateOwnershipControls();

            if (m_currentBlocks.Length > 0)
            {
                m_currentBlocks[0].PropertiesChanged += block_PropertiesChanged;
            }

            foreach (var block in m_currentBlocks)
            {
                block.OwnershipChanged  += block_OwnershipChanged;
                block.VisibilityChanged += block_VisibilityChanged;
            }

            UpdateDetailedInfo();

            Size = new Vector2(0.595f, 0.64f);
        }
        private void CreateEmptyVoxelMapSpawnMenu(float separatorSize, float usableWidth)
        {
            int min = 2;
            int max = 10;

            var label = AddLabel("Voxel Size: ", Vector4.One, m_scale);

            MyGuiControlSlider slider = null;
            slider = new MyGuiControlSlider(
                position: m_currentPosition,
                width: 400f / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
                minValue: min,
                maxValue: max,
                labelText: String.Empty,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                labelFont: MyFontEnum.Debug,
                intValue: true);
            slider.DebugScale = m_sliderDebugScale;
            slider.ColorMask = Color.White.ToVector4();
            Controls.Add(slider);

            label = new MyGuiControlLabel(
                position: m_currentPosition + new Vector2(slider.Size.X + 0.005f, slider.Size.Y / 2),
                text: String.Empty,
                colorMask: Color.White.ToVector4(),
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.8f * m_scale,
                font: MyFontEnum.Debug);
            label.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            Controls.Add(label);

            m_currentPosition.Y += slider.Size.Y;
            m_currentPosition.Y += separatorSize;

            slider.ValueChanged += (MyGuiControlSlider s) =>
            {
                int size = 1 << ((int)s.Value);
                label.Text = size + "m";
                m_procAsteroidSizeValue = size;
            };
            slider.Value = 5;

            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnAsteroid, x =>
            {
                int size = (int)m_procAsteroidSizeValue;
                Debug.Assert(MathHelper.IsPowerOfTwo(size));

                MyStorageBase storage = new MyOctreeStorage(null, new Vector3I(size));

                string name = MakeStorageName("MyEmptyVoxelMap");

                var builder = CreateAsteroidObjectBuilder(name);
                MyClipboardComponent.Static.ActivateVoxelClipboard(builder, storage, MySector.MainCamera.ForwardVector, (storage.Size * 0.5f).Length());

                CloseScreenNow();
            });
        }
        public void Close()
        {
            if (m_terminalSystem != null)
            {
                if (m_blockListbox != null)
                {
                    ClearBlockList();
                    m_blockListbox.ItemsSelected -= blockListbox_ItemSelected;
                }

                m_terminalSystem.BlockAdded -= TerminalSystem_BlockAdded;
                m_terminalSystem.BlockRemoved -= TerminalSystem_BlockRemoved;
                m_terminalSystem.GroupAdded -= TerminalSystem_GroupAdded;
                m_terminalSystem.GroupRemoved -= TerminalSystem_GroupRemoved;
            }

            if (m_tmpGroup != null)
            {
                m_tmpGroup.Blocks.Clear();
            }

            m_controlsParent = null;
            m_blockListbox = null;
            m_blockNameLabel = null;
            m_terminalSystem = null;
            m_currentGroups.Clear();
        }
        public MyGuiScreenTriggerPosition(MyTrigger trg)
            : base(trg, new Vector2(WINSIZEX+0.1f, WINSIZEY))
        {
            float left = MIDDLE_PART_ORIGIN.X-WINSIZEX/2;
            float top = -WINSIZEY / 2f + MIDDLE_PART_ORIGIN.Y;
            //X,Y,Z:
            m_labelInsX = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_X).ToString()
            );
            left += m_labelInsX.Size.X + spacingH;
            m_xCoord = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelInsX.Size.X, 0.035f),
                Name = "textX"
            };
            m_xCoord.Enabled = false;
            left += m_xCoord.Size.X + spacingH;

            m_labelInsY = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(WINSIZEX - 0.012f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Y).ToString()
            );
            left += m_labelInsY.Size.X + spacingH;
            m_yCoord = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelInsY.Size.X, 0.035f),
                Name = "textY"
            };
            m_yCoord.Enabled = false;
            left += m_yCoord.Size.X + spacingH;

            m_labelInsZ = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Z).ToString()
            );
            left += m_labelInsZ.Size.X + spacingH;
            m_zCoord = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelInsZ.Size.X, 0.035f),
                Name = "textZ"
            };
            m_zCoord.Enabled = false;

            left = MIDDLE_PART_ORIGIN.X - WINSIZEX / 2;
            top += m_zCoord.Size.Y + VERTICAL_OFFSET;
            m_labelRadius = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.GuiTriggerPositionRadius).ToString()
            );
            left += m_labelRadius.Size.X + spacingH;
            m_radius = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelInsZ.Size.X, 0.035f),
                Name = "radius"
            };
            m_radius.TextChanged += OnRadiusChanged;

            left += m_radius.Size.X + spacingH + 0.05f;
            m_pasteButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerPasteGps),
                visualStyle : MyGuiControlButtonStyleEnum.Small,
                onButtonClick: OnPasteButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left,top));


            Controls.Add(m_labelInsX);
            Controls.Add(m_xCoord);
            Controls.Add(m_labelInsY);
            Controls.Add(m_yCoord);
            Controls.Add(m_labelInsZ);
            Controls.Add(m_zCoord);
            Controls.Add(m_labelRadius);
            Controls.Add(m_radius);
            Controls.Add(m_pasteButton);
        }
        public void Init(IMyGuiControlsParent controlsParent, MyPlayer controller, MyCubeGrid grid, MyTerminalBlock currentBlock, MyGridColorHelper colorHelper)
        {
            m_controlsParent = controlsParent;
            m_controller = controller;
            m_colorHelper = colorHelper;

            if (grid == null)
            {
                foreach (var control in controlsParent.Controls)
                    control.Visible = false;

                var label = MyGuiScreenTerminal.CreateErrorLabel(MySpaceTexts.ScreenTerminalError_ShipNotConnected, "ErrorMessage");
                controlsParent.Controls.Add(label);
                return;
            }

            m_terminalSystem = grid.GridSystems.TerminalSystem;
            m_tmpGroup = new MyBlockGroup(grid);

            m_blockSearch = (MyGuiControlTextbox)m_controlsParent.Controls.GetControlByName("FunctionalBlockSearch");
            m_blockSearch.TextChanged += blockSearch_TextChanged;
            m_blockSearchClear = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("FunctionalBlockSearchClear");
            m_blockSearchClear.ButtonClicked += blockSearchClear_ButtonClicked;
            m_blockListbox = (MyGuiControlListbox)m_controlsParent.Controls.GetControlByName("FunctionalBlockListbox");
            m_blockNameLabel = (MyGuiControlLabel)m_controlsParent.Controls.GetControlByName("BlockNameLabel");
            m_blockNameLabel.Text = "";
            m_groupName = (MyGuiControlTextbox)m_controlsParent.Controls.GetControlByName("GroupName");
            m_groupName.TextChanged += m_groupName_TextChanged;

            m_showAll = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("ShowAll");
            m_showAll.Selected = m_showAllTerminalBlocks;
            m_showAll.ButtonClicked += showAll_Clicked;
            m_showAll.SetToolTip(MySpaceTexts.Terminal_ShowAllInTerminal);
            m_showAll.IconRotation = 0f;
            m_showAll.Icon = new MyGuiHighlightTexture
                {
                    Normal = @"Textures\GUI\Controls\button_hide.dds",
                    Highlight = @"Textures\GUI\Controls\button_unhide.dds",
                    SizePx = new Vector2(40f, 40f),
                };
            m_showAll.Size = new Vector2(0, 0);

            m_showAll.HighlightType = MyGuiControlHighlightType.FORCED;
            m_showAll.IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;

            m_groupSave = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("GroupSave");
            m_groupSave.TextEnum = MySpaceTexts.TerminalButton_GroupSave;
            m_groupSave.TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER;
            m_groupSave.ButtonClicked += groupSave_ButtonClicked;
            m_groupDelete = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("GroupDelete");
            m_groupDelete.ButtonClicked += groupDelete_ButtonClicked;
            m_groupDelete.Enabled = false;

            m_blockListbox.ItemsSelected += blockListbox_ItemSelected;

            RefreshBlockList();

            m_terminalSystem.BlockAdded += TerminalSystem_BlockAdded;
            m_terminalSystem.BlockRemoved += TerminalSystem_BlockRemoved;
            m_terminalSystem.GroupAdded += TerminalSystem_GroupAdded;
            m_terminalSystem.GroupRemoved += TerminalSystem_GroupRemoved;
            if (currentBlock != null)
                SelectBlocks(new MyTerminalBlock[] { currentBlock });
        }