Exemplo n.º 1
0
        private void InitControls() 
        {
            Vector2 position = new Vector2(-m_size.Value.X / 2f, 0f);
            Vector2 controlsDelta = new Vector2(m_offset, 0f);

            // create description label
            if ((m_flags & MyGuiSizeEnumFlags.Description) > 0) 
            {
                m_descriptionLabel = new MyGuiControlLabel(this, position, null, m_description, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                Controls.Add(m_descriptionLabel);
                position += controlsDelta;
            }

            // create value slider
            if ((m_flags & MyGuiSizeEnumFlags.Slider) > 0)
            {
                // slider
                m_valueSlider = new MyGuiControlSlider(this, position, MyGuiConstants.SLIDER_WIDTH, m_minValue, m_maxValue, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                    new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
                m_valueSlider.OnChange = OnSliderChange;
                Controls.Add(m_valueSlider);
                position += controlsDelta;                                
            }

            // create value textbox
            if ((m_flags & MyGuiSizeEnumFlags.TextBox) > 0)
            {
                m_valueTextBox = new MyGuiControlTextbox(this, position, MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 9, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);
                m_valueTextBox.TextChanged = OnTextBoxChange;
                Controls.Add(m_valueTextBox);
            }
            else if((m_flags & MyGuiSizeEnumFlags.Slider) > 0)
            {
                // slider value label
                m_valueLabel = new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.None, MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                Controls.Add(m_valueLabel);
            }
        }
        public MyGuiScreenOptionsVideo()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            MyMwcLog.WriteLine("MyGuiScreenOptionsVideo.ctor START");

            m_enableBackgroundFade = true;
            m_size = new Vector2(0.59f, 0.68544f);
            m_size *= 1.1f;

            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality);
            
            AddCaption(MyTextsWrapperEnum.VideoOptions, new Vector2(0, 0.005f));
            //Controls.Add(new MyGuiControlLabel(this, -m_size.Value / 2.0f + MyGuiConstants.SCREEN_CAPTION_DELTA_Y, null, MyTextsWrapperEnum.VideoOptions, MyGuiConstants.SCREEN_CAPTION_TEXT_COLOR, MyGuiConstants.SCREEN_CAPTION_TEXT_SCALE));

            Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.05f, -m_size.Value.Y / 2.0f + 0.145f) + new Vector2(0.02f,0f);
            Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.185f, -m_size.Value.Y / 2.0f + 0.145f) + new Vector2(0.043f,0f);
            controlsOriginRight.X += 0.04f;


            int controlIndex = 0;

            // Adapter

            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VideoAdapter, MyGuiConstants.LABEL_TEXT_COLOR,
             MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            m_videoAdapterCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_videoAdapterCombobox.OnSelect += OnVideoAdapterSelected;
            AddAdaptersToComboBox();
            Controls.Add(m_videoAdapterCombobox);

            //  Video Mode
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VideoMode, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            m_videoModeCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            //  Populating Video Mode with supported DisplayMode reported by XNA framework
            m_videoModeCombobox.OnSelect += OnVideoModeSelected;
            //Added on UpdateSettings
            //AddDisplayModesToComboBox(MyMinerGame.GraphicsDeviceManager.GraphicsAdapter.AdapterOrdinal);
            Controls.Add(m_videoModeCombobox);

            //  Recommended aspect ratio
            m_recommendAspectRatioLabel = new MyGuiControlLabel(this, new Vector2(controlsOriginRight.X + MyGuiConstants.COMBOBOX_TEXT_OFFSET.X, controlsOriginRight.Y + controlIndex++ * MyGuiConstants.CONTROLS_DELTA.Y - 0.015f), null,
                    new StringBuilder(), MyGuiConstants.LABEL_TEXT_COLOR * 0.9f, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS * 0.85f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            //Added on UpdateSettings
            //UpdateRecommendecAspectRatioLabel(MyMinerGame.GraphicsDeviceManager.GraphicsAdapter.AdapterOrdinal);
            Controls.Add(m_recommendAspectRatioLabel);

            //  reduce the spacing between "Recommended aspect ratio" and items below it
            Vector2 offSet = new Vector2(0, MyGuiConstants.CONTROLS_DELTA.Y / 2);
            controlsOriginLeft -= offSet;
            controlsOriginRight -= offSet;

            //  Fullscreen
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Fullscreen, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            m_fullscreenCheckbox = new MyGuiControlCheckbox(this,
                                 controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA +
                                 new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                                 true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            //m_fullscreenCheckbox.OnCheck = OnFullScreenCheck;
            Controls.Add(m_fullscreenCheckbox);

            //  Vertical Sync
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VerticalSync, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            //m_verticalSyncCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            

            m_verticalSyncCheckbox = new MyGuiControlCheckbox(this,
                                 controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA +
                                 new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                                 false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            Controls.Add(m_verticalSyncCheckbox);


            //  Hardware Cursor
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.HardwareCursor, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            m_hardwareCursorCheckbox = new MyGuiControlCheckbox(this,
                                 controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA +
                                 new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                                 false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            Controls.Add(m_hardwareCursorCheckbox);

            //  Render Quality            
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RenderQuality, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            m_renderQualityCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.LOW, MyTextsWrapperEnum.RenderQualityLow);
            m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.NORMAL, MyTextsWrapperEnum.RenderQualityNormal);
            m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.HIGH, MyTextsWrapperEnum.RenderQualityHigh);
            m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.EXTREME, MyTextsWrapperEnum.RenderQualityExtreme);
            Controls.Add(m_renderQualityCombobox);

            // Field of View
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.FieldOfView, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            const float fovSliderSize = MyGuiConstants.SLIDER_WIDTH * 1.1f;
            m_fieldOfViewSlider = new MyGuiControlSlider(this, controlsOriginRight + controlIndex * MyGuiConstants.CONTROLS_DELTA + new Vector2(fovSliderSize / 2.0f, 0),
                fovSliderSize, MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS * 0.85f);
            m_fieldOfViewSlider.OnChange = OnFovChanged;
            Controls.Add(m_fieldOfViewSlider);

            m_fieldOfViewLabel = new MyGuiControlLabel(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(fovSliderSize * 1.1f, 0),
                null, new StringBuilder("{0:F1}"), MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            Controls.Add(m_fieldOfViewLabel);

            m_fieldOfViewDefaultLabel = new MyGuiControlLabel(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.009f, 0),
                null, MyTextsWrapper.Get(MyTextsWrapperEnum.DefaultFOV), MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, MyGuiManager.GetFontMinerWarsBlue());
            m_fieldOfViewDefaultLabel.UpdateParams(MathHelper.ToDegrees(MyConstants.FIELD_OF_VIEW_CONFIG_DEFAULT));
            Controls.Add(m_fieldOfViewDefaultLabel);

            //MyGuiManager.GetFontMinerWarsBlue()
            //  Brightness
            //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 8 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Brightness, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            //  Contrast
            //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 9 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Contrast, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            //m_contrastTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 9 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_WIDTH / 2.0f, 0), MyGuiConstants.TEXTBOX_WIDTH, "Opicka©123456", 20, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiControlTextboxType.NORMAL);
            //Controls.Add(m_contrastTextbox);

            //  Buttons APPLY and BACK


            var m_okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2269f), MyGuiConstants.OK_BUTTON_SIZE,
                                   MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                   MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok,
                                   MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnApplyClick,
                                   true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_okButton);
            //Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
             //   MyTextsWrapperEnum.Apply, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnApplyClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            //Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
             //   MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnBackClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.1428f, 0.2269f), MyGuiConstants.OK_BUTTON_SIZE,
                       MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                       MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Back,
                       MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnBackClick,
                       true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_cancelButton);

            //  Update controls with values from config file
            UpdateFromConfig();
            UpdateControls(m_settingsOld);

            //  Update OLD settings
            UpdateSettings(m_settingsOld);
            UpdateSettings(m_settingsNew);

            MyMwcLog.WriteLine("MyGuiScreenOptionsVideo.ctor END");
        }
 void OnFovChanged(MyGuiControlSlider sender)
 {
     m_fieldOfViewLabel.UpdateParams(MathHelper.ToDegrees(m_fieldOfViewSlider.GetValue()));
 }
        void OnComponentChange(MyGuiControlSlider sender)
        {
            if (!m_canUpdateValues)
                return;

            DummyPoint.Color = new Vector4(
                m_redSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE,
                m_greenSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE,
                m_blueSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE,
                m_alphaSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE);

            DummyPoint.UserScale = m_userScaleSlider.GetValue();

            UpdateValues();
        }
        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);
        }
Exemplo n.º 6
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;
 }
 void OnComponentChange(MyGuiControlSlider sender)
 {
     m_radiusLabel.UpdateText(string.Format("{0:#,###0} meters", m_radiusSlider.GetValue()));
     m_firstSpawnLabel.UpdateText(string.Format("{0:#,###0} seconds", m_firstSpawnTimeSlider.GetValue() / 1000));
     m_respawnLabel.UpdateText(string.Format("{0:#,###0} seconds", m_respawnTimeSlider.GetValue() / 1000));   
 }
Exemplo n.º 8
0
 private void OnSliderChange(MyGuiControlSlider sender) 
 {
     SetValue(sender, sender.GetValue());
 }        
        private void OnSizeSliderChange(MyGuiControlSlider sliderSender) 
        {
            int index = (int)sliderSender.UserData;
            MyEditorVoxelHand.VoxelHandShape.SetPropertyValue(index, sliderSender.GetValue());

            if (m_sizeChangedFromEditor)
                m_sizeChangedFromEditor = false;
            else
                UpdateVoxelHandProperties();
        }
        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();
        }
        public void CreateControls(Vector2 controlsOrigin, Vector2 sliderOffset)
        {                        
            float sliderMax = 1000f;

            AddActivatedCheckbox(controlsOrigin, Scanner.Activated);

            AddIdTextBox(new Vector2(-0.17f, controlsOrigin.Y), Scanner.EntityId.Value.NumericValue);

            //Width slider            
            m_widthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.4f, 0f) + 1 * CONTROLS_DELTA, new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Width), MyGuiSizeEnumFlags.All, sliderOffset.X);            
            Controls.Add(m_widthSize);

            //Height slider            
            m_heightSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.4f, 0f) + 2 * CONTROLS_DELTA, new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Height), MyGuiSizeEnumFlags.All, sliderOffset.X);
            Controls.Add(m_heightSize);

            //Depth slider            
            m_depthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.4f, 0f) + 3 * CONTROLS_DELTA, new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Depth), MyGuiSizeEnumFlags.All, sliderOffset.X);
            Controls.Add(m_depthSize);

            //Scanning speed slider            
            m_scanningSpeedSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.4f, 0f) + 4 * CONTROLS_DELTA, new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.ScanningSpeed), MyGuiSizeEnumFlags.All, 0.3f);
            Controls.Add(m_scanningSpeedSize);

            // Color
            Vector2 colorPosition = controlsOrigin + 5 * CONTROLS_DELTA;
            m_colorDrawPosition = colorPosition + sliderOffset;
            Controls.Add(new MyGuiControlLabel(this, colorPosition, null, MyTextsWrapperEnum.Color, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            MyTextsWrapperEnum[] colorNames = { MyTextsWrapperEnum.Red, MyTextsWrapperEnum.Green, MyTextsWrapperEnum.Blue };
            m_colorSlider = new MyGuiControlSlider[3];
            //color sliders
            for (int i = 0; i < 3; i++)
            {
                Controls.Add(new MyGuiControlLabel(this, controlsOrigin + (6 + i) * CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_colorSlider[i] = new MyGuiControlSlider(this, (sliderOffset + controlsOrigin) + (6 + i) * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                    MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                    new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f);                
                Controls.Add(m_colorSlider[i]);
            }

            Controls.Add(new MyGuiControlLabel(this, controlsOrigin + 9 * CONTROLS_DELTA, null, MyTextsWrapperEnum.On, MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_onCheckbox = new MyGuiControlCheckbox(this, controlsOrigin + sliderOffset + 9 * CONTROLS_DELTA, Scanner.Enabled, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); 
            Controls.Add(m_onCheckbox);                                
        }        
 void OnColorChange(MyGuiControlSlider sender) 
 {
     Color color = new Color();
     color.R = (byte)m_colorSlider[0].GetValue();
     color.G = (byte)m_colorSlider[1].GetValue();
     color.B = (byte)m_colorSlider[2].GetValue();
     color.A = 255;
     Scanner.Color = color;
 }        
Exemplo n.º 13
0
        /*
        public void OnMyShadowCheckEnable(MyGuiControlCheckbox sender)
        {
            foreach (MyPrefabLight prefabLight in m_prefabLights)
            {
                MyLight myLight = prefabLight.GetLight();

                if (sender == m_spotLightShadowCheckbox)
                {
                    myLight.ShadowsEnabled = sender.Checked;
                }

                prefabLight.OnWorldPositionChanged(this);
                prefabLight.UpdateEffect();
            }
            OnComponentChange(null);
        }
        */
        void OnComponentChange(MyGuiControlSlider sender)
        {
            foreach (MyPrefabLight prefabLight in m_prefabLights)
            {
                MyLight light = prefabLight.GetLight();
                Color tmpColor = new Color();
                tmpColor.R = (byte)m_pointNormalLightColorSlider[0].GetValue();
                tmpColor.G = (byte)m_pointNormalLightColorSlider[1].GetValue();
                tmpColor.B = (byte)m_pointNormalLightColorSlider[2].GetValue();
                light.Color = tmpColor.ToVector4();

                tmpColor.R = (byte)m_specularLightColorSlider[0].GetValue();
                tmpColor.G = (byte)m_specularLightColorSlider[1].GetValue();
                tmpColor.B = (byte)m_specularLightColorSlider[2].GetValue();
                light.SpecularColor = tmpColor.ToVector3();
                light.Falloff = m_pointFallOffSlider.GetValue(); // allowed values 0.1f-5.0f
                light.Range = m_pointRangeSlider.GetValue(); // allowed values 0.0f-MyLightsConstants.MAX_POINTLIGHT_RADIUS
                light.Intensity = prefabLight.m_IntensityMax = m_pointIntensitySlider.GetValue(); // allowed values 0.0f-10.0f
                light.PointLightOffset = m_pointOffsetSlider.GetValue();

                tmpColor.R = (byte)m_spotNormalLightColorSlider[0].GetValue();
                tmpColor.G = (byte)m_spotNormalLightColorSlider[1].GetValue();
                tmpColor.B = (byte)m_spotNormalLightColorSlider[2].GetValue();
                light.ReflectorColor = tmpColor.ToVector4();

                light.ReflectorFalloff = m_spotFallOffSlider.GetValue(); // allowed values 0.1f-5.0f
                light.ReflectorRange = m_spotRangeSlider.GetValue(); // allowed values 0.0f-MyLightsConstants.MAX_SPOTLIGHT_RANGE
                light.ReflectorIntensity = prefabLight.ReflectorIntensityMax = m_spotIntensitySlider.GetValue(); // allowed values 0.0f-10.0f

                light.ReflectorConeDegrees = m_spotAngleSlider.GetValue(); // allowed values 0.0f-MyLightsConstants.MAX_SPOTLIGHT_ANGLE
                light.ShadowDistance = m_spotLightShadowDistance.GetValue();
                prefabLight.FlashOffset = m_flashOffsetSlider.GetValue();
            }
        }
Exemplo n.º 14
0
        void CreateControls(Vector2 controlsOrigin)
        {
            var panel = new MyGuiControlPanel(m_parent, m_position, m_size, m_backgroundColor.Value, 2, m_backgroundColor.Value * 2f);
            m_controls.Add(panel);

            float dPos = -1;
            float dPosFalloff;
            MyTextsWrapperEnum[] colorNames = { MyTextsWrapperEnum.Red, MyTextsWrapperEnum.Green, MyTextsWrapperEnum.Blue };

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            /*
             * Effect 
             */

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

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

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

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

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

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

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

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

            AddControl(true, m_pointIntensitySlider);

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

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

            AddControl(true, m_pointOffsetSlider);


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

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

            AddControl(true, m_flashOffsetSlider);

            /*
             * 
             * Reflector spot light
             * 
             * 
             */




            dPos = -1;



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


            dPos = 1;

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





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

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

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

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


            dPos++;


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


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

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

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

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

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

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



            ActivateLightType(true);
            //m_tabControl.ActivateTab((int)MyGuiLightPrefabTypeEnum.PointLight);
        }
Exemplo n.º 15
0
 void OnFovSlider(MyGuiControlSlider slider)
 {
     MyCamera.FieldOfViewAngle = slider.GetValue();
 }
 private void OnDistanceSliderChange(MyGuiControlSlider sliderSender)
 {
     if (sliderSender == m_voxelShapeDistanceSlider)
     {
         if (m_distanceChangedFromEditor)
             m_distanceChangedFromEditor = false;
         else
             UpdateVoxelHandProperties();
     }
 }
 private void OnSeeDistanceChanged(MyGuiControlSlider sender)
 {
     m_seeDistanceLabel.UpdateText(string.Format(" {0:#,###0} meters", m_seeDistanceSlider.GetValue()));
 }
Exemplo n.º 18
0
        public MyGuiControlColor(IMyGuiControlsParent parent, StringBuilder text, Vector2 position, Vector2? size, float scale, Color color)
            : base(parent, position, size, null, null, false)
        {

            m_color = color;


            float localScale = 0.5f;

            MyGuiControlLabel label = new MyGuiControlLabel(parent, position, null, text, Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.8f * m_scale,
                                            MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            parent.Controls.Add(label);
            position.Y += 0.04f * m_scale;

            m_RSlider = new MyGuiControlSlider(parent, position + new Vector2(0.04f, 0) * m_scale, 0.2f, 0, 255, new Vector4(1, 1, 0, 1),
                new StringBuilder(), 0.1f, 3, 0.65f * m_scale * localScale, m_scale * localScale);
            parent.Controls.Add(m_RSlider);
            m_RSlider.SetValue(m_color.R);
            m_RSlider.OnChange += delegate(MyGuiControlSlider sender)
            {
                if (m_canChangeColor)
                {
                    m_color.R = (byte)sender.GetValue();
                    UpdateTexts();
                    if (OnChange != null)
                        OnChange(this);
                }
            };
            m_RLabel = new MyGuiControlLabel(parent, position, null, new StringBuilder(), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.8f * m_scale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            parent.Controls.Add(m_RLabel);

            m_GSlider = new MyGuiControlSlider(parent, position + new Vector2(0.04f + 0.1f, 0) * m_scale, 0.2f, 0, 255, new Vector4(1, 1, 0, 1),
    new StringBuilder(), 0.1f, 3, 0.65f * m_scale * localScale, m_scale * localScale);
            parent.Controls.Add(m_GSlider);
            m_GSlider.SetValue(m_color.G);
            m_GSlider.OnChange += delegate(MyGuiControlSlider sender)
            {
                if (m_canChangeColor)
                {
                    m_color.G = (byte)sender.GetValue();
                    UpdateTexts();
                    if (OnChange != null)
                        OnChange(this);
                }
            };
            m_GLabel = new MyGuiControlLabel(parent, position + new Vector2(0.04f + 0.1f, 0) * m_scale, null, new StringBuilder(), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.8f * m_scale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            parent.Controls.Add(m_GLabel);

            m_BSlider = new MyGuiControlSlider(parent, position + new Vector2(0.04f + 2 * 0.1f, 0) * m_scale, 0.2f, 0, 255, new Vector4(1, 1, 0, 1),
new StringBuilder(), 0.1f, 3, 0.65f * m_scale * localScale, m_scale * localScale);
            parent.Controls.Add(m_BSlider);
            m_BSlider.SetValue(m_color.B);
            m_BSlider.OnChange += delegate(MyGuiControlSlider sender)
            {
                if (m_canChangeColor)
                {
                    m_color.B = (byte)sender.GetValue();
                    UpdateTexts();
                    if (OnChange != null)
                        OnChange(this);
                }
            };
            m_BLabel = new MyGuiControlLabel(parent, position + new Vector2(0.04f + 2 * 0.1f, 0) * m_scale, null, new StringBuilder(), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.8f * m_scale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            parent.Controls.Add(m_BLabel);


            
        }
 private void OnAggresivityChanged(MyGuiControlSlider sender)
 {
     m_aggresivityLabel.UpdateText(string.Format(" {0:0.00}", m_aggresivitySlider.GetValue()));
 }
Exemplo n.º 20
0
        protected MyGuiControlSlider addSlider(StringBuilder text, float valueMin, float valueMax, Vector4? color = null)
        {
            MyGuiControlLabel label = new MyGuiControlLabel(this, m_currentPosition, null, text, color ?? m_defaultColor, MyGuiConstants.LABEL_TEXT_SCALE * 0.8f * m_scale,
                                                            MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            float labelWidth = label.GetTextSize().Size.X + 0.02f;
            m_maxWidth = Math.Max(m_maxWidth, labelWidth);
            Controls.Add(label);

            m_currentPosition.Y += 0.04f * m_scale;

            MyGuiControlSlider slider = new MyGuiControlSlider(this, m_currentPosition + new Vector2(0.1f, 0) * m_scale, 0.2f, valueMin, valueMax, color ?? m_defaultColor,
                new System.Text.StringBuilder(" {0}"), 0.1f, 3, 0.65f * m_scale, m_scale);

            Controls.Add(slider);
            m_currentPosition.Y += 0.05f * m_scale;

            return slider;
        }
 private void OnSeeDistanceChanged(MyGuiControlSlider sender)
 {
     m_seeDistanceLabel.UpdateText(string.Format(" {0:#,###0} " + MyTextsWrapper.Get(MyTextsWrapperEnum.MetersLong).ToString(), m_seeDistanceSlider.GetValue()));
 }
 void OnComponentChange(MyGuiControlSlider sender)
 {
     m_radiusLabel.UpdateText(string.Format("{0:#,###0} " + MyTextsWrapper.Get(MyTextsWrapperEnum.MetersLong).ToString(), m_radiusSlider.GetValue()));
     m_firstSpawnLabel.UpdateText(string.Format("{0:#,###0} " + MyTextsWrapper.Get(MyTextsWrapperEnum.SecondsLong).ToString(), m_firstSpawnTimeSlider.GetValue() / 1000));
     m_respawnLabel.UpdateText(string.Format("{0:#,###0} " + MyTextsWrapper.Get(MyTextsWrapperEnum.SecondsLong).ToString(), m_respawnTimeSlider.GetValue() / 1000));   
 }
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.73f, 0.93f);
            Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + new Vector2(0.02f, 0.01f);
            Vector2 controlsOriginRight = GetControlsOriginRightFromScreenSize();

            // Add screen title
            AddCaption();            

            #region Faction nationality

            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, controlsOriginRight + 1 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5);

            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(1);
            Controls.Add(m_selectShipFactionCombobox);

            #endregion

            // AI Template
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.AITemplate, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_selectAITemplateCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 2 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5);

            foreach (MyAITemplateEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_BotAITemplateValues)
            {
                MyGuiHelperBase aiTemplateHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipBotAITemplate(enumValue);
                if (aiTemplateHelper != null)
                    m_selectAITemplateCombobox.AddItem((int)enumValue, null, aiTemplateHelper.Description);
            }

            m_selectAITemplateCombobox.SelectItemByKey(0);
            Controls.Add(m_selectAITemplateCombobox);

            // Aggresivity
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Aggressivity, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_aggresivitySlider = new MyGuiControlSlider(this, controlsOriginRight + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2, 0), MyGuiConstants.SLIDER_WIDTH,
                                        0, 1, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                        new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);

            m_aggresivityLabel = new MyGuiControlLabel(this, controlsOriginRight + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH, 0), null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(m_aggresivitySlider);
            Controls.Add(m_aggresivityLabel);

            m_aggresivitySlider.OnChange += OnAggresivityChanged;
            OnAggresivityChanged(m_aggresivitySlider);

            // See distance
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.SeeDistance, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_seeDistanceSlider = new MyGuiControlSlider(this, controlsOriginRight + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2, 0), MyGuiConstants.SLIDER_WIDTH,
                                        0, 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                        new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);

            m_seeDistanceLabel = new MyGuiControlLabel(this, controlsOriginRight + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH, 0), null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(m_seeDistanceSlider);
            Controls.Add(m_seeDistanceLabel);

            m_seeDistanceSlider.OnChange += OnSeeDistanceChanged;
            OnSeeDistanceChanged(m_seeDistanceSlider);

            #region Smallship Model

            MyGuiControlLabel smallShipLabel = new MyGuiControlLabel(this, controlsOriginLeft + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseModel, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(smallShipLabel);

            //COMBOBOX - small ship
            var comboboxPredefinedSize = MyGuiControlPreDefinedSize.LONGMEDIUM;
            var comboboxSize = MyGuiControlCombobox.GetPredefinedControlSize(comboboxPredefinedSize);
            m_selectSmallShipCombobox = new MyGuiControlCombobox(
                this,
                controlsOriginLeft + 5 * CONTROLS_DELTA + 0.5f * new Vector2(comboboxSize.X, 0) + new Vector2(0.19f, 0.01f),
                comboboxPredefinedSize,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                MyGuiConstants.COMBOBOX_TEXT_SCALE,
                6,
                true,
                false,
                true);

            if (m_templatesBuilders == null)
            {
                foreach (MyMwcObjectBuilder_SmallShip_TypesEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_TypesEnumValues)
                {
                    //MyGuiSmallShipHelperSmallShip smallShipHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperSmallShip(enumValue);
                    MyGuiSmallShipHelperSmallShip smallShipHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, (int)enumValue) as MyGuiSmallShipHelperSmallShip;
                    m_selectSmallShipCombobox.AddItem((int)enumValue, smallShipHelper.Icon, smallShipHelper.Name);
                }
                m_selectSmallShipCombobox.SelectItemByKey(1);
            }
            else 
            {
                for(int i = 0; i < m_templatesBuilders.Count; i++)
                {
                    var templateBuilder = m_templatesBuilders[i];
                    m_selectSmallShipCombobox.AddItem(i, templateBuilder.Name);
                }                
            }
            
            m_selectSmallShipCombobox.OnSelectItemDoubleClick += OnOkClick;
            Controls.Add(m_selectSmallShipCombobox);
            #endregion

            if (m_bot != null)
            {
                Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 10 * CONTROLS_DELTA + new Vector2(0.07f, 0.02f), 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));

                AddActivatedCheckbox(controlsOriginLeft, m_bot.Activated);
            }

            AddOkAndCancelButtonControls(new Vector2(0, -0.02f));
        }
        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();
        }
        void CreateControls(Vector2 controlsOrigin, Vector2 sliderOffset)
        {            
            m_nameLabel = new MyGuiControlLabel(this, controlsOrigin - new Vector2(0, 2 * CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Name, 
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            m_nameTextBox = new MyGuiControlTextbox(this, controlsOrigin - new Vector2(-0.2f, 2 * CONTROLS_DELTA.Y), MyGuiControlPreDefinedSize.MEDIUM,
                DummyPoint.Name ?? String.Empty, 512, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            m_nameTextBox.TextChanged = OnTextChange;

            Controls.Add(m_nameLabel);
            Controls.Add(m_nameTextBox);

            m_typeComboBox = new MyGuiControlCombobox(this, controlsOrigin - new Vector2(-0.25f, CONTROLS_DELTA.Y), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_typeComboBox.AddItem(0, new StringBuilder("Box"));
            m_typeComboBox.AddItem(1, new StringBuilder("Sphere"));
            m_typeComboBox.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_typeComboBox_OnSelect);
            Controls.Add(m_typeComboBox);
            MyGuiControlLabel typeLabel = new MyGuiControlLabel(this, controlsOrigin - new Vector2(-0.0f, CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Width, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            typeLabel.UpdateText("Type");
            Controls.Add(typeLabel);

            float checkBoxOffset = 0.507f;
            //Enabled
            Controls.Add(new MyGuiControlLabel(this, controlsOrigin - new Vector2(-checkBoxOffset, 2 * CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Enabled, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_enabled = new MyGuiControlCheckbox(this, controlsOrigin - new Vector2(-checkBoxOffset, 2 * CONTROLS_DELTA.Y) + new Vector2(0.1f, 0f), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            m_enabled.OnCheck += OnEnabledChange;
            Controls.Add(m_enabled);

            // Active
            AddActivatedCheckbox(controlsOrigin - new Vector2(-checkBoxOffset, CONTROLS_DELTA.Y), DummyPoint.Activated);

            float sliderMax = 50000;

            //Width slider            
            m_widthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f), new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Width), MyGuiSizeEnumFlags.All, sliderOffset.X);
            m_widthSize.OnValueChange += OnWidthChange;
            Controls.Add(m_widthSize);

            //Height slider            
            m_heightSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f) + 1 * CONTROLS_DELTA, new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Height), MyGuiSizeEnumFlags.All, sliderOffset.X);
            m_heightSize.OnValueChange += OnHeightChange;
            Controls.Add(m_heightSize);

            //Depth slider            
            m_depthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f) + 2 * CONTROLS_DELTA, new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Depth), MyGuiSizeEnumFlags.All, sliderOffset.X);
            m_depthSize.OnValueChange += OnDepthChange;
            Controls.Add(m_depthSize);

            MyGuiControlLabel idLabel = new MyGuiControlLabel(this, controlsOrigin + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Depth, MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(idLabel);
            idLabel.UpdateText("ID: " + m_entity.EntityId.ToString());

            int controlsDelta = 4;

            // Flags
            m_colorArea = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta++ * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_colorArea.OnCheck += OnFlagChange;
            m_colorAreaLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ColorArea,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_colorArea);
            Controls.Add(m_colorAreaLabel);

            m_playerStart = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_playerStart.OnCheck += OnPlayerStartFlagChange;
            m_playerStartLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.PlayerStart,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_playerStart);
            Controls.Add(m_playerStartLabel);

            m_mothershipStart = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_mothershipStart.OnCheck += OnMothershipStartFlagChange;
            m_mothershipStartLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.MothershipStart,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_mothershipStart);
            Controls.Add(m_mothershipStartLabel);

            m_detector = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_detector.OnCheck += OnFlagChange;
            m_detectorLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.Detector,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_detector);
            Controls.Add(m_detectorLabel);

            m_sideMission = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_sideMission.OnCheck += OnFlagChange;
            m_sideMissionLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.SideMission,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_sideMission);
            Controls.Add(m_sideMissionLabel);

            m_particleEffect = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_particleEffect.OnCheck += OnFlagChange;
            m_particleEffectLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.ParticleEffect,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_particleEffectLabel);
            Controls.Add(m_particleEffect);

            m_respawnPoint = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_respawnPoint.OnCheck += OnFlagChange;
            m_respawnPointLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.RespawnPoint,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_respawnPointLabel);
            Controls.Add(m_respawnPoint);

            m_safeArea = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_safeArea.OnCheck += OnFlagChange;
            m_safeAreaLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.SafeArea,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_safeArea);
            Controls.Add(m_safeAreaLabel);

            m_survivePrefabDestruction = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_survivePrefabDestruction.OnCheck += OnFlagChange;
            m_survivePrefabDestructionLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.SurvivePrefabDestruction,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_survivePrefabDestructionLabel);
            Controls.Add(m_survivePrefabDestruction);

            m_textureQuad = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_textureQuad.OnCheck += OnFlagChange;
            m_textureQuadLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.TextureQuad,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_textureQuad);
            Controls.Add(m_textureQuadLabel);

            m_note = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_note.OnCheck += OnFlagChange;
            m_noteLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.Note,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_note);
            Controls.Add(m_noteLabel);

            Vector2 columnOffset = new Vector2(0.15f, 0);
            Vector2 labelColumnOffset = new Vector2(0.18f, 0);
            // Red slider
            m_redSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Red, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_redSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 4 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_redSlider.OnChange = OnComponentChange;
            Controls.Add(m_redSliderLabel);
            Controls.Add(m_redSlider);

            // Green slider
            m_greenSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Green, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_greenSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 5 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_greenSlider.OnChange = OnComponentChange;
            Controls.Add(m_greenSliderLabel);
            Controls.Add(m_greenSlider);

            // Blue slider
            m_blueSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Blue, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_blueSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 6 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_blueSlider.OnChange = OnComponentChange;
            Controls.Add(m_blueSliderLabel);
            Controls.Add(m_blueSlider);

            // Alpha slider
            m_alphaSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 7 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Alpha, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_alphaSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 7 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_alphaSlider.OnChange = OnComponentChange;
            m_alphaSliderValueLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 7 * CONTROLS_DELTA + new Vector2(0.4f, 0), null, new StringBuilder("0"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            // scale slider
            m_userScaleSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 8 * CONTROLS_DELTA, null, MyTextsWrapperEnum.UserScale, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_userScaleSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 8 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               0.01f, 3.9f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_userScaleSlider.OnChange = OnComponentChange;
            m_userScaleLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 8 * CONTROLS_DELTA + new Vector2(0.4f, 0), null, new StringBuilder("0"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(m_alphaSliderLabel);
            Controls.Add(m_alphaSliderValueLabel);
            Controls.Add(m_alphaSlider);

            Controls.Add(m_userScaleSliderLabel);
            Controls.Add(m_userScaleSlider);
            Controls.Add(m_userScaleLabel);

            // Particle effect
            //m_particleNameLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ParticleEffect, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_particleCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 9 * CONTROLS_DELTA + sliderOffset, MyGuiControlPreDefinedSize.MEDIUM,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5, false, false, false);
            foreach (var p in MyParticlesLibrary.GetParticleEffects())
            {
                m_particleCombo.AddItem(p.GetID(), new StringBuilder(p.Name));
                m_particleCombo.SortItemsByValueText();
            }
            m_particleCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_particleCombo_OnSelect);
            //Controls.Add(m_particleNameLabel);
            Controls.Add(m_particleCombo);

            m_respawnPointCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 10 * CONTROLS_DELTA + sliderOffset,
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4);
            foreach (MyMwcObjectBuilder_FactionEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues)
            {
                MyGuiHelperBase factionNationalityHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(enumValue);
                m_respawnPointCombo.AddItem((int)enumValue, null, factionNationalityHelper.Description);
            }
            m_respawnPointCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_repawnPointCombo_OnSelect);
            Controls.Add(m_respawnPointCombo);

            m_secretCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 7 * CONTROLS_DELTA + sliderOffset,
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4);

            m_secretCombo.AddItem(0, null, new StringBuilder("No secret"));
            foreach (var room in MySecretRooms.SecretRooms)
            {
                m_secretCombo.AddItem(room.Key, null, new StringBuilder(room.Value));
            }
            m_secretCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_secretCombo_OnSelect);
            Controls.Add(m_secretCombo);

            UpdateValues();
        }