Exemplo n.º 1
0
        private void OnDeleteButtonClick(MyGuiControlButton sender)
        {
            var selectedItem = m_templatesListbox.GetSelectedItem();

            if (selectedItem != null)
            {
                Debug.Assert(selectedItem != null);

                var selectedType     = (MyMwcObjectBuilder_SmallShip_TypesEnum)m_shipTypeCombobox.GetSelectedKey();
                var selectedTemplate = MySmallShipTemplates.GetTemplate(selectedType, selectedItem.Value);

                if (selectedTemplate.SavedToServer)
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR,
                                                                     MyTextsWrapperEnum.CannotDeleteSavedTemplate,
                                                                     MyTextsWrapperEnum.Failure,
                                                                     MyTextsWrapperEnum.Ok, null));
                }
                else
                {
                    MySmallShipTemplates.DeleteTemplate(selectedTemplate);
                    UpdateControls();
                }
            }
            else
            {
                WarnNotSelected();
            }
        }
Exemplo n.º 2
0
        private void OnEditButtonClick(MyGuiControlButton sender)
        {
            var selectedItem = m_templatesListbox.GetSelectedItem();

            if (selectedItem != null)
            {
                var selectedType = (MyMwcObjectBuilder_SmallShip_TypesEnum)m_shipTypeCombobox.GetSelectedKey();
                m_selectedTemplate = MySmallShipTemplates.GetTemplate(selectedType, selectedItem.Value);

                var builders = new List <MySmallShipBuilderWithName> {
                    new MySmallShipBuilderWithName(m_selectedTemplate.Builder)
                };

                var inventory = new MyInventory();
                inventory.FillInventoryWithAllItems(null, 100);
                var gui = new MyGuiScreenInventory(
                    builders,
                    0,
                    inventory.GetObjectBuilder(false),
                    MyTextsWrapper.Get(MyTextsWrapperEnum.AllItemsInventory));

                gui.OnSave += UpdateTemplate;
                MyGuiManager.AddScreen(gui);
            }
            else
            {
                WarnNotSelected();
            }
        }
        private void OnEditClick(MyGuiControlButton sender)
        {
            var selected = m_selectShipsListbox.GetSelectedItem();

            if (selected != null)
            {
                BotTemplate template      = m_bots[selected.Key];
                int?        selectedIndex = null;
                var         builders      = GetTemplatesForCombobox(template.m_builder, out selectedIndex);
                Debug.Assert(selectedIndex != null, "This shouldn't happen!");
                if (selectedIndex == null)
                {
                    selectedIndex = 0;
                }
                MyGuiScreenEditorSmallShip screen = new MyGuiScreenEditorSmallShip(template.m_builder, builders, selectedIndex.Value);
                screen.OnOk += delegate
                {
                    if (template.m_builder.ShipTemplateID != null)
                    {
                        OnEditBot(template.m_builder, MySmallShipTemplates.GetTemplate(template.m_builder.ShipTemplateID.Value));
                    }
                    else
                    {
                        OnEditBot(template.m_builder);
                    }
                };

                MyGuiManager.AddScreen(screen);
            }
        }
Exemplo n.º 4
0
        private void FillListBox(MyMwcObjectBuilder_SmallShip_TypesEnum selectedType)
        {
            m_templatesListbox.RemoveAllItems();
            var templates = MySmallShipTemplates.GetTemplatesForType(selectedType);

            for (int i = 0; i < templates.Count; i++)
            {
                var template = templates[i];
                m_templatesListbox.AddItem(i, template.Name);
            }
        }
Exemplo n.º 5
0
        private void OnRenameButtonClick(MyGuiControlButton sender)
        {
            var selectedItem = m_templatesListbox.GetSelectedItem();

            if (selectedItem != null)
            {
                var selectedType = (MyMwcObjectBuilder_SmallShip_TypesEnum)m_shipTypeCombobox.GetSelectedKey();
                m_selectedTemplate = MySmallShipTemplates.GetTemplate(selectedType, selectedItem.Value);

                MyGuiManager.AddScreen(new MyGuiScreenInputString(NameForRenameChosen, MyTextsWrapperEnum.NewTemplateName, m_selectedTemplate.Name));
            }
        }
Exemplo n.º 6
0
        private void AddTemplate(MyGuiScreenInventory sender, MyGuiScreenInventorySaveResult saveresult)
        {
            var newID = MySmallShipTemplates.GenerateNewID();

            MySmallShipTemplates.AddTemplate(new MySmallShipTemplate(
                                                 newID,
                                                 new StringBuilder(m_newName),
                                                 saveresult.SmallShipsObjectBuilders[saveresult.CurrentIndex].Builder,
                                                 false));

            UpdateControls();
            sender.OnSave -= AddTemplate;
        }
        private List <MySmallShipBuilderWithName> GetTemplatesForCombobox(MyMwcObjectBuilder_SmallShip_Bot selectedBuilder, out int?selectedIndex)
        {
            int?foundedIndex = null;
            int currentIndex = 0;
            List <MySmallShipBuilderWithName> templatesForCombobox = new List <MySmallShipBuilderWithName>();

            for (int i = 0; i < MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_TypesEnumValues.Length; i++)
            {
                MyMwcObjectBuilder_SmallShip_TypesEnum shipType = (MyMwcObjectBuilder_SmallShip_TypesEnum)MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_TypesEnumValues.GetValue(i);
                StringBuilder templateName;
                // insert no teplate
                templateName = GetTemplatePrefix(shipType);
                templateName.Append("NO TEMPLATE");
                MyMwcObjectBuilder_SmallShip_Bot builderToAdd = null;
                if (selectedBuilder != null && selectedBuilder.ShipTemplateID == null && selectedBuilder.ShipType == shipType)
                {
                    builderToAdd = selectedBuilder;
                    foundedIndex = currentIndex;
                }
                else
                {
                    builderToAdd = MyMwcObjectBuilder_SmallShip_Bot.CreateObjectBuilderWithAllItems(shipType, MyShipTypeConstants.GetShipTypeProperties(shipType).GamePlay.CargoCapacity);
                    if (selectedBuilder != null)
                    {
                        builderToAdd.CopyBotParameters(selectedBuilder);
                    }
                }
                templatesForCombobox.Add(new MySmallShipBuilderWithName(templateName, builderToAdd));
                currentIndex++;

                // real templates
                foreach (MySmallShipTemplate template in MySmallShipTemplates.GetTemplatesForType(shipType))
                {
                    if (selectedBuilder != null && selectedBuilder.ShipTemplateID != null && selectedBuilder.ShipTemplateID.Value == template.ID)
                    {
                        foundedIndex = currentIndex;
                    }
                    builderToAdd = new MyMwcObjectBuilder_SmallShip_Bot(template.Builder);
                    if (selectedBuilder != null)
                    {
                        builderToAdd.CopyBotParameters(selectedBuilder);
                    }
                    templateName = GetTemplatePrefix(shipType);
                    MyMwcUtils.AppendStringBuilder(templateName, template.Name);
                    templatesForCombobox.Add(new MySmallShipBuilderWithName(templateName, builderToAdd, template));
                    currentIndex++;
                }
            }
            selectedIndex = foundedIndex;
            return(templatesForCombobox);
        }
        private void OnDuplicateClick(MyGuiControlButton sender)
        {
            if (m_selectShipsListbox.GetSelectedItem() == null)
            {
                return;
            }
            BotTemplate btmp;

            m_bots.TryGetValue(m_selectShipsListbox.GetSelectedItem().Key, out btmp);
            if (btmp.m_builder.ShipTemplateID != null)
            {
                AddBot(btmp.m_builder, MySmallShipTemplates.GetTemplate(btmp.m_builder.ShipTemplateID.Value));
            }
            else
            {
                AddBot(btmp.m_builder);
            }
        }
Exemplo n.º 9
0
        protected override void OnOkClick(MyGuiControlButton sender)
        {
            var selectedItem = m_templatesListbox.GetSelectedItem();

            if (selectedItem != null)
            {
                var selectedType     = (MyMwcObjectBuilder_SmallShip_TypesEnum)m_shipTypeCombobox.GetSelectedKey();
                var selectedTemplate = MySmallShipTemplates.GetTemplate(selectedType, selectedItem.Value);

                base.OnOkClick(sender);

                Debug.Assert(m_selectCallback != null);
                m_selectCallback(ScreenResult.Ok, selectedTemplate);
            }
            else
            {
                WarnNotSelected();
            }
        }
Exemplo n.º 10
0
        private MySmallShipBot CreateBotFromBuilder(MyMwcObjectBuilder_SmallShip_Bot bldr, Vector3 position)
        {
            //hax
            bldr.ArmorHealth   = MyGameplayConstants.HEALTH_BASIC;
            bldr.ShipMaxHealth = MyGameplayConstants.HEALTH_BASIC;
            bldr.Fuel          = float.MaxValue;
            bldr.Oxygen        = float.MaxValue;
            bldr.OwnerId       = this.EntityId.Value.NumericValue;
            if (bldr.ShipTemplateID != null)
            {
                var shipTemplate = MySmallShipTemplates.GetTemplateForSpawn(bldr.ShipTemplateID.Value);
                Debug.Assert(shipTemplate != null, string.Format("ShipTemplate {0} was not found!", bldr.ShipTemplateID.Value));
                if (shipTemplate != null)
                {
                    shipTemplate.ApplyToSmallShipBuilder(bldr);
                }
            }
            bldr.Faction = this.Faction;

            MySmallShipBot bot = (MySmallShipBot)MyEntities.CreateFromObjectBuilder(null, bldr, Matrix.CreateWorld(position, Vector3.Backward, Vector3.Up));

            return(bot);
        }
Exemplo n.º 11
0
 private void OnReloadFromServerButton(MyGuiControlButton sender)
 {
     MySmallShipTemplates.Load(true);
 }
Exemplo n.º 12
0
 private void OnSaveToServerButton(MyGuiControlButton sender)
 {
     MySmallShipTemplates.SaveToServer(true);
 }
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.97f, 0.85f);
            Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + new Vector2(0.04f, 0);

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

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

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

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

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

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

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

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

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

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

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

            int k        = 0;
            int selected = 0;

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

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

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

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

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

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

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

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


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

            Controls.Add(m_selectShipsListbox);


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

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

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

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

            #endregion

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

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

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

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

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

                m_activeCheckbox.Checked = m_spawnPoint.IsActive();
            }

            // Just UI update
            OnComponentChange(null);
        }