void m_chatbox_EnterPressed(MyGuiControlTextbox obj)
 {
     if (m_chatboxText.Length > 0)
     {
         SendMessage();
     }
 }
Example #2
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));
        }
Example #3
0
        public void commandLine_TextChanged(MyGuiControlTextbox sender)
        {
            var text = sender.Text;

            //do not open autocomplete if text doesn't end with dot
            if (text.Length == 0 || !sender.Text.ElementAt(sender.Text.Length - 1).Equals('.'))
            {
                if (m_autoComplete.Enabled)
                {
                    m_autoComplete.Enabled = false;
                    m_autoComplete.Deactivate();
                }
                return;
            }

            //Sees if what is before the dot is a command
            MyCommand command;

            if (MyConsole.TryGetCommand(text.Substring(0, text.Length - 1), out command))
            {
                m_autoComplete.CreateNewContextMenu();
                m_autoComplete.Position = new Vector2(((1 - m_screenScale) / 2) + m_margin.X, m_size.Value.Y - 2 * m_margin.Y) + MyGuiManager.MeasureString(Common.MyFontEnum.Debug, new StringBuilder(m_commandLine.Text), m_commandLine.TextScaleWithLanguage);

                foreach (var method in command.Methods)
                {
                    m_autoComplete.AddItem(new StringBuilder(method).Append(" ").Append(command.GetHint(method)), userData: method);
                }

                m_autoComplete.Enabled = true;
                m_autoComplete.Activate(false);
            }
        }
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            this.Controls.Add(new MyGuiControlLabel(new Vector2(0.0f, -0.10f), text: "Select the amount and type of items to spawn in your inventory", originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));
            m_amountTextbox = new MyGuiControlTextbox(new Vector2(-0.2f, 0.0f), null, 9, null, MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiControlTextboxType.DigitsOnly);
            m_items         = new MyGuiControlCombobox(new Vector2(0.2f, 0.0f), new Vector2(0.3f, 0.05f), null, null, 10, null);
            m_confirmButton = new MyGuiControlButton(new Vector2(0.21f, 0.10f), Common.ObjectBuilders.Gui.MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Confirm"));
            m_cancelButton  = new MyGuiControlButton(new Vector2(-0.21f, 0.10f), Common.ObjectBuilders.Gui.MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Cancel"));

            foreach (var definition in MyDefinitionManager.Static.GetAllDefinitions())
            {
                var physicalItemDef = definition as MyPhysicalItemDefinition;
                if (physicalItemDef == null || physicalItemDef.CanSpawnFromScreen == false)
                {
                    continue;
                }

                int key = m_physicalItemDefinitions.Count;
                m_physicalItemDefinitions.Add(physicalItemDef);
                m_items.AddItem(key, definition.DisplayNameText);
            }

            this.Controls.Add(m_amountTextbox);
            this.Controls.Add(m_items);
            this.Controls.Add(m_confirmButton);
            this.Controls.Add(m_cancelButton);

            m_confirmButton.ButtonClicked += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked  += cancelButton_OnButtonClick;
        }
        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();
            });
        }
 public void OnNameChanged(MyGuiControlTextbox sender)
 {
     m_needsSyncName = true;
     //":" is not valid:
     if (IsNameOk(sender.Text))
     {
         m_nameOk = true;
         sender.ColorMask = Vector4.One;
         //propagate new name into table and re-sort:
         Sandbox.Graphics.GUI.MyGuiControlTable.Row selected = m_tableIns.SelectedRow;
         Sandbox.Graphics.GUI.MyGuiControlTable.Cell cell = selected.GetCell(0);
         if (cell != null)
             cell.Text.Clear().Append(sender.Text);
         m_tableIns.SortByColumn(0, MyGuiControlTable.SortStateEnum.Ascending);
         //select same entry:
         for (int i=0;i<m_tableIns.RowsCount;i++)
             if (selected == m_tableIns.GetRow(i))
             {
                 m_tableIns.SelectedRowIndex = i;
                 break;
             }
         m_tableIns.ScrollToSelection();
     }
     else
     {
         m_nameOk = false;
         sender.ColorMask = Color.Red.ToVector4();
     }
     updateWarningLabel();
 }
        public MyGuiScreenTriggerTimeLimit(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_labelMinutesLeft = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.013f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.GuiTriggerTimeLimit).ToString()
                );
            left          += m_labelMinutesLeft.Size.X + spacingH;
            m_minutesLimit = 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        = "minutes"
            };
            m_minutesLimit.TextChanged += OnTimeChanged;

            AddCaption(MySpaceTexts.GuiTriggerCaptionTimeLimit);
            Controls.Add(m_labelMinutesLeft);
            Controls.Add(m_minutesLimit);

            m_minutesLimit.Text = ((MyTriggerTimeLimit)trg).LimitInMinutes.ToString();
        }
        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();
        }
        private void BlindJump(MyGuiControlTextbox obj)
        {
            StringBuilder stringBuilder = new StringBuilder();

            this.distanceTextbox.GetText(stringBuilder);
            JumpSelectorGui.lastDistance = stringBuilder.ToString();
            double num = 0.0;

            try
            {
                num = Convert.ToDouble(stringBuilder.ToString()) * 1000.0;
            }
            catch
            {
                this.distanceTextbox.Clear();
                return;
            }
            if (num < 5000.01)
            {
                num = 5000.01;
            }
            Vector3D value = Vector3D.Transform(Base6Directions.GetVector(this.ControlledBy.Orientation.Forward), this.ControlledBy.CubeGrid.WorldMatrix.GetOrientation());

            value.Normalize();
            Vector3D destination = this.ControlledBy.CubeGrid.WorldMatrix.Translation + value * num;

            this.JumpSystem.RequestJump("Blind Jump", destination, this.ControlledBy.OwnerId);
        }
Example #10
0
 void OnSearchTextChange(MyGuiControlTextbox box)
 {
     if (box.Text != "")
     {
         String[] tmpSearch = box.Text.Split(' ');
         foreach (var item in m_blueprintList.Items)
         {
             String tmpName = item.Text.ToString().ToLower();
             bool   add     = true;
             foreach (var search in tmpSearch)
             {
                 if (!tmpName.Contains(search.ToLower()))
                 {
                     add = false;
                     break;
                 }
             }
             if (add)
             {
                 item.Visible = true;
             }
             else
             {
                 item.Visible = false;
             }
         }
     }
     else
     {
         foreach (var item in m_blueprintList.Items)
         {
             item.Visible = true;
         }
     }
 }
Example #11
0
        public sealed override void RecreateControls(bool constructor)
        {
            Elements.Clear();
            Elements.Add(new MyGuiControlLabel
            {
                Text        = "Torch Console",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Position    = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)
            });

            Controls.Clear();
            _textBox = new MyGuiControlTextbox
            {
                BorderEnabled = false,
                Enabled       = true,
                OriginAlign   = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position      = new Vector2(-0.5f)
            };
            Controls.Add(_textBox);

            var pistonBtn = new MyGuiControlImageButton
            {
                Name          = "TorchButton",
                Text          = "Torch",
                HighlightType = MyGuiControlHighlightType.WHEN_CURSOR_OVER,
                Visible       = true,
                OriginAlign   = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            };

            Controls.Add(pistonBtn);
        }
Example #12
0
        private void CreatePlanetControls(MyGuiControlList list, float usableWidth)
        {
            var asteroidSizeLabel = CreateSliderWithDescription(list, usableWidth, 8000f, 120000f, MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ProceduralSize), ref m_procAsteroidSize);

            m_procAsteroidSize.ValueChanged += (MyGuiControlSlider s) => { asteroidSizeLabel.Text = MyValueFormatter.GetFormatedFloat(s.Value, 0) + "m"; m_procAsteroidSizeValue = s.Value; };
            m_procAsteroidSize.Value         = 8000.1f;

            m_procAsteroidSeed = CreateSeedButton(list, m_procAsteroidSeedValue, usableWidth);
        }
Example #13
0
 protected void AddIdTextBox(Vector2 position, uint value)
 {
     if (HasEntity() && MyFakes.ENABLE_ENTITY_ID_CHANGE)
     {
         Controls.Add(new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.EntityId, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
         m_idTextbox = new MyGuiControlTextbox(this, position + new Vector2(0.2f, 0f), MyGuiControlPreDefinedSize.MEDIUM, Convert.ToString(value), 10, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);
         Controls.Add(m_idTextbox);
     }
 }
Example #14
0
        /// <summary>
        /// Adds the property for naming formats to the textBox
        /// </summary>
        /// <param name="textBox">TextBox</param>
        /// <param name="property">Property</param>
        /// <returns>The resulting text in the text box</returns>
        private string AddNameProperty(MyGuiControlTextbox textBox, string property)
        {
            var sb = new StringBuilder();

            textBox.GetText(sb);
            sb.Append("[" + property + "]");
            textBox.SetText(sb);

            return(sb.ToString());
        }
Example #15
0
        void OnBlockCountChanged(MyGuiControlTextbox textbox)
        {
            int numBlocks;

            if (int.TryParse(textbox.Text, out numBlocks))
            {
                MyTrashRemoval.PreviewSettings.BlockCountThreshold = numBlocks;
                RecalcTrash();
            }
        }
Example #16
0
        void OnTextChanged(MyGuiControlTextbox obj)
        {
            m_tmpText.Clear();
            obj.GetText(m_tmpText);

            foreach (var item in TargetBlocks)
            {
                SetValue(item, m_tmpText);
            }
        }
Example #17
0
        void OnDistanceChanged(MyGuiControlTextbox textbox)
        {
            float distance;

            if (float.TryParse(textbox.Text, out distance))
            {
                MyTrashRemoval.PreviewSettings.PlayerDistanceThreshold = distance;
                RecalcTrash();
            }
        }
Example #18
0
        public override void RecreateControls(bool constructor)
        {
            //This is probably very wrong!
            m_screenScale = (MyGuiManager.GetHudSize().X / MyGuiManager.GetHudSize().Y) / MyGuiConstants.SAFE_ASPECT_RATIO;

            m_size = new Vector2(m_screenScale, 0.5f);

            base.RecreateControls(constructor);
            Vector4 consoleTextColor = new Vector4(1, 1, 0, 1);
            float   consoleTextScale = 1f;

            m_commandLine = new MyGuiControlTextbox
                            (
                position: new Vector2(0, 0.25f),
                textColor: consoleTextColor
                            );

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


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

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

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

            Controls.Add(m_displayScreen);
            Controls.Add(m_commandLine);
            Controls.Add(m_autoComplete);
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            MyAnalyticsHelper.ReportActivityStart(null, "show_blueprints", string.Empty, "gui", string.Empty);

            Vector2 searchPosition = new Vector2(0f, SCREEN_SIZE.Y - 1.58f);

            float hiddenPartTop = (SCREEN_SIZE.Y - 1.0f) / 2.0f;

            var searchBoxLabel = MakeLabel("Search:", searchPosition + new Vector2(-0.175f, -0.015f), m_textScale);

            m_searchBox      = new MyGuiControlTextbox(searchPosition);
            m_searchBox.Size = new Vector2(0.2f, 0.2f);

            m_searchClear = new MyGuiControlButton()
            {
                Position               = searchPosition + new Vector2(0.077f, 0f),
                Size                   = new Vector2(0.045f, 0.05666667f),
                OriginAlign            = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                VisualStyle            = MyGuiControlButtonStyleEnum.Close,
                ActivateOnMouseRelease = true,
            };
            m_searchClear.ButtonClicked += OnSearchClear;

            m_blueprintList.Position         = new Vector2(0f, -0.03f);
            m_blueprintList.VisibleRowsCount = 17;
            m_blueprintList.MultiSelect      = false;

            var caption = AddCaption("Blueprints screen", VRageMath.Color.White.ToVector4(), m_controlPadding + new Vector2(-HIDDEN_PART_RIGHT, hiddenPartTop));

            Controls.Add(searchBoxLabel);
            Controls.Add(m_searchBox);
            Controls.Add(m_searchClear);
            Controls.Add(m_blueprintList);

            RefreshThumbnail();
            Controls.Add(m_thumbnailImage);

            CreateButtons();

            var texture = MyGuiConstants.LOADING_TEXTURE;

            m_wheel = new MyGuiControlRotatingWheel(
                searchPosition + new Vector2(0.127f, 0f),
                MyGuiConstants.ROTATING_WHEEL_COLOR,
                0.28f,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                texture,
                true,
                multipleSpinningWheels: MyPerGameSettings.GUI.MultipleSpinningWheels);
            Controls.Add(m_wheel);
            m_wheel.Visible = false;
        }
Example #20
0
 void m_groupName_TextChanged(MyGuiControlTextbox obj)
 {
     if (string.IsNullOrEmpty(obj.Text) || CurrentBlocks.Count == 0)
     {
         m_groupSave.Enabled = false;
     }
     else
     {
         m_groupSave.Enabled = true;
     }
 }
        private void CreateControlsBase(Vector2 controlsOrigin)
        {
            AddActivatedCheckbox(controlsOrigin + m_controlsAdded * CONTROLS_DELTA + new Vector2(0.0f, 0), true);

            Controls.Add(
                new MyGuiControlLabel(
                    this,
                    controlsOrigin + m_controlsAdded * CONTROLS_DELTA + new Vector2(0.2f, 0),
                    null,
                    MyTextsWrapperEnum.Enabled,
                    MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE,
                    MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_enabledCheckBox = new MyGuiControlCheckbox(
                this,
                controlsOrigin + m_controlsAdded++ *CONTROLS_DELTA + new Vector2(0.3f, 0),
                false,
                MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);

            Controls.Add(m_enabledCheckBox);

            // Set Radius Min
            Controls.Add(new MyGuiControlLabel(this, controlsOrigin + m_controlsAdded * CONTROLS_DELTA, null,
                                               MyTextsWrapperEnum.RadiusMin,
                                               MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE,
                                               MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_radiusMinTextBox = new MyGuiControlTextbox(this,
                                                         (new Vector2(0.17f, 0) + controlsOrigin) +
                                                         m_controlsAdded++ *CONTROLS_DELTA +
                                                         new Vector2(0.093f, 0), MyGuiControlPreDefinedSize.MEDIUM, "50",
                                                         MyMwcValidationConstants.POSITION_X_MAX,
                                                         MyGuiConstants.TEXTBOX_BACKGROUND_COLOR,
                                                         MyGuiConstants.LABEL_TEXT_SCALE,
                                                         MyGuiControlTextboxType.DIGITS_ONLY);
            Controls.Add(m_radiusMinTextBox);

            // Set Radius Max
            Controls.Add(new MyGuiControlLabel(this, controlsOrigin + m_controlsAdded * CONTROLS_DELTA, null,
                                               MyTextsWrapperEnum.RadiusMax,
                                               MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE,
                                               MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_radiusMaxTextBox = new MyGuiControlTextbox(this,
                                                         (new Vector2(0.17f, 0) + controlsOrigin) +
                                                         m_controlsAdded++ *CONTROLS_DELTA +
                                                         new Vector2(0.093f, 0), MyGuiControlPreDefinedSize.MEDIUM,
                                                         "100",
                                                         MyMwcValidationConstants.POSITION_X_MAX,
                                                         MyGuiConstants.TEXTBOX_BACKGROUND_COLOR,
                                                         MyGuiConstants.LABEL_TEXT_SCALE,
                                                         MyGuiControlTextboxType.DIGITS_ONLY);
            Controls.Add(m_radiusMaxTextBox);
        }
Example #22
0
        protected override MyGuiControlBase CreateGui()
        {
            m_textbox              = new MyGuiControlTextbox();
            m_textbox.Size         = new Vector2(PREFERRED_CONTROL_WIDTH, m_textbox.Size.Y);
            m_textChanged          = OnTextChanged;
            m_textbox.TextChanged += m_textChanged;

            var propertyControl = new MyGuiControlBlockProperty(MyTexts.GetString(Title), MyTexts.GetString(Tooltip), m_textbox);

            propertyControl.Size = new Vector2(PREFERRED_CONTROL_WIDTH, propertyControl.Size.Y);

            return(propertyControl);
        }
Example #23
0
 private void OnSearchTextChanged(MyGuiControlTextbox sender)
 {
     if (sender.Text != "")
     {
         String[] tmpSearch = sender.Text.Split(' ');
         m_tmpSearch = tmpSearch.ToList();
     }
     else
     {
         m_tmpSearch.Clear();
     }
     RefreshGameList();
 }
Example #24
0
 public void OnRadiusChanged(MyGuiControlTextbox sender)
 {
     if (null != StrToDouble(sender.Text))
     {
         sender.ColorMask   = Vector4.One;
         m_okButton.Enabled = true;
     }
     else
     {
         sender.ColorMask   = Color.Red.ToVector4();
         m_okButton.Enabled = false;
     }
 }
Example #25
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            var caption = AddCaption(m_caption, VRageMath.Color.White.ToVector4());

            m_nameBox      = new MyGuiControlTextbox(new Vector2(0f, 0f), maxLength: m_maxTextLength);
            m_nameBox.Text = m_defaultName;
            m_nameBox.Size = new Vector2(m_textBoxWidth, 0.2f);
            Controls.Add(m_nameBox);

            Createbuttons();
        }
        private void FilterGpsList(MyGuiControlTextbox obj)
        {
            this.radioButtonGroup.SelectByKey(0);
            StringBuilder stringBuilder = new StringBuilder();

            obj.GetText(stringBuilder);
            string text = stringBuilder.ToString();
            SortedList <string, IMyGps> sortedList = new SortedList <string, IMyGps>();

            string[] array = text.ToLower().Split(new char[]
            {
                ' '
            });
            if (text != null)
            {
                using (IEnumerator <KeyValuePair <string, IMyGps> > enumerator = this.gpsList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        KeyValuePair <string, IMyGps> keyValuePair = enumerator.Current;
                        string text2 = keyValuePair.Value.Name.ToString().ToLower();
                        bool   flag  = true;
                        foreach (string text3 in array)
                        {
                            if (!text2.Contains(text3.ToLower()))
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (flag)
                        {
                            sortedList.Add(keyValuePair.Key, keyValuePair.Value);
                        }
                    }
                    goto IL_DE;
                }
            }
            sortedList = this.gpsList;
            IL_DE:
            this.gpsCombobox.ClearItems();
            foreach (KeyValuePair <string, IMyGps> keyValuePair2 in sortedList)
            {
                this.gpsCombobox.AddItem((long)this.gpsList.IndexOfKey(keyValuePair2.Key), keyValuePair2.Key, null, null, true);
            }
            if (this.gpsCombobox.GetItemsCount() > 0)
            {
                this.gpsCombobox.SelectItemByIndex(0);
            }
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            Vector2 searchPosition = new Vector2(-0.025f, SCREEN_SIZE.Y - 1.59f);

            float hiddenPartTop = (SCREEN_SIZE.Y - 1.0f) / 2.0f;

            var searchBoxLabel = MakeLabel(MyTexts.GetString(MySpaceTexts.ScreenCubeBuilderBlockSearch), searchPosition + new Vector2(-0.129f, -0.015f), m_textScale);

            m_searchBox      = new MyGuiControlTextbox(searchPosition);
            m_searchBox.Size = new Vector2(0.15f, 0.2f);

            m_searchClear = new MyGuiControlButton()
            {
                Position    = searchPosition + new Vector2(0.078f, 0f),
                Size        = new Vector2(0.045f, 0.05666667f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                VisualStyle = MyGuiControlButtonStyleEnum.Close
            };
            m_searchClear.ButtonClicked += OnSearchClear;

            m_scriptList.Size            -= new Vector2(0.1f, 0f);
            m_scriptList.Position         = new Vector2(-0.015f, -0.07f);
            m_scriptList.VisibleRowsCount = 17;
            m_scriptList.MultiSelect      = false;

            var caption = AddCaption(MyTexts.GetString(MySpaceTexts.ProgrammableBlock_ScriptsScreenTitle), VRageMath.Color.White.ToVector4(), m_controlPadding + new Vector2(-HIDDEN_PART_RIGHT, hiddenPartTop));

            Controls.Add(searchBoxLabel);
            Controls.Add(m_searchBox);
            Controls.Add(m_searchClear);
            Controls.Add(m_scriptList);

            CreateButtons();

            var texture = MyGuiConstants.LOADING_TEXTURE;

            m_wheel = new MyGuiControlRotatingWheel(
                searchPosition + new Vector2(0.123f, 0f),
                MyGuiConstants.ROTATING_WHEEL_COLOR,
                0.28f,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                texture,
                true,
                multipleSpinningWheels: MyPerGameSettings.GUI.MultipleSpinningWheels);
            Controls.Add(m_wheel);
            m_wheel.Visible = false;
        }
Example #28
0
 public void OnZChanged(MyGuiControlTextbox sender)
 {
     m_needsSyncZ = true;
     if (IsCoordOk(sender.Text))
     {
         m_zOk            = true;
         sender.ColorMask = Vector4.One;
     }
     else
     {
         m_zOk            = false;
         sender.ColorMask = Color.Red.ToVector4();
     }
     updateWarningLabel();
 }
        public void OnTimeChanged(MyGuiControlTextbox sender)
        {
            int?lives = StrToInt(sender.Text);

            if (lives != null && lives > 0)
            {
                sender.ColorMask   = Vector4.One;
                m_okButton.Enabled = true;
            }
            else
            {
                sender.ColorMask   = Color.Red.ToVector4();
                m_okButton.Enabled = false;
            }
        }
 void OnWwwTextChanged(MyGuiControlTextbox source)
 {
     if (source.Text.Length == 0 || MyGuiSandbox.IsUrlWhitelisted(source.Text))
     {
         source.ColorMask = Vector4.One;
         source.SetToolTip((MyToolTips)null);
         m_okButton.Enabled = true;
     }
     else
     {
         m_wwwTextbox.SetToolTip(MySpaceTexts.WwwLinkNotAllowed);
         source.ColorMask   = Color.Red.ToVector4();
         m_okButton.Enabled = false;
     }
 }