Ejemplo n.º 1
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            var caption = AddCaption("SEWorldGenPlugin world settings");

            caption.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP;
            caption.Position    = new Vector2(0, SIZE.Y / -2 + PADDING.Y);

            MyGuiControlButton OkButton = new MyGuiControlButton(null, VRage.Game.MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM, null, VRage.MyTexts.Get(MyCommonTexts.Ok), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_ACTIVE, OkButtonClicked);

            OkButton.Position = new Vector2(0, SIZE.Y / 2 - PADDING.Y);
            Controls.Add(OkButton);

            MyGuiControlSeparatorList separators = new MyGuiControlSeparatorList();

            separators.AddHorizontal(SIZE / -2 + PADDING + new Vector2(0, caption.Size.Y) + CHILD_MARGINS_VERT, SIZE.X - 2 * PADDING.X);
            separators.AddHorizontal(new Vector2(SIZE.X / -2 + PADDING.X, SIZE.Y / 2 - PADDING.Y - OkButton.Size.Y) - CHILD_MARGINS_VERT, SIZE.X - 2 * PADDING.X);
            Controls.Add(separators);

            MyGuiControlParentTableLayout parent = new MyGuiControlParentTableLayout(2);

            parent.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;

            //Generate rows for parent layout containing settings

            var systemGenLabel           = new MyGuiControlLabel(null, null, "Generator mode");
            var asteroidGenLabel         = new MyGuiControlLabel(null, null, "Asteroid generator mode");
            var enableVanillaLabel       = new MyGuiControlLabel(null, null, "Use vanilla planets");
            var planetCountLabel         = new MyGuiControlLabel(null, null, "Planet count");
            var asteroidCountLabel       = new MyGuiControlLabel(null, null, "Asteroid object count");
            var oribtDistanceLabel       = new MyGuiControlLabel(null, null, "Orbit distances");
            var planeDeviationLabel      = new MyGuiControlLabel(null, null, "System plane deviation");
            var asteroidDensityLabel     = new MyGuiControlLabel(null, null, "Asteroid density");
            var worldSizeLabel           = new MyGuiControlLabel(null, null, "World size");
            var planetSizeCapLabel       = new MyGuiControlLabel(null, null, "Planet size cap");
            var planetSizeMultLabel      = new MyGuiControlLabel(null, null, "Planet size multiplier");
            var planetSizeDeviationLabel = new MyGuiControlLabel(null, null, "Planet size deviation");
            var planetMoonPropLabel      = new MyGuiControlLabel(null, null, "Planet moon probability");
            var planetRingPropLabel      = new MyGuiControlLabel(null, null, "Planet ring probability");
            var planetMoonCountLabel     = new MyGuiControlLabel(null, null, "Planet moon count");
            var planetGpsModeLabel       = new MyGuiControlLabel(null, null, "Planet gps mode");
            var moonGpsModeLabel         = new MyGuiControlLabel(null, null, "Moon gps mode");
            var asteroidGpsModeLabel     = new MyGuiControlLabel(null, null, "Asteroid gps mode");

            m_systemGeneratorCombo = new MyGuiControlCombobox(null, null);
            m_systemGeneratorCombo.SetToolTip(MyPluginTexts.TOOLTIPS.SYS_GEN_MODE_COMBO);
            m_systemGeneratorCombo.AddItem((long)SystemGenerationMethod.FULL_RANDOM, "Full random");
            m_systemGeneratorCombo.AddItem((long)SystemGenerationMethod.UNIQUE, "Unique");
            m_systemGeneratorCombo.AddItem((long)SystemGenerationMethod.MANDATORY_FIRST, "Mandatory first");
            m_systemGeneratorCombo.AddItem((long)SystemGenerationMethod.MANDATORY_ONLY, "Mandatory only");
            m_systemGeneratorCombo.AddItem((long)SystemGenerationMethod.MANDATORY_UNIQUE, "Mandatory only unique");

            m_systemGeneratorCombo.Size = new Vector2(0.25f, m_systemGeneratorCombo.Size.Y);

            parent.AddTableRow(systemGenLabel, m_systemGeneratorCombo);

            m_asteroidGeneratorCombo = new MyGuiControlCombobox();
            m_asteroidGeneratorCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ASTEROID_GEN_MODE_COMBO);
            m_asteroidGeneratorCombo.AddItem((long)AsteroidGenerationMethod.PLUGIN, "Plugin");
            m_asteroidGeneratorCombo.AddItem((long)AsteroidGenerationMethod.VANILLA, "Vanilla");
            m_asteroidGeneratorCombo.AddItem((long)AsteroidGenerationMethod.BOTH, "Combined");
            m_asteroidGeneratorCombo.ItemSelected += delegate()
            {
                m_asteroidGPSModeCombo.Enabled  = m_asteroidGeneratorCombo.GetSelectedKey() != (long)AsteroidGenerationMethod.VANILLA;
                m_asteroidDensitySlider.Enabled = m_asteroidGeneratorCombo.GetSelectedKey() != (long)AsteroidGenerationMethod.VANILLA;
            };

            m_asteroidGeneratorCombo.Size = new Vector2(0.25f, m_asteroidGeneratorCombo.Size.Y);

            parent.AddTableRow(asteroidGenLabel, m_asteroidGeneratorCombo);

            m_enableVanillaPlanetsCheckbox = new MyGuiControlCheckbox();
            m_enableVanillaPlanetsCheckbox.SetToolTip(MyPluginTexts.TOOLTIPS.VANILLA_PLANETS_CHECK);

            parent.AddTableRow(enableVanillaLabel, m_enableVanillaPlanetsCheckbox);

            m_planetCountSlider = new MyGuiControlRangedSlider(0, 50, 5, 15, true, width: 0.25f);
            m_planetCountSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_COUNT_SLIDER);

            parent.AddTableRow(planetCountLabel, m_planetCountSlider);

            m_asteroidCountSlider = new MyGuiControlRangedSlider(0, 50, 5, 15, true, width: 0.25f);
            m_asteroidCountSlider.SetToolTip(MyPluginTexts.TOOLTIPS.ASTEROID_COUNT_SLIDER);

            parent.AddTableRow(asteroidCountLabel, m_asteroidCountSlider);

            m_orbitDistancesSlider = new MyGuiControlRangedSlider(100, 10000000, 40000, 1000000, width: 0.25f, useLogScale: true);
            m_orbitDistancesSlider.SetToolTip(MyPluginTexts.TOOLTIPS.ORBIT_DISTANCE_SLIDER);

            parent.AddTableRow(oribtDistanceLabel, m_orbitDistancesSlider);

            m_systemPlaneDeviationSlider = new MyGuiControlClickableSlider(minValue: 0, maxValue: 90f, defaultValue: 5f, width: 0.25f, showLabel: true);
            m_systemPlaneDeviationSlider.SetToolTip(MyPluginTexts.TOOLTIPS.SYSTEM_PLANE_DEV_SLIDER);

            parent.AddTableRow(planeDeviationLabel, m_systemPlaneDeviationSlider);

            m_asteroidDensitySlider = new MyGuiControlClickableSlider(minValue: 0, maxValue: 1, defaultValue: 0.6f, width: 0.25f, showLabel: true);
            m_asteroidDensitySlider.SetToolTip(MyPluginTexts.TOOLTIPS.ASTEROID_DENS_SLIDER);

            parent.AddTableRow(asteroidDensityLabel, m_asteroidDensitySlider);

            m_worldSizeSlider = new MyGuiControlClickableSlider(minValue: -1, maxValue: 1000000000, defaultValue: -1, width: 0.25f, showLabel: true, labelSuffix: " Km");
            m_worldSizeSlider.SetToolTip(MyPluginTexts.TOOLTIPS.WORLD_SIZE_SLIDER);
            m_worldSizeSlider.OnLabelUpdate += delegate(MyGuiControlLabel l)
            {
                if (m_worldSizeSlider.Value < 0)
                {
                    l.Text = "Infinite";
                }
            };

            parent.AddTableRow(worldSizeLabel, m_worldSizeSlider);

            m_planetSizeCapSlider = new MyGuiControlClickableSlider(minValue: 1, maxValue: 2400000, defaultValue: 1200000, intValue: true, width: 0.25f, showLabel: true, labelSuffix: " m");
            m_planetSizeCapSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_SIZE_CAP_SLIDER);

            parent.AddTableRow(planetSizeCapLabel, m_planetSizeCapSlider);

            m_planetSizeMultSlider = new MyGuiControlClickableSlider(minValue: 0.1f, maxValue: 10, defaultValue: 2, width: 0.25f, showLabel: true);
            m_planetSizeMultSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_SIZE_MULT);

            parent.AddTableRow(planetSizeMultLabel, m_planetSizeMultSlider);

            m_planetSizeDeviationSlider = new MyGuiControlClickableSlider(minValue: 0f, maxValue: 0.5f, defaultValue: 0f, width: 0.25f, showLabel: true);
            m_planetSizeDeviationSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_SIZE_DEV);

            parent.AddTableRow(planetSizeDeviationLabel, m_planetSizeDeviationSlider);

            m_planetMoonBasePropSlider = new MyGuiControlClickableSlider(minValue: 0f, maxValue: 1f, defaultValue: 0.5f, width: 0.25f, showLabel: true);
            m_planetMoonBasePropSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_MOON_PROP);

            parent.AddTableRow(planetMoonPropLabel, m_planetMoonBasePropSlider);

            m_planetRingBasePropSlider = new MyGuiControlClickableSlider(minValue: 0f, maxValue: 1f, defaultValue: 0.5f, width: 0.25f, showLabel: true);
            m_planetRingBasePropSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_RING_PROP);

            parent.AddTableRow(planetRingPropLabel, m_planetRingBasePropSlider);

            m_planetMoonMinMaxSlider = new MyGuiControlRangedSlider(1, 50, 1, 25, true, showLabel: true, width: 0.25f);
            m_planetMoonMinMaxSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_MOON_COUNT);

            parent.AddTableRow(planetMoonCountLabel, m_planetMoonMinMaxSlider);

            m_planetGPSModeCombo = new MyGuiControlCombobox();
            m_planetGPSModeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_GPS_COMBO);
            m_planetGPSModeCombo.AddItem((long)MyGPSGenerationMode.DISCOVERY, "Discovery");
            m_planetGPSModeCombo.AddItem((long)MyGPSGenerationMode.PERSISTENT, "Persistent");
            m_planetGPSModeCombo.AddItem((long)MyGPSGenerationMode.PERSISTENT_HIDDEN, "Persistent hidden");
            m_planetGPSModeCombo.AddItem((long)MyGPSGenerationMode.NONE, "None");

            m_planetGPSModeCombo.Size = new Vector2(0.25f, m_planetGPSModeCombo.Size.Y);

            parent.AddTableRow(planetGpsModeLabel, m_planetGPSModeCombo);

            m_moonGPSModeCombo = new MyGuiControlCombobox();
            m_moonGPSModeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.MOON_GPS_COMBO);
            m_moonGPSModeCombo.AddItem((long)MyGPSGenerationMode.DISCOVERY, "Discovery");
            m_moonGPSModeCombo.AddItem((long)MyGPSGenerationMode.PERSISTENT, "Persistent");
            m_moonGPSModeCombo.AddItem((long)MyGPSGenerationMode.PERSISTENT_HIDDEN, "Persistent hidden");
            m_moonGPSModeCombo.AddItem((long)MyGPSGenerationMode.NONE, "None");

            m_moonGPSModeCombo.Size = new Vector2(0.25f, m_moonGPSModeCombo.Size.Y);

            parent.AddTableRow(moonGpsModeLabel, m_moonGPSModeCombo);

            m_asteroidGPSModeCombo = new MyGuiControlCombobox();
            m_asteroidGPSModeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ASTEROID_GPS_COMBO);
            m_asteroidGPSModeCombo.AddItem((long)MyGPSGenerationMode.DISCOVERY, "Discovery");
            m_asteroidGPSModeCombo.AddItem((long)MyGPSGenerationMode.PERSISTENT, "Persistent");
            m_asteroidGPSModeCombo.AddItem((long)MyGPSGenerationMode.PERSISTENT_HIDDEN, "Persistent hidden");
            m_asteroidGPSModeCombo.AddItem((long)MyGPSGenerationMode.NONE, "None");

            m_asteroidGPSModeCombo.Size = new Vector2(0.25f, m_asteroidGPSModeCombo.Size.Y);

            parent.AddTableRow(asteroidGpsModeLabel, m_asteroidGPSModeCombo);

            parent.ApplyRows();

            Vector2 start = SIZE / -2 + PADDING + new Vector2(0, caption.Size.Y) + CHILD_MARGINS_VERT * 2;
            Vector2 end   = new Vector2(SIZE.X / 2 - PADDING.X, SIZE.Y / 2 - PADDING.Y - OkButton.Size.Y) - CHILD_MARGINS_VERT * 2;

            MyGuiControlScrollablePanel scrollPane = new MyGuiControlScrollablePanel(parent);

            scrollPane.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            scrollPane.ScrollbarVEnabled = true;
            scrollPane.Size     = end - start;
            scrollPane.Position = start;

            Controls.Add(scrollPane);
        }
        protected virtual void BuildControls()
        {
            Vector2 buttonSize    = MyGuiConstants.BACK_BUTTON_SIZE;
            Vector2 buttonsOrigin = m_size.Value / 2 - new Vector2(0.23f, 0.03f);

            if (m_isNewGame)
            {
                AddCaption(MySpaceTexts.ScreenCaptionCustomWorld);
            }
            else
            {
                AddCaption(MySpaceTexts.ScreenCaptionEditSettings);
            }

            int numControls = 0;

            var nameLabel        = MakeLabel(MySpaceTexts.Name);
            var descriptionLabel = MakeLabel(MySpaceTexts.Description);
            var gameModeLabel    = MakeLabel(MySpaceTexts.WorldSettings_GameMode);
            var onlineModeLabel  = MakeLabel(MySpaceTexts.WorldSettings_OnlineMode);

            m_maxPlayersLabel = MakeLabel(MySpaceTexts.MaxPlayers);
            var environmentLabel = MakeLabel(MySpaceTexts.WorldSettings_EnvironmentHostility);
            var scenarioLabel    = MakeLabel(MySpaceTexts.WorldSettings_Scenario);

            float width = 0.284375f + 0.025f;

            m_nameTextbox        = new MyGuiControlTextbox(maxLength: MySession.MAX_NAME_LENGTH);
            m_descriptionTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_DESCRIPTION_LENGTH);
            m_onlineMode         = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
            m_environment        = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
            m_maxPlayersSlider   = new MyGuiControlSlider(
                position: Vector2.Zero,
                width: m_onlineMode.Size.X,
                minValue: 2,
                maxValue: 16,
                labelText: new StringBuilder("{0}").ToString(),
                labelDecimalPlaces: 0,
                labelSpaceWidth: 0.05f,
                intValue: true
                );



            m_asteroidAmountLabel = MakeLabel(MySpaceTexts.Asteroid_Amount);
            m_asteroidAmountCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));

            m_asteroidAmountCombo.ItemSelected += m_asteroidAmountCombo_ItemSelected;

            m_scenarioTypesList = new MyGuiControlList();

            // Ok/Cancel
            m_okButton     = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.Ok), onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);

            m_creativeModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative), onButtonClick: OnCreativeClick);
            m_creativeModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeCreative);
            m_survivalModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival), onButtonClick: OnSurvivalClick);
            m_survivalModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeSurvival);

            m_onlineMode.ItemSelected += OnOnlineModeSelect;
            m_onlineMode.AddItem((int)MyOnlineModeEnum.OFFLINE, MySpaceTexts.WorldSettings_OnlineModeOffline);
            m_onlineMode.AddItem((int)MyOnlineModeEnum.PRIVATE, MySpaceTexts.WorldSettings_OnlineModePrivate);
            m_onlineMode.AddItem((int)MyOnlineModeEnum.FRIENDS, MySpaceTexts.WorldSettings_OnlineModeFriends);
            m_onlineMode.AddItem((int)MyOnlineModeEnum.PUBLIC, MySpaceTexts.WorldSettings_OnlineModePublic);

            m_environment.AddItem((int)MyEnvironmentHostilityEnum.SAFE, MySpaceTexts.WorldSettings_EnvironmentHostilitySafe);
            m_environment.AddItem((int)MyEnvironmentHostilityEnum.NORMAL, MySpaceTexts.WorldSettings_EnvironmentHostilityNormal);
            m_environment.AddItem((int)MyEnvironmentHostilityEnum.CATACLYSM, MySpaceTexts.WorldSettings_EnvironmentHostilityCataclysm);
            m_environment.AddItem((int)MyEnvironmentHostilityEnum.CATACLYSM_UNREAL, MySpaceTexts.WorldSettings_EnvironmentHostilityCataclysmUnreal);

            if (m_isNewGame)
            {
                m_scenarioTypesGroup = new MyGuiControlRadioButtonGroup();
                m_scenarioTypesGroup.SelectedChanged += scenario_SelectedChanged;
                foreach (var scenario in MyDefinitionManager.Static.GetScenarioDefinitions())
                {
                    if (!scenario.Public && !MyFakes.ENABLE_NON_PUBLIC_BLOCKS)
                    {
                        continue;
                    }

                    var button = new MyGuiControlScenarioButton(scenario);
                    m_scenarioTypesGroup.Add(button);
                    m_scenarioTypesList.Controls.Add(button);
                }
            }

            m_nameTextbox.SetToolTip(string.Format(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsName), MySession.MIN_NAME_LENGTH, MySession.MAX_NAME_LENGTH));
            m_descriptionTextbox.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsDescription));
            m_environment.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsEnvironment));
            m_onlineMode.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsOnlineMode));
            m_maxPlayersSlider.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsMaxPlayer));
            m_asteroidAmountCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsAsteroidAmount));

            m_nameTextbox.TextChanged += m_nameTextbox_TextChanged;

            var advanced = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Advanced), onButtonClick: OnAdvancedClick);

            var mods = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Mods), onButtonClick: OnModsClick);

            m_worldGeneratorButton = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_WorldGenerator), onButtonClick: OnWorldGeneratorClick);

            // Add controls in pairs; label first, control second. They will be laid out automatically this way.
            Controls.Add(nameLabel);
            Controls.Add(m_nameTextbox);
            Controls.Add(descriptionLabel);
            Controls.Add(m_descriptionTextbox);

            Controls.Add(gameModeLabel);
            Controls.Add(m_creativeModeButton);

            Controls.Add(onlineModeLabel);
            Controls.Add(m_onlineMode);
            Controls.Add(m_maxPlayersLabel);
            Controls.Add(m_maxPlayersSlider);

            if (MyFakes.ENABLE_METEOR_SHOWERS)
            {
                Controls.Add(environmentLabel);
                Controls.Add(m_environment);
            }

            if (m_isNewGame && MyFakes.ENABLE_PLANETS == false)
            {
                Controls.Add(m_asteroidAmountLabel);
                Controls.Add(m_asteroidAmountCombo);
            }

            var autoSaveLabel = MakeLabel(MySpaceTexts.WorldSettings_AutoSave);

            m_autoSave = new MyGuiControlCheckbox();
            m_autoSave.SetToolTip(new StringBuilder().AppendFormat(MySpaceTexts.ToolTipWorldSettingsAutoSave, MyObjectBuilder_SessionSettings.DEFAULT_AUTOSAVE_IN_MINUTES).ToString());
            Controls.Add(autoSaveLabel);
            Controls.Add(m_autoSave);

            var scenarioEditModeLabel = MakeLabel(MySpaceTexts.WorldSettings_ScenarioEditMode);

            m_scenarioEditMode = new MyGuiControlCheckbox();
            m_scenarioEditMode.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettings_ScenarioEditMode));

            Controls.Add(scenarioEditModeLabel);
            Controls.Add(m_scenarioEditMode);

            if (MyFakes.ENABLE_WORKSHOP_MODS)
            {
                Controls.Add(mods);
            }

            Controls.Add(advanced);

            if (m_isNewGame && MyFakes.ENABLE_PLANETS == true)
            {
                Controls.Add(m_worldGeneratorButton);
            }

            float labelSize = 0.20f;

            float MARGIN_TOP    = 0.12f;
            float MARGIN_BOTTOM = 0.12f;
            float MARGIN_LEFT   = m_isNewGame ? 0.315f : 0.08f;
            float MARGIN_RIGHT  = m_isNewGame ? 0.075f : 0.045f;

            // Automatic layout.
            Vector2 originL, originC;
            Vector2 controlsDelta = new Vector2(0f, 0.052f);
            float   rightColumnOffset;

            originL           = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP);
            originC           = originL + new Vector2(labelSize, 0f);
            rightColumnOffset = originC.X + m_onlineMode.Size.X - labelSize - 0.017f;

            foreach (var control in Controls)
            {
                control.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
                if (control is MyGuiControlLabel)
                {
                    control.Position = originL + controlsDelta * numControls;
                }
                else
                {
                    control.Position = originC + controlsDelta * numControls++;
                }
            }

            Controls.Add(m_survivalModeButton);
            m_survivalModeButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_survivalModeButton.Position    = m_creativeModeButton.Position + new Vector2(m_onlineMode.Size.X, 0);

            if (m_isNewGame)
            {
                Vector2 scenarioPosition = new Vector2(-0.375f, nameLabel.Position.Y);

                m_nameTextbox.Size        = m_onlineMode.Size;
                m_descriptionTextbox.Size = m_nameTextbox.Size;

                scenarioLabel.Position = scenarioPosition;

                m_scenarioTypesList.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                m_scenarioTypesList.Position    = scenarioLabel.Position + new Vector2(0, 0.02f);
                m_scenarioTypesList.Size        = new Vector2(0.19f, m_size.Value.Y - MARGIN_BOTTOM - MARGIN_TOP);
                Controls.Add(scenarioLabel);
                Controls.Add(m_scenarioTypesList);

                MyGuiControlSeparatorList m_verticalLine = new MyGuiControlSeparatorList();
                Vector2 position = nameLabel.Position + new Vector2(-0.025f, -0.02f);
                m_verticalLine.AddVertical(position, m_size.Value.Y - MARGIN_BOTTOM - MARGIN_TOP + 0.04f);
                Controls.Add(m_verticalLine);
            }

            var pos2 = advanced.Position;

            //pos2.X = m_isNewGame ? 0.160f : 0.0f;
            pos2.X = Size.HasValue ? Size.Value.X / 2.0f - advanced.Size.X - MARGIN_RIGHT : 0.0f;
            advanced.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            advanced.Position    = pos2;

            mods.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            mods.Position    = advanced.Position - new Vector2(advanced.Size.X + 0.017f, 0);

            m_worldGeneratorButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            m_worldGeneratorButton.Position    = advanced.Position - new Vector2(advanced.Size.X + 0.017f, -0.06f);

            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);

            CloseButtonEnabled = true;
        }
        public override void RecreateControls(bool constructor)
        {
            float width = 0.284375f + 0.025f;

            base.RecreateControls(constructor);

            AddCaption(MySpaceTexts.ScreenCaptionWorldGeneratorSettings);

            m_moonMinSizeSlider = new MyGuiControlSlider(
                position: Vector2.Zero,
                width: width,
                minValue: MyProceduralPlanetCellGenerator.MOON_SIZE_MIN_LIMIT,
                maxValue: MyProceduralPlanetCellGenerator.MOON_SIZE_MAX_LIMIT,
                labelText: new StringBuilder("{0} m").ToString(),
                labelDecimalPlaces: 0,
                labelSpaceWidth: 0.09f,
                intValue: true
                );

            m_moonMinSizeSlider.ValueChanged += (x) =>
            {
                if (x.Value > m_moonMaxSizeSlider.Value)
                {
                    m_moonMaxSizeSlider.Value = x.Value;
                }
            };

            m_moonMaxSizeSlider = new MyGuiControlSlider(
                position: Vector2.Zero,
                width: width,
                minValue: MyProceduralPlanetCellGenerator.MOON_SIZE_MIN_LIMIT,
                maxValue: MyProceduralPlanetCellGenerator.MOON_SIZE_MAX_LIMIT,
                labelText: new StringBuilder("{0} m").ToString(),
                labelDecimalPlaces: 0,
                labelSpaceWidth: 0.09f,
                intValue: true
                );

            m_moonMaxSizeSlider.ValueChanged += (x) =>
            {
                if (x.Value < m_moonMinSizeSlider.Value)
                {
                    m_moonMinSizeSlider.Value = x.Value;
                }
            };

            m_planetMinSizeSlider = new MyGuiControlSlider(
                position: Vector2.Zero,
                width: width,
                minValue: MyProceduralPlanetCellGenerator.PLANET_SIZE_MIN_LIMIT,
                maxValue: MyProceduralPlanetCellGenerator.PLANET_SIZE_MAX_LIMIT,
                labelText: new StringBuilder("{0} m").ToString(),
                labelDecimalPlaces: 0,
                labelSpaceWidth: 0.09f,
                intValue: true
                );

            m_planetMinSizeSlider.ValueChanged += (x) =>
            {
                if (x.Value > m_planetMaxSizeSlider.Value)
                {
                    m_planetMaxSizeSlider.Value = x.Value;
                }
            };

            m_planetMaxSizeSlider = new MyGuiControlSlider(
                position: Vector2.Zero,
                width: width,
                minValue: MyProceduralPlanetCellGenerator.PLANET_SIZE_MIN_LIMIT,
                maxValue: MyProceduralPlanetCellGenerator.PLANET_SIZE_MAX_LIMIT,
                labelText: new StringBuilder("{0} m").ToString(),
                labelDecimalPlaces: 0,
                labelSpaceWidth: 0.09f,
                intValue: true
                );

            m_planetMaxSizeSlider.ValueChanged += (x) =>
            {
                if (x.Value < m_planetMinSizeSlider.Value)
                {
                    m_planetMinSizeSlider.Value = x.Value;
                }
            };

            m_asteroidAmountLabel = MakeLabel(MySpaceTexts.Asteroid_Amount);
            m_asteroidAmountCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));

            m_asteroidAmountCombo.ItemSelected += m_asteroidAmountCombo_ItemSelected;

            m_asteroidAmountCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsAsteroidAmount));

            m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.Normal, MySpaceTexts.WorldSettings_AsteroidAmountNormal);
            m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.More, MySpaceTexts.WorldSettings_AsteroidAmountLarge);
            if (Environment.Is64BitProcess)
            {
                m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.Many, MySpaceTexts.WorldSettings_AsteroidAmountExtreme);
            }

            if (MyFakes.ENABLE_ASTEROID_FIELDS)
            {
                m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.ProceduralLow, MySpaceTexts.WorldSettings_AsteroidAmountProceduralLow);
                m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.ProceduralNormal, MySpaceTexts.WorldSettings_AsteroidAmountProceduralNormal);
                if (Environment.Is64BitProcess)
                {
                    m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.ProceduralHigh, MySpaceTexts.WorldSettings_AsteroidAmountProceduralHigh);
                }
            }


            Controls.Add(m_asteroidAmountLabel);
            Controls.Add(m_asteroidAmountCombo);


            m_floraDensityLabel = MakeLabel(MySpaceTexts.WorldSettings_FloraDensity);
            m_floraDensityCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));

            m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.NONE, MySpaceTexts.WorldSettings_FloraDensity_None);
            m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.LOW, MySpaceTexts.WorldSettings_FloraDensity_Low);
            m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.MEDIUM, MySpaceTexts.WorldSettings_FloraDensity_Medium);
            m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.HIGH, MySpaceTexts.WorldSettings_FloraDensity_High);
            m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.EXTREME, MySpaceTexts.WorldSettings_FloraDensity_Extreme);

            m_floraDensityCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettings_FloraDensity));
            Controls.Add(m_floraDensityLabel);
            Controls.Add(m_floraDensityCombo);

            m_moonSizeMinLabel = MakeLabel(MySpaceTexts.WorldSettings_MoonSizeMin);
            Controls.Add(m_moonSizeMinLabel);
            Controls.Add(m_moonMinSizeSlider);

            m_moonSizeMaxLabel = MakeLabel(MySpaceTexts.WorldSettings_MoonSizeMax);
            Controls.Add(m_moonSizeMaxLabel);
            Controls.Add(m_moonMaxSizeSlider);

            m_planetSizeMinLabel = MakeLabel(MySpaceTexts.WorldSettings_PlanetSizeMin);
            Controls.Add(m_planetSizeMinLabel);
            Controls.Add(m_planetMinSizeSlider);

            m_planetSizeMaxLabel = MakeLabel(MySpaceTexts.WorldSettings_PlanetSizeMax);
            Controls.Add(m_planetSizeMaxLabel);
            Controls.Add(m_planetMaxSizeSlider);


            var enablePlanetsLabel = MakeLabel(MySpaceTexts.WorldSettings_EnablePlanets);

            m_enablePlanets = new MyGuiControlCheckbox();
            m_enablePlanets.SetToolTip(MySpaceTexts.ToolTipWorldSettings_EnablePlanets);
            m_enablePlanets.IsCheckedChanged += enablePlanets_IsCheckedChanged;
            Controls.Add(enablePlanetsLabel);
            Controls.Add(m_enablePlanets);

            int     numControls = 0;
            float   MARGIN_TOP = 0.22f;
            float   MARGIN_LEFT = 0.055f;
            float   labelSize = 0.25f;
            Vector2 originL, originC;
            Vector2 controlsDelta = new Vector2(0f, 0.052f);
            float   rightColumnOffset;

            originL           = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP);
            originC           = originL + new Vector2(labelSize, 0f);
            rightColumnOffset = originC.X + width - labelSize - 0.017f;

            foreach (var control in Controls)
            {
                control.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
                if (control is MyGuiControlLabel)
                {
                    control.Position = originL + controlsDelta * numControls;
                }
                else
                {
                    control.Position = originC + controlsDelta * numControls++;
                }
            }


            Vector2 buttonsOrigin = m_size.Value / 2 - new Vector2(0.23f, 0.03f);

            m_okButton     = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.01f, 0f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.Ok), onButtonClick: OkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.01f, 0f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.Cancel), onButtonClick: CancelButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);

            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);
        }
Ejemplo n.º 4
0
        protected virtual void BuildControls()
        {
            if (m_isNewGame)
            {
                //AddCaption(MyCommonTexts.ScreenCaptionCustomWorld);
            }
            else
            {
                AddCaption(MyCommonTexts.ScreenCaptionEditSettings);
            }

            int numControls = 0;


            float MARGIN_TOP            = m_isNewGame ? 0.18f : 0.1f;
            float MARGIN_BOTTOM         = 0.11f;
            float MARGIN_LEFT           = m_isNewGame ? 0.23f : 0.03f;
            float MARGIN_RIGHT          = m_isNewGame ? 0.03f : 0.03f;
            float MARGIN_BOTTOM_LISTBOX = 0.015f;

            // Automatic layout.
            Vector2 originL, originC, sizeL, sizeC, sizeControls;
            Vector2 controlsDelta = new Vector2(0f, 0.052f);
            float   rightColumnOffset;

            originL         = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP) + controlsDelta / 2;
            sizeControls    = m_size.Value / 2 - originL;
            sizeControls.X -= MARGIN_RIGHT + 0.005f;
            sizeControls.Y -= MARGIN_BOTTOM;
            sizeL           = sizeControls * (m_isNewGame ? 0.44f : 0.395f);

            originC = originL + new Vector2(sizeL.X, 0f);
            sizeC   = sizeControls - sizeL;
            //rightColumnOffset = originC.X + m_onlineMode.Size.X - labelSize - 0.017f;

            // Button positioning
            Vector2 buttonSize    = MyGuiConstants.BACK_BUTTON_SIZE;
            Vector2 buttonsOrigin = m_size.Value / 2;

            buttonsOrigin.X -= MARGIN_RIGHT;
            buttonsOrigin.Y -= 0.03f;

            var nameLabel        = MakeLabel(MyCommonTexts.Name);
            var descriptionLabel = MakeLabel(MyCommonTexts.Description);
            var gameModeLabel    = MakeLabel(MyCommonTexts.WorldSettings_GameMode);
            var onlineModeLabel  = MakeLabel(MyCommonTexts.WorldSettings_OnlineMode);

            m_maxPlayersLabel = MakeLabel(MyCommonTexts.MaxPlayers);
            var environmentLabel = MakeLabel(MySpaceTexts.WorldSettings_EnvironmentHostility);
            var soundModeLabel   = MakeLabel(MySpaceTexts.WorldSettings_SoundMode);

            float width = 0.284375f + 0.025f;

            m_nameTextbox        = new MyGuiControlTextbox(maxLength: MySession.MAX_NAME_LENGTH);
            m_descriptionTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_DESCRIPTION_LENGTH);
            m_onlineMode         = new MyGuiControlCombobox(size: new Vector2(sizeC.X, 0.04f));
            m_environment        = new MyGuiControlCombobox(size: new Vector2(sizeC.X, 0.04f));
            m_maxPlayersSlider   = new MyGuiControlSlider(
                position: Vector2.Zero,
                width: m_onlineMode.Size.X,
                minValue: 2,
                maxValue: 16,
                labelText: new StringBuilder("{0}").ToString(),
                labelDecimalPlaces: 0,
                labelSpaceWidth: 0.05f,
                intValue: true
                );



            m_asteroidAmountLabel = MakeLabel(MySpaceTexts.Asteroid_Amount);
            m_asteroidAmountCombo = new MyGuiControlCombobox(size: new Vector2(sizeC.X, 0.04f));

            m_asteroidAmountCombo.ItemSelected += m_asteroidAmountCombo_ItemSelected;
            m_soundModeCombo = new MyGuiControlCombobox(size: new Vector2(sizeC.X, 0.04f));

            m_scenarioTypesList = new MyGuiControlList();

            // Ok/Cancel
            m_cancelButton   = new MyGuiControlButton(position: buttonsOrigin, size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            buttonsOrigin.X -= m_cancelButton.Size.X + MyGuiConstants.GENERIC_BUTTON_SPACING.X;
            m_okButton       = new MyGuiControlButton(position: buttonsOrigin, size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);

            m_creativeModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MyCommonTexts.WorldSettings_GameModeCreative), onButtonClick: OnCreativeClick);
            m_creativeModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeCreative);
            m_survivalModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MyCommonTexts.WorldSettings_GameModeSurvival), onButtonClick: OnSurvivalClick);
            m_survivalModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeSurvival);

            m_onlineMode.ItemSelected += OnOnlineModeSelect;
            m_onlineMode.AddItem((int)MyOnlineModeEnum.OFFLINE, MyCommonTexts.WorldSettings_OnlineModeOffline);
            m_onlineMode.AddItem((int)MyOnlineModeEnum.PRIVATE, MyCommonTexts.WorldSettings_OnlineModePrivate);
            m_onlineMode.AddItem((int)MyOnlineModeEnum.FRIENDS, MyCommonTexts.WorldSettings_OnlineModeFriends);
            m_onlineMode.AddItem((int)MyOnlineModeEnum.PUBLIC, MyCommonTexts.WorldSettings_OnlineModePublic);

            m_environment.AddItem((int)MyEnvironmentHostilityEnum.SAFE, MySpaceTexts.WorldSettings_EnvironmentHostilitySafe);
            m_environment.AddItem((int)MyEnvironmentHostilityEnum.NORMAL, MySpaceTexts.WorldSettings_EnvironmentHostilityNormal);
            m_environment.AddItem((int)MyEnvironmentHostilityEnum.CATACLYSM, MySpaceTexts.WorldSettings_EnvironmentHostilityCataclysm);
            m_environment.AddItem((int)MyEnvironmentHostilityEnum.CATACLYSM_UNREAL, MySpaceTexts.WorldSettings_EnvironmentHostilityCataclysmUnreal);
            m_environment.ItemSelected += HostilityChanged;

            m_soundModeCombo.AddItem((int)MySoundModeEnum.Arcade, MySpaceTexts.WorldSettings_ArcadeSound);
            m_soundModeCombo.AddItem((int)MySoundModeEnum.Realistic, MySpaceTexts.WorldSettings_RealisticSound);

            if (m_isNewGame)
            {
                if (MyDefinitionManager.Static.GetScenarioDefinitions().Count == 0)
                {
                    MyDefinitionManager.Static.LoadScenarios();
                }

                m_scenarioTypesGroup = new MyGuiControlRadioButtonGroup();
                m_scenarioTypesGroup.SelectedChanged += scenario_SelectedChanged;

                RefreshCustomWorldsList();
            }

            m_nameTextbox.SetToolTip(string.Format(MyTexts.GetString(MyCommonTexts.ToolTipWorldSettingsName), MySession.MIN_NAME_LENGTH, MySession.MAX_NAME_LENGTH));
            m_descriptionTextbox.SetToolTip(MyTexts.GetString(MyCommonTexts.ToolTipWorldSettingsDescription));
            m_environment.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsEnvironment));
            m_onlineMode.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsOnlineMode));
            m_maxPlayersSlider.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsMaxPlayer));
            m_asteroidAmountCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsAsteroidAmount));
            m_soundModeCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsSoundMode));

            m_nameTextbox.TextChanged     += m_nameTextbox_TextChanged;
            m_soundModeCombo.ItemSelected += m_soundModeCombo_ItemSelected;

            var advanced = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Advanced), onButtonClick: OnAdvancedClick);

#if !XB1 // XB1_NOWORKSHOP
            var mods = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MyCommonTexts.WorldSettings_Mods), onButtonClick: OnModsClick);
#endif // !XB1

            m_worldGeneratorButton = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_WorldGenerator), onButtonClick: OnWorldGeneratorClick);

            // Add controls in pairs; label first, control second. They will be laid out automatically this way.
            Controls.Add(nameLabel);
            Controls.Add(m_nameTextbox);
            Controls.Add(descriptionLabel);
            Controls.Add(m_descriptionTextbox);

            Controls.Add(gameModeLabel);
            Controls.Add(m_creativeModeButton);

            if (MyFakes.ENABLE_NEW_SOUNDS)
            {
                Controls.Add(soundModeLabel);
                Controls.Add(m_soundModeCombo);
            }

            Controls.Add(onlineModeLabel);
            Controls.Add(m_onlineMode);
            Controls.Add(m_maxPlayersLabel);
            Controls.Add(m_maxPlayersSlider);

            if (MyFakes.ENABLE_METEOR_SHOWERS)
            {
                Controls.Add(environmentLabel);
                Controls.Add(m_environment);
            }

            if (m_isNewGame && MyFakes.ENABLE_PLANETS == false)
            {
                Controls.Add(m_asteroidAmountLabel);
                Controls.Add(m_asteroidAmountCombo);
            }

            var blockLimitsLabel = MakeLabel(MyCommonTexts.WorldSettings_BlockLimits);
            m_blockLimits = new MyGuiControlCheckbox();
            m_blockLimits.IsCheckedChanged = blockLimits_CheckedChanged;
            m_blockLimits.SetToolTip(MyTexts.GetString(MyCommonTexts.ToolTipWorldSettingsBlockLimits));
            Controls.Add(blockLimitsLabel);
            Controls.Add(m_blockLimits);

            var autoSaveLabel = MakeLabel(MyCommonTexts.WorldSettings_AutoSave);
            m_autoSave = new MyGuiControlCheckbox();
            m_autoSave.SetToolTip(new StringBuilder().AppendFormat(MyCommonTexts.ToolTipWorldSettingsAutoSave, MyObjectBuilder_SessionSettings.DEFAULT_AUTOSAVE_IN_MINUTES).ToString());
            Controls.Add(autoSaveLabel);
            Controls.Add(m_autoSave);

#if !XB1 // XB1_NOWORKSHOP
            if (!MyFakes.XB1_PREVIEW)
            {
                if (MyFakes.ENABLE_WORKSHOP_MODS)
                {
                    Controls.Add(mods);
                }
            }
#endif // !XB1

            Controls.Add(advanced);

            // Uncomment to show the World generator button again
            if (m_isNewGame && MyFakes.ENABLE_PLANETS == true)
            {
                Controls.Add(m_worldGeneratorButton);
            }

            foreach (var control in Controls)
            {
                control.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
                if (control is MyGuiControlLabel)
                {
                    control.Position = originL + controlsDelta * numControls;
                }
                else
                {
                    control.Position = originC + controlsDelta * numControls++;
                }
            }

            Controls.Add(m_survivalModeButton);
            m_survivalModeButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_survivalModeButton.Position    = m_creativeModeButton.Position + new Vector2(m_onlineMode.Size.X, 0);

            m_nameTextbox.Size        = m_onlineMode.Size;
            m_descriptionTextbox.Size = m_nameTextbox.Size;

            if (m_isNewGame)
            {
                Vector2 scenarioPosition = -m_size.Value / 2 + new Vector2(0.015f, MARGIN_TOP);

                m_scenarioTypesList.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                m_scenarioTypesList.Position    = scenarioPosition;
                m_scenarioTypesList.Size        = new Vector2(MyGuiConstants.LISTBOX_WIDTH, m_size.Value.Y - 0.02f - MARGIN_TOP);
                Controls.Add(m_scenarioTypesList);

                //MyGuiControlSeparatorList m_verticalLine = new MyGuiControlSeparatorList();
                //Vector2 position = nameLabel.Position + new Vector2(-0.025f, -0.02f);
                //m_verticalLine.AddVertical(position, m_size.Value.Y - MARGIN_BOTTOM - MARGIN_TOP + 0.04f);
                //Controls.Add(m_verticalLine);
            }

            var pos2 = advanced.Position;
            //pos2.X = m_isNewGame ? 0.160f : 0.0f;
            pos2.X = Size.HasValue ? Size.Value.X / 2.0f - advanced.Size.X - MARGIN_RIGHT : 0.0f;
            advanced.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            advanced.Position    = pos2;

#if !XB1 // XB1_NOWORKSHOP
            mods.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            mods.Position    = advanced.Position - new Vector2(advanced.Size.X + MyGuiConstants.GENERIC_BUTTON_SPACING.X, 0);
#endif // !XB1

            m_worldGeneratorButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            m_worldGeneratorButton.Position    = advanced.Position - new Vector2(advanced.Size.X + MyGuiConstants.GENERIC_BUTTON_SPACING.X, -0.06f);

            if (MyFakes.XB1_PREVIEW)
            {
                var pos2p = m_worldGeneratorButton.Position;
                pos2p.X = Size.HasValue ? Size.Value.X / 2.0f - m_worldGeneratorButton.Size.X - MARGIN_RIGHT : 0.0f;
                m_worldGeneratorButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                m_worldGeneratorButton.Position    = pos2p;

                advanced.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                if (m_isNewGame)
                {
                    advanced.Position = m_worldGeneratorButton.Position - new Vector2(m_worldGeneratorButton.Size.X + 0.017f, 0);
                }
                else
                {
                    advanced.Position = m_worldGeneratorButton.Position - new Vector2(m_worldGeneratorButton.Size.X + 0.017f, 0.008f);
                }
            }

            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);

            CloseButtonEnabled = true;
        }
Ejemplo n.º 5
0
        public void BuildControls()
        {
            Vector2 vector = new Vector2(50f) / MyGuiConstants.GUI_OPTIMAL_SIZE;
            float   x2     = 0.209375018f;
            int     mod    = m_isNewGame ? 6 : 0;

            AddCaption("SEWorldGenPlugin Settings", null, new Vector2(0f, 0.003f));

            MyGuiControlParent parent = new MyGuiControlParent(null, new Vector2(base.Size.Value.X - vector.X * 2f, 0.052f * (15 + mod)));

            parent.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;

            MyGuiControlSeparatorList myGuiControlSeparatorList = new MyGuiControlSeparatorList();

            myGuiControlSeparatorList.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.835f / 2f, m_size.Value.Y / 2f - 0.075f), m_size.Value.X * 0.835f);
            Controls.Add(myGuiControlSeparatorList);
            MyGuiControlSeparatorList myGuiControlSeparatorList2 = new MyGuiControlSeparatorList();

            myGuiControlSeparatorList2.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.835f / 2f, (0f - m_size.Value.Y) / 2f + 0.123f), m_size.Value.X * 0.835f);
            Controls.Add(myGuiControlSeparatorList2);

            m_useGlobalSettignsLabel       = MakeLabel("Use global Config");
            m_useSemiRandomGenerationLabel = MakeLabel("Use all planets");
            m_useVanillaPlanetsLabel       = MakeLabel("Use vanilla planets");
            m_planetsOnlyOnceLabel         = MakeLabel("Generate Planets Once");
            m_moonsOnlyOnceLabel           = MakeLabel("Generate Moons Once");
            m_planetGpsLabel         = MakeLabel("Create GPS for Planets");
            m_moonGpsLabel           = MakeLabel("Create GPS for Moons");
            m_beltGpsLabel           = MakeLabel("Create GPS for Belts");
            m_ringGpsLabel           = MakeLabel("Create GPS for Rings");
            m_asteroidGeneratorLabel = MakeLabel("Asteroid generator");
            m_asteroidDensityLabel   = MakeLabel("Asteroid density");
            m_objAmountLabel         = MakeLabel("Objects in System");
            m_orbDistanceLabel       = MakeLabel("Average Orbit distance");
            m_sizeMultiplierLabel    = MakeLabel("Planet size multiplier");
            m_sizeCapLabel           = MakeLabel("Planet size cap");
            m_moonProbLabel          = MakeLabel("Moon spawn probability");
            m_ringWidthLabel         = MakeLabel("Average ring width");
            m_ringProbLabel          = MakeLabel("Ring spawn probability");
            m_beltHeightLabel        = MakeLabel("Average belt height");
            m_beltProbLabel          = MakeLabel("Belt spawn probability");
            m_worldSizeLabel         = MakeLabel("World Size");

            m_useGlobalCheck = new MyGuiControlCheckbox();
            m_useSemiRandomGenerationCheck = new MyGuiControlCheckbox();
            m_useVanillaPlanetsCheck       = new MyGuiControlCheckbox();
            m_planetsOnlyOnceCheck         = new MyGuiControlCheckbox();
            m_moonsOnlyOnceCheck           = new MyGuiControlCheckbox();
            m_planetGpsCheck         = new MyGuiControlCheckbox();
            m_moonGpsCheck           = new MyGuiControlCheckbox();
            m_beltGpsCheck           = new MyGuiControlCheckbox();
            m_ringGpsCheck           = new MyGuiControlCheckbox();
            m_asteroidGeneratorCombo = new MyGuiControlCombobox(null, new Vector2(x2, 0.04f));
            x2 += 0.05f;
            m_asteroidDensitySlider = new MyGuiControlClickableSlider(Vector2.Zero, 0.1f, 1f, x2, 0.6f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.ROID_DENS_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: false);
            m_objAmountSlider       = new MyGuiControlClickableSlider(Vector2.Zero, 0f, 100f, x2, 15f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.SYS_OBJ_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true);
            m_orbDistanceSlider     = new MyGuiControlClickableSlider(Vector2.Zero, 500f, 100000f, x2, 50500f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.ORB_DIST_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true);
            m_sizeMultiplierSlider  = new MyGuiControlClickableSlider(Vector2.Zero, 1f, 10f, x2, 2f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.SIZE_MUL_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true);
            m_sizeCapSlider         = new MyGuiControlClickableSlider(Vector2.Zero, 120f, 2400f, x2, 1200f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.SIZE_CAP_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true);
            m_moonProbSlider        = new MyGuiControlClickableSlider(Vector2.Zero, 0f, 1f, x2, 0.5f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.MOON_PROB_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: false);
            m_ringWidthSlider       = new MyGuiControlClickableSlider(Vector2.Zero, 10000f, 100000f, x2, 15000f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.RING_WIDTH_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true);
            m_ringProbSlider        = new MyGuiControlClickableSlider(Vector2.Zero, 0f, 1f, x2, 0.5f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.RING_PROB_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: false);
            m_beltHeightSlider      = new MyGuiControlClickableSlider(Vector2.Zero, 4000f, 40000f, x2, 22000f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.BELT_HEIGHT_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true);
            m_beltProbSlider        = new MyGuiControlClickableSlider(Vector2.Zero, 0f, 1f, x2, 0.4f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.BELT_PROB_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: false);
            m_worldSizeSlider       = new MyGuiControlClickableSlider(Vector2.Zero, -1f, 1000000 - 1, x2, -1, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.WORLD_SIZE_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true);

            m_asteroidDensityValue             = MakeLabel(String.Format("{0:0.00}", m_asteroidDensitySlider.Value));
            m_asteroidDensityValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_objAmountValue                  = MakeLabel(m_objAmountSlider.Value.ToString());
            m_objAmountValue.OriginAlign      = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_orbDistanceValue                = MakeLabel(m_orbDistanceSlider.Value.ToString());
            m_orbDistanceValue.OriginAlign    = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_sizeMultiplierValue             = MakeLabel(m_sizeMultiplierSlider.Value.ToString());
            m_sizeMultiplierValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_sizeCapValue                = MakeLabel(m_sizeCapSlider.Value.ToString());
            m_sizeCapValue.OriginAlign    = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_moonProbValue               = MakeLabel(String.Format("{0:0.00}", m_moonProbSlider.Value));
            m_moonProbValue.OriginAlign   = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_ringWidthValue              = MakeLabel(m_ringWidthSlider.Value.ToString());
            m_ringWidthValue.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_ringProbValue               = MakeLabel(m_ringProbSlider.Value.ToString());
            m_ringProbValue.OriginAlign   = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_beltHeightValue             = MakeLabel(m_beltHeightSlider.Value.ToString());
            m_beltHeightValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
            m_beltProbValue               = MakeLabel(String.Format("{0:0.00}", m_beltProbSlider.Value));
            m_beltProbValue.OriginAlign   = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;

            m_useGlobalCheck.SetToolTip(MyPluginTexts.TOOLTIPS.USE_GLOBAL_CHECK);
            m_useGlobalCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_useSemiRandomGenerationCheck.SetToolTip(MyPluginTexts.TOOLTIPS.USE_SEMI_RAND_GEN_CHECK);
            m_useSemiRandomGenerationCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_useVanillaPlanetsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.USE_VANILLA_PLANETS);
            m_useVanillaPlanetsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_planetsOnlyOnceCheck.SetToolTip(MyPluginTexts.TOOLTIPS.PLANETS_ONLY_ONCE);
            m_planetsOnlyOnceCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_moonsOnlyOnceCheck.SetToolTip(MyPluginTexts.TOOLTIPS.MOONS_ONLY_ONCE);
            m_moonsOnlyOnceCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_planetGpsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_GPSL_CHECK);
            m_planetGpsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_moonGpsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.MOON_GPS_CHECK);
            m_moonGpsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_beltGpsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.BELT_GPS_CHECK);
            m_beltGpsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_ringGpsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.RING_GPS_CHECK);
            m_ringGpsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_asteroidGeneratorCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ROID_GEN_COMBO);
            m_asteroidGeneratorCombo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            m_worldSizeValue             = MakeLabel(m_worldSizeSlider.Value.ToString());
            m_worldSizeValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;

            m_asteroidGeneratorCombo.AddItem(0L, "Plugin");
            m_asteroidGeneratorCombo.AddItem(1L, "Vanilla");
            m_asteroidGeneratorCombo.AddItem(2L, "Mixed");
            m_asteroidGeneratorCombo.SelectItemByIndex(0);

            m_asteroidGeneratorCombo.ItemSelected += delegate
            {
                bool val = m_asteroidGeneratorCombo.GetSelectedKey() == 01L;

                m_beltGpsCheck.Enabled          = !val;
                m_ringProbSlider.Enabled        = !val;
                m_ringWidthSlider.Enabled       = !val;
                m_beltHeightSlider.Enabled      = !val;
                m_beltProbSlider.Enabled        = !val;
                m_asteroidDensitySlider.Enabled = !val;
            };

            m_asteroidDensitySlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_asteroidDensitySlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_asteroidDensityValue.Text = String.Format("{0:0.00}", s.Value);
            });
            m_objAmountSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_objAmountSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_objAmountValue.Text = s.Value.ToString();
            });
            m_orbDistanceSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_orbDistanceSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_orbDistanceValue.Text = s.Value.ToString();
            });
            m_sizeMultiplierSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_sizeMultiplierSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_sizeMultiplierValue.Text = s.Value.ToString();
            });
            m_sizeCapSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_sizeCapSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_sizeCapValue.Text = s.Value.ToString();
            });
            m_moonProbSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_moonProbSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_moonProbValue.Text = String.Format("{0:0.00}", s.Value);
            });
            m_ringWidthSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringWidthSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_ringWidthValue.Text = s.Value.ToString();
            });
            m_ringProbSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringProbSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_ringProbValue.Text = String.Format("{0:0.00}", s.Value);
            });
            m_beltHeightSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_beltHeightSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_beltHeightValue.Text = s.Value.ToString();
            });
            m_beltProbSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_beltProbSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                m_beltProbValue.Text = String.Format("{0:0.000}", s.Value);
            });
            m_worldSizeSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_worldSizeSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s)
            {
                if (s.Value <= 0)
                {
                    m_worldSizeValue.Text = "Infinite";
                }
                else
                {
                    m_worldSizeValue.Text = s.Value.ToString();
                }
            });
            m_useGlobalCheck.IsCheckedChanged = (Action <MyGuiControlCheckbox>) Delegate.Combine(m_useGlobalCheck.IsCheckedChanged, (Action <MyGuiControlCheckbox>) delegate(MyGuiControlCheckbox s)
            {
                m_useSemiRandomGenerationCheck.Enabled = !s.IsChecked;
                m_useVanillaPlanetsCheck.Enabled       = !s.IsChecked;
                m_planetsOnlyOnceCheck.Enabled         = !s.IsChecked;
                m_moonsOnlyOnceCheck.Enabled           = !s.IsChecked;
                m_objAmountSlider.Enabled        = !s.IsChecked;
                m_asteroidDensitySlider.Enabled  = !s.IsChecked;
                m_asteroidGeneratorCombo.Enabled = !s.IsChecked;
                m_orbDistanceSlider.Enabled      = !s.IsChecked;
                m_sizeMultiplierSlider.Enabled   = !s.IsChecked;
                m_sizeCapSlider.Enabled          = !s.IsChecked;
                m_moonProbSlider.Enabled         = !s.IsChecked;
                m_ringWidthSlider.Enabled        = !s.IsChecked;
                m_ringProbSlider.Enabled         = !s.IsChecked;
                m_beltHeightSlider.Enabled       = !s.IsChecked;
                m_beltProbSlider.Enabled         = !s.IsChecked;
                m_planetGpsCheck.Enabled         = !s.IsChecked;
                m_moonGpsCheck.Enabled           = !s.IsChecked;
                m_beltGpsCheck.Enabled           = !s.IsChecked;
                m_ringGpsCheck.Enabled           = !s.IsChecked;
                m_worldSizeSlider.Enabled        = !s.IsChecked && m_isNewGame;
            });

            parent.Controls.Add(m_useGlobalSettignsLabel);
            parent.Controls.Add(m_useGlobalCheck);

            if (m_isNewGame)
            {
                parent.Controls.Add(m_useSemiRandomGenerationLabel);
                parent.Controls.Add(m_useSemiRandomGenerationCheck);

                parent.Controls.Add(m_useVanillaPlanetsLabel);
                parent.Controls.Add(m_useVanillaPlanetsCheck);

                parent.Controls.Add(m_planetsOnlyOnceLabel);
                parent.Controls.Add(m_planetsOnlyOnceCheck);

                parent.Controls.Add(m_moonsOnlyOnceLabel);
                parent.Controls.Add(m_moonsOnlyOnceCheck);

                parent.Controls.Add(m_planetGpsLabel);
                parent.Controls.Add(m_planetGpsCheck);

                parent.Controls.Add(m_moonGpsLabel);
                parent.Controls.Add(m_moonGpsCheck);
            }

            parent.Controls.Add(m_beltGpsLabel);
            parent.Controls.Add(m_beltGpsCheck);

            parent.Controls.Add(m_ringGpsLabel);
            parent.Controls.Add(m_ringGpsCheck);

            parent.Controls.Add(m_asteroidGeneratorLabel);
            parent.Controls.Add(m_asteroidGeneratorCombo);

            parent.Controls.Add(m_asteroidDensityLabel);
            parent.Controls.Add(m_asteroidDensitySlider);
            parent.Controls.Add(m_asteroidDensityValue);

            parent.Controls.Add(m_objAmountLabel);
            parent.Controls.Add(m_objAmountSlider);
            parent.Controls.Add(m_objAmountValue);

            parent.Controls.Add(m_orbDistanceLabel);
            parent.Controls.Add(m_orbDistanceSlider);
            parent.Controls.Add(m_orbDistanceValue);

            parent.Controls.Add(m_sizeMultiplierLabel);
            parent.Controls.Add(m_sizeMultiplierSlider);
            parent.Controls.Add(m_sizeMultiplierValue);

            parent.Controls.Add(m_sizeCapLabel);
            parent.Controls.Add(m_sizeCapSlider);
            parent.Controls.Add(m_sizeCapValue);

            parent.Controls.Add(m_moonProbLabel);
            parent.Controls.Add(m_moonProbSlider);
            parent.Controls.Add(m_moonProbValue);

            parent.Controls.Add(m_ringWidthLabel);
            parent.Controls.Add(m_ringWidthSlider);
            parent.Controls.Add(m_ringWidthValue);

            parent.Controls.Add(m_ringProbLabel);
            parent.Controls.Add(m_ringProbSlider);
            parent.Controls.Add(m_ringProbValue);

            parent.Controls.Add(m_beltHeightLabel);
            parent.Controls.Add(m_beltHeightSlider);
            parent.Controls.Add(m_beltHeightValue);

            parent.Controls.Add(m_beltProbLabel);
            parent.Controls.Add(m_beltProbSlider);
            parent.Controls.Add(m_beltProbValue);

            parent.Controls.Add(m_worldSizeLabel);
            parent.Controls.Add(m_worldSizeSlider);
            parent.Controls.Add(m_worldSizeValue);

            //Vector2 start = (new Vector2(0f, (!m_isNewGame) ? 0.052f : 0.026f) - new Vector2(m_size.Value.X * 0.835f / 2f, m_size.Value.Y / 2f - 0.075f)) + (new Vector2(0f, m_useGlobalSettignsLabel.Size.Y));
            Vector2 start   = Vector2.Zero - new Vector2(parent.Size.X / 2f, parent.Size.Y / 2f - 0.028f);
            Vector2 offset  = new Vector2(0f, 0.050f);//0.028f
            Vector2 offset2 = new Vector2(m_orbDistanceLabel.Size.X * 1.5f, 0f);
            Vector2 offset3 = new Vector2(0.4973214f, 0f);
            int     m       = 0;

            m_useGlobalSettignsLabel.Position = start + offset * m++;
            m_useGlobalCheck.Position         = m_useGlobalSettignsLabel.Position + offset2;

            if (m_isNewGame)
            {
                m_useSemiRandomGenerationLabel.Position = start + offset * m++;
                m_useSemiRandomGenerationCheck.Position = m_useSemiRandomGenerationLabel.Position + offset2;

                m_useVanillaPlanetsLabel.Position = start + offset * m++;
                m_useVanillaPlanetsCheck.Position = m_useVanillaPlanetsLabel.Position + offset2;

                m_planetsOnlyOnceLabel.Position = start + offset * m++;
                m_planetsOnlyOnceCheck.Position = m_planetsOnlyOnceLabel.Position + offset2;

                m_moonsOnlyOnceLabel.Position = start + offset * m++;
                m_moonsOnlyOnceCheck.Position = m_moonsOnlyOnceLabel.Position + offset2;

                m_planetGpsLabel.Position = start + offset * m++;
                m_planetGpsCheck.Position = m_planetGpsLabel.Position + offset2;

                m_moonGpsLabel.Position = start + offset * m++;
                m_moonGpsCheck.Position = m_moonGpsLabel.Position + offset2;
            }

            m_beltGpsLabel.Position = start + offset * m++;
            m_beltGpsCheck.Position = m_beltGpsLabel.Position + offset2;

            m_ringGpsLabel.Position = start + offset * m++;
            m_ringGpsCheck.Position = m_ringGpsLabel.Position + offset2;

            m_asteroidGeneratorLabel.Position = start + offset * m++;
            m_asteroidGeneratorCombo.Position = m_asteroidGeneratorLabel.Position + offset2;

            m_asteroidDensityLabel.Position  = start + offset * m++;
            m_asteroidDensitySlider.Position = m_asteroidDensityLabel.Position + offset2;
            m_asteroidDensityValue.Position  = m_asteroidDensityLabel.Position + offset3;

            m_objAmountLabel.Position  = start + offset * m++;
            m_objAmountSlider.Position = m_objAmountLabel.Position + offset2;
            m_objAmountValue.Position  = m_objAmountLabel.Position + offset3;

            m_orbDistanceLabel.Position  = start + offset * m++;
            m_orbDistanceSlider.Position = m_orbDistanceLabel.Position + offset2;
            m_orbDistanceValue.Position  = m_orbDistanceLabel.Position + offset3;

            m_sizeMultiplierLabel.Position  = start + offset * m++;
            m_sizeMultiplierSlider.Position = m_sizeMultiplierLabel.Position + offset2;
            m_sizeMultiplierValue.Position  = m_sizeMultiplierLabel.Position + offset3;

            m_sizeCapLabel.Position  = start + offset * m++;
            m_sizeCapSlider.Position = m_sizeCapLabel.Position + offset2;
            m_sizeCapValue.Position  = m_sizeCapLabel.Position + offset3;

            m_moonProbLabel.Position  = start + offset * m++;
            m_moonProbSlider.Position = m_moonProbLabel.Position + offset2;
            m_moonProbValue.Position  = m_moonProbLabel.Position + offset3;

            m_ringWidthLabel.Position  = start + offset * m++;
            m_ringWidthSlider.Position = m_ringWidthLabel.Position + offset2;
            m_ringWidthValue.Position  = m_ringWidthLabel.Position + offset3;

            m_ringProbLabel.Position  = start + offset * m++;
            m_ringProbSlider.Position = m_ringProbLabel.Position + offset2;
            m_ringProbValue.Position  = m_ringProbLabel.Position + offset3;

            m_beltHeightLabel.Position  = start + offset * m++;
            m_beltHeightSlider.Position = m_beltHeightLabel.Position + offset2;
            m_beltHeightValue.Position  = m_beltHeightLabel.Position + offset3;

            m_beltProbLabel.Position  = start + offset * m++;
            m_beltProbSlider.Position = m_beltProbLabel.Position + offset2;
            m_beltProbValue.Position  = m_beltProbLabel.Position + offset3;

            m_worldSizeLabel.Position  = start + offset * m++;
            m_worldSizeSlider.Position = m_worldSizeLabel.Position + offset2;
            m_worldSizeValue.Position  = m_worldSizeLabel.Position + offset3;

            m_okButton = new MyGuiControlButton(null, VRage.Game.MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, VRage.MyTexts.Get(MyCommonTexts.Ok), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_ACTIVE, OkButtonClicked);
            m_okButton.SetToolTip(VRage.MyTexts.GetString(MySpaceTexts.ToolTipOptionsSpace_Ok));
            m_okButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
            m_okButton.Position    = (m_size.Value / 2f - vector) * new Vector2(0f, 1f) + new Vector2(0f - 25f, 0f) / MyGuiConstants.GUI_OPTIMAL_SIZE;

            MyGuiControlScrollablePanel scrollPane = new MyGuiControlScrollablePanel(parent);

            scrollPane.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            scrollPane.ScrollbarVEnabled = true;
            scrollPane.Size     = new Vector2(base.Size.Value.X - vector.X * 2f - 0.035f, 0.74f);
            scrollPane.Position = new Vector2(-0.27f, -0.394f);

            if (!m_isNewGame)
            {
                m_worldSizeSlider.Enabled = false;
            }

            Controls.Add(m_okButton);
            Controls.Add(scrollPane);
        }
        public override void RecreateControls(bool constructor)
        {
            float width = 0.284375f + 0.025f;

            base.RecreateControls(constructor);

            AddCaption(MySpaceTexts.ScreenCaptionWorldGeneratorSettings);

            m_asteroidAmountCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));

            m_asteroidAmountCombo.ItemSelected += m_asteroidAmountCombo_ItemSelected;

            m_asteroidAmountCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsAsteroidAmount));

            m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.Normal, MySpaceTexts.WorldSettings_AsteroidAmountNormal);
            m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.More, MySpaceTexts.WorldSettings_AsteroidAmountLarge);
            if (Environment.Is64BitProcess)
            {
                m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.Many, MySpaceTexts.WorldSettings_AsteroidAmountExtreme);
            }

            if (MyFakes.ENABLE_ASTEROID_FIELDS)
            {
                m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.ProceduralLow, MySpaceTexts.WorldSettings_AsteroidAmountProceduralLow);
                m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.ProceduralNormal, MySpaceTexts.WorldSettings_AsteroidAmountProceduralNormal);
                if (Environment.Is64BitProcess)
                {
                    m_asteroidAmountCombo.AddItem((int)AsteroidAmountEnum.ProceduralHigh, MySpaceTexts.WorldSettings_AsteroidAmountProceduralHigh);
                }
            }

            m_asteroidAmountLabel = MakeLabel(MySpaceTexts.Asteroid_Amount);
            Controls.Add(m_asteroidAmountLabel);
            Controls.Add(m_asteroidAmountCombo);

            int     numControls = 0;
            float   MARGIN_TOP = 0.12f;
            float   MARGIN_LEFT = 0.055f;
            float   labelSize = 0.25f;
            Vector2 originL, originC;
            Vector2 controlsDelta = new Vector2(0f, 0.052f);
            float   rightColumnOffset;

            originL           = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP);
            originC           = originL + new Vector2(labelSize, 0f);
            rightColumnOffset = originC.X + width - labelSize - 0.017f;

            foreach (var control in Controls)
            {
                control.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
                if (control is MyGuiControlLabel)
                {
                    control.Position = originL + controlsDelta * numControls;
                }
                else
                {
                    control.Position = originC + controlsDelta * numControls++;
                }
            }


            Vector2 buttonsOrigin = m_size.Value / 2 - new Vector2(0.23f, 0.03f);

            m_okButton     = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.01f, 0f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.Ok), onButtonClick: OkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.01f, 0f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.Cancel), onButtonClick: CancelButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);


            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);
        }