Exemplo n.º 1
0
        protected MyGuiControlCheckbox addCheckBox(StringBuilder text, bool enabled = true, List<MyGuiControlBase> controlGroup = null, Vector4? color = null)
        {
            MyGuiControlLabel label = new MyGuiControlLabel(this, m_currentPosition, null, text, color ?? m_defaultColor, MyGuiConstants.LABEL_TEXT_SCALE * MyGuiConstants.DEBUG_LABEL_TEXT_SCALE * m_scale,
                                                            MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            float labelWidth = label.GetTextSize().Size.X + 0.02f;
            m_maxWidth = Math.Max(m_maxWidth, labelWidth);
            label.Enabled = enabled;
            Controls.Add(label);


            Vector2? m = this.GetSize();

            Vector2 checkBoxSize = MyGuiConstants.CHECKBOX_SIZE * m_scale;
            MyGuiControlCheckbox checkBox = new MyGuiControlCheckbox(this, m_currentPosition + new Vector2(m.Value.X - 2 * checkBoxSize.X - m_checkBoxOffset, 0),
                checkBoxSize, false, 0.8f * (color ?? m_defaultColor));
            checkBox.Enabled = enabled;

            Controls.Add(checkBox);

            m_currentPosition.Y += 0.04f * m_scale;

            if (controlGroup != null)
            {
                controlGroup.Add(label);
                controlGroup.Add(checkBox);
            }

            return checkBox;
        }
        public MyGuiScreenMultiplayerEnterGameRequest(MyGuiScreenGamePlay.MyJoinGameRequest request)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 600 / 1200f), false, MyGuiManager.GetSandboxBackgoround())
        {
            m_enableBackgroundFade = true;
            m_backgroundFadeColor = new Vector4(0.0f, 0.0f, 0.0f, 0.5f);

            m_request = request;
            AddCaption(MyTextsWrapperEnum.JoinRequestTitle);

            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.146f);
            MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            Controls.Add(new MyGuiControlLabel(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, null, new StringBuilder(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.JoinRequest, request.Message.PlayerInfo.DisplayName)), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiConstants.DEFAULT_CONTROL_FONT));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.AllowEnter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAllowEnter, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.DenyEnter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDenyEnter, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            MyGuiControlLabel lblRememberSetting = new MyGuiControlLabel(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA - new Vector2(0.03f, 0), null, MyTextsWrapperEnum.Remember, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(lblRememberSetting);

            m_chkRememberSetting = new MyGuiControlCheckbox(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA + new Vector2(0.05f, 0), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, lblRememberSetting);
            Controls.Add(m_chkRememberSetting);
        }
        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 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();
        }
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.92f, 0.95f);

            // Add screen title
            AddCaption();

            Vector2 originDelta = new Vector2(0.02f, 0);
            Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta;
            Vector2 controlsOriginRight = GetControlsOriginRightFromScreenSize() + originDelta;

            m_label = new MyGuiControlLabel(this, controlsOriginLeft, null, MyTextsWrapperEnum.On, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_label);
            m_on = new MyGuiControlCheckbox(this, controlsOriginLeft + new Vector2(0.1f, 0f), PrefabKinematic.CanOpen, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_on);

            AddOkAndCancelButtonControls();            
        }                
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.5f, 0.3f);
            AddCaption();

            Vector2 left = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.11f);
            Vector2 right = new Vector2(m_size.Value.X / 2.0f - 0.07f, -m_size.Value.Y / 2.0f + 0.11f);

            bool anySecret = false;
            foreach (var v in m_waypoints) if (v.IsSecret)
            {
                anySecret = true;
                break;
            }

            Controls.Add(new MyGuiControlLabel(this, left, null, MyTextsWrapperEnum.Secret, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_secretCheckbox = new MyGuiControlCheckbox(this, right - new Vector2(MyGuiConstants.CHECKBOX_SIZE.X, 0), anySecret, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));

            AddOkAndCancelButtonControls();
        }
        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;
            Vector2 controlsOriginRight = GetControlsOriginRightFromScreenSize() + originDelta;

            AddActivatedCheckbox(controlsOriginLeft, PrefabContainer.Activated);

            m_label = new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Alarm, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_label);
            m_alarmOn = new MyGuiControlCheckbox(this, controlsOriginLeft + 1 * CONTROLS_DELTA + new Vector2(0.1f, 0f), PrefabContainer.AlarmOn, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_alarmOn);

            AddOkAndCancelButtonControls();            
        }                
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.92f, 0.45f);
            Vector2 size = new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT);

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

            Vector2 originDelta = new Vector2(0.45f, 0.00f);
            Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta;            

            m_searchingDistance = new MyGuiControlSize(
                this,
                controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA,
                size,
                Vector4.Zero,
                MyTextsWrapper.Get(MyTextsWrapperEnum.SearchingDistance),
                m_prefabLargeWeapons[0].SearchingDistance,
                MyLargeShipWeaponsConstants.MIN_SEARCHING_DISTANCE,
                MyLargeShipWeaponsConstants.MAX_SEARCHING_DISTANCE,
                MyTextsWrapper.Get(MyTextsWrapperEnum.SearchingDistance),
                MyGuiSizeEnumFlags.All,
                0.3f);
            Controls.Add(m_searchingDistance);

            m_label = new MyGuiControlLabel(this, GetControlsOriginLeftFromScreenSize() + new Vector2(0.25f,0) + 3 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.On, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_label);
            m_on = new MyGuiControlCheckbox(this, GetControlsOriginLeftFromScreenSize() + new Vector2(0.25f, 0) + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.07f, 0f), m_prefabLargeWeapons[0].Enabled, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_on);

            AddActivatedCheckbox(GetControlsOriginLeftFromScreenSize() + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.5f, 0f), m_prefabLargeWeapons[0].Activated);
            //m_searchingDistance.OnValueChange += OnSearchingDistanceChanged;

            AddOkAndCancelButtonControls(new Vector2(0, -0.02f));            
        }
        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);
        }
        private void OnActivatedChecked(MyGuiControlCheckbox sender)
        {
            SaveTempEditProperties();

            InitControls();
        }
        //private void OnRequiresEnergyChecked(MyGuiControlCheckbox sender)
        //{
        //    SaveTempEditProperties();

        //    InitControls();
        //}

        private void OnIndestructibleChecked(MyGuiControlCheckbox sender)
        {
            SaveTempEditProperties();

            InitControls();
        }
Exemplo n.º 12
0
 protected MyGuiControlCheckbox AddCheckBox(StringBuilder text, bool checkedState, MyGuiControlCheckbox.OnCheckBoxCheckCallback checkBoxChange, bool enabled = true, List<MyGuiControlBase> controlGroup = null, Vector4? color = null)
 {
     MyGuiControlCheckbox checkBox = addCheckBox(text, enabled, controlGroup, color);
     checkBox.Checked = checkedState;
     checkBox.OnCheck = checkBoxChange;
     return checkBox;
 }
 protected void AddActivatedCheckbox(Vector2 position, bool value) 
 {
     Controls.Add(new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.Active, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
     m_activatedCheckbox = new MyGuiControlCheckbox(this, position + new Vector2(0.1f, 0f), value, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
     Controls.Add(m_activatedCheckbox);
 }
Exemplo n.º 14
0
        // save changes
        private void OnFilterInventorySortClick(MyGuiControlCheckbox sender)
        {
            SaveIDsFromOtherSideInventoryListbox();
            SaveIDsFromShipCustomizationListboxes(m_currentShipBuilderIndex);
            if (sender.Checked)
            {
                if (sender == m_sortAll)
                {
                    UncheckAllInventoryCheckboxes();
                }
                else
                {
                    m_sortAll.UnCheck();
                }
            }
            else if (sender == m_sortAll)
            {
                m_sortAll.Check();
            }

            FilterInventory(m_otherSideInventoryListBox, m_otherSideInventoryItemIDs, m_tempFilteredCategoriesTheirsInventory, m_otherSideInventoryHideList,
                m_sortAll, m_sortWeapons, m_sortOres, m_sortConsumables, m_sortEquipment, m_sortGods);
            if (m_tradeForMoney)
            {
                UpdateOtherSideInventoryListboxForTrading();
            }
        }
Exemplo n.º 15
0
        public void CheckChanged(MyGuiControlCheckbox sender)
        {
            m_gameTypeFilter &= ~MyGameTypes.Deathmatch;
            m_gameTypeFilter &= ~MyGameTypes.Story;

            if (m_deathCheck.Checked)
                m_gameTypeFilter |= MyGameTypes.Deathmatch;

            if (m_storyCheck.Checked)
                m_gameTypeFilter |= MyGameTypes.Story;

            GetDataFromServer(true);
        }
Exemplo n.º 16
0
 void OnCheatCheckedChanged(MyGuiControlCheckbox sender)
 {
     MyGameplayCheat cheat = (MyGameplayCheat)sender.UserData;
     MyGameplayCheats.EnableCheat(cheat.CheatEnum, sender.Checked);
 }
Exemplo n.º 17
0
 //  Constructor for YES/NO message boxes and checkBox
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum checkBoxMessage, MyTextsWrapperEnum? okButtonText, MyTextsWrapperEnum? yesButtonText, MyTextsWrapperEnum? noButtonText, MessageBoxCallback callback, out MyGuiControlCheckbox showAgainCheckBox) :
     this(type, MyMessageBoxButtonsType.YES_NO, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, true)
 {
     showAgainCheckBox = m_showAgainCheckBox;
 }
Exemplo n.º 18
0
 //  change is password is normal text or asterixs
 public void OnChangePasswordType(MyGuiControlCheckbox sender)
 {
     if (m_hidePasswordCheckbox.Checked)
         m_passwordTextbox.ChangeMyType(MyGuiControlTextboxType.PASSWORD);
     else m_passwordTextbox.ChangeMyType(MyGuiControlTextboxType.NORMAL);
 }
Exemplo n.º 19
0
        // save changes
        private void OnFilterInventoryMySortClick(MyGuiControlCheckbox sender)
        {
            SaveIDsFromOtherSideInventoryListbox();
            SaveIDsFromShipCustomizationListboxes(m_currentShipBuilderIndex);
            if (sender.Checked) 
            {
                if (sender == m_sortAllMy)
                {
                    UncheckAllMyInventoryCheckboxes();
                }
                else 
                {
                    m_sortAllMy.UnCheck();
                }
            }
            else if (sender == m_sortAllMy)
            {
                m_sortAllMy.Check();
            }

            FilterInventory(m_shipInventoryListBox, m_smallShipsInventoryItemIDs[m_currentShipBuilderIndex].Inventory, m_tempFilteredCategoriesMyInventory, m_shipInventoryHideList,
                m_sortAllMy, m_sortWeaponsMy, m_sortOresMy, m_sortConsumablesMy, m_sortEquipmentMy, m_sortGodsMy);            
        }
        public MyGuiScreenOptionsVideo()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            MyMwcLog.WriteLine("MyGuiScreenOptionsVideo.ctor START");

            m_enableBackgroundFade = true;
            m_size = new Vector2(0.59f, 0.68544f);
            m_size *= 1.1f;

            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality);
            
            AddCaption(MyTextsWrapperEnum.VideoOptions, new Vector2(0, 0.005f));
            //Controls.Add(new MyGuiControlLabel(this, -m_size.Value / 2.0f + MyGuiConstants.SCREEN_CAPTION_DELTA_Y, null, MyTextsWrapperEnum.VideoOptions, MyGuiConstants.SCREEN_CAPTION_TEXT_COLOR, MyGuiConstants.SCREEN_CAPTION_TEXT_SCALE));

            Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.05f, -m_size.Value.Y / 2.0f + 0.145f) + new Vector2(0.02f,0f);
            Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.185f, -m_size.Value.Y / 2.0f + 0.145f) + new Vector2(0.043f,0f);
            controlsOriginRight.X += 0.04f;


            int controlIndex = 0;

            // Adapter

            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VideoAdapter, MyGuiConstants.LABEL_TEXT_COLOR,
             MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            m_videoAdapterCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_videoAdapterCombobox.OnSelect += OnVideoAdapterSelected;
            AddAdaptersToComboBox();
            Controls.Add(m_videoAdapterCombobox);

            //  Video Mode
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VideoMode, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            m_videoModeCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            //  Populating Video Mode with supported DisplayMode reported by XNA framework
            m_videoModeCombobox.OnSelect += OnVideoModeSelected;
            //Added on UpdateSettings
            //AddDisplayModesToComboBox(MyMinerGame.GraphicsDeviceManager.GraphicsAdapter.AdapterOrdinal);
            Controls.Add(m_videoModeCombobox);

            //  Recommended aspect ratio
            m_recommendAspectRatioLabel = new MyGuiControlLabel(this, new Vector2(controlsOriginRight.X + MyGuiConstants.COMBOBOX_TEXT_OFFSET.X, controlsOriginRight.Y + controlIndex++ * MyGuiConstants.CONTROLS_DELTA.Y - 0.015f), null,
                    new StringBuilder(), MyGuiConstants.LABEL_TEXT_COLOR * 0.9f, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS * 0.85f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            //Added on UpdateSettings
            //UpdateRecommendecAspectRatioLabel(MyMinerGame.GraphicsDeviceManager.GraphicsAdapter.AdapterOrdinal);
            Controls.Add(m_recommendAspectRatioLabel);

            //  reduce the spacing between "Recommended aspect ratio" and items below it
            Vector2 offSet = new Vector2(0, MyGuiConstants.CONTROLS_DELTA.Y / 2);
            controlsOriginLeft -= offSet;
            controlsOriginRight -= offSet;

            //  Fullscreen
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Fullscreen, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            m_fullscreenCheckbox = new MyGuiControlCheckbox(this,
                                 controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA +
                                 new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                                 true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            //m_fullscreenCheckbox.OnCheck = OnFullScreenCheck;
            Controls.Add(m_fullscreenCheckbox);

            //  Vertical Sync
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VerticalSync, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            //m_verticalSyncCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            

            m_verticalSyncCheckbox = new MyGuiControlCheckbox(this,
                                 controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA +
                                 new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                                 false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            Controls.Add(m_verticalSyncCheckbox);


            //  Hardware Cursor
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.HardwareCursor, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            m_hardwareCursorCheckbox = new MyGuiControlCheckbox(this,
                                 controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA +
                                 new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                                 false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            Controls.Add(m_hardwareCursorCheckbox);

            //  Render Quality            
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RenderQuality, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            m_renderQualityCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.LOW, MyTextsWrapperEnum.RenderQualityLow);
            m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.NORMAL, MyTextsWrapperEnum.RenderQualityNormal);
            m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.HIGH, MyTextsWrapperEnum.RenderQualityHigh);
            m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.EXTREME, MyTextsWrapperEnum.RenderQualityExtreme);
            Controls.Add(m_renderQualityCombobox);

            // Field of View
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.FieldOfView, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            const float fovSliderSize = MyGuiConstants.SLIDER_WIDTH * 1.1f;
            m_fieldOfViewSlider = new MyGuiControlSlider(this, controlsOriginRight + controlIndex * MyGuiConstants.CONTROLS_DELTA + new Vector2(fovSliderSize / 2.0f, 0),
                fovSliderSize, MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS * 0.85f);
            m_fieldOfViewSlider.OnChange = OnFovChanged;
            Controls.Add(m_fieldOfViewSlider);

            m_fieldOfViewLabel = new MyGuiControlLabel(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(fovSliderSize * 1.1f, 0),
                null, new StringBuilder("{0:F1}"), MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            Controls.Add(m_fieldOfViewLabel);

            m_fieldOfViewDefaultLabel = new MyGuiControlLabel(this, controlsOriginRight + controlIndex++ * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.009f, 0),
                null, MyTextsWrapper.Get(MyTextsWrapperEnum.DefaultFOV), MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, MyGuiManager.GetFontMinerWarsBlue());
            m_fieldOfViewDefaultLabel.UpdateParams(MathHelper.ToDegrees(MyConstants.FIELD_OF_VIEW_CONFIG_DEFAULT));
            Controls.Add(m_fieldOfViewDefaultLabel);

            //MyGuiManager.GetFontMinerWarsBlue()
            //  Brightness
            //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 8 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Brightness, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            //  Contrast
            //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 9 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Contrast, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            //m_contrastTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 9 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_WIDTH / 2.0f, 0), MyGuiConstants.TEXTBOX_WIDTH, "Opicka©123456", 20, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiControlTextboxType.NORMAL);
            //Controls.Add(m_contrastTextbox);

            //  Buttons APPLY and BACK


            var m_okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2269f), MyGuiConstants.OK_BUTTON_SIZE,
                                   MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                   MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok,
                                   MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnApplyClick,
                                   true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_okButton);
            //Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
             //   MyTextsWrapperEnum.Apply, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnApplyClick, 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.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnBackClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.1428f, 0.2269f), MyGuiConstants.OK_BUTTON_SIZE,
                       MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                       MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Back,
                       MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnBackClick,
                       true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_cancelButton);

            //  Update controls with values from config file
            UpdateFromConfig();
            UpdateControls(m_settingsOld);

            //  Update OLD settings
            UpdateSettings(m_settingsOld);
            UpdateSettings(m_settingsNew);

            MyMwcLog.WriteLine("MyGuiScreenOptionsVideo.ctor END");
        }
Exemplo n.º 21
0
        public MyGuiScreenRegister(MyGuiScreenBase openAfterSuccesfullRegistration, string login, string password)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_enableBackgroundFade = true;
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality);

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

            m_openAfterSuccesfullRegistration = openAfterSuccesfullRegistration;
            //  If user presses enter in any control, we call this method. It's default ENTER.
            this.OnEnterCallback = delegate { OnOkClick(null); };

            Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.125f + 0.018f);
            Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.32f, -m_size.Value.Y / 2.0f + 0.125f + 0.018f );
            Vector2 checkboxControlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.35f, -m_size.Value.Y / 2.0f + 0.125f);

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

            // Choose a username
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseUsername, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_usernameTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 0.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.USERNAME_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            Controls.Add(m_usernameTextbox);            

            // Choose a password
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.ChoosePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.PASSWORD);
            Controls.Add(m_passwordTextbox);

            // Retype password
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RetypePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_retypePasswordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 2.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.PASSWORD);
            Controls.Add(m_retypePasswordTextbox);

            // Email address
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.EmailAddress, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_emailTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 3.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.EMAIL_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            Controls.Add(m_emailTextbox);            

            // Send me newsletters
            Controls.Add(new MyGuiControlLabel(this, (new Vector2(0.05f,0) + controlsOriginLeft) + 5.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SendNewsletters, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_sendNewslettersCheckbox = new MyGuiControlCheckbox(this,
             controlsOriginLeft + 5.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
             MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
             MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
             true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);


            //m_sendNewslettersCheckbox = new MyGuiControlCheckbox(this, controlsOriginLeft + 6f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_sendNewslettersCheckbox);

            bool remember = MyConfig.RememberUsernameAndPassword;

            // Remember me
            Controls.Add(new MyGuiControlLabel(this, (new Vector2(0.05f, 0) + controlsOriginLeft) + 6.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RememberMe, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_rememberCheckbox = new MyGuiControlCheckbox(this,
                 controlsOriginLeft + 6.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                 MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                 remember, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            Controls.Add(m_rememberCheckbox);
            /*
            // Buttons APPLY and BACK
            Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f);
            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));
            */

            var okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2558f), MyGuiConstants.OK_BUTTON_SIZE,
                       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(okButton);

            var cancelButton = new MyGuiControlButton(this, new Vector2(0.1418f, 0.2558f), MyGuiConstants.OK_BUTTON_SIZE,
           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(cancelButton);


            if (login != null) 
            {
                m_usernameTextbox.Text = login;
            }
            if (password != null) 
            {
                m_passwordTextbox.Text = password;
                m_retypePasswordTextbox.Text = password;
            }
        }
Exemplo n.º 22
0
        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 MyGuiScreenEditorSelectAndHide()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.5f, 0.4025f + (TYPE_COUNT + 4) * MyGuiConstants.CONTROLS_DELTA.Y + 1.3f * MyGuiConstants.CONTROLS_DELTA.Y);

            AddCaption(MyTextsWrapperEnum.EditorSelectAndHide, new Vector2(0, 0.01f));

            Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.08f, -m_size.Value.Y / 2.0f + 0.1f);
            Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.181f, -m_size.Value.Y / 2.0f + 0.1f);

            Vector2 pos = controlsOriginLeft;
            Vector2 tab1 = new Vector2(0.19f, 0);
            Vector2 tab2 = new Vector2(0.29f, 0);

            Controls.Add(new MyGuiControlLabel(this, pos + tab1, null, MyTextsWrapperEnum.Selectable, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));
            Controls.Add(new MyGuiControlLabel(this, pos + tab2, null, MyTextsWrapperEnum.Visible, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));

            for (int i = 0; i < m_checkboxVisible.Length; i++)
            {
                pos += MyGuiConstants.CONTROLS_DELTA - new Vector2(0,0.0025f);
                Controls.Add(new MyGuiControlLabel(this, pos, null, rowLabels[i], MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_checkboxSelectable[i] = new MyGuiControlCheckbox(this, pos + tab1, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));
                Controls.Add(m_checkboxVisible[i] = new MyGuiControlCheckbox(this, pos + tab2, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));

                // uncheck Visible: uncheck its Selectable
                m_checkboxVisible[i].OnCheck = delegate(MyGuiControlCheckbox sender)
                {
                    if (!sender.Checked)
                        for (int j = 0; j < m_checkboxVisible.Length; j++)
                            if (m_checkboxVisible[j] == sender)
                                m_checkboxSelectable[j].Checked = false;
                };
                // check Selectable: check its Visible
                m_checkboxSelectable[i].OnCheck = delegate(MyGuiControlCheckbox sender)
                {
                    if (sender.Checked)
                        for (int j = 0; j < m_checkboxSelectable.Length; j++)
                            if (m_checkboxSelectable[j] == sender)
                                m_checkboxVisible[j].Checked = true;
                };
            }

            //safe areas
            pos += MyGuiConstants.CONTROLS_DELTA;
            Controls.Add(new MyGuiControlLabel(this, pos, null, MyTextsWrapperEnum.SafeAreaDummies, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_checkboxSafeAreasSelectable = new MyGuiControlCheckbox(this, pos + tab1, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));
            Controls.Add(m_checkboxSafeAreasVisible = new MyGuiControlCheckbox(this, pos + tab2, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));

            //detectors
            pos += MyGuiConstants.CONTROLS_DELTA;
            Controls.Add(new MyGuiControlLabel(this, pos, null, MyTextsWrapperEnum.DetectorDummies, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_checkboxDetectorsSelectable = new MyGuiControlCheckbox(this, pos + tab1, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));
            Controls.Add(m_checkboxDetectorsVisible = new MyGuiControlCheckbox(this, pos + tab2, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));

            //particle effects
            pos += MyGuiConstants.CONTROLS_DELTA;
            Controls.Add(new MyGuiControlLabel(this, pos, null, MyTextsWrapperEnum.ParticleDummies, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_checkboxParticleEffectsSelectable = new MyGuiControlCheckbox(this, pos + tab1, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));
            Controls.Add(m_checkboxParticleEffectsVisible = new MyGuiControlCheckbox(this, pos + tab2, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));
            
            // uncheck Visible: uncheck its Selectable
            m_checkboxSafeAreasVisible.OnCheck = delegate(MyGuiControlCheckbox sender) { if (!sender.Checked) m_checkboxSafeAreasSelectable.Checked = false; };
            m_checkboxDetectorsVisible.OnCheck = delegate(MyGuiControlCheckbox sender) { if (!sender.Checked) m_checkboxDetectorsSelectable.Checked = false; };
            m_checkboxParticleEffectsVisible.OnCheck = delegate(MyGuiControlCheckbox sender) { if (!sender.Checked) m_checkboxParticleEffectsSelectable.Checked = false; };
            
            // check Selectable: check its Visible
            m_checkboxSafeAreasSelectable.OnCheck = delegate(MyGuiControlCheckbox sender) { if (sender.Checked) m_checkboxSafeAreasVisible.Checked = true; };
            m_checkboxDetectorsSelectable.OnCheck = delegate(MyGuiControlCheckbox sender) { if (sender.Checked) m_checkboxDetectorsVisible.Checked = true; };
            m_checkboxParticleEffectsSelectable.OnCheck = delegate(MyGuiControlCheckbox sender) { if (sender.Checked) m_checkboxParticleEffectsVisible.Checked = true; };

            //  Are snap points hidden?
            pos += MyGuiConstants.CONTROLS_DELTA;
            Controls.Add(new MyGuiControlLabel(this, pos, null, MyTextsWrapperEnum.SnapPoints, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_checkboxSnapPointsVisible = new MyGuiControlCheckbox(this, pos + tab2, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));

            //  Do waypoints ignore depth?
            pos += MyGuiConstants.CONTROLS_DELTA * 1.2f;
            Controls.Add(new MyGuiControlLabel(this, pos, null, MyTextsWrapperEnum.WaypointsIgnoreDepth, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_checkboxWaypointIgnoreDepth = new MyGuiControlCheckbox(this, pos + tab2, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));

            //  Generators range visible
            pos += MyGuiConstants.CONTROLS_DELTA;
            Controls.Add(new MyGuiControlLabel(this, pos, null, MyTextsWrapperEnum.GeneratorsRange, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_checkboxGeneratorsRangeVisible = new MyGuiControlCheckbox(this, pos + tab2, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));

            //  Large weapons range visible
            pos += MyGuiConstants.CONTROLS_DELTA;
            Controls.Add(new MyGuiControlLabel(this, pos, null, MyTextsWrapperEnum.LargeWeaponsRange, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_checkboxLargeWeaponsRangeVisible = new MyGuiControlCheckbox(this, pos + tab2, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));

            //  Display deactivated entities
            pos += MyGuiConstants.CONTROLS_DELTA;
            Controls.Add(new MyGuiControlLabel(this, pos, null, MyTextsWrapperEnum.DisplayDeactivatedEntities, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_checkboxDisplayDeactivatedEntities = new MyGuiControlCheckbox(this, pos + tab2, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));            

            //  Buttons OK and CANCEL
            Vector2 buttonDelta = new Vector2(0.09f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f - 0.025f);
            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));

            InitControls();
        }
Exemplo n.º 24
0
        public MyGuiScreenMessageBox(MyMessageBoxType type, MyMessageBoxButtonsType buttonType, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum? okButtonText, MyTextsWrapperEnum? yesButtonText, MyTextsWrapperEnum? noButtonText, MessageBoxCallback callback, bool enableCheckBox, Vector2 buttonSize)            
            : base(new Vector2(0.5f, 0.5f), null, null, true, null)
        {
            InstantClose = true;

            MyMessageBoxConfiguration config = m_typesConfiguration[(int)type];
            m_backgroundColor = config.BackgroundColor;
            m_backgroundTexture = config.Texture;
            m_textColor = config.TextColor;
            m_interferenceVideoColor = config.InterferenceVideoColor;

            m_enableBackgroundFade = true;

            m_buttonType = buttonType;
            m_okButtonText = okButtonText;
            m_yesButtonText = yesButtonText;
            m_noButtonText = noButtonText;
            m_callback = callback;            
            m_drawEvenWithoutFocus = true;
            m_screenCanHide = false;
            m_buttonSize = buttonSize;                    

            //  Recalculate heigh of message box screen, so it will auto-adapt to message size and maybe make split it on more lines
            Vector2 textSize = MyGuiManager.GetNormalizedSize(config.Font, messageText, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE);
            Vector2 captionSize = MyGuiManager.GetNormalizedSize(config.Font, messageCaption, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE);
            m_size = new Vector2(Math.Max(2f * m_buttonSize.X + 0.1f, textSize.X) + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X, 
                                3 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y + captionSize.Y + textSize.Y + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y)+ new Vector2();

            //if (type == MyMessageBoxType.MESSAGE) m_size = m_size + new Vector2(0.1f, 0.1f);
            //m_size. =m_size.Value.Y * 1.1f;
            if (enableCheckBox)
            {
                m_size = new Vector2(m_size.Value.X, m_size.Value.Y + 0.05f);
            }

            //  Message box caption
            MyGuiControlLabel captionLabel = new MyGuiControlLabel(this, new Vector2(0, -m_size.Value.Y / 2.0f + captionSize.Y / 2.0f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y),
                null, messageCaption, m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,config.Font);
            Controls.Add(captionLabel);

            //  Message box text
            m_messageBoxText = new MyGuiControlLabel(this, new Vector2(0f, captionLabel.GetPosition().Y + textSize.Y / 2.0f + 1.0f * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y), null, messageText,
                m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, config.Font);
            Controls.Add(m_messageBoxText);

            float deltaY = 0;

            if (enableCheckBox)
            {
                const float CHECKBOX_DELTA_Y = 0.01f;

                // CheckBox to not show again this message box
                m_showAgainCheckBox = new MyGuiControlCheckbox(this, new Vector2(-0.02f,
                    m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f + 2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y),
                    true, config.ButtonColor);
                Controls.Add(m_showAgainCheckBox);
                Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f +
                    2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y) + 0 * MyGuiConstants.CONTROLS_DELTA, null,
                    MyTextsWrapper.Get(MyTextsWrapperEnum.DecreaseVideoSettingsCheckBox), m_textColor,
                    MyGuiConstants.LABEL_TEXT_SCALE * 0.75f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, config.Font));
            }

            //  Buttons
            Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - m_buttonSize.Y / 2.0f);
            if (m_buttonType == MyMessageBoxButtonsType.OK)
            {

                    //Controls.Add(new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor,
                    //null,null,null,
                    //m_okButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick,
                    //true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true));

                var okButton = new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                    config.ButtonColor,
                    config.ButtonTexture, null, null, m_okButtonText.Value,
                    m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick,
                    true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(okButton);


            }
            else if ((m_buttonType == MyMessageBoxButtonsType.YES_NO) || (m_buttonType == MyMessageBoxButtonsType.YES_NO_TIMEOUT))
            {

                var okButton = new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                        config.ButtonColor,
                        config.ButtonTexture, null, null, m_yesButtonText.Value,
                        m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick,
                        true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(okButton);

                var noButton = new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                    config.ButtonColor,
                    config.ButtonTexture, null, null, m_noButtonText.Value,
                    m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick,
                    true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(noButton);


                //Controls.Add(new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor,
                //    null,null,null,
                //    m_yesButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true));

                //Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor,
                //    null,null,null,
                //    m_noButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true));
            }
            else if (m_buttonType == MyMessageBoxButtonsType.NONE)
            {
            }
            else
            {
                throw new MyMwcExceptionApplicationShouldNotGetHere();
            }
        }                
        private void AddControls()
        {
            m_keyButtonsDictionary = new Dictionary<MyControl, MyGuiControlButton>();
            m_mouseButtonsDictionary = new Dictionary<MyControl, MyGuiControlButton>();
            m_joystickButtonsDictionary = new Dictionary<MyControl, MyGuiControlButton>();
            m_joystickAxesDictionary = new Dictionary<MyControl, MyGuiControlButton>();
            m_keyButtons = new List<MyGuiControlButton>();
            m_mouseButtons = new List<MyGuiControlButton>();
            m_joystickButtons = new List<MyGuiControlButton>();
            m_joystickAxes = new List<MyGuiControlButton>();

            //  "General" page is little bit too complex, so I need to create it separately.
            #region AddControlsByType(MyGuiInputTypeEnum.GENERAL_CONTROL);

            m_allControls[MyGuiControlTypeEnum.General] = new List<MyGuiControlBase>();

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.InvertMouseX, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            //m_invertMouseXCheckbox = new MyGuiControlCheckbox(this, m_controlsOriginRight + 2 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), MyGuiManager.GetInput().GetMouseXInversion(), MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            m_invertMouseXCheckbox = new MyGuiControlCheckbox(this,
                     m_controlsOriginRight + 2 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                     MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                     MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                     MyGuiManager.GetInput().GetMouseXInversion(), MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);

            m_allControls[MyGuiControlTypeEnum.General].Add(m_invertMouseXCheckbox);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 3 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.InvertMouseY, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            //m_invertMouseYCheckbox = new MyGuiControlCheckbox(this, m_controlsOriginRight + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), MyGuiManager.GetInput().GetMouseYInversion(), MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            m_invertMouseYCheckbox = new MyGuiControlCheckbox(this,
                 m_controlsOriginRight + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                 MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                 MyGuiManager.GetInput().GetMouseYInversion(), MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);

            m_allControls[MyGuiControlTypeEnum.General].Add(m_invertMouseYCheckbox);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 4 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.MouseSensitivity, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_mouseSensitivitySlider = new MyGuiControlSlider(this, m_controlsOriginRight + 4 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X, 0.0f, 3.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, 0, MyGuiConstants.LABEL_TEXT_SCALE);
            m_mouseSensitivitySlider.SetValue(MyGuiManager.GetInput().GetMouseSensitivity());
            m_allControls[MyGuiControlTypeEnum.General].Add(m_mouseSensitivitySlider);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 8.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Joystick, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_joystickCombobox = new MyGuiControlCombobox(this, m_controlsOriginRight + 8.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_joystickCombobox.OnSelect += OnSelectJoystick;
            AddJoysticksToComboBox();
            m_allControls[MyGuiControlTypeEnum.General].Add(m_joystickCombobox);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 10 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.JoystickSensitivity, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_joystickSensitivitySlider = new MyGuiControlSlider(this, m_controlsOriginRight + 10 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X, 0.1f, 6.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, 0, MyGuiConstants.LABEL_TEXT_SCALE);
            m_joystickSensitivitySlider.SetValue(MyGuiManager.GetInput().GetJoystickSensitivity());
            m_allControls[MyGuiControlTypeEnum.General].Add(m_joystickSensitivitySlider);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 11 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.JoystickExponent, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_joystickExponentSlider = new MyGuiControlSlider(this, m_controlsOriginRight + 11 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X, 1.0f, 8.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, 0, MyGuiConstants.LABEL_TEXT_SCALE);
            m_joystickExponentSlider.SetValue(MyGuiManager.GetInput().GetJoystickExponent());
            m_allControls[MyGuiControlTypeEnum.General].Add(m_joystickExponentSlider);

            m_allControls[MyGuiControlTypeEnum.General].Add(new MyGuiControlLabel(this, m_controlsOriginLeft + 12 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.JoystickDeadzone, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_joystickDeadzoneSlider = new MyGuiControlSlider(this, m_controlsOriginRight + 12 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X, 0.0f, 0.5f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, 0, MyGuiConstants.LABEL_TEXT_SCALE);
            m_joystickDeadzoneSlider.SetValue(MyGuiManager.GetInput().GetJoystickDeadzone());
            m_allControls[MyGuiControlTypeEnum.General].Add(m_joystickDeadzoneSlider);




            #endregion
            AddControlsByType(MyGuiControlTypeEnum.Navigation);
            AddControlsByType(MyGuiControlTypeEnum.Systems1);
            AddControlsByType(MyGuiControlTypeEnum.Systems2);
            AddControlsByType(MyGuiControlTypeEnum.Weapons);
            AddControlsByType(MyGuiControlTypeEnum.SpecialWeapons);
            AddControlsByType(MyGuiControlTypeEnum.Editor);

            //There are no controls for this category now, so hide it completely and uncomment, when we have new comms controls
            //AddControlsByType(MyGuiInputTypeEnum.Communications);
            RefreshJoystickControlEnabling();
        }
Exemplo n.º 26
0
 protected MyGuiControlCheckbox AddCheckBox(MyTextsWrapperEnum textEnum, bool checkedState, MyGuiControlCheckbox.OnCheckBoxCheckCallback checkBoxChange, bool enabled = true, List<MyGuiControlBase> controlGroup = null, Vector4? color = null)
 {
     return AddCheckBox(MyTextsWrapper.Get(textEnum), checkedState, checkBoxChange, enabled, controlGroup, color);
 }
Exemplo n.º 27
0
 private void FilterInventory(MyGuiControlListbox listbox, List<int> itemsIDs, List<ItemCategory> filter, List<int> hideList,
     MyGuiControlCheckbox checkboxAll, MyGuiControlCheckbox checkboxWeapons, MyGuiControlCheckbox checkboxOres,
     MyGuiControlCheckbox checkboxConsumables, MyGuiControlCheckbox checkboxEquipment, MyGuiControlCheckbox checkboxGods)
 {
     if (listbox != null)
     {                
         listbox.RemoveAllItems();
         listbox.ResetScrollbarPosition();
         filter.Clear();
         if (!checkboxAll.Checked) 
         {
             if (checkboxWeapons.Checked) filter.AddRange(MyItemFilterConstants.CategoryAmmo);
             if (checkboxOres.Checked) filter.AddRange(MyItemFilterConstants.Ores);
             if (checkboxConsumables.Checked) filter.AddRange(MyItemFilterConstants.ConsumAndMedical);
             if (checkboxEquipment.Checked) filter.AddRange(MyItemFilterConstants.Devices);
             if (checkboxGods.Checked) filter.AddRange(MyItemFilterConstants.GoodsAndIllegal);
         }
         FillListBoxFromIDs(listbox, itemsIDs, filter, ref hideList);
         AddFreeRowsIfCan(listbox, 1);
     }
 }
Exemplo n.º 28
0
        public MyGuiScreenLogin(string username, string password, MyGuiScreenBase openAfterSuccessfulLogin, bool simple = false)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_simple = simple;
            m_enableBackgroundFade = true;
            m_openAfterSuccessfulLogin = openAfterSuccessfulLogin;
            m_size = new Vector2(1030f / 1600f, 674 / 1200f);
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\LoginBackground", flags: TextureFlags.IgnoreQuality);
            //  If user presses enter in any control, we call this method. It's default ENTER.
            this.OnEnterCallback = delegate { OnOkClick(null); };

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

            AddCaption(MyTextsWrapperEnum.Login);

            //  Player name
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.PlayerName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_usernameTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 0 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, username, MyMwcValidationConstants.USERNAME_LENGTH_MAX, MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR/*TEXTBOX_BACKGROUND_COLOR*/, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            Controls.Add(m_usernameTextbox);

            //  Password
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Password, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            //m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_WIDTH / 2.0f, 0), true, MyGuiConstants.LABEL_TEXT_COLOR);
            m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, password, MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR/*TEXTBOX_BACKGROUND_COLOR*/, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            Controls.Add(m_passwordTextbox);

            bool remember = MyConfig.RememberUsernameAndPassword;
            bool autologin = MyConfig.Autologin;


            m_hidePasswordCheckbox = new MyGuiControlCheckbox(this,
                  new Vector2(0.1950f,-0.0793f), 
                  MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                 true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            //m_hidePasswordCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight - 0.025f * Vector2.UnitX + MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_hidePasswordCheckbox);
            m_hidePasswordCheckbox.OnCheck = OnChangePasswordType;
            OnChangePasswordType(m_hidePasswordCheckbox);



            //  Remember
            m_rememberCheckbox = new MyGuiControlCheckbox(this,
                     controlsOriginRight + 2.25f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                     MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                     MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                     remember, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);

            if (!m_simple)
            {
                Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2.25f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RememberMe, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_rememberCheckbox);
            }

            //  Auto-login
            m_autologinCheckbox = new MyGuiControlCheckbox(this,
                     controlsOriginRight + 3.25f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                     MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                     MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                     autologin, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            
            if (!m_simple)
            {
                Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3.25f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Autologin, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_autologinCheckbox);
            }


            //  Buttons APPLY and BACK
            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);


            var okButton = new MyGuiControlButton(this, new Vector2(-0.1861f, 0.1611f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                Vector4.One,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Ok,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            var cancelButton = new MyGuiControlButton(this, new Vector2(-0.0461f, 0.1611f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                Vector4.One,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Cancel,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);

            var registerButton = new MyGuiControlButton(this, new Vector2(0.1924f, 0.1611f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                Vector4.One,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Register,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnRegisterClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(okButton);
            Controls.Add(cancelButton);

            if (!m_simple)
            {
                Controls.Add(registerButton);
            }

            //  Hide password
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.2164f,-0.0793f),  null, MyTextsWrapperEnum.HidePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));


        }
Exemplo n.º 29
0
        private void InitControls(StringBuilder otherSideInventoryName)
        {
            Vector2 topLeft = new Vector2(-m_size.Value.X / 2.0f + 0.05f, -m_size.Value.Y / 2.0f + 0.1f);
            Vector2 topRight = new Vector2(m_size.Value.X / 2.0f - 0.05f, -m_size.Value.Y / 2.0f + 0.1f);

            List<MyGuiControlListbox> listboxToDrop = new List<MyGuiControlListbox>();
            m_listboxDropConditions = new Dictionary<MyGuiControlListbox, Predicate<MyInventoryItem>>();

            m_inventoryItemTexture = null;
            m_inventoryScrollBarTexture = MyGuiManager.GetInventoryScreenListboxScrollBarTexture();

            #region my ship's inventory and customization

            // Ship's inventory label
            Controls.Add(new MyGuiControlLabel(this,
                                               new Vector2(0.1959f, -0.357f), null,
                                               MyTextsWrapperEnum.ShipInventory, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                               MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                                               MyGuiManager.GetFontMinerWarsBlue()));

            // Ship's inventory capacity label
            m_shipInventoryCapacityLabel = new MyGuiControlLabel(this,
                                                                 new Vector2(0.4f, -0.357f), null, MyTextsWrapperEnum.InventoryCapacityLabel,
                                                                 MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                 MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
            Controls.Add(m_shipInventoryCapacityLabel);

            // Ship inventory listbox
            m_shipInventoryListBox = new MyGuiControlListbox(this,
                                                             new Vector2(0.3211f, -0.1425f),
                                                             MyGuiConstants.LISTBOX_SMALL_SIZE + new Vector2(0,0.003f),
                                                             new Vector4(0f, 0f, 0f, 0f),
                                                             null,
                                                             MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                             INVENTORY_COLUMNS, INVENTORY_DISPLAY_ROWS,
                                                             INVENTORY_COLUMNS, true, true, false,
                                                             null,
                                                             null,
                                                             m_inventoryScrollBarTexture,
                                                             null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0.03f, 0, 0, 0, -0.005f, -0.01f, -0.016f, -0.017f);
            InitializeListboxDragAndAddToControls(m_shipInventoryListBox);
            listboxToDrop.Add(m_shipInventoryListBox);
            m_listboxDropConditions.Add(m_shipInventoryListBox, ii => true);

            // Left weapons inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.2637f, 0.2903f),
                                               null, MyTextsWrapperEnum.LeftWeapons, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            
            m_leftWeaponListboxes = new List<MyGuiControlListbox>();
            var leftWeapon1InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.3075f, 0.2203f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0.02f, 0f, 0f, 0f, 0, 0, 0);


            leftWeapon1InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon1InventoryListBox);
            leftWeapon1InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon1InventoryListBox);
            listboxToDrop.Add(leftWeapon1InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon1InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon2InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.2363f, 0.2303f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon2InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon2InventoryListBox);
            leftWeapon2InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon2InventoryListBox);
            listboxToDrop.Add(leftWeapon2InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon2InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon3InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.1668f, 0.2303f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon3InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon3InventoryListBox);
            leftWeapon3InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon3InventoryListBox);
            listboxToDrop.Add(leftWeapon3InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon3InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon4InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.1659f, 0.1374f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon4InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon4InventoryListBox);
            leftWeapon4InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon4InventoryListBox);
            listboxToDrop.Add(leftWeapon4InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon4InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon5InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.0946f, 0.1374f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon5InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon5InventoryListBox);
            leftWeapon5InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon5InventoryListBox);
            listboxToDrop.Add(leftWeapon5InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon5InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            // Right weapons inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.2021f, 0.2909f),
                                               null, MyTextsWrapperEnum.RighWeapons, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            
            m_rightWeaponListboxes = new List<MyGuiControlListbox>();
            var rightWeapon1InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.0877f, 0.1362f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon1InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon1InventoryListBox);
            rightWeapon1InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon1InventoryListBox);
            listboxToDrop.Add(rightWeapon1InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon1InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon2InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.1599f, 0.1362f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon2InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon2InventoryListBox);
            rightWeapon2InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon2InventoryListBox);
            listboxToDrop.Add(rightWeapon2InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon2InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon3InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.1581f, 0.2303f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon3InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon3InventoryListBox);
            rightWeapon3InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon3InventoryListBox);
            listboxToDrop.Add(rightWeapon3InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon3InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon4InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.2293f, 0.2303f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon4InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon4InventoryListBox);
            rightWeapon4InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon4InventoryListBox);
            listboxToDrop.Add(rightWeapon4InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon4InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon5InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.2997f, 0.2303f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon5InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon5InventoryListBox);
            rightWeapon5InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon5InventoryListBox);
            listboxToDrop.Add(rightWeapon5InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon5InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            // Engine inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, 0.1846f),
                                               null, MyTextsWrapperEnum.Engine, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Engine inventory listbox
            m_engineInventoryListBox = new MyGuiControlListbox(this,
                                                               new Vector2(-0.0042f, 0.1256f),
                                                               MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                               MyTextsWrapper.Get(MyTextsWrapperEnum.Engine),
                                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                               1, 1, 1, true, false, false,
                                                               null, m_inventoryItemTexture,
                                                               null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_engineInventoryListBox.DisplayHighlight = false;
            m_engineInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_engineInventoryListBox);
            listboxToDrop.Add(m_engineInventoryListBox);
            m_listboxDropConditions.Add(m_engineInventoryListBox,
                                        ii => ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Engine);

            // Back universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0626f, 0.3374f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncherBackTitle, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            // Back universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0626f, 0.3531f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncher, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));


            // Back universal launcher inventory listbox
            m_backUniversalLauncherInventoryListBox = new MyGuiControlListbox(this,
                                                                              new Vector2(-0.0605f, 0.2755f),
                                                                              MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                              new Vector4(1f, 1f, 1f, 0f),
                                                                              MyTextsWrapper.Get(MyTextsWrapperEnum.WeaponUniversalLauncherBack),
                                                                              MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                              1, 1, 1, true, false, false,
                                                                              null, m_inventoryItemTexture,
                                                                              null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_backUniversalLauncherInventoryListBox.DisplayHighlight = false;
            m_backUniversalLauncherInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_backUniversalLauncherInventoryListBox);
            listboxToDrop.Add(m_backUniversalLauncherInventoryListBox);
            m_listboxDropConditions.Add(m_backUniversalLauncherInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        ii.ObjectBuilderId.Value == 9);

            // Armor inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0573f, 0.3374f),
                                               null, MyTextsWrapperEnum.Armor, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Armor inventory listbox
            m_armorInventoryListBox = new MyGuiControlListbox(this,
                                                              new Vector2(0.0555f, 0.2755f),
                                                              MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                              MyTextsWrapper.Get(MyTextsWrapperEnum.Armor),
                                                              MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                              1, 1, 1, true, false, false,
                                                              null, m_inventoryItemTexture,
                                                              null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_armorInventoryListBox.DisplayHighlight = false;
            m_armorInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_armorInventoryListBox);
            listboxToDrop.Add(m_armorInventoryListBox);
            m_listboxDropConditions.Add(m_armorInventoryListBox,
                                        ii => ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Armor);

            // Front universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, 0.0323f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncherFrontTitle, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            // Front universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, 0.0462f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncher, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            // Front universal launcher inventory listbox
            m_frontUniversalLauncherInventoryListBox = new MyGuiControlListbox(this,
                                                                               new Vector2(-0.0039f, -0.0287f),
                                                                               MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                                               MyTextsWrapper.Get(MyTextsWrapperEnum.WeaponUniversalLauncherFront),
                                                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                               1, 1, 1, true, false, false,
                                                                               null, m_inventoryItemTexture,
                                                                               null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_frontUniversalLauncherInventoryListBox.DisplayHighlight = false;
            m_frontUniversalLauncherInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_frontUniversalLauncherInventoryListBox);
            listboxToDrop.Add(m_frontUniversalLauncherInventoryListBox);
            m_listboxDropConditions.Add(m_frontUniversalLauncherInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        ii.ObjectBuilderId.Value == 10);

            // Drill inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0920f, 0.0547f),
                                               null, MyTextsWrapperEnum.Drill, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0920f, 0.0715f),
                                   null, MyTextsWrapperEnum.device, MyGuiConstants.LABEL_TEXT_COLOR,
                                   MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Drill inventory listbox
            m_drillInventoryListBox = new MyGuiControlListbox(this,
                                                              new Vector2(-0.0944f, -0.0044f),
                                                              MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                              MyTextsWrapper.Get(MyTextsWrapperEnum.Drill),
                                                              MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                              1, 1, 1, true, false, false,
                                                              null, m_inventoryItemTexture,
                                                              null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_drillInventoryListBox.DisplayHighlight = false;
            m_drillInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_drillInventoryListBox);
            listboxToDrop.Add(m_drillInventoryListBox);
            m_listboxDropConditions.Add(m_drillInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value));

            // Harvesting tool inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0861f, 0.0559f),
                                               null, MyTextsWrapperEnum.Harvester, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Harvesting tool inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0861f, 0.0703f),
                                               null, MyTextsWrapperEnum.device, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Harvesting tool inventory listbox
            m_harvestingToolInventoryListBox = new MyGuiControlListbox(this,
                                                                       new Vector2(0.0843f, -0.0044f),
                                                                       MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                                       MyTextsWrapper.Get(MyTextsWrapperEnum.WeaponHarvestingDevice),
                                                                       MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                       1, 1, 1, true, false, false,
                                                                       null, m_inventoryItemTexture,
                                                                       null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_harvestingToolInventoryListBox.DisplayHighlight = false;
            m_harvestingToolInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_harvestingToolInventoryListBox);
            listboxToDrop.Add(m_harvestingToolInventoryListBox);
            m_listboxDropConditions.Add(m_harvestingToolInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        ii.ObjectBuilderId.Value == 11);

            #endregion

            // money information
            m_playersMoneyLabel = new MyGuiControlLabel(this, new Vector2(0.355f, 0.1450f), null,
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.Cash),
                                                        MyGuiConstants.LABEL_TEXT_COLOR,
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE * 1.2f,
                                                        MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                                                        MyGuiManager.GetFontMinerWarsBlue());
            Controls.Add(m_playersMoneyLabel);            


            m_okButton = new MyGuiControlButton(this, new Vector2(0f, 0.4086f), MyGuiConstants.OK_BUTTON_SIZE,
                                   MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                   MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Close,
                                   MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick,
                                   true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_okButton);




            if (!m_tradeForMoney)
            {
                //Take all button
                m_ButtonTakeAll = new MyGuiControlButton(this, new Vector2(-0.3095f, 0.1455f), new Vector2(0.1532f, 0.063f),
                           MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                           MyGuiManager.GetInventoryScreenButtonTextureTakeAll(), null, null, MyTextsWrapperEnum.TakeAll,
                           MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER, MyGuiControlButtonTextAlignment.CENTERED, OnTakeAllClick,
                           true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(m_ButtonTakeAll);
            }

            if (m_inventoryScreenType == MyGuiScreenInventoryType.GodEditor) 
            {
                m_removeAll = new MyGuiControlButton(this, new Vector2(0.29f, -0.4f), new Vector2(0.1532f, 0.063f),
                       MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                       MyGuiManager.GetInventoryScreenButtonTextureTakeAll(), null, null, MyTextsWrapperEnum.RemoveAll,
                       MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER, MyGuiControlButtonTextAlignment.CENTERED, OnRemoveAllClick,
                       true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(m_removeAll);
            }

            #region other side's inventory

            if (m_otherSideInventoryBuilder != null)
            {
                // Other side's inventory label
                Controls.Add(new MyGuiControlLabel(this,
                                                   new Vector2(-0.4126f, -0.357f), null,
                                                   otherSideInventoryName, MyGuiConstants.LABEL_TEXT_COLOR,
                                                   MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                   MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                                                   MyGuiManager.GetFontMinerWarsBlue()));

                // Ship's inventory capacity label
                m_otherSideInventoryCapacityLabel = new MyGuiControlLabel(this,
                                                                     new Vector2(-0.215f, -0.357f), null, MyTextsWrapperEnum.InventoryCapacityLabel,
                                                                     MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
                Controls.Add(m_otherSideInventoryCapacityLabel);
                
                // Other side inventory listbox
                m_otherSideInventoryListBox = new MyGuiControlListbox(this,
                                                                      new Vector2(-0.2925f, -0.1425f),
                                                                      MyGuiConstants.LISTBOX_SMALL_SIZE + new Vector2(0, 0.003f),
                                                                      new Vector4(1f, 1f, 1f, 0f),
                                                                      null,
                                                                      MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                      INVENTORY_COLUMNS, INVENTORY_DISPLAY_ROWS,
                                                                      INVENTORY_COLUMNS, true, true, false,
                                                                      null,
                                                                      null,
                                                                      m_inventoryScrollBarTexture,
                                                                      null, 0, 0, new Vector4(1f, 1f, 1f, 0.0f), 0.03f, 0, 0, 0, -0.005f, -0.01f, -0.0155f, -0.017f);
                InitializeListboxDragAndAddToControls(m_otherSideInventoryListBox);
                listboxToDrop.Add(m_otherSideInventoryListBox);
                m_listboxDropConditions.Add(m_otherSideInventoryListBox, ii => true);                

                m_shipInventoryListBox.ItemDoubleClick += OnShipItemDoubleClick;
                m_otherSideInventoryListBox.ItemDoubleClick += OnOtherSideItemDoubleClick;
            }
            else
            {
                m_otherSideInventoryListBox = new MyGuiControlListbox(this,
                                                                      new Vector2(-0.2925f, -0.1425f),
                                                                      MyGuiConstants.LISTBOX_SMALL_SIZE + new Vector2(0, 0.003f),
                                                                      new Vector4(1f, 1f, 1f, 0f),
                                                                      otherSideInventoryName,
                                                                      MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                      INVENTORY_COLUMNS, INVENTORY_DISPLAY_ROWS,
                                                                      INVENTORY_COLUMNS, true, true, false,
                                                                      null,
                                                                      null,
                                                                      m_inventoryScrollBarTexture,
                                                                      null, 0, 0, new Vector4(1f, 1f, 1f, 0.0f), 0.03f, 0, 0, 0, -0.005f, -0.01f, -0.0155f, -0.017f);
            }

            //Filters All Items

            const float delta = 0.028f;
            var position = new Vector2(-0.2402f, 0.0684f);
            m_sortAll = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortAllOff(),
                                             MyGuiManager.GetInventoryFilterSortAllOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowAll), true, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortAll);
            position.X -= delta;

            m_sortGods = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortGodsOff(),
                                             MyGuiManager.GetInventoryFilterSortGodsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowGods), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortGods);
            position.X -= delta;

            m_sortOres = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortOresOff(),
                                             MyGuiManager.GetInventoryFilterSortOresOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowOres), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortOres);
            position.X -= delta;

            m_sortConsumables = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortConsumablesOff(),
                                             MyGuiManager.GetInventoryFilterSortConsumablesOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowConsumables), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortConsumables);            
            position.X -= delta;

            m_sortEquipment = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortEquipmentOff(),
                                             MyGuiManager.GetInventoryFilterSortEquipmentOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowEquipment), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortEquipment);            
            position.X -= delta;

            m_sortWeapons = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortWeaponsOff(),
                                             MyGuiManager.GetInventoryFilterSortWeaponsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowWeapons), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortWeapons);

            if (m_otherSideInventoryBuilder != null)
            {
                m_sortAll.OnCheck += OnFilterInventorySortClick;
                m_sortGods.OnCheck += OnFilterInventorySortClick;
                m_sortOres.OnCheck += OnFilterInventorySortClick;
                m_sortConsumables.OnCheck += OnFilterInventorySortClick;
                m_sortEquipment.OnCheck += OnFilterInventorySortClick;
                m_sortWeapons.OnCheck += OnFilterInventorySortClick;
            }
            else 
            {
                m_sortAll.Checked = false;
                m_sortAll.Enabled = false;
                m_sortGods.Enabled = false;
                m_sortOres.Enabled = false;
                m_sortConsumables.Enabled = false;
                m_sortEquipment.Enabled = false;
                m_sortWeapons.Enabled = false;
            }

            //Filters My Inventory
            position = new Vector2(0.373f, 0.0684f);

            m_sortAllMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortAllOff(),
                                             MyGuiManager.GetInventoryFilterSortAllOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowAll), true, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortAllMy);
            m_sortAllMy.OnCheck += OnFilterInventoryMySortClick;
            position.X -= delta;

            m_sortGodsMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortGodsOff(),
                                             MyGuiManager.GetInventoryFilterSortGodsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowGods), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortGodsMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortGodsMy);
            position.X -= delta;

            m_sortOresMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortOresOff(),
                                             MyGuiManager.GetInventoryFilterSortOresOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowOres), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortOresMy);
            m_sortOresMy.OnCheck += OnFilterInventoryMySortClick;
            position.X -= delta;

            m_sortConsumablesMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortConsumablesOff(),
                                             MyGuiManager.GetInventoryFilterSortConsumablesOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowConsumables), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortConsumablesMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortConsumablesMy);
            position.X -= delta;

            m_sortEquipmentMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortEquipmentOff(),
                                             MyGuiManager.GetInventoryFilterSortEquipmentOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowEquipment), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortEquipmentMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortEquipmentMy);
            position.X -= delta;

            m_sortWeaponsMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortWeaponsOff(),
                                             MyGuiManager.GetInventoryFilterSortWeaponsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowWeapons), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortWeaponsMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortWeaponsMy);



            #endregion

            #region combobox for select ship to customization
            if (m_smallShipsBuilders.Count > 1 && m_inventoryScreenType != MyGuiScreenInventoryType.Game)
            {
                m_shipsCombobox = new MyGuiControlCombobox(this, new Vector2(0f, topLeft.Y), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                        MyGuiConstants.COMBOBOX_TEXT_SCALE);
                m_shipsCombobox.OnSelect += OnComboboxSelectedItemChanged;
                Controls.Add(m_shipsCombobox);                
            }

            Vector2 shipButtonSize = new Vector2(128 / 1600f, 512 / 1200f) * 0.5f;
            m_previousShipButton = new MyGuiControlButton(this, new Vector2(-0.144f, -0.256f), shipButtonSize, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                               MyGuiManager.GetInventoryPreviousShip(), null, null, MyTextsWrapperEnum.EmptyDescription,
                               Vector4.Zero, 0f, MyGuiControlButtonTextAlignment.CENTERED, OnPreviousShipButtonClick,
                               false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_previousShipButton);

            m_nextShipButton = new MyGuiControlButton(this, new Vector2(0.144f, -0.256f), shipButtonSize, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                               MyGuiManager.GetInventoryNextShip(), null, null, MyTextsWrapperEnum.EmptyDescription,
                               Vector4.Zero, 0f, MyGuiControlButtonTextAlignment.CENTERED, OnNextShipButtonClick,
                               false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_nextShipButton);
            #endregion

            // ship's name
            m_shipNameLabel = new MyGuiControlLabel(this, 
                                                    new Vector2(0f, -0.1156f), null, new StringBuilder(), MyGuiConstants.LABEL_TEXT_COLOR, 
                                                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_shipNameLabel);

            // initialize drag and drop
            m_dragAndDrop = new MyGuiControlListboxDragAndDrop(this, listboxToDrop, MyGuiControlPreDefinedSize.SMALL,
                                                               MyGuiConstants.DRAG_AND_DROP_BACKGROUND_COLOR,
                                                               MyGuiConstants.DRAG_AND_DROP_TEXT_COLOR,
                                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                               MyGuiConstants.DRAG_AND_DROP_TEXT_OFFSET, true);
            m_dragAndDrop.ListboxItemDropped += OnDrop;
            m_dragAndDrop.DrawBackgroundTexture = false;
            Controls.Add(m_dragAndDrop);
        }
        private void InitControls() 
        {
            Vector2 controlsLeftPosition = -m_size.Value / 2f;
            Vector2 controlsRightPosition = controlsLeftPosition + new Vector2(m_size.Value.X / 2f, 0f);
            Vector2 labelOffset = new Vector2(0.25f, 0f);

            // use solo
            Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.UseSolo, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_useSoloCheckbox = new MyGuiControlCheckbox(this, controlsLeftPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.UseType & MyUseType.Solo) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_useSoloCheckbox);                        
            controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA/* + new Vector2(m_useSoloCheckbox.GetSize().Value.Y)*/;
            if ((m_useProperties.UseMask & MyUseType.Solo) == 0) 
            {
                m_useSoloCheckbox.Enabled = false;
                m_useSoloCheckbox.Checked = false;
            }

            // hack solo
            Controls.Add(new MyGuiControlLabel(this, controlsRightPosition, null, MyTextsWrapperEnum.HackSolo, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_hackSoloCheckbox = new MyGuiControlCheckbox(this, controlsRightPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.HackType & MyUseType.Solo) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_hackSoloCheckbox);                        
            controlsRightPosition += MyGuiConstants.CONTROLS_DELTA/* + new Vector2(m_hackSoloCheckbox.GetSize().Value.Y)*/;
            if ((m_useProperties.HackMask & MyUseType.Solo) == 0)
            {
                m_hackSoloCheckbox.Enabled = false;
                m_hackSoloCheckbox.Checked = false;
            }
            
            // use from HUB
            Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.UseFromHUB, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_useHUBCheckbox = new MyGuiControlCheckbox(this, controlsLeftPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.UseType & MyUseType.FromHUB) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_useHUBCheckbox);                                
            controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA;
            if ((m_useProperties.UseMask & MyUseType.FromHUB) == 0)
            {
                m_useHUBCheckbox.Enabled = false;
                m_useHUBCheckbox.Checked = false;
            }

            // hack from HUB
            Controls.Add(new MyGuiControlLabel(this, controlsRightPosition, null, MyTextsWrapperEnum.HackFromHUB, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_hackHUBCheckbox = new MyGuiControlCheckbox(this, controlsRightPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.HackType & MyUseType.FromHUB) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_hackHUBCheckbox);                                
            controlsRightPosition += MyGuiConstants.CONTROLS_DELTA;
            if ((m_useProperties.HackMask & MyUseType.FromHUB) == 0)
            {
                m_hackHUBCheckbox.Enabled = false;
                m_hackHUBCheckbox.Checked = false;
            }

            // is hacked
            Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.IsHacked, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_isHackedCheckbox = new MyGuiControlCheckbox(this, controlsLeftPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, m_useProperties.IsHacked, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_isHackedCheckbox);                        
            controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA;

            // move the two last controls to the right a bit.
            labelOffset.X = labelOffset.X + 0.075f;

            // hacking time
            Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.HackingTime, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_hackingTimeTextbox = new MyGuiControlTextbox(this, controlsLeftPosition + labelOffset, MyGuiControlPreDefinedSize.MEDIUM, m_useProperties.HackingTime.ToString(), 6, MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);
            Controls.Add(m_hackingTimeTextbox);            
            controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA;

            // hacking level
            Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.HackingLevel, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_hackingLevelCombobox = new MyGuiControlCombobox(this, controlsLeftPosition + labelOffset, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            Controls.Add(m_hackingLevelCombobox);
            for (int i = 1; i <= 5; i++) 
            {
                m_hackingLevelCombobox.AddItem(i, new StringBuilder(i.ToString()));
            }
            m_hackingLevelCombobox.SelectItemByKey(m_useProperties.HackingLevel);
        }