private void AddBot(int key, BotTemplate btmp)
        {
            String bld = GenerateNameFromBotTemplate(btmp);

            m_bots[key] = btmp;
            m_selectShipsListbox.AddItem(key, new StringBuilder(bld), null);
        }
 void AddHeader(int rowIndex, int currentColumn)
 {
     m_gameList.AddItem(
         GetHeaderKey(currentColumn, rowIndex),
         GetHeaderText(m_gameTableHeaders[currentColumn]),
         null,
         rowIndex,
         currentColumn);
 }
        private void AddStatRowToListbox(MyStatsRow statsRow)
        {
            StringBuilder pingText   = GetStringBuilderLong();
            StringBuilder killsText  = GetStringBuilderShort();
            StringBuilder deathsText = GetStringBuilderShort();

            pingText.Append(statsRow.Ping.HasValue ? statsRow.Ping.Value.ToString() + "ms" : "");
            killsText.Append(statsRow.Kills.ToString());
            deathsText.Append(statsRow.Deaths.ToString());

            Vector4?rowColor = null;

            if (statsRow.IsFaction)
            {
                if (MySession.Static.Player.Faction == statsRow.Faction)
                {
                    rowColor = new Vector4(0, 1f, 0, 0.07f);
                }
                else
                {
                    rowColor = new Vector4(1f, 0, 0, 0.07f);
                }
            }
            else if (statsRow.Id == (byte)MyClientServer.LoggedPlayer.GetUserId())
            {
                rowColor = new Vector4(1f, 1f, 1f, 0.02f);
            }

            int rowIndex = m_statsListbox.AddRow(rowColor);

            var textColor = Color.White;


            MyGuiFont textFont;

            if (MyFactions.GetFactionsRelation(MySession.Static.Player.Faction, statsRow.Faction) == MyFactionRelationEnum.Friend || statsRow.Id == m_playerId)
            {
                textFont = MyGuiManager.GetFontMinerWarsGreen();
            }
            else
            {
                textFont = MyGuiManager.GetFontMinerWarsRed();
            }

            m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 0,
                                                               new MyColoredText(statsRow.Name, textColor, textFont, GetRowScale(statsRow)),
                                                               null, new MyToolTips(statsRow.Name)), rowIndex, 0);

            m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 1,
                                                               new MyColoredText(killsText, textColor, textFont, GetRowScale(statsRow)),
                                                               null, new MyToolTips(killsText)), rowIndex, 1);

            m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 2,
                                                               new MyColoredText(deathsText, textColor, textFont, GetRowScale(statsRow)),
                                                               null, new MyToolTips(deathsText)), rowIndex, 2);

            m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 3,
                                                               new MyColoredText(pingText, textColor, textFont, GetRowScale(statsRow)),
                                                               null, new MyToolTips(pingText)), rowIndex, 3);
        }
        public MyGuiScreenEditorWayPointList()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.7f, 0.75f);

            AddCaption(MyTextsWrapperEnum.Waypoints, new Vector2(0, 0.015f));

            var wayPointsListBox = new MyGuiControlListbox(this, new Vector2(0, -0.01f), new Vector2(0.55f, 0.1f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                                                           MyTextsWrapper.Get(MyTextsWrapperEnum.Waypoints), MyGuiConstants.LABEL_TEXT_SCALE, 1, 5, 1, false, true, false,
                                                           null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 2, 1, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f);

            wayPointsListBox.ItemSelect += new OnListboxItemSelect(wayPointsListBox_ItemSelect);


            MyWayPointGraph.StoredPaths.Sort(Waypoint_Sort);

            for (int i = 0; i < MyWayPointGraph.StoredPaths.Count; i++)
            {
                wayPointsListBox.AddItem(i, new StringBuilder(MyWayPointGraph.StoredPaths[i].Name));
            }

            Controls.Add(wayPointsListBox);


            Controls.Add(new MyGuiControlButton(this, new Vector2(0.2080f, 0.28f), 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));
        }
Exemplo n.º 5
0
        private void FillListbox()
        {
            List <MyEntity> deactivatedEntities = new List <MyEntity>();

            foreach (MyEntity entity in MyEntities.GetEntities())
            {
                if (!entity.Activated)
                {
                    deactivatedEntities.Add(entity);
                }
                else if (entity is MyPrefabContainer)
                {
                    foreach (MyPrefabBase deactivatedPrefab in ((MyPrefabContainer)entity).GetDeactivatedPrefabs())
                    {
                        deactivatedEntities.Add(deactivatedPrefab);
                    }
                }
            }

            foreach (MyEntity deactivatedEntity in deactivatedEntities)
            {
                if (deactivatedEntity.EntityId.HasValue)
                {
                    string displayInfo = string.Format("[{0}] ({1}) {2} : {3}",
                                                       deactivatedEntity.EntityId.Value.NumericValue,
                                                       deactivatedEntity.GetFriendlyName(),
                                                       string.IsNullOrEmpty(deactivatedEntity.Name) ? "NONE" : deactivatedEntity.Name,
                                                       string.IsNullOrEmpty(deactivatedEntity.DisplayName) ? "NONE" : deactivatedEntity.DisplayName);
                    m_listbox.AddItem((int)deactivatedEntity.EntityId.Value.NumericValue, new StringBuilder(displayInfo));
                }
            }
        }
Exemplo n.º 6
0
        private void ConnectPrefabScreen_OnSubmit(object sender, EventArgs e)
        {
            MyGuiScreenEditorConnectPrefab connectPrefabScreen = (MyGuiScreenEditorConnectPrefab)sender;

            uint prefabId = connectPrefabScreen.PrefabId;
            MyConnectEntityOperation result = PrefabSecurityControlHUB.ConnectEntity(prefabId);

            switch (result)
            {
            case MyConnectEntityOperation.AlreadyConnected:
                DisplayErrorMessage(MyTextsWrapperEnum.EntityIsAlreadyConnected);
                break;

            case MyConnectEntityOperation.NotExists:
                DisplayErrorMessage(MyTextsWrapperEnum.EntityIsNotExist);
                break;

            case MyConnectEntityOperation.NotSupported:
                DisplayErrorMessage(MyTextsWrapperEnum.EntityIsNotSupported);
                break;

            case MyConnectEntityOperation.Success:
                m_connectedPrefabIdsListbox.AddItem((int)prefabId, new StringBuilder(prefabId.ToString()));
                connectPrefabScreen.CloseScreen();
                break;

            default:
                throw new MyMwcExceptionApplicationShouldNotGetHere();
            }
        }
Exemplo n.º 7
0
        private void Init()
        {
            m_windowIsMovable      = false;
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.45f, 0.875f);
            AddCaption(new Vector2(0, -0.005f));

            AddActivatedCheckbox(GetControlsOriginLeftFromScreenSize() + new Vector2(0.05f, 0.01f), PrefabSecurityControlHUB.Activated);
            m_activatedCheckbox.OnCheck = OnActivateClick;

            m_connectedPrefabIdsListbox = new MyGuiControlListbox(this, new Vector2(0, -0.02f), new Vector2(0.2f, 0.07f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                                                                  MyTextsWrapper.Get(MyTextsWrapperEnum.ConnectedPrefabIds), MyGuiConstants.LABEL_TEXT_SCALE, 1, 7, 1, false, true, false);
            foreach (IMyUseableEntity connectedEntity in PrefabSecurityControlHUB.ConnectedEntities)
            {
                MyEntity entity = connectedEntity as MyEntity;
                Debug.Assert(entity.EntityId != null);
                uint entityId = entity.EntityId.Value.NumericValue;
                m_connectedPrefabIdsListbox.AddItem((int)entityId, new StringBuilder(entityId.ToString()));
            }

            Controls.Add(m_connectedPrefabIdsListbox);

            Vector2 buttonPosition = m_connectedPrefabIdsListbox.GetPosition() +
                                     new Vector2(-m_connectedPrefabIdsListbox.GetSize().Value.X / 2f, m_connectedPrefabIdsListbox.GetSize().Value.Y / 2f) +
                                     new Vector2(-0.05f, 0.09f);

            Controls.Add(new MyGuiControlButton(this, buttonPosition, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Add, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAddClick,
                                                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
            buttonPosition += new Vector2(0.18f, 0f);
            Controls.Add(new MyGuiControlButton(this, buttonPosition, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Delete, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDeleteClick,
                                                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
        }
 private void MoveItemToListbox(MyGuiControlListbox moveTo, MyGuiControlListboxItem item, int?rowIndex = null, int?itemIndex = null)
 {
     if (moveTo == m_allItemsInventoryListbox)
     {
         RemoveCopy(item.Key);
     }
     else
     {
         if (rowIndex != null && itemIndex != null)
         {
             moveTo.AddItem(item, rowIndex.Value, itemIndex.Value);
         }
         else
         {
             moveTo.AddItem(item);
         }
     }
 }
Exemplo n.º 9
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);
            }
        }
        private void AddInventoryListbox(MyGuiControlListbox listbox, MyInventory inventory, ref List <MyGuiControlListbox> listboxesToDragAndDrop)
        {
            Controls.Add(listbox);
            listboxesToDragAndDrop.Add(listbox);
            listbox.ItemDrag        += ListboxItemDrag;
            listbox.ItemDoubleClick += ListboxItemDoubleClick;

            foreach (MyInventoryItem inventoryItem in inventory.GetInventoryItems())
            {
                listbox.AddItem(CreateListboxItemAndAddToRepository(inventoryItem));
            }
        }
Exemplo n.º 11
0
        void FillList()
        {
            m_chapters = MinerWars.AppCode.Networking.MyLocalCache.LoadChapters().OrderByDescending(c => c.Item2).ToList();

            m_listbox.DeselectAll();
            m_listbox.RemoveAllRows();
            m_listbox.RemoveAllItems();
            int index = 0;

            for (int ind = 0; ind < m_chapters.Count; ind++)
            {
                var chapter = m_chapters[ind].Item3;

                string time = MyUtils.GetDatetimeAsSpentTime(m_chapters[ind].Item2);

                var name = new StringBuilder(time);
                name.Append(" - ");
                if (chapter.ActiveMissionID != -1)
                {
                    if (MyMissions.GetMissionByID((MyMissionID)chapter.ActiveMissionID) != null)
                    {
                        name.Append(MyTextsWrapper.Get(MyMissions.GetMissionByID((MyMissionID)chapter.ActiveMissionID).Name));
                    }
                    else
                    {
                        name.Append("<mission deleted>");
                    }
                }
                else
                {
                    name.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.FreeRoaming));
                }

                var lastEvent = GetLastEvent(chapter);
                if (lastEvent != null)
                {
                    name.Append(" - ");
                    if (MyMissions.GetMissionByID((MyMissionID)lastEvent.EventTypeID) != null)
                    {
                        name.Append(MyMissions.GetMissionByID((MyMissionID)lastEvent.EventTypeID).NameTemp);
                    }
                }

                var difficultyName = MyGameplayConstants.GetGameplayDifficultyProfile(chapter.SessionObjectBuilder.Difficulty).DifficultyName;

                name.Append(" - ");
                name.Append(MyTextsWrapper.Get(difficultyName));

                m_listbox.AddItem(index, name);
                index++;
            }
        }
        private void InsertItems(List <MyCheckpointInfo> info)
        {
            m_listbox.DeselectAll();
            m_listbox.RemoveAllRows();
            m_listbox.RemoveAllItems();
            int index = 0;

            for (int ind = 0; ind < info.Count; ind++)
            {
                var i = info[ind];
                if (i.CheckpointName != null)
                {
                    m_listbox.AddItem(index, new StringBuilder(i.CheckpointName));
                    index++;
                }
            }
        }
Exemplo n.º 13
0
        private void FillControls()
        {
            string commonPrefix = "MyMwcObjectBuilder_";

            m_objectList.RemoveAllItems();
            if (m_sectorBuilder != null)
            {
                int index = 0;
                foreach (var objectBuilder in m_sectorBuilder.SectorObjects)
                {
                    string builderTypeName = objectBuilder.GetType().Name.ToString();
                    string text            = string.Format("{0}, {1}, {2}",
                                                           string.IsNullOrEmpty(objectBuilder.Name) ? "no name" : objectBuilder.Name,
                                                           objectBuilder.EntityId,
                                                           builderTypeName.StartsWith(commonPrefix) ? builderTypeName.Substring(commonPrefix.Length) : builderTypeName);

                    m_objectList.AddItem(index++, new StringBuilder(text));
                }
            }
        }
        private void RecreateControls()
        {
            m_size = new Vector2(1100f / 1600f, 1200 / 1200f);

            Controls.Clear();

            string prevName = MyConfig.LastFriendName;

            if (m_findPlayerName != null && m_findPlayerName.Text != null)
            {
                prevName = m_findPlayerName.Text;
            }

            AddCaption(MyTextsWrapperEnum.FriendsSectorMap, new Vector2(0, 0.04f));

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

            // controls for typing friend name to search
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1f * controlsDelta, null, MyTextsWrapperEnum.FriendName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_findPlayerName = new MyGuiControlTextbox(this, controlsOriginLeft + 1f * controlsDelta + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f + 0.15f, 0), MyGuiControlPreDefinedSize.MEDIUM, prevName, 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            Controls.Add(m_findPlayerName);

            var searchButton = new MyGuiControlButton(this, m_findPlayerName.GetPosition() + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f - 0.0208f, 0), MyGuiConstants.SEARCH_BUTTON_SIZE,
                                                      MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                      MyGuiManager.GetButtonSearchTexture(), null, null, MyTextsWrapperEnum.Search,
                                                      MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE * 0.8f, MyGuiControlButtonTextAlignment.CENTERED, OnSearchClick,
                                                      true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true, true);

            Controls.Add(searchButton);

            // friend maps available for selection
            //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3* controlsDelta, null, MyTextsWrapperEnum.Map, MyGuiConstants.LABEL_TEXT_COLOR,
            //    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            if (m_sectorIdentifiers != null && m_userDetails != null && m_sectorIdentifiers.Count > 0)
            {
                m_mapsCombobox = new MyGuiControlListbox(this, new Vector2(0, -0.010f), new Vector2(0.43f, 0.1f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, 1, 6, 1, true, true, false,
                                                         null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 1, 0, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0f, -0.01f, -0.01f, -0.02f, 0.02f);

                for (int i = 0; i < m_sectorIdentifiers.Count; i++)
                {
                    MyMwcSectorIdentifier sectorIdentifier = m_sectorIdentifiers[i];
                    foreach (MyMwcUserDetail userDetail in m_userDetails)
                    {
                        if (sectorIdentifier.UserId.HasValue && sectorIdentifier.UserId.Value == userDetail.UserId)
                        {
                            if (string.IsNullOrEmpty(sectorIdentifier.SectorName))
                            {
                                m_mapsCombobox.AddItem(i, new StringBuilder(string.Format("{0} - {1}", userDetail.DisplayName, sectorIdentifier.Position.ToString())), null);
                            }
                            else
                            {
                                m_mapsCombobox.AddItem(i, new StringBuilder(string.Format("{0} - {1} ({2})", userDetail.DisplayName, sectorIdentifier.SectorName, sectorIdentifier.Position.ToString())), null);
                            }
                        }
                    }
                }

                SortSectors();
                m_mapsCombobox.ItemDoubleClick += OnItemDoubleClick;
                Controls.Add(m_mapsCombobox);
            }
            else
            {
                Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3 * controlsDelta + new Vector2(0.21f, 0), null, MyTextsWrapperEnum.NoSectorsAvailable, MyGuiConstants.LABEL_TEXT_COLOR,
                                                   MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            }

            //  Buttons OK and CANCEL
            var m_okButton = new MyGuiControlButton(this, new Vector2(-0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f,
                                                    MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                    MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok,
                                                    MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick,
                                                    true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);

            Controls.Add(m_okButton);

            var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f,
                                                        MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                        MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Cancel,
                                                        MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick,
                                                        true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);

            Controls.Add(m_cancelButton);

            m_findPlayerName.MoveCartrigeToEnd();
            this.SetControlIndex(Controls.IndexOf(m_findPlayerName));
        }
Exemplo n.º 15
0
        private void RecreateControls()
        {
            Controls.Clear();

            m_size = new Vector2(1100f / 1600f, 1200 / 1200f);

            Vector2 controlsOriginLeft  = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.2f - 0.0360f);
            Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.07f + 0.355f, -m_size.Value.Y / 2.0f + 0.2f - 0.0360f);



            AddCaption(MyTextsWrapperEnum.TemporarySectorMap, new Vector2(0, 0.035f));

            //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft, null, MyTextsWrapperEnum.Map, MyGuiConstants.LABEL_TEXT_COLOR,
            //    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            if (m_sectors != null && m_sectors.Count > 0)
            {
                // When editing global story sectors, add some unused sector
                AddUnusedSector();

                int selectedIndex = 0;

                /*m_sectorsCombobox = new MyGuiControlCombobox(this, new Vector2(0, -0.17f), MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 6, true, false, true);
                 * for (int i = 0; i < m_sectors.Count; i++)
                 * {
                 *  MyMwcSectorIdentifier sectorIdentifier = m_sectors[i];
                 *
                 *  if (m_lastSandboxSector.HasValue && sectorIdentifier.Position.Equals(m_lastSandboxSector.Value))
                 *  {
                 *      selectedIndex = i;
                 *  }
                 *
                 *  if (string.IsNullOrEmpty(sectorIdentifier.SectorName))
                 *  {
                 *      m_sectorsCombobox.AddItem(i, GetSectorScreenshot(sectorIdentifier), new StringBuilder(string.Format("{0}", sectorIdentifier.Position.ToString())));
                 *  }
                 *  else
                 *  {
                 *      m_sectorsCombobox.AddItem(i, GetSectorScreenshot(sectorIdentifier), new StringBuilder(string.Format("{0} ({1})", sectorIdentifier.SectorName, sectorIdentifier.Position.ToString())));
                 *  }
                 * }
                 *
                 * SortSectors();
                 *
                 * m_sectorsCombobox.SelectItemByKey(selectedIndex);
                 * m_sectorsCombobox.OnSelectItemDoubleClick += OnItemDoubleClick;
                 * Controls.Add(m_sectorsCombobox);*/

                //Listbox

                m_sectorsListbox = new MyGuiControlListbox(this, new Vector2(0, -0.025f), new Vector2(0.43f, 0.1f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, 1, 6, 1, true, true, false,
                                                           null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 1, 0, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0f, -0.01f, -0.01f, -0.02f, 0.02f)
                {
                    IconScale = new Vector2(0.97f)
                };
                for (int i = 0; i < m_sectors.Count; i++)
                {
                    MyMwcSectorIdentifier sectorIdentifier = m_sectors[i];

                    if (m_lastSandboxSector.HasValue && sectorIdentifier.Position.Equals(m_lastSandboxSector.Value))
                    {
                        selectedIndex = i;
                    }

                    if (string.IsNullOrEmpty(sectorIdentifier.SectorName))
                    {
                        m_sectorsListbox.AddItem(i, new StringBuilder(string.Format("{0}", sectorIdentifier.Position.ToString())), GetSectorScreenshot(sectorIdentifier));
                    }
                    else
                    {
                        m_sectorsListbox.AddItem(i, new StringBuilder(string.Format("{0} ({1})", sectorIdentifier.SectorName, sectorIdentifier.Position.ToString())), GetSectorScreenshot(sectorIdentifier));
                    }
                }

                SortSectors();

                m_sectorsListbox.SetSelectedItem(selectedIndex);
                m_sectorsListbox.ItemDoubleClick += OnItemDoubleClick;
                Controls.Add(m_sectorsListbox);
            }
            else
            {
                var text = m_loadingSectors.HasValue ? MyTextsWrapperEnum.LoadingPleaseWait : MyTextsWrapperEnum.NoSectorsAvailable;

                Controls.Add(new MyGuiControlLabel(this, new Vector2(0, -0.03f), null, text, MyGuiConstants.LABEL_TEXT_COLOR,
                                                   MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            }



            //  Buttons OK and CANCEL
            var m_okButton = new MyGuiControlButton(this, new Vector2(-0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f,
                                                    MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                    MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok,
                                                    MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick,
                                                    true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);

            Controls.Add(m_okButton);

            var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f,
                                                        MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                        MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Cancel,
                                                        MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick,
                                                        true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);

            Controls.Add(m_cancelButton);
        }