public MyGuiScreenEditorSmallShip(MySmallShip smallShip)
            : base(smallShip, new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null, MyTextsWrapperEnum.EditSmallShip)
        {
            m_bot = smallShip as MySmallShipBot;

            Init();

            m_selectShipFactionCombobox.SelectItemByKey((int)m_bot.Faction);
            m_selectAITemplateCombobox.SelectItemByKey((int)m_bot.AITemplate.TemplateId);
            m_aggresivitySlider.SetValue(m_bot.Aggressivity);
            m_seeDistanceSlider.SetValue(m_bot.SeeDistance);
            m_selectSmallShipCombobox.SelectItemByKey((int)m_bot.ShipType);
        }
        private void Init()
        {
            m_size = new Vector2(0.7f, 1);

            m_enableBackgroundFade = true;

            AddCaption(new Vector2(0, 0.003f));
            AddOkAndCancelButtonControls(new Vector2(0.03f, -0.02f));

            var controlsOrigin = GetControlsOriginLeftFromScreenSize() - new Vector2(-0.018f, 0.025f);

            m_controlsAdded = 1;

            CreateControlsBase(controlsOrigin);

            m_activatedCheckbox.OnCheck += OnActivatedCheckedChanged;

            CreateControlsDust(controlsOrigin);

            CreateControlsSound(controlsOrigin);

            CreateControlsRadioactivity(controlsOrigin);

            if (HasEntity())
            {
                var influenceSphere = (MyInfluenceSphere)m_entity;
                m_radiusMinTextBox.Text = influenceSphere.RadiusMin.ToString(CultureInfo.InvariantCulture);
                m_radiusMaxTextBox.Text = influenceSphere.RadiusMax.ToString(CultureInfo.InvariantCulture);

                m_enabledCheckBox.Checked   = influenceSphere.Enabled;
                m_activatedCheckbox.Checked = influenceSphere.Activated;

                m_redColorSlider.SetValue(influenceSphere.DustColor.R);
                m_greenColorSlider.SetValue(influenceSphere.DustColor.G);
                m_blueColorSlider.SetValue(influenceSphere.DustColor.B);
                m_opacitySlider.SetValue(influenceSphere.DustColor.A);

                m_strengthSlider.SetValue(influenceSphere.Magnitude);

                var objectBuilder = (MyMwcObjectBuilder_InfluenceSphere)influenceSphere.GetObjectBuilder(false);
                m_selectSoundCombobox.SelectItemByKey(objectBuilder.SoundCueId);

                m_dustCheckbox.Checked          = influenceSphere.IsDust;
                m_radioactivityCheckbox.Checked = influenceSphere.IsRadioactivity;
                m_soundCheckbox.Checked         = influenceSphere.IsSound;
            }
            else
            {
                m_opacitySlider.SetValue(255);
            }
        }
Exemplo n.º 3
0
        private void SetValue(object sender, float newValue)
        {
            m_value = newValue;
            //string valueString = m_value.ToString("#,###0.000", System.Globalization.CultureInfo.InvariantCulture);
            //string valueString = MyValueFormatter.GetFormatedDecimal(Convert.ToDecimal(m_value), 1);
            string valueString = MyValueFormatter.GetFormatedFloat(m_value, 1, "");

            if (m_valueSlider != null && m_valueSlider != sender)
            {
                m_valueSlider.OnChange = null;
                m_valueSlider.SetValue(m_value);
                m_valueSlider.OnChange = OnSliderChange;
            }
            if (m_valueTextBox != null && m_valueTextBox != sender)
            {
                m_valueTextBox.TextChanged = null;
                m_valueTextBox.Text        = valueString;
                m_valueTextBox.TextChanged = OnTextBoxChange;
            }
            if (m_valueLabel != null)
            {
                m_valueLabel.UpdateText(valueString);
            }
            if (OnValueChange != null)
            {
                OnValueChange(this);
            }
        }
Exemplo n.º 4
0
        private void InitializeValues(MyPrefabLight prefabLight)
        {
            MyLight light = prefabLight.GetLight();

            m_pointNormalLightColorSlider[0].SetNormalizedValue(light.Color.X);
            m_pointNormalLightColorSlider[1].SetNormalizedValue(light.Color.Y);
            m_pointNormalLightColorSlider[2].SetNormalizedValue(light.Color.Z);
            m_specularLightColorSlider[0].SetNormalizedValue(light.SpecularColor.X);
            m_specularLightColorSlider[1].SetNormalizedValue(light.SpecularColor.Y);
            m_specularLightColorSlider[2].SetNormalizedValue(light.SpecularColor.Z);
            m_pointFallOffSlider.SetValue(light.Falloff);
            m_pointRangeSlider.SetValue(light.Range);
            m_pointIntensitySlider.SetValue(light.Intensity);
            m_pointOffsetSlider.SetValue(light.PointLightOffset);

            m_spotNormalLightColorSlider[0].SetNormalizedValue(light.ReflectorColor.X);
            m_spotNormalLightColorSlider[1].SetNormalizedValue(light.ReflectorColor.Y);
            m_spotNormalLightColorSlider[2].SetNormalizedValue(light.ReflectorColor.Z);
            m_spotFallOffSlider.SetValue(light.ReflectorFalloff);
            m_spotRangeSlider.SetValue(light.ReflectorRange);
            m_spotIntensitySlider.SetValue(light.ReflectorIntensity);
            m_spotAngleSlider.SetValue(light.ReflectorConeDegrees);

            m_pointLightCheckbox.Checked      = (light.LightType & MyLight.LightTypeEnum.PointLight) != 0;
            m_hemisphereLightCheckbox.Checked = (light.LightType & MyLight.LightTypeEnum.Hemisphere) != 0;
            m_spotLightCheckbox.Checked       = (light.LightType & MyLight.LightTypeEnum.Spotlight) != 0;
            m_spotLightShadowDistance.SetValue(light.ShadowDistance);

            m_flashOffsetSlider.SetValue(prefabLight.FlashOffset);

            m_effectComboBox.SelectItemByIndex((int)prefabLight.Effect);

            SetComponentsVisibility();
        }
Exemplo n.º 5
0
        protected void AddSlider(StringBuilder text, float value, float valueMin, float valueMax, MyGuiControlSlider.OnSliderChangeCallback valueChange, Vector4?color = null)
        {
            MyGuiControlSlider slider = addSlider(text, valueMin, valueMax, color);

            slider.SetValue(value);
            slider.OnChange = valueChange;
        }
        private void CreateControlsRadioactivity(Vector2 controlsOrigin)
        {
            AddSeparator(controlsOrigin);

            Controls.Add(new MyGuiControlLabel(this, controlsOrigin + m_controlsAdded * CONTROLS_DELTA + new Vector2(0.05f, 0), null, MyTextsWrapperEnum.RadioactivityInfluenceSphereType, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_radioactivityCheckbox = new MyGuiControlCheckbox(this, controlsOrigin + m_controlsAdded++ *CONTROLS_DELTA + new Vector2(0.02f, 0), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_radioactivityCheckbox);

            //choose influence sphere sound
            Controls.Add(new MyGuiControlLabel(this, controlsOrigin + m_controlsAdded * CONTROLS_DELTA, null,
                                               MyTextsWrapperEnum.Magnitude, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE,
                                               MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            // slider - magnitude
            m_strengthSlider = new MyGuiControlSlider(this,
                                                      controlsOrigin + m_controlsAdded++ *CONTROLS_DELTA +
                                                      new Vector2(0.25f, 0), MyGuiConstants.SLIDER_WIDTH,
                                                      0, MAX_RADIOACTIVITY_MAGNITUDE,
                                                      MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder("{0}"),
                                                      0.03f, 1, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);

            m_strengthSlider.SetValue(1);

            Controls.Add(m_strengthSlider);
        }
        void OnVideoModeSelected()
        {
            MyVideoModeEx mode = MyVideoModeManager.GetVideoModeByIndex(m_videoAdapterCombobox.GetSelectedKey(), m_videoModeCombobox.GetSelectedKey());

            m_fieldOfViewSlider.SetValue(MyConstants.FIELD_OF_VIEW_CONFIG_DEFAULT);
            if (mode.AspectRatio >= (12.0 / 3.0))
            {
                m_fieldOfViewSlider.SetBounds(MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX_TRIPLE_HEAD);
            }
            else if (mode.AspectRatio >= (8.0 / 3.0))
            {
                m_fieldOfViewSlider.SetBounds(MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX_DUAL_HEAD);
            }
            else
            {
                m_fieldOfViewSlider.SetBounds(MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX);
            }
        }
Exemplo n.º 8
0
        protected MyGuiControlSlider AddSlider(StringBuilder text, float valueMin, float valueMax, object instance, MemberInfo memberInfo, Vector4?color = null)
        {
            MyGuiControlSlider slider = addSlider(text, valueMin, valueMax, color);

            if (memberInfo is PropertyInfo)
            {
                PropertyInfo property = (PropertyInfo)memberInfo;

                slider.SetValue((float)property.GetValue(instance, new object[0]));
                slider.UserData = new Tuple <object, PropertyInfo>(instance, property);
                slider.OnChange = delegate(MyGuiControlSlider sender)
                {
                    Tuple <object, PropertyInfo> tuple = sender.UserData as Tuple <object, PropertyInfo>;
                    tuple.Item2.SetValue(tuple.Item1, sender.GetValue(), new object[0]);
                };
            }
            else
            if (memberInfo is FieldInfo)
            {
                FieldInfo field = (FieldInfo)memberInfo;

                slider.SetValue((float)field.GetValue(instance));
                slider.UserData = new Tuple <object, FieldInfo>(instance, field);
                slider.OnChange = delegate(MyGuiControlSlider sender)
                {
                    Tuple <object, FieldInfo> tuple = sender.UserData as Tuple <object, FieldInfo>;
                    tuple.Item2.SetValue(tuple.Item1, sender.GetValue());
                };
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "Unknown type of memberInfo");
            }

            return(slider);
        }
Exemplo n.º 9
0
        void UpdateValues()
        {
            if (!m_canUpdateValues)
            {
                return;
            }

            m_canUpdateValues = false;

            m_nameTextBox.Text = DummyPoint.Name ?? String.Empty;

            if (DummyPoint.Type == MyDummyPointType.Box)
            {
                m_heightSize.Visible = true;
                m_depthSize.Visible  = true;

                m_widthSize.SetValue(DummyPoint.Size.X);
                m_heightSize.SetValue(DummyPoint.Size.Y);
                m_depthSize.SetValue(DummyPoint.Size.Z);

                m_widthSize.UpdateDescription("Width");
            }
            else
            {
                m_heightSize.Visible = false;
                m_depthSize.Visible  = false;

                m_widthSize.UpdateDescription("Diameter");

                m_widthSize.SetValue(DummyPoint.Radius * 2);
            }

            if (DummyPoint.Type == MyDummyPointType.Box)
            {
                m_typeComboBox.SelectItemByIndex(0);
            }
            else
            {
                m_typeComboBox.SelectItemByIndex(1);
            }

            m_colorArea.Checked                = (DummyPoint.DummyFlags & MyDummyPointFlags.COLOR_AREA) > 0;
            m_playerStart.Checked              = (DummyPoint.DummyFlags & MyDummyPointFlags.PLAYER_START) > 0;
            m_mothershipStart.Checked          = (DummyPoint.DummyFlags & MyDummyPointFlags.MOTHERSHIP_START) > 0;
            m_detector.Checked                 = (DummyPoint.DummyFlags & MyDummyPointFlags.DETECTOR) > 0;
            m_sideMission.Checked              = (DummyPoint.DummyFlags & MyDummyPointFlags.SIDE_MISSION) > 0;
            m_safeArea.Checked                 = (DummyPoint.DummyFlags & MyDummyPointFlags.SAFE_AREA) > 0;
            m_particleEffect.Checked           = (DummyPoint.DummyFlags & MyDummyPointFlags.PARTICLE) > 0;
            m_survivePrefabDestruction.Checked = (DummyPoint.DummyFlags & MyDummyPointFlags.SURIVE_PREFAB_DESTRUCTION) > 0;
            m_respawnPoint.Checked             = (DummyPoint.DummyFlags & MyDummyPointFlags.RESPAWN_POINT) > 0;
            m_enabled.Checked     = (DummyPoint.PersistentFlags & CommonLIB.AppCode.ObjectBuilders.MyPersistentEntityFlags.Enabled) > 0;
            m_textureQuad.Checked = (DummyPoint.DummyFlags & MyDummyPointFlags.TEXTURE_QUAD) > 0;
            m_note.Checked        = (DummyPoint.DummyFlags & MyDummyPointFlags.NOTE) > 0;

            m_redSlider.Visible             = m_colorArea.Checked || m_particleEffect.Checked;
            m_redSliderLabel.Visible        = m_colorArea.Checked || m_particleEffect.Checked;
            m_greenSlider.Visible           = m_colorArea.Checked || m_particleEffect.Checked;
            m_greenSliderLabel.Visible      = m_colorArea.Checked || m_particleEffect.Checked;
            m_blueSlider.Visible            = m_colorArea.Checked || m_particleEffect.Checked;
            m_blueSliderLabel.Visible       = m_colorArea.Checked || m_particleEffect.Checked;
            m_alphaSlider.Visible           = m_colorArea.Checked || m_particleEffect.Checked;
            m_alphaSliderLabel.Visible      = m_colorArea.Checked || m_particleEffect.Checked;
            m_alphaSliderValueLabel.Visible = m_colorArea.Checked || m_particleEffect.Checked;
            m_userScaleSliderLabel.Visible  = m_particleEffect.Checked;
            m_userScaleSlider.Visible       = m_particleEffect.Checked;
            m_userScaleLabel.Visible        = m_particleEffect.Checked;

            m_redSlider.SetValue(DummyPoint.Color.X * MyEditorConstants.COLOR_COMPONENT_MAX_VALUE);
            m_greenSlider.SetValue(DummyPoint.Color.Y * MyEditorConstants.COLOR_COMPONENT_MAX_VALUE);
            m_blueSlider.SetValue(DummyPoint.Color.Z * MyEditorConstants.COLOR_COMPONENT_MAX_VALUE);
            m_alphaSlider.SetValue(DummyPoint.Color.W * MyEditorConstants.COLOR_COMPONENT_MAX_VALUE);
            m_alphaSliderValueLabel.UpdateText(new Color(DummyPoint.Color).ToVector4().W.ToString("#,###0.000", System.Globalization.CultureInfo.InvariantCulture));
            m_userScaleSlider.SetValue(DummyPoint.UserScale);
            m_userScaleLabel.UpdateText(DummyPoint.UserScale.ToString("#,###0.000", System.Globalization.CultureInfo.InvariantCulture));

            //m_particleCombo.Visible = m_particleEffect.Checked;
            // m_particleNameLabel.Visible = m_particleEffect.Checked;
            m_particleCombo.SelectItemByKey((int)DummyPoint.ParticleID);
            m_respawnPointCombo.SelectItemByKey((int)DummyPoint.RespawnPointFaction);//hopefuly china

            if (DummyPoint.DummyFlags == MyDummyPointFlags.DETECTOR)
            {
                m_secretCombo.Visible = true;
                m_secretCombo.SelectItemByKey((int)DummyPoint.Argument);
            }
            else
            {
                m_secretCombo.Visible = false;
            }

            m_canUpdateValues = true;
        }
        /*
         * private void OnVoxelHandSizeChanged(float newSize)
         * {
         * m_sizeChangedFromEditor = true;
         * m_voxelShapeSizeSlider.SetValue(newSize);
         * }        */

        private void OnVoxelHandDistanceChanged(float newDistance)
        {
            m_distanceChangedFromEditor = true;
            m_voxelShapeDistanceSlider.SetValue(newDistance);
        }
        private void RecreateDynamicProperties()
        {
            Vector2 controlsOriginLeft = m_position + new Vector2(-m_size.Value.X / 2.0f + 0.025f, -m_size.Value.Y / 2.0f + 0.025f);

            controlsOriginLeft.Y = m_offsetForSizeProperties;
            Vector2 labelOffset   = new Vector2(-0.015f, 0f);
            Vector2 controlsDelta = MyGuiConstants.CONTROLS_DELTA * 0.6f;

            #region shape size slidebar

            foreach (MyGuiControlBase oldControl in m_dynamicControls)
            {
                m_controls.Remove(oldControl);
            }
            m_dynamicControls.Clear();


            float propScale   = 0.65f;
            float sliderWidth = MyGuiConstants.SLIDER_WIDTH * 1.2f;

            for (int i = 0; i < MyEditorVoxelHand.VoxelHandShape.GetPropertiesCount(); i++)
            {
                MyGuiControlLabel  label = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyEditorVoxelHand.VoxelHandShape.GetPropertyName(i), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * propScale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                MyGuiControlSlider voxelShapeSizeSlider = new MyGuiControlSlider(m_parent, controlsOriginLeft + new Vector2(0.145f, 0), sliderWidth,
                                                                                 MyVoxelConstants.MIN_VOXEL_HAND_SIZE, MyVoxelConstants.MAX_VOXEL_HAND_SIZE * MyVoxelConstants.VOXEL_SIZE_IN_METRES, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                                                 new StringBuilder("{0}"), 0.05f, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f, propScale);
                m_dynamicControls.Add(label);
                m_dynamicControls.Add(voxelShapeSizeSlider);
                m_controls.Add(label);
                m_controls.Add(voxelShapeSizeSlider);

                voxelShapeSizeSlider.SetValue(MyEditorVoxelHand.VoxelHandShape.GetPropertyValue(i));
                voxelShapeSizeSlider.UserData  = i;
                voxelShapeSizeSlider.OnChange += OnSizeSliderChange;

                controlsOriginLeft += new Vector2(0, MyGuiConstants.SLIDER_HEIGHT * propScale * 0.75f);
            }

            controlsOriginLeft += new Vector2(0, MyGuiConstants.SLIDER_HEIGHT * propScale);

            #endregion

            #region shape distance slidebar

            if (m_voxelShapeDistanceLabel != null)
            {
                m_voxelShapeDistanceLabel.SetPosition(controlsOriginLeft + labelOffset);
                m_voxelShapeDistanceSlider.SetPosition(controlsOriginLeft + new Vector2(0.145f, 0));
            }
            else
            {
                m_controls.Add(m_voxelShapeDistanceLabel = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandShapeDistance, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * propScale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_voxelShapeDistanceSlider = new MyGuiControlSlider(m_parent, controlsOriginLeft + new Vector2(0.145f, 0), sliderWidth,
                                                                    MyVoxelConstants.MIN_VOXEL_HAND_DISTANCE, MyVoxelConstants.MAX_VOXEL_HAND_DISTANCE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                                    new StringBuilder("{0:0.00}"), 0.05f, 2, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f, propScale);
                m_controls.Add(m_voxelShapeDistanceSlider);

                m_voxelShapeDistanceSlider.SetValue(MyEditorVoxelHand.GetShapeDistance());
                m_voxelShapeDistanceSlider.OnChange += OnDistanceSliderChange;
            }

            #endregion


            controlsOriginLeft += MyGuiConstants.CONTROLS_DELTA;

            #region shape material
            Vector2 iconSize = new Vector2(0.095f, 0.095f);

            if (m_voxelShapeMaterialLabel != null)
            {
                m_voxelShapeMaterialLabel.SetPosition(controlsOriginLeft + labelOffset);
                controlsOriginLeft += controlsDelta;
                m_voxelShapeMaterialCombobox.SetPosition(new Vector2(controlsOriginLeft.X - 0.015f + MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, controlsOriginLeft.Y));
            }
            else
            {
                m_controls.Add(m_voxelShapeMaterialLabel = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandShapeMaterial, MyGuiConstants.LABEL_TEXT_COLOR,
                                                                                 MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                controlsOriginLeft          += controlsDelta;
                m_voxelShapeMaterialCombobox = new MyGuiControlCombobox(m_parent, new Vector2(controlsOriginLeft.X - 0.015f, controlsOriginLeft.Y) + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, iconSize.Y / 2.5f), MyGuiControlPreDefinedSize.MEDIUM,
                                                                        iconSize, new Vector2(0.015f, 0f), MyGuiConstants.COMBOBOX_BACKGROUND_COLOR * 0.7f, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4, true, false, true);

                foreach (MyMwcVoxelMaterialsEnum voxelMaterial in MyGuiAsteroidHelpers.MyMwcVoxelMaterialsEnumValues)
                {
                    MyGuiVoxelMaterialHelper voxelMaterialHelper = MyGuiAsteroidHelpers.GetMyGuiVoxelMaterialHelper(voxelMaterial);
                    m_voxelShapeMaterialCombobox.AddItem((int)voxelMaterial, voxelMaterialHelper.Icon, voxelMaterialHelper.Description);
                }
                m_controls.Add(m_voxelShapeMaterialCombobox);
                m_voxelShapeMaterialCombobox.OnSelect += OnComboboxItemSelect;
            }

            #endregion

            controlsOriginLeft += 3.4f * MyGuiConstants.CONTROLS_DELTA;
            if (m_attachDetachVoxelHandCheckbox != null)
            {
                m_controls.Remove(m_attachDetachVoxelHandCheckbox);
            }
            if (m_detachLabel != null)
            {
                m_controls.Remove(m_detachLabel);
            }

            MyTextsWrapperEnum text = MyEditorVoxelHand.DetachedVoxelHand == null ? MyTextsWrapperEnum.DetachVoxelHand : MyTextsWrapperEnum.AttachVoxelHand;

            m_detachLabel = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, text, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * propScale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_controls.Add(m_detachLabel);

            m_attachDetachVoxelHandCheckbox          = new MyGuiControlCheckbox(m_parent, new Vector2(controlsOriginLeft.X + 5 * MyGuiConstants.CHECKBOX_SIZE.X, controlsOriginLeft.Y), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, m_detachLabel);
            m_attachDetachVoxelHandCheckbox.OnCheck += OnAttachClick;

            m_controls.Add(m_attachDetachVoxelHandCheckbox);


            LoadSortedControlsByPriority();
        }
Exemplo n.º 12
0
        //void UpdateSettings(MyGuiScreenOptionsVideoSettings settings)
        //{
        //    settings.AspectRatio = (MyAspectRatioEnum)m_aspectRationCombobox.GetSelectedKey();
        //}

        void UpdateControls(MyGuiScreenOptionsAudioSettings settings)
        {
            m_gameVolumeSlider.SetValue(settings.GameVolume);
            m_musicVolumeSlider.SetValue(settings.MusicVolume);
        }
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.97f, 0.85f);
            Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + new Vector2(0.04f, 0);

            m_bots = new Dictionary <int, BotTemplate>();

            // Add screen title
            AddCaption(new Vector2(0, 0.028f));

            //Faction
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA, null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_selectShipFactionCombobox = new MyGuiControlCombobox(this, (new Vector2(0.31f, 0)) + controlsOriginLeft + 1 * CONTROLS_DELTA,
                                                                   MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 8);

            foreach (MyMwcObjectBuilder_FactionEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues)
            {
                MyGuiHelperBase factionNationalityHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(enumValue);
                m_selectShipFactionCombobox.AddItem((int)enumValue, null, factionNationalityHelper.Description);
            }

            m_selectShipFactionCombobox.SelectItemByKey((int)MyMwcObjectBuilder_FactionEnum.China);//hopefuly china
            Controls.Add(m_selectShipFactionCombobox);

            //radius slider
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Radius, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_radiusSlider = new MyGuiControlSlider(this, (new Vector2(0.25f, 0) + controlsOriginLeft) + 2 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                    15, 200, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                    new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_radiusSlider.SetNormalizedValue(0.2f);
            m_radiusSlider.OnChange = OnComponentChange;
            Controls.Add(m_radiusSlider);
            Controls.Add(m_radiusLabel = new MyGuiControlLabel(this, new Vector2(m_radiusSlider.GetPosition().X + m_radiusSlider.GetSize().Value.X / 2 + 0.01f, controlsOriginLeft.Y) + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Radius, MyGuiConstants.LABEL_TEXT_COLOR,
                                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            //first spawn timer
            Controls.Add(new MyGuiControlLabel(this,
                                               controlsOriginLeft + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.FirstSpawn, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_firstSpawnTimeSlider = new MyGuiControlSlider(this,
                                                            (new Vector2(0.25f, 0) + controlsOriginLeft) + 3 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                            0, 10 * 60 * 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                            new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_firstSpawnTimeSlider.OnChange = OnComponentChange;
            m_firstSpawnTimeSlider.SetNormalizedValue(0.0f);
            Controls.Add(m_firstSpawnTimeSlider);
            Controls.Add(m_firstSpawnLabel = new MyGuiControlLabel(this,
                                                                   new Vector2(m_firstSpawnTimeSlider.GetPosition().X + m_firstSpawnTimeSlider.GetSize().Value.X / 2 + 0.01f, controlsOriginLeft.Y) + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Respawn, MyGuiConstants.LABEL_TEXT_COLOR,
                                                                   MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            //respawn timer
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Respawn, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_respawnTimeSlider = new MyGuiControlSlider(this, controlsOriginLeft + new Vector2(0.25f, 0) + 4 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                                                         0, 10 * 60 * 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                         new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_respawnTimeSlider.OnChange = OnComponentChange;
            m_respawnTimeSlider.SetNormalizedValue(0.0f);
            Controls.Add(m_respawnTimeSlider);
            Controls.Add(m_respawnLabel = new MyGuiControlLabel(this, new Vector2(m_respawnTimeSlider.GetPosition().X + m_respawnTimeSlider.GetSize().Value.X / 2 + 0.01f, controlsOriginLeft.Y) + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Respawn, MyGuiConstants.LABEL_TEXT_COLOR,
                                                                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            //waypoints
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.WayPointPath, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_waypointPathCombobox = new MyGuiControlCombobox(this, new Vector2(0.31f, 0) + controlsOriginLeft + 5 * CONTROLS_DELTA,
                                                              MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 8);

            int k        = 0;
            int selected = 0;

            m_waypointPathCombobox.AddItem(k++, null, MyTextsWrapper.Get(MyTextsWrapperEnum.None));
            foreach (var path in MyWayPointGraph.StoredPaths)
            {
                if (HasEntity() && String.Compare(path.Name, m_spawnPoint.GetWaypointPath()) == 0)
                {
                    selected = k;
                }
                m_waypointPathCombobox.AddItem(k++, null, new StringBuilder(path.Name));
            }

            m_waypointPathCombobox.SelectItemByKey(selected);//
            Controls.Add(m_waypointPathCombobox);

            // patrol mode
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.PatrolMode, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_patrolModeCombobox = new MyGuiControlCombobox(this, new Vector2(0.31f, 0) + controlsOriginLeft + 6 * CONTROLS_DELTA,
                                                            MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 8);

            foreach (MyPatrolMode enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_PatrolModes)
            {
                MyGuiHelperBase patrolModeHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipPatrolMode(enumValue);
                m_patrolModeCombobox.AddItem((int)enumValue, null, patrolModeHelper.Description);
            }

            m_patrolModeCombobox.SelectItemByKey(HasEntity() ? (int)m_spawnPoint.PatrolMode : 0);
            Controls.Add(m_patrolModeCombobox);

            #region Smallship Bots To Spawn
            //MyGuiControlLabel smallShipLabel = new MyGuiControlLabel(this, controlsOriginLeft + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseModel, MyGuiConstants.LABEL_TEXT_COLOR,
            //    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            //Controls.Add(smallShipLabel);

            m_selectShipsListbox = new MyGuiControlListbox(this, controlsOriginLeft + 7 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LARGE_SIZE.X / 2.0f + MyGuiConstants.LISTBOX_SCROLLBAR_WIDTH / 2.0f, MyGuiConstants.COMBOBOX_LARGE_SIZE.Y * 2.5f), MyGuiConstants.LISTBOX_LONGMEDIUM_SIZE,
                                                           MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, 1, 6, 1, false, true, false);


            //m_selectShipsListbox.ItemSelect = OnItemSelect;
            m_selectShipsListbox.ItemDoubleClick += OnDoubleClick;

            Controls.Add(m_selectShipsListbox);


            Vector2 columnOriginLeft    = new Vector2(0.178f, controlsOriginLeft.Y);
            Vector2 controlsOriginRight = new Vector2(m_size.Value.X / 2.0f - 0.05f, controlsOriginLeft.Y);

            //  Activated
            Controls.Add(new MyGuiControlLabel(this, columnOriginLeft + MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Active, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_activeCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + MyGuiConstants.CONTROLS_DELTA - new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.02f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_activeCheckbox);

            //  Spawn in groups
            Controls.Add(new MyGuiControlLabel(this, columnOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SpawnInGroups, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spawnInGroupsCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 2 * MyGuiConstants.CONTROLS_DELTA - new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.02f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_spawnInGroupsCheckbox);

            Controls.Add(new MyGuiControlLabel(this, columnOriginLeft + 3 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SpawnedBots,
                                               MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE,
                                               MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spawnedBotsTextbox = new MyGuiControlTextbox(this, columnOriginLeft + 4 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2 - 0.01f, 0), MyGuiControlPreDefinedSize.MEDIUM,
                                                           string.Empty,
                                                           TEXTBOX_NUMBERS_MAX_LENGTH,
                                                           MyGuiConstants.TEXTBOX_BACKGROUND_COLOR,
                                                           MyGuiConstants.LABEL_TEXT_SCALE,
                                                           MyGuiControlTextboxType.DIGITS_ONLY);
            Controls.Add(m_spawnedBotsTextbox);

            #endregion

            #region Bots Listbox Buttons
            Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 7 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Add, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAddClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 8 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Edit, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnEditClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 9 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Inventory, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnInventoryClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 10 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDuplicateClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 11 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Delete, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDeleteClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            #endregion

            AddOkAndCancelButtonControls(new Vector2(0, -0.038f));

            if (HasEntity())
            {
                m_radiusSlider.SetValue(m_spawnPoint.BoundingSphereRadius);
                m_spawnInGroupsCheckbox.Checked = m_spawnPoint.SpawnInGroups;
                m_spawnedBotsTextbox.Text       = m_spawnPoint.LeftToSpawn >= 0 ? m_spawnPoint.LeftToSpawn.ToString() : string.Empty;
                m_firstSpawnTimeSlider.SetValue(m_spawnPoint.FirstSpawnTimer);
                m_respawnTimeSlider.SetValue(m_spawnPoint.RespawnTimer);

                m_selectShipFactionCombobox.SelectItemByKey((int)m_spawnPoint.Faction);
                m_bots.Clear();

                foreach (BotTemplate bt in m_spawnPoint.GetBotTemplates())
                {
                    if (bt.m_builder.ShipTemplateID != null)
                    {
                        AddBot(bt.m_builder, MySmallShipTemplates.GetTemplate(bt.m_builder.ShipTemplateID.Value));
                    }
                    else
                    {
                        AddBot(bt.m_builder);
                    }
                }

                m_activeCheckbox.Checked = m_spawnPoint.IsActive();
            }

            // Just UI update
            OnComponentChange(null);
        }
        private void AddControls()
        {
            m_keyButtonsDictionary      = new Dictionary <MyControl, MyGuiControlButton>();
            m_mouseButtonsDictionary    = new Dictionary <MyControl, MyGuiControlButton>();
            m_joystickButtonsDictionary = new Dictionary <MyControl, MyGuiControlButton>();
            m_joystickAxesDictionary    = new Dictionary <MyControl, MyGuiControlButton>();
            m_keyButtons      = new List <MyGuiControlButton>();
            m_mouseButtons    = new List <MyGuiControlButton>();
            m_joystickButtons = new List <MyGuiControlButton>();
            m_joystickAxes    = new List <MyGuiControlButton>();

            //  "General" page is little bit too complex, so I need to create it separately.
            #region AddControlsByType(MyGuiInputTypeEnum.GENERAL_CONTROL);

            m_allControls[MyGuiControlTypeEnum.General] = new List <MyGuiControlBase>();

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.InvertMouseX, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            //m_invertMouseXCheckbox = new MyGuiControlCheckbox(this, m_controlsOriginRight + 2 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), MyGuiManager.GetInput().GetMouseXInversion(), MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            m_invertMouseXCheckbox = new MyGuiControlCheckbox(this,
                                                              m_controlsOriginRight + 2 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                                                              MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                                                              MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                                                              MyGuiManager.GetInput().GetMouseXInversion(), MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);

            m_allControls[MyGuiControlTypeEnum.General].Add(m_invertMouseXCheckbox);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 3 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.InvertMouseY, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            //m_invertMouseYCheckbox = new MyGuiControlCheckbox(this, m_controlsOriginRight + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), MyGuiManager.GetInput().GetMouseYInversion(), MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            m_invertMouseYCheckbox = new MyGuiControlCheckbox(this,
                                                              m_controlsOriginRight + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                                                              MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                                                              MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                                                              MyGuiManager.GetInput().GetMouseYInversion(), MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);

            m_allControls[MyGuiControlTypeEnum.General].Add(m_invertMouseYCheckbox);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 4 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.MouseSensitivity, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_mouseSensitivitySlider = new MyGuiControlSlider(this, m_controlsOriginRight + 4 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X, 0.0f, 3.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, 0, MyGuiConstants.LABEL_TEXT_SCALE);
            m_mouseSensitivitySlider.SetValue(MyGuiManager.GetInput().GetMouseSensitivity());
            m_allControls[MyGuiControlTypeEnum.General].Add(m_mouseSensitivitySlider);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 8.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Joystick, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_joystickCombobox           = new MyGuiControlCombobox(this, m_controlsOriginRight + 8.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_joystickCombobox.OnSelect += OnSelectJoystick;
            AddJoysticksToComboBox();
            m_allControls[MyGuiControlTypeEnum.General].Add(m_joystickCombobox);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 10 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.JoystickSensitivity, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_joystickSensitivitySlider = new MyGuiControlSlider(this, m_controlsOriginRight + 10 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X, 0.1f, 6.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, 0, MyGuiConstants.LABEL_TEXT_SCALE);
            m_joystickSensitivitySlider.SetValue(MyGuiManager.GetInput().GetJoystickSensitivity());
            m_allControls[MyGuiControlTypeEnum.General].Add(m_joystickSensitivitySlider);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 11 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.JoystickExponent, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_joystickExponentSlider = new MyGuiControlSlider(this, m_controlsOriginRight + 11 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X, 1.0f, 8.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, 0, MyGuiConstants.LABEL_TEXT_SCALE);
            m_joystickExponentSlider.SetValue(MyGuiManager.GetInput().GetJoystickExponent());
            m_allControls[MyGuiControlTypeEnum.General].Add(m_joystickExponentSlider);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 12 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.JoystickDeadzone, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_joystickDeadzoneSlider = new MyGuiControlSlider(this, m_controlsOriginRight + 12 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X, 0.0f, 0.5f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, 0, MyGuiConstants.LABEL_TEXT_SCALE);
            m_joystickDeadzoneSlider.SetValue(MyGuiManager.GetInput().GetJoystickDeadzone());
            m_allControls[MyGuiControlTypeEnum.General].Add(m_joystickDeadzoneSlider);



            #endregion
            AddControlsByType(MyGuiControlTypeEnum.Navigation);
            AddControlsByType(MyGuiControlTypeEnum.Systems1);
            AddControlsByType(MyGuiControlTypeEnum.Systems2);
            AddControlsByType(MyGuiControlTypeEnum.Weapons);
            AddControlsByType(MyGuiControlTypeEnum.SpecialWeapons);
            AddControlsByType(MyGuiControlTypeEnum.Editor);

            //There are no controls for this category now, so hide it completely and uncomment, when we have new comms controls
            //AddControlsByType(MyGuiInputTypeEnum.Communications);
            RefreshJoystickControlEnabling();
        }