示例#1
0
 void m_languageCombobox_ItemSelected()
 {
     m_settings.Language = (MyLanguagesEnum)m_languageCombobox.GetSelectedKey();
     if (m_languageCombobox.GetSelectedIndex() > 0)
     {
         m_localizationWarningLabel.ColorMask = Color.Red.ToVector4();
     }
     else
     {
         m_localizationWarningLabel.ColorMask = Color.White.ToVector4();
     }
 }
示例#2
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 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 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.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_asteroidGPSModeCombo.GetSelectedIndex() != (long)AsteroidGenerationMethod.VANILLA;
                m_asteroidDensitySlider.Enabled = m_asteroidGPSModeCombo.GetSelectedIndex() != (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_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_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.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.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.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);
        }
 private void OnPhysicalObjectCombobox_ItemSelected()
 {
     m_lastSelectedFloatingObjectIndex = m_physicalObjectCombobox.GetSelectedIndex();
 }
示例#4
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            m_usableWidth = Size.Value.X * 0.75f;

            if (!m_pluginInstalled)
            {
                CheckPluginInstalledOnServer();
                return;
            }

            if (m_isRecreating)
            {
                return;
            }
            m_isRecreating = true;

            var comboBoxTop = GetCombo();
            int oldCount    = comboBoxTop.GetItemsCount();

            if (MySession.Static.IsUserSpaceMaster(Sync.MyId) && MySession.Static.IsUserAdmin(Sync.MyId))
            {
                comboBoxTop.AddItem(oldCount, "SEWorldGenPlugin - Spawning");
                comboBoxTop.AddItem(oldCount + 1, "SEWorldGenPlugin - Editing");
            }

            MyGuiControlCombobox newCombo = AddCombo();

            for (int i = 0; i < comboBoxTop.GetItemsCount(); i++)
            {
                newCombo.AddItem(comboBoxTop.GetItemByIndex(i).Key, comboBoxTop.GetItemByIndex(i).Value);
            }

            newCombo.Position    = comboBoxTop.Position;
            newCombo.Size        = comboBoxTop.Size;
            newCombo.OriginAlign = comboBoxTop.OriginAlign;
            newCombo.SelectItemByIndex(m_selectedMenuIndex);

            Controls[Controls.IndexOf(comboBoxTop)] = newCombo;
            Controls.Remove(comboBoxTop);

            newCombo.ItemSelected += delegate
            {
                if (newCombo.GetSelectedIndex() != m_selectedMenuIndex)
                {
                    ForceFetchStarSystem = true;
                }

                m_selectedMenuIndex = newCombo.GetSelectedIndex();

                foreach (var provider in m_asteroidProviders)
                {
                    provider.GetAdminMenuCreator().Close();
                }

                if (newCombo.GetSelectedIndex() >= oldCount)
                {
                    RecreateControls(false);
                }
                else
                {
                    comboBoxTop.SelectItemByIndex(m_selectedMenuIndex);
                    RecreateControls(false);
                }
            };

            if (m_selectedMenuIndex == oldCount)
            {
                ClearControls();
                BuildSpawnMenu();
            }
            if (m_selectedMenuIndex == oldCount + 1)
            {
                ClearControls();
                BuildEditMenu();
            }
            m_isRecreating = false;
        }
 private void OnAsteroidCombobox_ItemSelected()
 {
     m_lastSelectedAsteroidIndex = m_asteroidCombobox.GetSelectedIndex();
     m_selectedCoreVoxelFile     = m_asteroidCombobox.GetSelectedValue().ToString();
 }