Esempio n. 1
0
        protected override void CreateButtons()
        {
            Vector2 buttonPosition = new Vector2(0.215f, -0.173f) + m_offset;
            Vector2 buttonOffset   = new Vector2(0.13f, 0.045f);

            float width = 0.26f;

            var openInWorkshopButton = CreateButton(width, new StringBuilder("Open In Workshop"), OnOpenInWorkshop, textScale: m_textScale);

            openInWorkshopButton.Position = buttonPosition;

            width = 0.14f;

            var closeButton = CreateButton(width, new StringBuilder("Close"), OnCloseButton, textScale: m_textScale);

            closeButton.Position = buttonPosition + new Vector2(0.5f, 2f) * buttonOffset + new Vector2(-0.005f, 0.005f);

            var sendLabel = MakeLabel("Send to Player", buttonPosition + new Vector2(-1f, 1f) * buttonOffset, m_textScale);

            Controls.Add(sendLabel);

            m_sendToCombo          = AddCombo(size: new Vector2(0.14f, 0.1f));
            m_sendToCombo.Position = buttonPosition + new Vector2(-0.075f, 1f) * buttonOffset;

            foreach (var player in Sync.Clients.GetClients())
            {
                m_sendToCombo.AddItem(Convert.ToInt64(player.SteamUserId), new StringBuilder(player.DisplayName));
                if (player.SteamUserId != Sync.MyId)
                {
                    m_sendToCombo.AddItem(Convert.ToInt64(player.SteamUserId), new StringBuilder(player.DisplayName));
                }
            }
            m_sendToCombo.ItemSelected += OnSendToPlayer;
        }
        protected override void BuildControls()
        {
            base.BuildControls();

            // Training level
            {
                var trainingLabel = MakeLabel(MySpaceTexts.TrainingLevel);
                trainingLabel.Position    = new Vector2(-0.25f, -0.47f + MARGIN_TOP);
                trainingLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;

                m_trainingLevel = new MyGuiControlCombobox(
                    position: new Vector2(-0.04f, -0.47f + MARGIN_TOP),
                    size: new Vector2(0.2f, trainingLabel.Size.Y),
                    originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER
                    );
                m_trainingLevel.AddItem((int)TrainingLevel.BASIC, MySpaceTexts.TrainingLevel_Basic);
                m_trainingLevel.AddItem((int)TrainingLevel.INTERMEDIATE, MySpaceTexts.TrainingLevel_Intermediate);
                m_trainingLevel.AddItem((int)TrainingLevel.ADVANCED, MySpaceTexts.TrainingLevel_Advanced);
                m_trainingLevel.SelectItemByIndex(0);
                m_trainingLevel.ItemSelected += OnTrainingLevelSelected;

                Controls.Add(trainingLabel);
                Controls.Add(m_trainingLevel);
            }
        }
Esempio n. 3
0
        private void PopulateMutuallyConnectedCubeGrids(HashSet <MyAntennaSystem.BroadcasterInfo> playerMutualConnection)
        {
            m_shipsInRange.ClearItems();
            bool isCubeGrid = m_openInventoryInteractedEntityRepresentative is MyCubeGrid;

            //You should always be selectable
            m_shipsInRange.AddItem(m_openInventoryInteractedEntityRepresentative.EntityId, new StringBuilder(m_openInventoryInteractedEntityRepresentative.DisplayName));

            foreach (var connection in playerMutualConnection)
            {
                if (m_shipsInRange.TryGetItemByKey(connection.EntityId) == null)
                {
                    m_shipsInRange.AddItem(connection.EntityId, new StringBuilder(connection.Name));
                }
            }

            m_shipsInRange.Visible = true;
            m_button.Visible       = true;
            m_shipsInRange.SortItemsByValueText();

            //if the interacted entity is not in the combobox, it means we're watching a disconnected ship so it should be red (somehow)
            if (m_shipsInRange.TryGetItemByKey(m_interactedEntityRepresentative.EntityId) == null)
            {
                if (m_interactedEntityRepresentative is MyCubeGrid)
                {
                    m_shipsInRange.AddItem(m_interactedEntityRepresentative.EntityId, new StringBuilder((m_interactedEntityRepresentative as MyCubeGrid).DisplayName));
                }
            }
            m_shipsInRange.SelectItemByKey(m_interactedEntityRepresentative.EntityId);
        }
Esempio n. 4
0
        private void ComboResolution_ItemSelected()
        {
            int  adapterIndex        = (int)m_comboVideoAdapter.GetSelectedKey();
            var  selectedResolution  = m_resolutions[(int)m_comboResolution.GetSelectedKey()];
            bool fullscreenSupported = false;

            foreach (var displayMode in MyVideoSettingsManager.Adapters[adapterIndex].SupportedDisplayModes)
            {
                if (displayMode.Width == selectedResolution.X &&
                    displayMode.Height == selectedResolution.Y)
                {
                    fullscreenSupported = true;
                    break;
                }
            }

            var selectedWindowMode = (MyWindowModeEnum)m_comboWindowMode.GetSelectedKey();

            m_comboWindowMode.ClearItems();
            m_comboWindowMode.AddItem((int)MyWindowModeEnum.Window, MySpaceTexts.ScreenOptionsVideo_WindowMode_Window);
            m_comboWindowMode.AddItem((int)MyWindowModeEnum.FullscreenWindow, MySpaceTexts.ScreenOptionsVideo_WindowMode_FullscreenWindow);
            if (fullscreenSupported)
            {
                m_comboWindowMode.AddItem((int)MyWindowModeEnum.Fullscreen, MySpaceTexts.ScreenOptionsVideo_WindowMode_Fullscreen);
            }

            if (!fullscreenSupported && selectedWindowMode == MyWindowModeEnum.Fullscreen)
            {
                m_comboWindowMode.SelectItemByKey((long)MyWindowModeEnum.FullscreenWindow);
            }
            else
            {
                m_comboWindowMode.SelectItemByKey((long)selectedWindowMode);
            }
        }
        /// <summary>
        /// Builds the spawn menu
        /// </summary>
        private void BuildSpawnMenu()
        {
            MyPluginLog.Debug("Create Spawn Menu");

            var     topCombo = GetCombo();
            Vector2 start    = topCombo.Position + new Vector2(0, MARGIN_VERT * 2 + GetCombo().Size.Y);
            Vector2 end      = start + new Vector2(topCombo.Size.X, 0.8f - MARGIN_VERT);

            MyGuiControlParentTableLayout table = new MyGuiControlParentTableLayout(1, false, Vector2.Zero);

            table.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;

            m_spawnTypeCombo = new MyGuiControlCombobox();
            m_spawnTypeCombo.AddItem(0L, "Planet");
            m_spawnTypeCombo.AddItem(1L, "Asteroid object");
            m_spawnTypeCombo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_spawnTypeCombo.SelectItemByKey(m_spawnType);
            m_spawnTypeCombo.ItemSelected += OnSpawnTypeChange;
            m_spawnTypeCombo.Size          = new Vector2(m_usableWidth * 0.9f, m_spawnTypeCombo.Size.Y);
            m_spawnTypeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_SPAWN_TYPE);

            table.AddTableRow(m_spawnTypeCombo);

            table.AddTableSeparator();

            switch (m_spawnType)
            {
            case 0L:
                CreatePlanetSpawnMenu(table);
                break;

            case 1L:
                CreateAsteroidSpawnMenu(table);
                break;
            }

            table.AddTableSeparator();

            table.ApplyRows();

            MyGuiControlScrollablePanel scrollPane = new MyGuiControlScrollablePanel(table);

            scrollPane.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP;
            scrollPane.ScrollbarVEnabled = true;
            scrollPane.Size     = end - start;
            scrollPane.Size     = new Vector2(0.315f, scrollPane.Size.Y);
            scrollPane.Position = new Vector2(0, start.Y);

            Controls.Add(scrollPane);

            MyGuiControlSeparatorList sep = new MyGuiControlSeparatorList();

            sep.AddHorizontal(new Vector2(scrollPane.Position.X - scrollPane.Size.X / 2, scrollPane.Position.Y + scrollPane.Size.Y), m_usableWidth);

            Controls.Add(sep);

            MyPluginLog.Debug("Added spawn menu");
        }
Esempio n. 6
0
        /// <summary>
        /// Rebuilds the UI of the menu, by replacing the combo box at the top, with
        /// a new one with new selectable options, and checks, if a plugin menu should be shown and when yes,
        /// which one, otherwise shows the corresponding vanilla menu
        /// </summary>
        /// <param name="constructor">Whether this is run from constructor</param>
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            MyGuiControlCombobox modeCombo = GetCombo();

            int oldCount = modeCombo.GetItemsCount();

            if (MySession.Static.IsUserSpaceMaster(Sync.MyId) && MySession.Static.IsUserAdmin(Sync.MyId))
            {
                modeCombo.AddItem(oldCount, "SEWorldGenPlugin - Rings");
                modeCombo.AddItem(oldCount + 1, "SEWorldGenPlugin - Planets");
            }

            MyGuiControlCombobox newCombo = AddCombo();

            int count = modeCombo.GetItemsCount();

            for (int i = 0; i < count; i++)
            {
                var item = modeCombo.GetItemByIndex(i);
                newCombo.AddItem(item.Key, item.Value);
            }

            newCombo.Position = modeCombo.Position;
            newCombo.SelectItemByKey(m_currentKey);
            Controls[Controls.IndexOf(modeCombo)] = newCombo;
            Controls.Remove(modeCombo);

            newCombo.ItemSelected += delegate
            {
                m_currentKey = newCombo.GetSelectedKey();
                if (newCombo.GetSelectedKey() >= oldCount)
                {
                    RecreateControls(false);
                }
                else
                {
                    m_attachedEntity = 0L;
                    m_selectedPlanet = null;
                    modeCombo.SelectItemByKey(newCombo.GetSelectedKey());
                    RecreateControls(false);
                }
            };
            if (newCombo.GetSelectedKey() == oldCount)
            {
                ClearControls();
                CheckBuildPluginControls(BuildRingMenu);
            }
            else if (newCombo.GetSelectedKey() == oldCount + 1)
            {
                ClearControls();
                CheckBuildPluginControls(BuildPlanetMenu);
            }
        }
Esempio n. 7
0
 private void AddSectorToCombo(MyMwcSectorIdentifier sectorIdentifier, int index, string username)
 {
     if (string.IsNullOrEmpty(sectorIdentifier.SectorName))
     {
         m_mapsCombobox.AddItem(index, new StringBuilder(string.Format("{0} ({1})",
                                                                       username, sectorIdentifier.Position.ToString())));
     }
     else
     {
         m_mapsCombobox.AddItem(index, new StringBuilder(string.Format("{0} {1} ({2})",
                                                                       username, sectorIdentifier.SectorName, sectorIdentifier.Position.ToString())));
     }
 }
        void AddVoxelMaterialCombobox(Vector2 labelPosition, Vector2 comboboxPosition, MyMwcVoxelMaterialsEnum?selectedMaterial)
        {
            //choose material label
            m_selectMaterialLabel = new MyGuiControlLabel(this, labelPosition, null, MyTextsWrapperEnum.AsteroidMaterial, MyGuiConstants.LABEL_TEXT_COLOR,
                                                          MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_selectMaterialLabel);

            //COMBOBOX - voxel materials enum
            m_selectVoxelMapMaterialCombobox = new MyGuiControlCombobox(this, comboboxPosition, MyGuiControlPreDefinedSize.LONGMEDIUM,
                                                                        MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 11, true, false, true);

            foreach (MyMwcVoxelMaterialsEnum enumValue in MyGuiAsteroidHelpers.MyMwcVoxelMaterialsEnumValues)
            {
                MyGuiVoxelMaterialHelper voxelMaterialHelper = MyGuiAsteroidHelpers.GetMyGuiVoxelMaterialHelper(enumValue);

                if (voxelMaterialHelper != null)
                {
                    m_selectVoxelMapMaterialCombobox.AddItem((int)enumValue, voxelMaterialHelper.Icon, voxelMaterialHelper.Description);
                }
            }
            int selectedIndex;

            if (selectedMaterial == null)
            {
                selectedIndex = 0;
            }
            else
            {
                selectedIndex = (int)selectedMaterial.Value;
            }
            m_selectVoxelMapMaterialCombobox.SelectItemByKey(selectedIndex);
            m_selectVoxelMapMaterialCombobox.OnSelectItemDoubleClick += OnDoubleClick;
            Controls.Add(m_selectVoxelMapMaterialCombobox);
        }
Esempio n. 9
0
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            this.Controls.Add(new MyGuiControlLabel(new Vector2(0.0f, -0.10f), text: "Select gps you want to reach. (Dont use for grids with subgrids.)", originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));
            m_prefabs       = new MyGuiControlCombobox(new Vector2(0.2f, 0.0f), new Vector2(0.3f, 0.05f), null, null, 10, null);
            m_confirmButton = new MyGuiControlButton(new Vector2(0.21f, 0.10f), MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Confirm"));
            m_cancelButton  = new MyGuiControlButton(new Vector2(-0.21f, 0.10f), MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Cancel"));

            List <IMyGps> outlist = new List <IMyGps>();

            MySession.Static.Gpss.GetGpsList(MySession.Static.LocalPlayerId, outlist);
            foreach (var prefab in outlist)
            {
                int key = m_prefabDefinitions.Count;
                m_prefabDefinitions.Add(prefab);
                m_prefabs.AddItem(key, prefab.Name);
            }

            this.Controls.Add(m_prefabs);
            this.Controls.Add(m_confirmButton);
            this.Controls.Add(m_cancelButton);

            m_confirmButton.ButtonClicked += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked  += cancelButton_OnButtonClick;
        }
        private void CreateControlsSound(Vector2 controlsOrigin)
        {
            AddSeparator(controlsOrigin);

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

            m_controlsAdded++;

            m_selectDialogueCombobox = new MyGuiControlCombobox(this,
                                                                controlsOrigin + m_controlsAdded++ *CONTROLS_DELTA +
                                                                new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0),
                                                                MyGuiControlPreDefinedSize.LONGMEDIUM,
                                                                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                                                                MyGuiConstants.COMBOBOX_TEXT_SCALE, 6, false, false, false);

            System.Collections.Generic.SortedDictionary <string, int> dialogues = new System.Collections.Generic.SortedDictionary <string, int>();

            foreach (MyDialogueEnum dialogue in Enum.GetValues(typeof(MyDialogueEnum)))
            {
                dialogues.Add(dialogue.ToString(), (int)dialogue);
            }

            foreach (var dialogue in dialogues)
            {
                m_selectDialogueCombobox.AddItem(dialogue.Value, null, new StringBuilder(dialogue.Key));
            }

            m_selectDialogueCombobox.SelectItemByIndex(0);

            Controls.Add(m_selectDialogueCombobox);
        }
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

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

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

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

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

            m_confirmButton.ButtonClicked += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked  += cancelButton_OnButtonClick;
        }
Esempio n. 12
0
        public void InitControls()
        {
            AddActivatedCheckbox(new Vector2(-0.07f, -0.1f), CargoBox.Activated);

            AddIdTextBox(new Vector2(-0.16f, -0.15f), CargoBox.EntityId.Value.NumericValue);

            m_cargoBoxTypeCombobox = new MyGuiControlCombobox(
                this,
                new Vector2(0, -0.2f),
                MyGuiControlPreDefinedSize.LONGMEDIUM,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                MyGuiConstants.COMBOBOX_TEXT_SCALE,
                6,
                false,
                false,
                false);

            foreach (MyMwcObjectBuilder_CargoBox_TypesEnum cargoBoxType in Enum.GetValues(typeof(MyMwcObjectBuilder_CargoBox_TypesEnum)))
            {
                var cargoBoxHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(
                    MyMwcObjectBuilderTypeEnum.CargoBox, (int)cargoBoxType);
                m_cargoBoxTypeCombobox.AddItem((int)cargoBoxType, MyGuiManager.GetBlankTexture(), cargoBoxHelper.Description);
            }
            m_cargoBoxTypeCombobox.SortItemsByValueText();

            m_cargoBoxTypeCombobox.SelectItemByKey((int)CargoBox.CargoBoxType);

            Controls.Add(m_cargoBoxTypeCombobox);
        }
        /// <summary>
        /// Creates the menu to spawn asteroid objects
        /// </summary>
        /// <param name="table">Table to add elements to</param>
        private void CreateAsteroidSpawnMenu(MyGuiControlParentTableLayout table)
        {
            m_asteroidTypeCombo = new MyGuiControlCombobox();

            foreach (var provider in m_asteroidProviders)
            {
                m_asteroidTypeCombo.AddItem(m_asteroidProviders.IndexOf(provider), provider.GetTypeName());
            }

            m_asteroidTypeCombo.SelectItemByKey(m_asteroidType);
            m_asteroidTypeCombo.ItemSelected += delegate
            {
                if (m_asteroidType != m_asteroidTypeCombo.GetSelectedKey())
                {
                    m_asteroidProviders[(int)m_asteroidType].GetAdminMenuCreator().Close();
                }
                m_asteroidType = m_asteroidTypeCombo.GetSelectedKey();

                RecreateControls(false);
            };
            m_asteroidTypeCombo.Size = new Vector2(m_usableWidth * 0.9f, m_asteroidTypeCombo.Size.Y);
            m_asteroidTypeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_ROID_TYPE);

            table.AddTableRow(m_asteroidTypeCombo);

            m_asteroidProviders[(int)m_asteroidType].GetAdminMenuCreator().CreateSpawnMenu(m_usableWidth, table, this);
        }
Esempio n. 14
0
        protected override void OnUpdateVisual()
        {
            base.OnUpdateVisual();

            var first = FirstBlock;

            if (first != null)
            {
                // clear current listed items
                m_comboBox.ClearItems();
                m_handlerItems.Clear();
                // add items
                if (ComboBoxContent != null)
                {
                    ComboBoxContent(m_handlerItems);
                    foreach (var item in m_handlerItems)
                    {
                        m_comboBox.AddItem(item.Key, item.Value);
                    }

                    var value = GetValue(first);
                    if (m_comboBox.GetSelectedKey() != value)
                    {
                        m_comboBox.SelectItemByKey(value);
                    }
                }
            }
        }
        private void CreatePlanetsSpawnMenu(float separatorSize, float usableWidth)
        {
            float min = MyFakes.ENABLE_EXTENDED_PLANET_OPTIONS ? 100 : 19000;
            float max = /*MyFakes.ENABLE_EXTENDED_PLANET_OPTIONS ? (6378.1f * 1000 * 2) :*/ 120000f;
            MyGuiControlSlider slider = null;

            slider = new MyGuiControlSlider(
                position: m_currentPosition,
                width: 400f / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
                minValue: min,
                maxValue: max,
                labelText: String.Empty,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                labelFont: MyFontEnum.Debug,
                intValue: true);
            slider.DebugScale = m_sliderDebugScale;
            slider.ColorMask  = Color.White.ToVector4();
            Controls.Add(slider);

            var label = new MyGuiControlLabel(
                position: m_currentPosition + new Vector2(slider.Size.X + 0.005f, slider.Size.Y / 2),
                text: String.Empty,
                colorMask: Color.White.ToVector4(),
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.8f * m_scale,
                font: MyFontEnum.Debug);

            label.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            Controls.Add(label);

            m_currentPosition.Y += slider.Size.Y;
            m_currentPosition.Y += separatorSize;

            slider.ValueChanged += (MyGuiControlSlider s) =>
            {
                StringBuilder sb = new StringBuilder();
                MyValueFormatter.AppendDistanceInBestUnit(s.Value, sb);
                label.Text = sb.ToString();
                m_procAsteroidSizeValue = s.Value;
            };
            slider.Value = 8000;

            m_procAsteroidSeed = CreateSeedButton(m_procAsteroidSeedValue, usableWidth);
            m_planetCombobox   = AddCombo();
            {
                foreach (var definition in MyDefinitionManager.Static.GetPlanetsGeneratorsDefinitions())
                {
                    m_planetCombobox.AddItem((int)definition.Id.SubtypeId, definition.Id.SubtypeId.ToString());
                }
                m_planetCombobox.ItemSelected += OnPlanetCombobox_ItemSelected;
                m_planetCombobox.SortItemsByValueText();
                m_planetCombobox.SelectItemByIndex(0);
            }

            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnAsteroid, x =>
            {
                int seed = GetProceduralAsteroidSeed(m_procAsteroidSeed);
                CreatePlanet(seed, slider.Value);
                CloseScreenNow();
            });
        }
Esempio n. 16
0
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.8f, 0.4f);

            // Add screen title
            AddCaption();

            Vector2 originDelta        = new Vector2(0.05f, 0.02f);
            Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta;

            AddActivatedCheckbox(controlsOriginLeft, Prefab.Activated);

            m_onLabel = new MyGuiControlLabel(this, controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.On, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_onLabel);
            m_on = new MyGuiControlCheckbox(this, controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.1f, 0f), Prefab.Enabled, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_on);

            m_alarmLabel = new MyGuiControlLabel(this, controlsOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Alarm, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_alarmLabel);

            var alarmComboboxPredefinedSize = MyGuiControlPreDefinedSize.MEDIUM;
            var alarmComboboxSize           = MyGuiControlCombobox.GetPredefinedControlSize(alarmComboboxPredefinedSize);

            m_alarmComboBox = new MyGuiControlCombobox(
                this,
                controlsOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA +
                new Vector2(0.075f + alarmComboboxSize.X / 2, 0f),
                alarmComboboxPredefinedSize,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                MyGuiConstants.COMBOBOX_TEXT_SCALE);

            m_alarmComboBox.AddItem(0, MyTextsWrapperEnum.Default);
            m_alarmComboBox.AddItem(1, MyTextsWrapperEnum.On);
            m_alarmComboBox.AddItem(2, MyTextsWrapperEnum.Off);
            if (Prefab.DefaultCausesAlarm())
            {
                m_alarmComboBox.SelectItemByKey(0);
            }
            else
            {
                m_alarmComboBox.SelectItemByKey(Prefab.CausesAlarm ? 1 : 2);
            }
            Controls.Add(m_alarmComboBox);

            AddOkAndCancelButtonControls();
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            BackgroundColor = new Vector4(1f, 1f, 1f, 0.5f);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.13f);

            AddCaption("Voxels", Color.Yellow.ToVector4());
            AddShareFocusHint();

            AddSlider("Max precalc time", 0f, 20f, null, MemberHelper.GetMember(() => MyFakes.MAX_PRECALC_TIME_IN_MILLIS));
            //AddSlider("Terrain Tau Parameter", 0f, 1f, () => MyPlanetShapeProvider.GetTau(), x => MyPlanetShapeProvider.SetTau(x));
            AddCheckBox("Enable yielding", null, MemberHelper.GetMember(() => MyFakes.ENABLE_YIELDING_IN_PRECALC_TASK));

            m_filesCombo = MakeComboFromFiles(Path.Combine(MyFileSystem.ContentPath, "VoxelMaps"));
            m_filesCombo.ItemSelected += filesCombo_OnSelect;

            m_materialsCombo = AddCombo();
            foreach (var material in MyDefinitionManager.Static.GetVoxelMaterialDefinitions())
            {
                m_materialsCombo.AddItem(material.Index, new StringBuilder(material.Id.SubtypeName));
            }
            m_materialsCombo.ItemSelected += materialsCombo_OnSelect;
            m_materialsCombo.SelectItemByIndex(0);

            AddCombo <MyVoxelDebugDrawMode>(null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_VOXELS_MODE));

            AddLabel("Voxel ranges", Color.Yellow.ToVector4(), 0.7f);
            AddCombo <MyRenderQualityEnum>(null, MemberHelper.GetMember(() => VoxelRangesQuality));



            AddButton(new StringBuilder("Remove all"), onClick: RemoveAllAsteroids);
            AddButton(new StringBuilder("Generate render"), onClick: GenerateRender);
            AddButton(new StringBuilder("Generate physics"), onClick: GeneratePhysics);
            //AddButton(new StringBuilder("Voxelize all"), onClick: ForceVoxelizeAllVoxelMaps);
            //AddButton(new StringBuilder("Resave prefabs"), onClick: ResavePrefabs);
            AddButton(new StringBuilder("Reset all"), onClick: ResetAll);
            //AddButton(new StringBuilder("Reset part"), onClick: ResetPart);
            m_currentPosition.Y += 0.01f;

            //AddCheckBox("Geometry cell debug draw", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_VOXEL_GEOMETRY_CELL));
            AddCheckBox("Freeze terrain queries", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.FreezeTerrainQueries));
            AddCheckBox("Debug render clipmap cells", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.DebugRenderClipmapCells));
            AddCheckBox("Debug render merged cells", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.DebugRenderMergedCells));
            AddCheckBox("Debug clipmap lod colors", () => MyRenderSettings.DebugClipmapLodColor, (value) => MyRenderSettings.DebugClipmapLodColor = value);
            AddCheckBox("Enable physics shape discard", null, MemberHelper.GetMember(() => MyFakes.ENABLE_VOXEL_PHYSICS_SHAPE_DISCARDING));
            AddCheckBox("Wireframe", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.Wireframe));
            //AddCheckBox("Green background", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.ShowGreenBackground));
            AddCheckBox("Use triangle cache", this, MemberHelper.GetMember(() => UseTriangleCache));
            AddCheckBox("Use lod cutting", null, MemberHelper.GetMember(() => MyClipmap.UseLodCut));
            AddCheckBox("Use storage cache", null, MemberHelper.GetMember(() => MyStorageBase.UseStorageCache));
            AddCheckBox("Use dithering", null, MemberHelper.GetMember(() => MyClipmap.UseDithering));
            AddCheckBox("Use voxel merging", () => MyRenderProxy.Settings.EnableVoxelMerging, (x) => { VoxelMergeChanged(x); });
            AddCheckBox("Use queries", null, MemberHelper.GetMember(() => MyClipmap.UseQueries));
            AddCheckBox("Voxel AO", null, MemberHelper.GetMember(() => MyFakes.ENABLE_VOXEL_COMPUTED_OCCLUSION));

            m_currentPosition.Y += 0.01f;
        }
Esempio n. 18
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            m_scale = 0.7f;

            AddCaption("Cutscenes", Color.Yellow.ToVector4());
            AddShareFocusHint();

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);


            m_comboCutscenes       = AddCombo();
            m_playButton           = AddButton(new StringBuilder("Play"), onClick_PlayButton);
            m_addCutsceneButton    = AddButton(new StringBuilder("Add cutscene"), onClick_AddCutsceneButton);
            m_deleteCutsceneButton = AddButton(new StringBuilder("Delete cutscene"), onClick_DeleteCutsceneButton);


            m_currentPosition.Y += 0.01f;

            AddLabel("Nodes", Color.Yellow.ToVector4(), 1);
            m_comboNodes = AddCombo();
            m_comboNodes.ItemSelected += m_comboNodes_ItemSelected;


            m_addNodeButton    = AddButton(new StringBuilder("Add node"), onClick_AddNodeButton);
            m_deleteNodeButton = AddButton(new StringBuilder("Delete node"), onClick_DeleteNodeButton);

            m_nodeTimeSlider = AddSlider("Node time", 0, 0, 100, OnNodeTimeChanged);

            var cutscenes = MySession.Static.GetComponent <MySessionComponentCutscenes>();

            m_comboCutscenes.ClearItems();
            foreach (var key in cutscenes.GetCutscenes().Keys)
            {
                m_comboCutscenes.AddItem(key.GetHashCode(), key);
            }

            m_comboCutscenes.SortItemsByValueText();
            m_comboCutscenes.ItemSelected += m_comboCutscenes_ItemSelected;

            AddLabel("Waypoints", Color.Yellow.ToVector4(), 1);
            m_comboWaypoints = AddCombo();
            m_comboWaypoints.ItemSelected += m_comboWaypoints_ItemSelected;



            m_currentPosition.Y += 0.01f;

            m_spawnButton     = AddButton(new StringBuilder("Spawn entity"), onSpawnButton);
            m_removeAllButton = AddButton(new StringBuilder("Remove all"), onRemoveAllButton);


            if (m_comboCutscenes.GetItemsCount() > 0)
            {
                m_comboCutscenes.SelectItemByIndex(0);
            }
        }
        public MyGuiScreenOptionsGame()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.51f, 0.525f);
            //m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\GameOptionsBackground", flags: TextureFlags.IgnoreQuality);

            AddCaption(MyTextsWrapperEnum.GameOptions, new Vector2(0, 0.005f));

            Vector2 controlsOriginLeft  = new Vector2(-m_size.Value.X / 2.0f + 0.05f, -m_size.Value.Y / 2.0f + 0.125f);
            Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.175f, -m_size.Value.Y / 2.0f + 0.125f);
            Vector2 controlsDelta       = new Vector2(0, 0.0525f);

            //  Language
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0 * controlsDelta, null, MyTextsWrapperEnum.Language, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_languageCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 0 * controlsDelta + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.Y / 2.0f + 0.1f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_languageCombobox.AddItem((int)MyLanguagesEnum.English, MyTextsWrapperEnum.LanguageEnglish);
            m_languageCombobox.AddItem((int)MyLanguagesEnum.Cesky, MyTextsWrapperEnum.LanguageCesky);
            Controls.Add(m_languageCombobox);

            //  Subtitles
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * controlsDelta, null, MyTextsWrapperEnum.Subtitles, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_subtitlesCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 1 * controlsDelta + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.1f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_subtitlesCheckbox);

            //  Notifications
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2 * controlsDelta, null, MyTextsWrapperEnum.Notifications, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_notificationsCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 2 * controlsDelta + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.1f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_notificationsCheckbox);

            //  Buttons OK and CANCEL
            Vector2 buttonDelta = new Vector2(0.1f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f - 0.03f);

            Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), 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_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.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));


            //  Update controls with values from config file
            UpdateControls();
        }
Esempio n. 20
0
        void AddAdaptersToComboBox()
        {
            int counter = 0;

            foreach (var adapter in MyVideoSettingsManager.Adapters)
            {
                m_videoAdapterCombobox.AddItem(counter++, new StringBuilder(adapter.Name));
            }
        }
        void AddAdaptersToComboBox()
        {
            int counter = 0;

            foreach (GraphicsAdapter adapter in GraphicsAdapter.Adapters)
            {
                m_videoAdapterCombobox.AddItem(counter++, new StringBuilder(adapter.Name));
            }
        }
        void AddDisplayModesToComboBox(int adapterIndex)
        {
            m_videoModeCombobox.ClearItems();

            int counter = 0;

            foreach (MyVideoModeEx videoMode in MyVideoModeManager.GetAllSupportedVideoModes(adapterIndex))
            {
                m_videoModeCombobox.AddItem(counter++, new StringBuilder(
                                                videoMode.Width + " × " + videoMode.Height + string.Format(videoMode.IsRecommended ? " – {0} ***" : " – {0}", MyTextsWrapper.Get(MyAspectRatioExList.Get(videoMode.AspectRatioEnum).TextShort))
                                                ));
            }
        }
Esempio n. 23
0
        void onClick_AddCutsceneButton(MyGuiControlButton sender)
        {
            var    cutscenes = MySession.Static.GetComponent <MySessionComponentCutscenes>();
            string name      = "Cutscene" + cutscenes.GetCutscenes().Count;

            cutscenes.GetCutscenes().Add(name, new Cutscene());

            m_comboCutscenes.ClearItems();
            foreach (var key in cutscenes.GetCutscenes().Keys)
            {
                m_comboCutscenes.AddItem(key.GetHashCode(), key);
            }

            m_comboCutscenes.SelectItemByKey(name.GetHashCode());
        }
Esempio n. 24
0
        protected void RecreateHandItemsCombo()
        {
            m_handItemsCombo = AddCombo();

            m_handItemDefinitions.Clear();
            foreach (var handItemDef in MyDefinitionManager.Static.GetHandItemDefinitions())
            {
                var def         = MyDefinitionManager.Static.GetDefinition(handItemDef.PhysicalItemId);
                int handItemKey = m_handItemDefinitions.Count;
                m_handItemDefinitions.Add(handItemDef);
                m_handItemsCombo.AddItem(handItemKey, def.DisplayNameText);
            }

            m_handItemsCombo.SortItemsByValueText();
            m_handItemsCombo.ItemSelected += handItemsCombo_ItemSelected;
        }
Esempio n. 25
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            BackgroundColor = new Vector4(1f, 1f, 1f, 0.5f);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.13f);

            AddCaption("Voxels", Color.Yellow.ToVector4());
            AddShareFocusHint();

            AddSlider("Max precalc time", 0f, 20f, null, MemberHelper.GetMember(() => MyFakes.MAX_PRECALC_TIME_IN_MILLIS));
            AddCheckBox("Enable yielding", null, MemberHelper.GetMember(() => MyFakes.ENABLE_YIELDING_IN_PRECALC_TASK));

            m_filesCombo = MakeComboFromFiles(Path.Combine(MyFileSystem.ContentPath, "VoxelMaps"));
            m_filesCombo.ItemSelected += filesCombo_OnSelect;

            m_materialsCombo = AddCombo();
            foreach (var material in MyDefinitionManager.Static.GetVoxelMaterialDefinitions())
            {
                m_materialsCombo.AddItem(material.Index, new StringBuilder(material.Id.SubtypeName));
            }
            m_materialsCombo.ItemSelected += materialsCombo_OnSelect;
            m_materialsCombo.SelectItemByIndex(0);
            AddCombo <MyVoxelDebugDrawMode>(null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_VOXELS_MODE));

            AddButton(new StringBuilder("Remove all"), onClick: RemoveAllAsteroids);
            AddButton(new StringBuilder("Generate render"), onClick: GenerateRender);
            AddButton(new StringBuilder("Generate physics"), onClick: GeneratePhysics);
            AddButton(new StringBuilder("Voxelize all"), onClick: ForceVoxelizeAllVoxelMaps);
            AddButton(new StringBuilder("Resave prefabs"), onClick: ResavePrefabs);
            AddButton(new StringBuilder("Reset all"), onClick: ResetAll);
            AddButton(new StringBuilder("Reset part"), onClick: ResetPart);
            m_currentPosition.Y += 0.01f;

            AddCheckBox("Geometry cell debug draw", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_VOXEL_GEOMETRY_CELL));
            AddCheckBox("Freeze terrain queries", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.FreezeTerrainQueries));
            AddCheckBox("Debug render clipmap cells", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.DebugRenderClipmapCells));
            AddCheckBox("Debug clipmap lod colors", () => MyRenderSettings.DebugClipmapLodColor, (value) => MyRenderSettings.DebugClipmapLodColor = value);
            AddCheckBox("Enable physics shape discard", null, MemberHelper.GetMember(() => MyFakes.ENABLE_VOXEL_PHYSICS_SHAPE_DISCARDING));
            AddCheckBox("Wireframe", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.Wireframe));
            AddCheckBox("Green background", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.ShowGreenBackground));
            m_currentPosition.Y += 0.01f;

            AddSlider("Clipmap highest lod", MyClipmap.DebugClipmapMostDetailedLod, 0f, 15.9f, (slider) => MyClipmap.DebugClipmapMostDetailedLod = slider.Value);
            m_currentPosition.Y += 0.01f;
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            BackgroundColor = new Vector4(1f, 1f, 1f, 0.5f);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.13f);

            AddCaption("Voxel materials", Color.Yellow.ToVector4());
            AddShareFocusHint();

            m_materialsCombo = AddCombo();

            var defList = MyDefinitionManager.Static.GetVoxelMaterialDefinitions().OrderBy(x => x.Id.SubtypeName).ToList();

            foreach (var material in defList)
            {
                m_materialsCombo.AddItem(material.Index, new StringBuilder(material.Id.SubtypeName));
            }
            m_materialsCombo.ItemSelected += materialsCombo_OnSelect;
            m_currentPosition.Y           += 0.01f;

            m_sliderInitialScale       = AddSlider("Initial scale", 0, 1f, 100f, null);
            m_sliderScaleMultiplier    = AddSlider("Scale multiplier", 0, 1f, 100f, null);
            m_sliderInitialDistance    = AddSlider("Initial distance", 0, 1f, 100f, null);
            m_sliderDistanceMultiplier = AddSlider("Distance multiplier", 0, 1f, 100f, null);

            m_sliderFar1Distance = AddSlider("Far1 distance", 0, 0f, 20000f, null);
            m_sliderFar1Scale    = AddSlider("Far1 scale", 0, 1f, 50000f, null);
            m_sliderFar2Distance = AddSlider("Far2 distance", 0, 0f, 20000f, null);
            m_sliderFar2Scale    = AddSlider("Far2 scale", 0, 1f, 50000f, null);
            m_sliderFar3Distance = AddSlider("Far3 distance", 0, 0f, 40000f, null);
            m_sliderFar3Scale    = AddSlider("Far3 scale", 0, 1f, 50000f, null);

            m_sliderExtScale = AddSlider("Detail scale (/1000)", 0, 0.01f, 1f, null);

            m_materialsCombo.SelectItemByIndex(0);

            m_colorFar3 = AddColor(new StringBuilder("Far3 color"), m_selectedVoxelMaterial, MemberHelper.GetMember(() => m_selectedVoxelMaterial.Far3Color));
            m_colorFar3.SetColor(m_selectedVoxelMaterial.Far3Color);

            m_currentPosition.Y += 0.01f;

            AddButton(new StringBuilder("Reload definition"), OnReloadDefinition);
        }
        private void CreateObjectsSpawnMenu(float separatorSize, float usableWidth)
        {
            AddSubcaption(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_Items), Color.White.ToVector4(), new Vector2(-HIDDEN_PART_RIGHT, 0.0f));

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ItemType), Vector4.One, m_scale);
            m_physicalObjectCombobox = AddCombo();
            {
                foreach (var definition in MyDefinitionManager.Static.GetAllDefinitions())
                {
                    if (!definition.Public)
                    {
                        continue;
                    }
                    var physicalItemDef = definition as MyPhysicalItemDefinition;
                    if (physicalItemDef == null || physicalItemDef.CanSpawnFromScreen == false)
                    {
                        continue;
                    }

                    int key = m_physicalItemDefinitions.Count;
                    m_physicalItemDefinitions.Add(physicalItemDef);
                    m_physicalObjectCombobox.AddItem(key, definition.DisplayNameText);
                }
                m_physicalObjectCombobox.SortItemsByValueText();
                m_physicalObjectCombobox.SelectItemByIndex(m_lastSelectedFloatingObjectIndex);
                m_physicalObjectCombobox.ItemSelected += OnPhysicalObjectCombobox_ItemSelected;
            }

            m_currentPosition.Y += separatorSize;

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ItemAmount), Vector4.One, m_scale);
            m_amountTextbox              = new MyGuiControlTextbox(m_currentPosition, m_amount.ToString(), 6, null, m_scale, MyGuiControlTextboxType.DigitsOnly);
            m_amountTextbox.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_amountTextbox.TextChanged += OnAmountTextChanged;
            Controls.Add(m_amountTextbox);

            m_currentPosition.Y += separatorSize + m_amountTextbox.Size.Y;
            m_errorLabel         = AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_InvalidAmount), Color.Red.ToVector4(), m_scale);
            m_errorLabel.Visible = false;
            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnObject, OnSpawnPhysicalObject);

            m_currentPosition.Y += separatorSize;
        }
Esempio n. 28
0
        void UdpateCuesCombo(MyGuiControlCombobox box)
        {
            box.ClearItems();
            long key = 0;

            foreach (var cue in MyAudio.Static.CueDefinitions)
            {
                if ((m_currentCategorySelectedItem == ALL_CATEGORIES) || (m_currentCategorySelectedItem == cue.Category.ToString()))
                {
                    box.AddItem(key, new StringBuilder(cue.SubtypeId.ToString()));
                    key++;
                }
            }

            box.SortItemsByValueText();
            if (box.GetItemsCount() > 0)
            {
                box.SelectItemByIndex(0);
            }
        }
Esempio n. 29
0
        void m_comboNodes_ItemSelected()
        {
            m_selectedCutsceneNode = m_selectedCutscene.SequenceNodes[m_comboNodes.GetSelectedKey()];
            m_nodeTimeSlider.Value = m_selectedCutsceneNode.Time;

            m_comboWaypoints.ClearItems();

            if (m_selectedCutsceneNode.Waypoints != null)
            {
                foreach (var waypoint in m_selectedCutsceneNode.Waypoints)
                {
                    m_comboWaypoints.AddItem(waypoint.Name.GetHashCode(), waypoint.Name);
                }

                if (m_comboWaypoints.GetItemsCount() > 0)
                {
                    m_comboWaypoints.SelectItemByIndex(0);
                }
            }
        }
Esempio n. 30
0
        void TerminalSystem_BlockAdded(MyTerminalBlock obj)
        {
            var assembler = obj as MyAssembler;

            if (assembler != null)
            {
                if (m_assemblersByKey.Count == 0)
                {
                    HideError(m_controlsParent);
                }
                var key = m_assemblerKeyCounter++;
                m_assemblersByKey.Add(key, assembler);
                m_comboboxAssemblers.AddItem(key, assembler.CustomName);
                if (m_assemblersByKey.Count == 1)
                {
                    m_comboboxAssemblers.SelectItemByIndex(0);
                }
                assembler.CustomNameChanged += assembler_CustomNameChanged;
            }
        }