Example #1
0
        private void InitListBox()
        {
            m_templatesListbox = new MyGuiControlListbox(
                this,
                new Vector2(0, 0.0f),
                new Vector2(0.25f, 0.075f),
                MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                MyTextsWrapper.Get(MyTextsWrapperEnum.SmallShipTemplates),
                MyGuiConstants.LABEL_TEXT_SCALE,
                1, 6, 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);

            Controls.Add(m_templatesListbox);
        }
Example #2
0
        public override void Draw()
        {
            if (!Visible)
            {
                return;
            }

            if (CanScroll())
            {
                Vector2 carretPosition = GetCarretPosition();
                //GUIHelper.FillRectangle(m_position + carretPosition, m_caretSize, new Color(0.5f, 0.5f, 0, 0.5f));
                MyGuiManager.DrawSpriteBatch(MyGuiManager.GetHorizontalScrollbarSlider(), m_position + carretPosition, m_caretSize, Color.White, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            }

            Color borderColor = m_control.GetColorAfterTransitionAlpha(MyGuiConstants.TREEVIEW_VERTICAL_LINE_COLOR);

            MyGUIHelper.Border(m_position, m_size, 1, borderColor, TopBorder, BottomBorder, LeftBorder, RightBorder);
        }
        public void InitControls()
        {
            StringBuilder otherSideInventoryName = new StringBuilder();

            otherSideInventoryName.Append(string.IsNullOrEmpty(m_entity.DisplayName) ? m_entity.GetFriendlyName() : m_entity.DisplayName);
            otherSideInventoryName.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.OtherSideInventory));

            Vector2 controlsOriginLeft  = new Vector2(-m_size.Value.X / 4f + 0.03f, 0.1f);
            Vector2 controlsOriginRight = new Vector2(+m_size.Value.X / 4f - 0.03f, 0.1f);
            List <MyGuiControlListbox> listboxesToDragAndDrop = new List <MyGuiControlListbox>();

            m_allItemsInventoryListbox = new MyGuiControlListbox(this, controlsOriginLeft, MyGuiConstants.LISTBOX_SMALL_SIZE, MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                                                                 null, MyGuiConstants.LABEL_TEXT_SCALE, COLUMNS, ROWS, COLUMNS, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 4, 2, MyGuiConstants.LISTBOX_ITEM_COLOR, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f);
            AddInventoryListbox(m_allItemsInventoryListbox, m_allItemsInventory, ref listboxesToDragAndDrop);

            m_entityInventoryListbox = new MyGuiControlListbox(this, controlsOriginRight, MyGuiConstants.LISTBOX_SMALL_SIZE, MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                                                               null, MyGuiConstants.LABEL_TEXT_SCALE, COLUMNS, ROWS, COLUMNS, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 4, 2, MyGuiConstants.LISTBOX_ITEM_COLOR, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f);
            AddInventoryListbox(m_entityInventoryListbox, EntityWithInventory.Inventory, ref listboxesToDragAndDrop);

            m_dragAndDrop = new MyGuiControlListboxDragAndDrop(this, listboxesToDragAndDrop, MyGuiControlPreDefinedSize.SMALL, MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                                                               MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, Vector2.Zero, true);
            m_dragAndDrop.ListboxItemDropped += DragAndDropListboxItemDropped;
            Controls.Add(m_dragAndDrop);

            Vector2 labelOffset = new Vector2(0.05f, -0.05f);

            Controls.Add(new MyGuiControlLabel(this, m_allItemsInventoryListbox.GetPosition() - m_allItemsInventoryListbox.GetSize().Value / 2f + labelOffset,
                                               null, MyTextsWrapperEnum.AllItemsInventory, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(new MyGuiControlLabel(this, m_entityInventoryListbox.GetPosition() - m_entityInventoryListbox.GetSize().Value / 2f + labelOffset,
                                               null, otherSideInventoryName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));


            Vector2 otherSettingsPosition = new Vector2(-m_size.Value.X / 2f + 0.1f, -0.35f);

            Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition,
                                               null, MyTextsWrapperEnum.PriceCoeficient, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_priceCoeficientTextbox      = new MyGuiControlTextbox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 3, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);
            m_priceCoeficientTextbox.Text = MyValueFormatter.GetFormatedFloat(EntityWithInventory.Inventory.PriceCoeficient, 2, string.Empty);
            Controls.Add(m_priceCoeficientTextbox);

            if (PrefabContainer != null)
            {
                otherSettingsPosition += MyGuiConstants.CONTROLS_DELTA;

                Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition,
                                                   null, MyTextsWrapperEnum.InventoryTemplates, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_inventoryTemplatesCombobox           = new MyGuiControlCombobox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
                m_inventoryTemplatesCombobox.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_inventoryTemplatesCombobox_OnSelect);
                m_inventoryTemplatesCombobox.AddItem(0, MyTextsWrapperEnum.None);
                foreach (MyMwcInventoryTemplateTypeEnum inventoryTemplateType in MyGuiInventoryTemplateTypeHelpers.MyInventoryTemplateTypeValues)
                {
                    if (MyInventoryTemplates.ContainsAnyItems(inventoryTemplateType))
                    {
                        m_inventoryTemplatesCombobox.AddItem((int)inventoryTemplateType, MyGuiInventoryTemplateTypeHelpers.GetInventoryTemplateTypeHelper(inventoryTemplateType).Description);
                    }
                }
                Controls.Add(m_inventoryTemplatesCombobox);

                otherSettingsPosition += MyGuiConstants.CONTROLS_DELTA;

                Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition,
                                                   null, MyTextsWrapperEnum.RefillTime, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_refillTimeTextbox = new MyGuiControlTextbox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 9, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);
                Controls.Add(m_refillTimeTextbox);

                RefillTime           = PrefabContainer.RefillTime;
                SelectedTemplateType = EntityWithInventory.Inventory.TemplateType;
            }
        }
Example #4
0
        public MyGuiScreenEditorCopyTool(MyMwcObjectBuilder_Sector sectorBuilder)
            : base(new Vector2(0.5f, 0.5f), new Vector2(0.8f, 0.88f))
        {
            m_size          = new Vector2(0.815f, 0.95f);
            m_sectorBuilder = sectorBuilder;

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

            AddCaption(MyTextsWrapperEnum.CopyTool, MyGuiConstants.LABEL_TEXT_COLOR, new Vector2(0, 0.01f));

            m_objectList = new MyGuiControlListbox(this,
                                                   new Vector2(0f, -0.02f),
                                                   MyGuiConstants.LISTBOX_LONGMEDIUM_SIZE,
                                                   MyGuiConstants.DEFAULT_CONTROL_BACKGROUND_COLOR,
                                                   null, .6f, 1, 17, 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);

            m_objectList.MultipleSelection = true;

            Controls.Add(m_objectList);

            //AddOkAndCancelButtonControls();
            Vector2 buttonPosition = new Vector2(0, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y - 0.02f);
            Vector2 buttonSize     = new Vector2(0.25f, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y);

            Controls.Add(new MyGuiControlButton(this,
                                                new Vector2(MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X - 0.05f - m_size.Value.X / 2, 0) + buttonPosition + buttonSize / 2,
                                                buttonSize,
                                                MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.SelectAllNone, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnSelectAllNone, MyGuiControlButtonTextAlignment.CENTERED, true,
                                                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            Controls.Add(new MyGuiControlButton(this,
                                                new Vector2(m_size.Value.X / 2 - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X - buttonSize.X + 0.01f, 0) + buttonPosition + buttonSize / 2,
                                                buttonSize,
                                                MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.AddSelectedToSector, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAddSelected, MyGuiControlButtonTextAlignment.CENTERED, true,
                                                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            Controls.Add(new MyGuiControlButton(this,
                                                new Vector2(m_size.Value.X / 2 - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X + 0.05f, 0) + buttonPosition + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE / 2,
                                                MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE,
                                                MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancel, MyGuiControlButtonTextAlignment.CENTERED, true,
                                                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            FillControls();
        }
        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));
        }
Example #6
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);
        }
        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));
        }
Example #8
0
        private void Init()
        {
            m_listbox = new MyGuiControlListbox(this,
                                                new Vector2(0f, -0.02f),
                                                MyGuiConstants.LISTBOX_LONGMEDIUM_SIZE,
                                                MyGuiConstants.DEFAULT_CONTROL_BACKGROUND_COLOR,
                                                null, .6f, 1, 16, 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);
            Controls.Add(m_listbox);

            m_listbox.ItemDoubleClick += new OnListboxItemDoubleClick(m_listbox_ItemDoubleClick);
            FillListbox();
        }
        public MyGuiScreenJoinGame(MyGuiScreenBase closeAfterSuccessfulEnter, MyGameTypes gameTypeFilter)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.95f, 0.8f))
        {
            m_size = new Vector2(0.95f, 0.85f);
            m_serverDisconnectedHandler = new ConnectionHandler(Static_ServerDisconnected);

            m_gameTypeFilter    = gameTypeFilter;
            m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality);

            m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;
            m_enableBackgroundFade      = true;
            m_games = new List <MyGameExtendedInfo>();
            AddCaption(MyTextsWrapperEnum.JoinGame, new Vector2(0, 0.0075f));

            Vector2 menuPositionOrigin = new Vector2(-0.31f, -m_size.Value.Y / 2.0f + 0.15f);
            Vector2 buttonDelta        = new Vector2(0.22f, 0);
            const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            Controls.Add(new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.SearchGameToJoin, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));

            m_searchTextbox              = new MyGuiControlTextbox(this, menuPositionOrigin + buttonDelta, MyGuiControlPreDefinedSize.LARGE, "", 40, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            m_searchTextbox.TextChanged += OnSearchTextChanged;
            Controls.Add(m_searchTextbox);

            menuPositionOrigin += new Vector2(0.395f, 0);

            var refreshButton = new MyGuiControlButton(
                this,
                menuPositionOrigin + buttonDelta,
                MyGuiConstants.BACK_BUTTON_SIZE,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Refresh,
                MyGuiConstants.BUTTON_TEXT_COLOR,
                MyGuiConstants.BUTTON_TEXT_SCALE,
                OnRefreshButtonClick,
                menuButtonTextAlignement,
                true,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                true);

            Controls.Add(refreshButton);

            menuPositionOrigin.Y += 0.052f;
            menuPositionOrigin.X  = -0.33f;

            var storyLabel = new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.Story, Vector4.One, 1.0f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(storyLabel);

            menuPositionOrigin.X = -0.35f;
            m_storyCheck         = new MyGuiControlCheckbox(this, menuPositionOrigin, true, Vector4.One, null);
            m_storyCheck.OnCheck = CheckChanged;
            Controls.Add(m_storyCheck);

            menuPositionOrigin.X = -0.2f;
            var deathLabel = new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.Deathmatch, Vector4.One, 1.0f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(deathLabel);

            menuPositionOrigin.X = -0.22f;
            m_deathCheck         = new MyGuiControlCheckbox(this, menuPositionOrigin, true, Vector4.One, null);
            m_deathCheck.OnCheck = CheckChanged;
            Controls.Add(m_deathCheck);

            //var storyButton = new MyGuiControlButton(this, menuPositionOrigin, null, Vector4.One, MyTextsWrapperEnum.Story, Vector4.One, 1.0f,

            menuPositionOrigin.Y += 0.25f;
            menuPositionOrigin.X  = 0;
            m_gameList            = new MyGuiControlListbox(this,
                                                            menuPositionOrigin,
                                                            new Vector2(0.22f, 0.04f),
                                                            MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                                                            MyTextsWrapper.Get(MyTextsWrapperEnum.JoinGame),
                                                            MyGuiConstants.LABEL_TEXT_SCALE,
                                                            HeaderCount, 10, HeaderCount,
                                                            true, 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);
            m_gameList.ItemSelect       += OnGamesItemSelect;
            m_gameList.DisplayHighlight  = true;
            m_gameList.MultipleSelection = true;
            m_gameList.ItemDoubleClick  += GameListOnItemDoubleClick;
            m_gameList.HighlightHeadline = true;
            m_gameList.EnableAllRowHighlightWhileMouseOver(true, true);
            m_gameList.SetCustomCollumnsWidths(new List <float>()
            {
                0.15f, 0.30f, 0.15f, 0.10f
            });
            Controls.Add(m_gameList);

            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.06f);
            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));

            AddHeaders();
        }
        public MyGuiScreenGameScore()
            : base(Vector2.Zero, null, null)
        {
            m_closeOnEsc           = true;
            m_enableBackgroundFade = true;

            m_sbLongPool  = new List <StringBuilder>();
            m_sbShortPool = new List <StringBuilder>();
            NullPoolIndexes();

            m_statsListbox = new MyGuiControlListbox(this, new Vector2(0.5f, 0.5f), new Vector2(0.35f, 0.04f), new Vector4(0, 0, 0, 0.5f), null, 0.65f, 4, 20, 4, true, false, false, null, null,
                                                     MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 0, 0, Color.Transparent.ToVector4(), 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f);
            m_statsListbox.DisplayHighlight = false;
            m_statsListbox.HideToolTip();
            m_statsListbox.SetCustomCollumnsWidths(new List <float>()
            {
                0, 0.1f, 0.1f, 0.1f
            });
            m_statsListbox.ShowScrollBarOnlyWhenNeeded = true;
            Controls.Add(m_statsListbox);

            GetStats();

            MyGuiScreenGamePlay.Static.DrawHud = false;
        }