示例#1
0
 public MyGuiScreenFake()
     :base(new Vector2(0.5f, 0.5f), new Vector4(0f, 1f, 0f, 0.5f), new Vector2(1f, 1f))
 {
     MyGuiControlList controlList = new MyGuiControlList(this, new Vector2(0f, 0f), new Vector2(0.8f, 0.5f), MyGuiConstants.DEFAULT_CONTROL_BACKGROUND_COLOR, new StringBuilder("ToolTip"), MyGuiManager.GetBlankTexture());
     Controls.Add(controlList);
     List<MyGuiControlBase> fakeControls = new List<MyGuiControlBase>();
     MyGuiControlParent parent1 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 0f, 0f, 1f), new StringBuilder("Parent1"), null);
     parent1.Controls.Add(new MyGuiControlTextbox(parent1, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "AAA", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     parent1.Controls.Add(new MyGuiControlCheckbox(parent1, new Vector2(0f, 0.07f), MyGuiConstants.CHECKBOX_SIZE, true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));            
     fakeControls.Add(parent1);
     MyGuiControlParent parent2 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(0f, 1f, 0f, 1f), new StringBuilder("Parent2"), null);
     parent2.Controls.Add(new MyGuiControlTextbox(parent2, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "CCC", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     MyGuiControlCombobox combobox1 = new MyGuiControlCombobox(parent2, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 10, false, true, false);
     combobox1.AddItem(0, new StringBuilder("Item1 Item1 Item1 Item1 Item1 Item1 Item1 "));
     combobox1.AddItem(1, new StringBuilder("Item2 Item2 Item2 Item2 Item2 Item2 Item2 "));
     combobox1.AddItem(2, new StringBuilder("Item3 Item3 Item3 Item3 Item3 Item3 Item3 "));
     combobox1.AddItem(3, new StringBuilder("Item4"));
     combobox1.AddItem(4, new StringBuilder("Item5"));
     combobox1.AddItem(5, new StringBuilder("Item6"));
     combobox1.AddItem(6, new StringBuilder("Item7"));
     combobox1.AddItem(7, new StringBuilder("Item8"));
     combobox1.AddItem(8, new StringBuilder("Item9"));
     combobox1.AddItem(9, new StringBuilder("Item10"));
     combobox1.AddItem(10, new StringBuilder("Item11"));
     combobox1.AddItem(11, new StringBuilder("Item12"));
     combobox1.AddItem(12, new StringBuilder("Item13"));
     parent2.Controls.Add(combobox1);
     fakeControls.Add(parent2);
     MyGuiControlParent parent3 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(0f, 0f, 1f, 1f), new StringBuilder("Parent3"), null);
     parent3.Controls.Add(new MyGuiControlTextbox(parent3, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "EEE", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     MyGuiControlCombobox combobox2 = new MyGuiControlCombobox(parent3, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 10, false, true, false);
     combobox2.AddItem(0, new StringBuilder("Item1 Item1 Item1 Item1 Item1 Item1 Item1 "));
     combobox2.AddItem(1, new StringBuilder("Item2 Item2 Item2 Item2 Item2 Item2 Item2 "));
     combobox2.AddItem(2, new StringBuilder("Item3 Item3 Item3 Item3 Item3 Item3 Item3 "));
     combobox2.AddItem(3, new StringBuilder("Item4"));
     combobox2.AddItem(4, new StringBuilder("Item5"));
     combobox2.AddItem(5, new StringBuilder("Item6"));
     combobox2.AddItem(6, new StringBuilder("Item7"));
     combobox2.AddItem(7, new StringBuilder("Item8"));
     combobox2.AddItem(8, new StringBuilder("Item9"));
     combobox2.AddItem(9, new StringBuilder("Item10"));
     combobox2.AddItem(10, new StringBuilder("Item11"));
     combobox2.AddItem(11, new StringBuilder("Item12"));
     combobox2.AddItem(12, new StringBuilder("Item13"));
     parent3.Controls.Add(combobox2);
     fakeControls.Add(parent3);
     MyGuiControlParent parent4 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 0f, 1f, 1f), new StringBuilder("Parent4"), null);
     parent4.Controls.Add(new MyGuiControlTextbox(parent4, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "GGG", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     parent4.Controls.Add(new MyGuiControlTextbox(parent4, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.LARGE, "HHH", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     fakeControls.Add(parent4);
     MyGuiControlParent parent5 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 1f, 0f, 1f), new StringBuilder("Parent5"), null);
     parent5.Controls.Add(new MyGuiControlTextbox(parent5, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "III", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     parent5.Controls.Add(new MyGuiControlTextbox(parent5, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.LARGE, "JJJ", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     fakeControls.Add(parent5);
     controlList.InitControls(fakeControls);
 }
        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();
        }
        private void InitCombobox()
        {
            m_shipTypeCombobox = new MyGuiControlCombobox(
                this,
                new Vector2(0, -0.3f),
                MyGuiControlPreDefinedSize.MEDIUM,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                MyGuiConstants.COMBOBOX_TEXT_SCALE);

            foreach (MyMwcObjectBuilder_SmallShip_TypesEnum shipType in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_TypesEnumValues)
            {
                int shipTypeNumber = (int) shipType;
                var helper = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, shipTypeNumber);
                m_shipTypeCombobox.AddItem(shipTypeNumber, helper.Name);
            }

            m_shipTypeCombobox.SelectItemByIndex(0);

            m_shipTypeCombobox.OnSelect += Combobox_OnSelect;

            Controls.Add(m_shipTypeCombobox);
        }
        private void InitControls()
        {
            Controls.Clear();            

            string entityName;
            if (m_entities.Count == 1)
            {
                entityName = "(" + m_entities[0].GetFriendlyName() + ")";
            }
            else 
            {
                entityName = "(Mutliedit)";
            }

            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, -m_size.Value.Y / 2f + 0.063f), null, new StringBuilder(entityName),
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));

            Vector2 controlsStartPosition = new Vector2(-m_size.Value.X / 2f + 0.05f, -m_size.Value.Y / 2f + 0.12f);
            Vector2 labelPosition = controlsStartPosition;
            Vector2 controlPosition = controlsStartPosition + new Vector2(0.4f, 0f);
            Vector4 notSameColor = Color.Red.ToVector4();

            // name
            if ((m_editPropertiesFlags & MyEditPropertyEnum.Name) != 0)
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.Name, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Name]);                
                m_name = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM,
                                                 m_editProperties.Name != null ? m_editProperties.Name : string.Empty, TEXTBOX_MAX_LENGTH,
                                                 MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE,
                                                 MyGuiControlTextboxType.NORMAL);
                Controls.Add(m_name);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;
            }

            // display name
            if ((m_editPropertiesFlags & MyEditPropertyEnum.DisplayName) != 0)
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.DisplayName, m_editPropertiesNotSame[(int)MyEditPropertyEnum.DisplayName]);                
                m_displayName = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM,
                                                 m_editProperties.DisplayName != null ? m_editProperties.DisplayName : string.Empty, TEXTBOX_MAX_LENGTH,
                                                 MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE,
                                                 MyGuiControlTextboxType.NORMAL);
                Controls.Add(m_displayName);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;
            }

            // display hud
            if ((m_editPropertiesFlags & MyEditPropertyEnum.DisplayHud) != 0)
            {                
                AddLabel(labelPosition, MyTextsWrapperEnum.DisplayHud, m_editPropertiesNotSame[(int)MyEditPropertyEnum.DisplayHud]);
                m_displayHud = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.DisplayHud, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);

                Controls.Add(m_displayHud);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;

            }

            // difficulty
            if ((m_editPropertiesFlags ^ MyEditPropertyEnum.Difficulty) != 0) 
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.ActivatedUpToDifficulty, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Difficulty]);
                m_difficulty = new MyGuiControlCombobox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
                m_difficulty.AddItem((int)MyGameplayDifficultyEnum.EASY, MyTextsWrapperEnum.DifficultyEasy);
                m_difficulty.AddItem((int)MyGameplayDifficultyEnum.NORMAL, MyTextsWrapperEnum.DifficultyNormal);
                m_difficulty.AddItem((int)MyGameplayDifficultyEnum.HARD, MyTextsWrapperEnum.DifficultyHard);
                m_difficulty.SelectItemByKey((int)m_editProperties.Difficulty);

                Controls.Add(m_difficulty);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;
            }

            // faction
            if ((m_editPropertiesFlags & MyEditPropertyEnum.Faction) != 0)
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.Faction, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Faction]);
                m_faction = new MyGuiControlCombobox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
                foreach (MyMwcObjectBuilder_FactionEnum faction in Enum.GetValues(typeof(MyMwcObjectBuilder_FactionEnum)))
                {
                    MyGuiHelperBase factionHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(faction);
                    m_faction.AddItem((int)faction, factionHelper.Description);
                }
                m_faction.SelectItemByKey((int)m_editProperties.Faction);

                Controls.Add(m_faction);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;
            }            

            // health
            if ((m_editPropertiesFlags & MyEditPropertyEnum.HealthRatio) != 0)
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.HealthPercentage, m_editPropertiesNotSame[(int)MyEditPropertyEnum.HealthRatio]);
                m_healthPercentage = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM,
                                                   m_editProperties.HealthRatio != null ?
                                                   GetFormatedFloat(
                                                       m_editProperties.HealthRatio.Value * 100f) : string.Empty,
                                                       TEXTBOX_NUMBERS_MAX_LENGTH,
                                                   MyGuiConstants.TEXTBOX_BACKGROUND_COLOR,
                                                   MyGuiConstants.LABEL_TEXT_SCALE,
                                                   MyGuiControlTextboxType.DIGITS_ONLY);
                Controls.Add(m_healthPercentage);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;

                AddLabel(labelPosition, MyTextsWrapperEnum.Health, m_editPropertiesNotSame[(int)MyEditPropertyEnum.HealthRatio]);
                m_health = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM,
                                                   m_editProperties.HealthRatio != null && m_editProperties.MaxHealth != null ?
                                                   GetFormatedFloat(
                                                       m_editProperties.HealthRatio.Value * m_editProperties.MaxHealth.Value) : string.Empty,
                                                       TEXTBOX_NUMBERS_MAX_LENGTH,
                                                   MyGuiConstants.TEXTBOX_BACKGROUND_COLOR,
                                                   MyGuiConstants.LABEL_TEXT_SCALE,
                                                   MyGuiControlTextboxType.DIGITS_ONLY);
                Controls.Add(m_health);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;

                m_healthPercentage.TextChanged -= HealthChanged;
                m_healthPercentage.TextChanged += HealthChanged;
                m_health.TextChanged -= HealthChanged;
                m_health.TextChanged += HealthChanged;
            }

            // maxhealth
            if ((m_editPropertiesFlags & MyEditPropertyEnum.MaxHealth) != 0)
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.MaxHealth, m_editPropertiesNotSame[(int)MyEditPropertyEnum.MaxHealth]);
                m_maxHealth = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM,
                                                      m_editProperties.MaxHealth != null ?
                                                      GetFormatedFloat(
                                                          m_editProperties.MaxHealth.Value) : string.Empty,
                                                          TEXTBOX_NUMBERS_MAX_LENGTH,
                                                      MyGuiConstants.TEXTBOX_BACKGROUND_COLOR,
                                                      MyGuiConstants.LABEL_TEXT_SCALE,
                                                      MyGuiControlTextboxType.DIGITS_ONLY);
                Controls.Add(m_maxHealth);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;
                m_maxHealth.TextChanged -= HealthChanged;
                m_maxHealth.TextChanged += HealthChanged;
            }

            // prefab kinematic parts health and max health
            if ((m_editPropertiesFlags & MyEditPropertyEnum.KinematicPartsHealthAndMaxHealth) != 0) 
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.EditPrefabKinematicPartsHealthAndMaxHealth, m_editPropertiesNotSame[(int)MyEditPropertyEnum.KinematicPartsHealthAndMaxHealth]);
                m_kinematicPartsHealthAndMaxHealth = new MyGuiControlButton(this, controlPosition + new Vector2(0.1f, 0f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Edit, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                    OnEditPrefabKinematicPartsHealthAndMaxHealthClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true);
                Controls.Add(m_kinematicPartsHealthAndMaxHealth);
                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;
            }

            // indestructible
            if ((m_editPropertiesFlags & MyEditPropertyEnum.Indestructible) != 0)
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.Indestructible, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Indestructible]);
                m_indestructible = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.IsIndestructible, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
                m_indestructible.OnCheck -= OnIndestructibleChecked;
                m_indestructible.OnCheck += OnIndestructibleChecked;

                Controls.Add(m_indestructible);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;
            }

            // change faction appearance
            if ((m_editPropertiesFlags & MyEditPropertyEnum.FactionAppearance) != 0)
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.PrefabMaterials, false);

                m_appearance = new MyGuiControlCombobox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
                foreach (MyMwcObjectBuilder_Prefab_AppearanceEnum factionAppearance in MyGuiPrefabHelpers.MyMwcFactionTextureEnumValues)
                {
                    m_appearance.AddItem((int)factionAppearance, MyGuiPrefabHelpers.GetFactionName(factionAppearance));
                }
                Controls.Add(m_appearance);

                Controls.Add(new MyGuiControlButton(
                    this,
                    controlPosition + new Vector2(.2f, 0),
                    MyGuiConstants.BACK_BUTTON_SIZE,
                    MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                    MyTextsWrapperEnum.Ok,
                    MyGuiConstants.BUTTON_TEXT_COLOR,
                    MyGuiConstants.BUTTON_TEXT_SCALE,
                    OnChangeAppearanceClick,
                    MyGuiControlButtonTextAlignment.CENTERED,
                    true,
                    MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                    true));

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;
            }

            // Requires energy
            if ((m_editPropertiesFlags & MyEditPropertyEnum.RequiresEnergy) != 0)
            {                
                AddLabel(labelPosition, MyTextsWrapperEnum.RequiresEnergy, m_editPropertiesNotSame[(int)MyEditPropertyEnum.RequiresEnergy]);
                m_requiresEnergyCheckbox = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.RequiresEnergy.Value, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
                //m_requiresEnergyCheckbox.OnCheck -= OnRequiresEnergyChecked;
                //m_requiresEnergyCheckbox.OnCheck += OnRequiresEnergyChecked;

                Controls.Add(m_requiresEnergyCheckbox);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;

            }

            // use properties
            if ((m_editPropertiesFlags & MyEditPropertyEnum.UseProperties) != 0) 
            {
                m_useProperties = new MyGuiControlUseProperties(this, controlPosition, m_editProperties.UseProperties, m_editPropertiesNotSame[(int)MyEditPropertyEnum.UseProperties] ? new Vector4(1f, 0f, 0f, 1f) : MyGuiConstants.LABEL_TEXT_COLOR);
                Vector2 usePropertiesSize = m_useProperties.GetSize().Value;
                m_useProperties.SetPosition(labelPosition + usePropertiesSize / 2f);
                Controls.Add(m_useProperties);
                labelPosition += new Vector2(0f, usePropertiesSize.Y) + MyGuiConstants.CONTROLS_DELTA;
                controlPosition += new Vector2(0f, usePropertiesSize.Y) + MyGuiConstants.CONTROLS_DELTA;
            }


            // Activated
            /*  //Temporary disabled because there is no way how to select invisible object
            if ((m_editPropertiesFlags & MyEditPropertyEnum.Activated) != 0)
            {
                AddLabel(labelPosition, MyTextsWrapperEnum.Active, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Activated]);
                m_activated = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.IsActivated, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
                m_activated.OnCheck -= OnActivatedChecked;
                m_activated.OnCheck += OnActivatedChecked;

                Controls.Add(m_activated);

                labelPosition += MyGuiConstants.CONTROLS_DELTA;
                controlPosition += MyGuiConstants.CONTROLS_DELTA;
            } */

            foreach (var notSameFlag in m_editPropertiesNotSame)
            {
                if (notSameFlag)
                {
                    Controls.Add(new MyGuiControlLabel(this, new Vector2(-m_size.Value.X / 2f + 0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f + 0.03f), null, MyTextsWrapperEnum.RedColoredPropertiesAreNotSame, new Vector4(1f, 0f, 0f, 1f), MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                    break;
                }
            }

            AddOkAndCancelButtonControls(new Vector2(0, 0.0f));
        }
        protected MyGuiControlCombobox AddCombo(List<MyGuiControlBase> controlGroup = null, MyGuiControlButtonTextAlignment textAlign = MyGuiControlButtonTextAlignment.CENTERED, Vector4? textColor = null, Vector2? size = null)
        {
            MyGuiControlCombobox combo = new MyGuiControlCombobox(this, new Vector2(m_buttonXOffset, m_currentPosition.Y), MyGuiControlPreDefinedSize.MEDIUM, Vector4.One, 0.7f);
            Controls.Add(combo);

            m_currentPosition.Y += 0.04f * m_scale;

            if (controlGroup != null)
                controlGroup.Add(combo);

            return combo;
        }
        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);
        }
示例#8
0
        private void UpdateControls()
        {
            //  Update screen controls
            for (int i = 0; i < m_controlsAll.Count; i++)
            {
                MyGuiControlBase control = m_controlsAll[i];
                control.Update();
            }

            m_comboboxHandlingNow = GetComboboxHandlingInputNow();
            m_listboxDragAndDropHandlingNow = GetDragAndDropHandlingNow();
        }        
        void CreateControls(Vector2 controlsOrigin)
        {
            var panel = new MyGuiControlPanel(m_parent, m_position, m_size, m_backgroundColor.Value, 2, m_backgroundColor.Value * 2f);
            m_controls.Add(panel);

            float dPos = -1;
            float dPosFalloff;
            MyTextsWrapperEnum[] colorNames = { MyTextsWrapperEnum.Red, MyTextsWrapperEnum.Green, MyTextsWrapperEnum.Blue };

            Vector2 sliderOffset = new Vector2(0.21f, 0f);

            float buttonsY = m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f;

            AddControl(true, new MyGuiControlButton(m_parent, new Vector2(m_position.X, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.SwitchToSpotLight, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnSpotClick,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            ++dPos;

            m_controls.Add(new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.EachlightHasInternallyTwoLightsPointAndSpot, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            /*
             * 
             * Point light
             * 
             * 
             */
            // Checkboxes for Disabled/Point/Hemisphere

            Vector2 checkBoxOffset = new Vector2(0.14f, 0);
            dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Point enabled"), MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_pointLightCheckbox = new MyGuiControlCheckbox(m_parent, (checkBoxOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            AddControl(true, m_pointLightCheckbox);

            //dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.2f, 0), null, new StringBuilder("Hemispheric enabled"), MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_hemisphereLightCheckbox = new MyGuiControlCheckbox(m_parent, (checkBoxOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.26f, 0), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            AddControl(true, m_hemisphereLightCheckbox);

            //text
            dPos += 0.9f;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.DiffuseColor, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            Vector2 buttonsColumn = new Vector2(0.165f, 0.0025f);
            Vector2 copyPasteButtonScale = MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE * new Vector2(0.7f, 0.7f);
            float copyPasteButtonFontScale = MyGuiConstants.BUTTON_TEXT_SCALE * 0.75f;
            Vector2 pasteButtonShift = new Vector2(0.115f, 0f);            

            AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnCopyPointDiffuseColor,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));

            AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn + pasteButtonShift, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Paste, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnPastePointDiffuseColor,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
            dPos += 0.1f;

            //point color sliders
            for (int i = 0; i < 3; i++)
            {
                dPos += 0.75f;
                AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_pointNormalLightColorSlider[i] = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                    MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                    new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f);
                AddControl(true, m_pointNormalLightColorSlider[i]);
            }

            //text
            dPos += 0.9f;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SpecularColor, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnCopyPointSpecularColor,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));

            AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn + pasteButtonShift, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Paste, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnPastePointSpecularColor,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
            dPos += 0.1f;

            // specular color sliders
            for (int i = 0; i < 3; i++)
            {
                dPos += 0.75f;
                AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_specularLightColorSlider[i] = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                    MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                    new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f);
                AddControl(true, m_specularLightColorSlider[i]);
            }

            /*
             * Effect 
             */

            //effect
            dPos += 1.25f;
            m_controls.Add( new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Options, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_effectComboBox = new MyGuiControlCombobox(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + sliderOffset + new Vector2(0.03f, 0f),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);

            foreach (MyLightEffectTypeEnum enumValue in Enum.GetValues(typeof(MyLightEffectTypeEnum)))
            {
                m_effectComboBox.AddItem((int)enumValue, MyPrefabLight.GetStringFromMyLightEffectTypeEnum(enumValue));
            }

            m_effectComboBox.SelectItemByKey(0);
            m_effectComboBox.OnSelect += OnComboBoxChange;
            //m_controls.Add(m_effectComboBox);
            m_controls.Add(m_effectComboBox);

            //falloff slider
            dPos += 1.25f;
            dPosFalloff = dPos;

            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Falloff"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_pointFallOffSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                0.1f, 5.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(true, m_pointFallOffSlider);

            //range slider
            dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Range"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_pointRangeSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                0.1f, MyLightsConstants.MAX_POINTLIGHT_RADIUS, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(true, m_pointRangeSlider);

            //intensity slider
            dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Intensity"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_pointIntensitySlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                0.1f, 10.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);

            AddControl(true, m_pointIntensitySlider);

            // Offset slider
            dPos++;
            AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Offset"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_pointOffsetSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                -0.5f, 1.5f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);

            AddControl(true, m_pointOffsetSlider);


            dPos++;
            AddControl(true, m_flashOffsetLabel = new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Flash Ofst."), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_flashOffsetSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                0f, 1f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);

            AddControl(true, m_flashOffsetSlider);

            /*
             * 
             * Reflector spot light
             * 
             * 
             */




            dPos = -1;



            AddControl(false, new MyGuiControlButton(m_parent, new Vector2(m_position.X, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.SwitchToPointLight, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnPointClick,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));


            dPos = 1;

            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Enabled, MyGuiConstants.LABEL_TEXT_COLOR,
    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotLightCheckbox = new MyGuiControlCheckbox(m_parent, (checkBoxOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            AddControl(false, m_spotLightCheckbox);





            //text
            dPos += 0.9f;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.DiffuseColor, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            AddControl(false, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnCopySpotDiffuseColor,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));

            AddControl(false, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn + pasteButtonShift, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Paste, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnPasteSpotDiffuseColor,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
            dPos += 0.1f;

            //color sliders
            for (int i = 0; i < 3; i++)
            {
                dPos += 0.75f;
                AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_spotNormalLightColorSlider[i] = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                    MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                    new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f);
                AddControl(false, m_spotNormalLightColorSlider[i]);
            }


            dPos++;


            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Shadows Distance"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            dPos++;
            m_spotLightShadowDistance = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                0.0f, MyLightsConstants.MAX_SPOTLIGHT_SHADOW_RANGE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotLightShadowDistance);


            //angle slider
            dPos = dPosFalloff;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Angle"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotAngleSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                0.1f, MyLightsConstants.MAX_SPOTLIGHT_ANGLE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotAngleSlider);

            //falloff slider
            dPos++;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Falloff"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotFallOffSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                0.1f, 5.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotFallOffSlider);

            //range slider
            dPos++;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Range"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotRangeSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                 0.1f, MyLightsConstants.MAX_SPOTLIGHT_RANGE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotRangeSlider);

            //intensity slider
            dPos++;
            AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Intensity"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_spotIntensitySlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
                0.1f, 10.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE);
            AddControl(false, m_spotIntensitySlider);

            dPos = 15;
            m_controls.Add(new MyGuiControlButton(m_parent, new Vector2(m_position.X - 0.05f, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, 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_RIGHT_AND_VERTICAL_CENTER, true));

            m_controls.Add(new MyGuiControlButton(m_parent, new Vector2(m_position.X + 0.05f, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, 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_LEFT_AND_VERTICAL_CENTER, true));



            ActivateLightType(true);
            //m_tabControl.ActivateTab((int)MyGuiLightPrefabTypeEnum.PointLight);
        }
        private void CreateControlsSound(Vector2 controlsOrigin)
        {
            AddSeparator(controlsOrigin);

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

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

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

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

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

            m_selectDialogueCombobox.SelectItemByIndex(0);

            Controls.Add(m_selectDialogueCombobox);
        }
        private void RecreateControls()
        {
            Controls.Clear();

            AddCaption(new StringBuilder("Select Sector"), MyGuiConstants.SCREEN_CAPTION_TEXT_COLOR);

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

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

            // search button
            Controls.Add(new MyGuiControlButton(this, m_findPlayerName.GetPosition() + new Vector2(0.2f, 0), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Search, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnSearchClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

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

            if (m_sectorIdentifiers != null && m_userDetails != null)
            {
                m_mapsCombobox = new MyGuiControlCombobox(this, controlsOriginLeft + 5 * controlsDelta + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
                for (int i = 0; i < m_sectorIdentifiers.Count; i++)
                {
                    MyMwcSectorIdentifier sectorIdentifier = m_sectorIdentifiers[i];
                    if (!sectorIdentifier.UserId.HasValue)
                    {
                        AddSectorToCombo(sectorIdentifier, i, "STORY");
                    }
                    else
                    {
                        foreach (MyMwcUserDetail userDetail in m_userDetails)
                        {
                            if (sectorIdentifier.UserId.HasValue && sectorIdentifier.UserId.Value == userDetail.UserId)
                            {
                                AddSectorToCombo(sectorIdentifier, i, userDetail.DisplayName);
                            }
                        }
                    }
                }

                SortSectors();

                m_mapsCombobox.SelectItemByIndex(0);
                Controls.Add(m_mapsCombobox);
            }
            else
            {
                Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 5 * controlsDelta, null, MyTextsWrapperEnum.NoSectorsAvailable, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            }

            //  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);
            if (m_mapsCombobox != null)
            {
                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));
            }
            else
            {
                Controls.Add(new MyGuiControlButton(this, new Vector2(0, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f), 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));
            }
        }
        void CreateControls(Vector2 controlsOrigin, Vector2 sliderOffset)
        {            
            m_nameLabel = new MyGuiControlLabel(this, controlsOrigin - new Vector2(0, 2 * CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Name, 
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            m_nameTextBox = new MyGuiControlTextbox(this, controlsOrigin - new Vector2(-0.2f, 2 * CONTROLS_DELTA.Y), MyGuiControlPreDefinedSize.MEDIUM,
                DummyPoint.Name ?? String.Empty, 512, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            m_nameTextBox.TextChanged = OnTextChange;

            Controls.Add(m_nameLabel);
            Controls.Add(m_nameTextBox);

            m_typeComboBox = new MyGuiControlCombobox(this, controlsOrigin - new Vector2(-0.25f, CONTROLS_DELTA.Y), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_typeComboBox.AddItem(0, new StringBuilder("Box"));
            m_typeComboBox.AddItem(1, new StringBuilder("Sphere"));
            m_typeComboBox.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_typeComboBox_OnSelect);
            Controls.Add(m_typeComboBox);
            MyGuiControlLabel typeLabel = new MyGuiControlLabel(this, controlsOrigin - new Vector2(-0.0f, CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Width, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            typeLabel.UpdateText("Type");
            Controls.Add(typeLabel);

            float checkBoxOffset = 0.507f;
            //Enabled
            Controls.Add(new MyGuiControlLabel(this, controlsOrigin - new Vector2(-checkBoxOffset, 2 * CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Enabled, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_enabled = new MyGuiControlCheckbox(this, controlsOrigin - new Vector2(-checkBoxOffset, 2 * CONTROLS_DELTA.Y) + new Vector2(0.1f, 0f), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            m_enabled.OnCheck += OnEnabledChange;
            Controls.Add(m_enabled);

            // Active
            AddActivatedCheckbox(controlsOrigin - new Vector2(-checkBoxOffset, CONTROLS_DELTA.Y), DummyPoint.Activated);

            float sliderMax = 50000;

            //Width slider            
            m_widthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f), new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Width), MyGuiSizeEnumFlags.All, sliderOffset.X);
            m_widthSize.OnValueChange += OnWidthChange;
            Controls.Add(m_widthSize);

            //Height slider            
            m_heightSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f) + 1 * CONTROLS_DELTA, new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Height), MyGuiSizeEnumFlags.All, sliderOffset.X);
            m_heightSize.OnValueChange += OnHeightChange;
            Controls.Add(m_heightSize);

            //Depth slider            
            m_depthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f) + 2 * CONTROLS_DELTA, new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Depth), MyGuiSizeEnumFlags.All, sliderOffset.X);
            m_depthSize.OnValueChange += OnDepthChange;
            Controls.Add(m_depthSize);

            MyGuiControlLabel idLabel = new MyGuiControlLabel(this, controlsOrigin + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Depth, MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(idLabel);
            idLabel.UpdateText("ID: " + m_entity.EntityId.ToString());

            int controlsDelta = 4;

            // Flags
            m_colorArea = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta++ * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_colorArea.OnCheck += OnFlagChange;
            m_colorAreaLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ColorArea,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_colorArea);
            Controls.Add(m_colorAreaLabel);

            m_playerStart = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_playerStart.OnCheck += OnPlayerStartFlagChange;
            m_playerStartLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.PlayerStart,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_playerStart);
            Controls.Add(m_playerStartLabel);

            m_mothershipStart = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_mothershipStart.OnCheck += OnMothershipStartFlagChange;
            m_mothershipStartLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.MothershipStart,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_mothershipStart);
            Controls.Add(m_mothershipStartLabel);

            m_detector = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_detector.OnCheck += OnFlagChange;
            m_detectorLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.Detector,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_detector);
            Controls.Add(m_detectorLabel);

            m_sideMission = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_sideMission.OnCheck += OnFlagChange;
            m_sideMissionLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.SideMission,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_sideMission);
            Controls.Add(m_sideMissionLabel);

            m_particleEffect = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_particleEffect.OnCheck += OnFlagChange;
            m_particleEffectLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.ParticleEffect,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_particleEffectLabel);
            Controls.Add(m_particleEffect);

            m_respawnPoint = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_respawnPoint.OnCheck += OnFlagChange;
            m_respawnPointLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.RespawnPoint,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_respawnPointLabel);
            Controls.Add(m_respawnPoint);

            m_safeArea = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_safeArea.OnCheck += OnFlagChange;
            m_safeAreaLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.SafeArea,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_safeArea);
            Controls.Add(m_safeAreaLabel);

            m_survivePrefabDestruction = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_survivePrefabDestruction.OnCheck += OnFlagChange;
            m_survivePrefabDestructionLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.SurvivePrefabDestruction,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_survivePrefabDestructionLabel);
            Controls.Add(m_survivePrefabDestruction);

            m_textureQuad = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_textureQuad.OnCheck += OnFlagChange;
            m_textureQuadLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.TextureQuad,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_textureQuad);
            Controls.Add(m_textureQuadLabel);

            m_note = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR);
            m_note.OnCheck += OnFlagChange;
            m_noteLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.Note,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_note);
            Controls.Add(m_noteLabel);

            Vector2 columnOffset = new Vector2(0.15f, 0);
            Vector2 labelColumnOffset = new Vector2(0.18f, 0);
            // Red slider
            m_redSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Red, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_redSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 4 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_redSlider.OnChange = OnComponentChange;
            Controls.Add(m_redSliderLabel);
            Controls.Add(m_redSlider);

            // Green slider
            m_greenSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Green, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_greenSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 5 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_greenSlider.OnChange = OnComponentChange;
            Controls.Add(m_greenSliderLabel);
            Controls.Add(m_greenSlider);

            // Blue slider
            m_blueSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Blue, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_blueSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 6 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_blueSlider.OnChange = OnComponentChange;
            Controls.Add(m_blueSliderLabel);
            Controls.Add(m_blueSlider);

            // Alpha slider
            m_alphaSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 7 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Alpha, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_alphaSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 7 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_alphaSlider.OnChange = OnComponentChange;
            m_alphaSliderValueLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 7 * CONTROLS_DELTA + new Vector2(0.4f, 0), null, new StringBuilder("0"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            // scale slider
            m_userScaleSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 8 * CONTROLS_DELTA, null, MyTextsWrapperEnum.UserScale, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_userScaleSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 8 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH,
               0.01f, 3.9f, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
            m_userScaleSlider.OnChange = OnComponentChange;
            m_userScaleLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 8 * CONTROLS_DELTA + new Vector2(0.4f, 0), null, new StringBuilder("0"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(m_alphaSliderLabel);
            Controls.Add(m_alphaSliderValueLabel);
            Controls.Add(m_alphaSlider);

            Controls.Add(m_userScaleSliderLabel);
            Controls.Add(m_userScaleSlider);
            Controls.Add(m_userScaleLabel);

            // Particle effect
            //m_particleNameLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ParticleEffect, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_particleCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 9 * CONTROLS_DELTA + sliderOffset, MyGuiControlPreDefinedSize.MEDIUM,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5, false, false, false);
            foreach (var p in MyParticlesLibrary.GetParticleEffects())
            {
                m_particleCombo.AddItem(p.GetID(), new StringBuilder(p.Name));
                m_particleCombo.SortItemsByValueText();
            }
            m_particleCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_particleCombo_OnSelect);
            //Controls.Add(m_particleNameLabel);
            Controls.Add(m_particleCombo);

            m_respawnPointCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 10 * CONTROLS_DELTA + sliderOffset,
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4);
            foreach (MyMwcObjectBuilder_FactionEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues)
            {
                MyGuiHelperBase factionNationalityHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(enumValue);
                m_respawnPointCombo.AddItem((int)enumValue, null, factionNationalityHelper.Description);
            }
            m_respawnPointCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_repawnPointCombo_OnSelect);
            Controls.Add(m_respawnPointCombo);

            m_secretCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 7 * CONTROLS_DELTA + sliderOffset,
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4);

            m_secretCombo.AddItem(0, null, new StringBuilder("No secret"));
            foreach (var room in MySecretRooms.SecretRooms)
            {
                m_secretCombo.AddItem(room.Key, null, new StringBuilder(room.Value));
            }
            m_secretCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_secretCombo_OnSelect);
            Controls.Add(m_secretCombo);

            UpdateValues();
        }
        public MyGuiScreenOptionsControls()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_size = new Vector2(1110f / 1600f, 1127f / 1200f);
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ControlsBackground", flags: TextureFlags.IgnoreQuality);

            m_enableBackgroundFade = true;
            AddCaption(MyTextsWrapperEnum.Controls, new Vector2(0, 0.005f));

            MyGuiManager.GetInput().TakeSnapshot();

            m_controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.06f, -m_size.Value.Y / 2.0f + 0.102f);
            m_controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.333f, -m_size.Value.Y / 2.0f + 0.102f);

            #region Add Revert, OK, Cancel and selection combobox
            /*
            //  Buttons Revert, OK and CANCEL
            float buttonsY = 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((MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X + 0.015f) * -1, buttonsY),
                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(0, buttonsY),
                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));
            Controls.Add(new MyGuiControlButton(this,
                new Vector2(m_controlsOriginRight.X + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, buttonsY),
                new Vector2(MyGuiConstants.BUTTON_DEFAULTS_WIDTH, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y), MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Revert, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnResetDefaultsClick,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            */


            var okButton = new MyGuiControlButton(this, new Vector2(-0.1942f, 0.3435f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                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.0597f, 0.3435f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                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 resetButton = new MyGuiControlButton(this, new Vector2(0.1942f, 0.3435f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Revert,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnResetDefaultsClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(okButton);
            Controls.Add(cancelButton);
            Controls.Add(resetButton);




            //  Page selection combobox
            m_currentControlType = MyGuiControlTypeEnum.General;
            var cBoxPosition = m_controlsOriginRight + 0.5f * MyGuiConstants.CONTROLS_DELTA +
                               new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0) - new Vector2(0.065f, 0);
            m_controlTypeList = new MyGuiControlCombobox(this, cBoxPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.General, MyTextsWrapperEnum.General);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Navigation, MyTextsWrapperEnum.Navigation);
            // There are no controls for this category now, so hide it completely and uncomment, when we have new comms controls
            //m_controlTypeList.AddItem((int)MyGuiInputTypeEnum.Communications, MyTextsWrapperEnum.Comms);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Weapons, MyTextsWrapperEnum.Weapons);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.SpecialWeapons, MyTextsWrapperEnum.SpecialWeapons);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Systems1, MyTextsWrapperEnum.Systems1);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Systems2, MyTextsWrapperEnum.Systems2);
            m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Editor, MyTextsWrapperEnum.Editor);
            m_controlTypeList.SelectItemByKey((int)m_currentControlType);
            Controls.Add(m_controlTypeList);

            #endregion

            AddControls();

            ActivateControls(m_currentControlType);
        }
        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);
        }
        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;

            // Decide if screen is for editing existing phys object or adding new
            if (HasEntity())
            {
                //controlsOriginLeft.X += 0.5f * MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X;
                controlsOriginLeft.Y += 0.075f;

                //AddEditPositionControls();                
                AddVoxelMaterialCombobox(
                    controlsOriginLeft + new Vector2(0.1f,-0.02f),
                    controlsOriginLeft + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0) + 2 * CONTROLS_DELTA + new Vector2(0.1f,-0.065f),
                    m_entity.VoxelMaterial);

                if (this.m_entity is MyVoxelMap)
                {
                    Vector2 buttonDelta = new Vector2(-0.15f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f - 0.085f);
                    Controls.Add(new MyGuiControlButton(this, new Vector2(buttonDelta.X, buttonDelta.Y), new Vector2(0.25f, 0.0475f), MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                        MyTextsWrapperEnum.RemoveVoxels, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnClearClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

                    buttonDelta.X = -buttonDelta.X;
                    Controls.Add(new MyGuiControlButton(this, new Vector2(buttonDelta.X, buttonDelta.Y), new Vector2(0.25f, 0.0475f), MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                        MyTextsWrapperEnum.RemoveAllVoxelHands, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnClearVoxelHands, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
                }

                Vector2 controlsColumn2OriginLabel = new Vector2(controlsOriginLeft.X + MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2 + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X + 0.03f, -m_size.Value.Y / 2.0f + 0.04f);
                Vector2 controlsColumn2Origin = new Vector2(controlsColumn2OriginLabel.X + 0.02f, -m_size.Value.Y / 2.0f + 0.04f);

                m_positionX = new MyGuiControlTextbox(this, controlsColumn2Origin + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
                m_positionY = new MyGuiControlTextbox(this, controlsColumn2Origin + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
                m_positionZ = new MyGuiControlTextbox(this, controlsColumn2Origin + 5 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);

                Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.X, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Y, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Z, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

                Controls.Add(m_positionX);
                Controls.Add(m_positionY);
                Controls.Add(m_positionZ);

                m_positionX.Text = m_entity.WorldMatrix.Translation.X.ToString();
                m_positionY.Text = m_entity.WorldMatrix.Translation.Y.ToString();
                m_positionZ.Text = m_entity.WorldMatrix.Translation.Z.ToString();

                m_changeMaterial = new MyGuiControlCheckbox(this, controlsColumn2OriginLabel + 6 * CONTROLS_DELTA + new Vector2(0.16f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
                Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChangeMaterial, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_changeMaterial);

                AddOkAndCancelButtonControls();
            }
            else
            {
                #region Asteroid Type
                //choose asteroid type label
                //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA + new Vector2(0, -0.0f), null, MyTextsWrapperEnum.AsteroidType, MyGuiConstants.LABEL_TEXT_COLOR,
                //    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

                //COMBOBOX - asteroid type
                m_selectAsteroidTypeCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 1 * CONTROLS_DELTA + new Vector2(- controlsOriginRight.X, -0.045f),
                    MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 2);

                foreach (MyGuiAsteroidTypesEnum enumValue in MyGuiAsteroidHelpers.MyGuiAsteroidTypeEnumValues)
                {
                    MyGuiAsteroidHelper asteroidTypeHelper = MyGuiAsteroidHelpers.GetMyGuiAsteroidTypeHelper(enumValue);
                    m_selectAsteroidTypeCombobox.AddItem((int)enumValue, null, asteroidTypeHelper.Description);
                }

                m_selectAsteroidTypeCombobox.SelectItemByKey(0);
                Controls.Add(m_selectAsteroidTypeCombobox);
                m_selectAsteroidTypeCombobox.OnSelect += OnComboboxAsteroidTypeSelect;
                #endregion

                ReloadControls();

                AddOkAndCancelButtonControls();
            }
        }
        void AddVoxelMaterialCombobox(Vector2 labelPosition, Vector2 comboboxPosition, MyMwcVoxelMaterialsEnum? selectedMaterial)
        {
            //choose material label            
            m_selectMaterialLabel = new MyGuiControlLabel(this, labelPosition, null, MyTextsWrapperEnum.AsteroidMaterial, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_selectMaterialLabel);

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

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

                if (voxelMaterialHelper != null)
                    m_selectVoxelMapMaterialCombobox.AddItem((int)enumValue, voxelMaterialHelper.Icon, voxelMaterialHelper.Description);
            }
            int selectedIndex;
            if (selectedMaterial == null)
            {
                selectedIndex = 0;
            }
            else
            {
                selectedIndex = (int)selectedMaterial.Value;
            }
            m_selectVoxelMapMaterialCombobox.SelectItemByKey(selectedIndex);
            m_selectVoxelMapMaterialCombobox.OnSelectItemDoubleClick += OnDoubleClick;
            Controls.Add(m_selectVoxelMapMaterialCombobox);
        }
        public void ReloadControls()
        {
            Vector2 originDelta = new Vector2(0.02f, 0);
            Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta;

            if (GetAsteroidType() == MyGuiAsteroidTypesEnum.VOXEL)
            {
                #region Voxel File
                //choose asteroid label
                m_selectAsteroidLabel = new MyGuiControlLabel(this, controlsOriginLeft + 2.5f * CONTROLS_DELTA + new Vector2(0.02f, -0.02f), null, MyTextsWrapperEnum.AsteroidName, MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                Controls.Add(m_selectAsteroidLabel);

                //COMBOBOX - voxel files
                m_selectVoxelMapCombobox = new MyGuiControlCombobox(this, controlsOriginLeft + 4.5f * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f + 0.02f, -0.065f), MyGuiControlPreDefinedSize.LONGMEDIUM,
                    MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 11, true, false, true);

                foreach (MyMwcVoxelFilesEnum enumValue in MyGuiAsteroidHelpers.MyMwcVoxelFilesEnumValues)
                {
                    MyGuiAsteroidHelper voxelFileHelper = MyGuiAsteroidHelpers.GetMyGuiVoxelFileHelper(enumValue);
                    Debug.Assert(voxelFileHelper.Description != null);
                    m_selectVoxelMapCombobox.AddItem((int)enumValue, voxelFileHelper.Icon, voxelFileHelper.Description);
                }

                m_selectVoxelMapCombobox.SortItemsByValueText();
                m_selectVoxelMapCombobox.SelectItemByKey(1);
                m_selectVoxelMapCombobox.OnSelectItemDoubleClick += OnDoubleClick;
                Controls.Add(m_selectVoxelMapCombobox);
                #endregion

                #region Voxel Material
                Vector2 delta = new Vector2(m_selectVoxelMapCombobox.GetSize().Value.X + 0.02f, 0);
                AddVoxelMaterialCombobox(
                    controlsOriginLeft + 2.5f * CONTROLS_DELTA + delta + new Vector2(0.14f, -0.02f),
                    controlsOriginLeft + 4.5f * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0) + delta + new Vector2(0.14f, -0.065f),
                    null);
                #endregion
            }
            else if (GetAsteroidType() == MyGuiAsteroidTypesEnum.STATIC)
            {

                #region Static Asteroid
                m_selectAsteroidLabel = new MyGuiControlLabel(this, controlsOriginLeft + 2.5f * CONTROLS_DELTA + new Vector2(0.02f,-0.02f), null, MyTextsWrapperEnum.AsteroidName, MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                Controls.Add(m_selectAsteroidLabel);

                //COMBOBOX - static asteroids
                m_selectVoxelMapCombobox = new MyGuiControlCombobox(this, controlsOriginLeft + 4.5f * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f + 0.02f, -0.065f), MyGuiControlPreDefinedSize.LONGMEDIUM,
                    MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 11, true, false, true);

                m_selectVoxelMapCombobox.OnSelectItemDoubleClick += OnDoubleClick;

                foreach (MyMwcObjectBuilder_StaticAsteroid_TypesEnum enumValue in MyGuiAsteroidHelpers.MyMwcStaticAsteroidTypesEnumValues)
                {
                    MyGuiAsteroidHelper staticAsteroidHelper = MyGuiAsteroidHelpers.GetStaticAsteroidTypeHelper(enumValue);

                    if (staticAsteroidHelper != null)
                    {
                        m_selectVoxelMapCombobox.AddItem((int)enumValue, staticAsteroidHelper.Icon, staticAsteroidHelper.Description);
                    }
                }

                m_selectVoxelMapCombobox.SelectItemByIndex(0);
                Controls.Add(m_selectVoxelMapCombobox);

                Vector2 delta = new Vector2(m_selectVoxelMapCombobox.GetSize().Value.X + 0.02f, 0);
                AddVoxelMaterialCombobox(
                    controlsOriginLeft + 2.5f * CONTROLS_DELTA + delta + new Vector2(0.14f, -0.02f),
                    controlsOriginLeft + 4.5f * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0) + delta + new Vector2(0.14f,-0.065f),
                    null);

                m_selectVoxelMapMaterialCombobox.SelectItemByKey(0); // Select default material

                #endregion
            }
        }
        public void InitControls()
        {           
            StringBuilder otherSideInventoryName = new StringBuilder();
            otherSideInventoryName.Append(string.IsNullOrEmpty(m_entity.DisplayName) ? m_entity.GetFriendlyName() : m_entity.DisplayName);
            otherSideInventoryName.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.OtherSideInventory));

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

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

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

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

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

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


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

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

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

                otherSettingsPosition += MyGuiConstants.CONTROLS_DELTA;

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

                RefillTime = PrefabContainer.RefillTime;
                SelectedTemplateType = EntityWithInventory.Inventory.TemplateType;
            }            
        }
        private void RecreateDynamicProperties()
        {
            Vector2 controlsOriginLeft = m_position + new Vector2(-m_size.Value.X / 2.0f + 0.025f, -m_size.Value.Y / 2.0f + 0.025f);
            controlsOriginLeft.Y = m_offsetForSizeProperties;
            Vector2 labelOffset = new Vector2(-0.015f, 0f);
            Vector2 controlsDelta = MyGuiConstants.CONTROLS_DELTA * 0.6f;            

            #region shape size slidebar

            foreach (MyGuiControlBase oldControl in m_dynamicControls)
            {
                m_controls.Remove(oldControl);
            }
            m_dynamicControls.Clear();


            float propScale = 0.65f;
            float sliderWidth = MyGuiConstants.SLIDER_WIDTH * 1.2f;
            
            for (int i = 0; i < MyEditorVoxelHand.VoxelHandShape.GetPropertiesCount(); i++)
            {
                MyGuiControlLabel label = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyEditorVoxelHand.VoxelHandShape.GetPropertyName(i), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * propScale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                MyGuiControlSlider voxelShapeSizeSlider = new MyGuiControlSlider(m_parent, controlsOriginLeft + new Vector2(0.145f, 0), sliderWidth,
                    MyVoxelConstants.MIN_VOXEL_HAND_SIZE, MyVoxelConstants.MAX_VOXEL_HAND_SIZE * MyVoxelConstants.VOXEL_SIZE_IN_METRES, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                    new StringBuilder("{0}"), 0.05f, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f, propScale);
                m_dynamicControls.Add(label);
                m_dynamicControls.Add(voxelShapeSizeSlider);
                m_controls.Add(label);
                m_controls.Add(voxelShapeSizeSlider);

                voxelShapeSizeSlider.SetValue(MyEditorVoxelHand.VoxelHandShape.GetPropertyValue(i));
                voxelShapeSizeSlider.UserData = i;
                voxelShapeSizeSlider.OnChange += OnSizeSliderChange;

                controlsOriginLeft += new Vector2(0, MyGuiConstants.SLIDER_HEIGHT * propScale * 0.75f);
            }

            controlsOriginLeft += new Vector2(0, MyGuiConstants.SLIDER_HEIGHT * propScale);

            #endregion

            #region shape distance slidebar

            if (m_voxelShapeDistanceLabel != null)
            {
                m_voxelShapeDistanceLabel.SetPosition(controlsOriginLeft + labelOffset);
                m_voxelShapeDistanceSlider.SetPosition(controlsOriginLeft + new Vector2(0.145f, 0));
            }
            else
            {
                m_controls.Add(m_voxelShapeDistanceLabel = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandShapeDistance, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * propScale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_voxelShapeDistanceSlider = new MyGuiControlSlider(m_parent, controlsOriginLeft + new Vector2(0.145f, 0), sliderWidth,
                    MyVoxelConstants.MIN_VOXEL_HAND_DISTANCE, MyVoxelConstants.MAX_VOXEL_HAND_DISTANCE, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                    new StringBuilder("{0:0.00}"), 0.05f, 2, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f, propScale);
                m_controls.Add(m_voxelShapeDistanceSlider);

                m_voxelShapeDistanceSlider.SetValue(MyEditorVoxelHand.GetShapeDistance());
                m_voxelShapeDistanceSlider.OnChange += OnDistanceSliderChange;
            }

            #endregion


            controlsOriginLeft += MyGuiConstants.CONTROLS_DELTA;

            #region shape material
            Vector2 iconSize = new Vector2(0.095f, 0.095f);

            if (m_voxelShapeMaterialLabel != null)
            {
                m_voxelShapeMaterialLabel.SetPosition(controlsOriginLeft + labelOffset);
                controlsOriginLeft += controlsDelta;
                m_voxelShapeMaterialCombobox.SetPosition(new Vector2(controlsOriginLeft.X - 0.015f + MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, controlsOriginLeft.Y));
            }
            else
            {
                m_controls.Add(m_voxelShapeMaterialLabel = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandShapeMaterial, MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                controlsOriginLeft += controlsDelta;
                m_voxelShapeMaterialCombobox = new MyGuiControlCombobox(m_parent, new Vector2(controlsOriginLeft.X - 0.015f, controlsOriginLeft.Y) + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, iconSize.Y / 2.5f), MyGuiControlPreDefinedSize.MEDIUM,
                    iconSize, new Vector2(0.015f, 0f), MyGuiConstants.COMBOBOX_BACKGROUND_COLOR * 0.7f, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4, true, false, true);

                foreach (MyMwcVoxelMaterialsEnum voxelMaterial in MyGuiAsteroidHelpers.MyMwcVoxelMaterialsEnumValues)
                {
                    MyGuiVoxelMaterialHelper voxelMaterialHelper = MyGuiAsteroidHelpers.GetMyGuiVoxelMaterialHelper(voxelMaterial);
                    m_voxelShapeMaterialCombobox.AddItem((int)voxelMaterial, voxelMaterialHelper.Icon, voxelMaterialHelper.Description);
                }
                m_controls.Add(m_voxelShapeMaterialCombobox);
                m_voxelShapeMaterialCombobox.OnSelect += OnComboboxItemSelect;
            }

            #endregion

            controlsOriginLeft += 3.4f * MyGuiConstants.CONTROLS_DELTA;
            if (m_attachDetachVoxelHandCheckbox != null)
                m_controls.Remove(m_attachDetachVoxelHandCheckbox);
            if (m_detachLabel != null)
                m_controls.Remove(m_detachLabel);

            MyTextsWrapperEnum text = MyEditorVoxelHand.DetachedVoxelHand == null ? MyTextsWrapperEnum.DetachVoxelHand : MyTextsWrapperEnum.AttachVoxelHand;

            m_detachLabel = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, text, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * propScale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_controls.Add(m_detachLabel);

            m_attachDetachVoxelHandCheckbox = new MyGuiControlCheckbox(m_parent, new Vector2(controlsOriginLeft.X + 5*MyGuiConstants.CHECKBOX_SIZE.X, controlsOriginLeft.Y), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, m_detachLabel);
            m_attachDetachVoxelHandCheckbox.OnCheck += OnAttachClick;

            m_controls.Add(m_attachDetachVoxelHandCheckbox);
                 

            LoadSortedControlsByPriority();
        }
        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();
        }
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.73f, 0.93f);
            Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + new Vector2(0.02f, 0.01f);
            Vector2 controlsOriginRight = GetControlsOriginRightFromScreenSize();

            // Add screen title
            AddCaption();            

            #region Faction nationality

            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, controlsOriginRight + 1 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5);

            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(1);
            Controls.Add(m_selectShipFactionCombobox);

            #endregion

            // AI Template
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.AITemplate, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_selectAITemplateCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 2 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5);

            foreach (MyAITemplateEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_BotAITemplateValues)
            {
                MyGuiHelperBase aiTemplateHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipBotAITemplate(enumValue);
                if (aiTemplateHelper != null)
                    m_selectAITemplateCombobox.AddItem((int)enumValue, null, aiTemplateHelper.Description);
            }

            m_selectAITemplateCombobox.SelectItemByKey(0);
            Controls.Add(m_selectAITemplateCombobox);

            // Aggresivity
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Aggressivity, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_aggresivitySlider = new MyGuiControlSlider(this, controlsOriginRight + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2, 0), MyGuiConstants.SLIDER_WIDTH,
                                        0, 1, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                        new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);

            m_aggresivityLabel = new MyGuiControlLabel(this, controlsOriginRight + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH, 0), null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(m_aggresivitySlider);
            Controls.Add(m_aggresivityLabel);

            m_aggresivitySlider.OnChange += OnAggresivityChanged;
            OnAggresivityChanged(m_aggresivitySlider);

            // See distance
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.SeeDistance, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_seeDistanceSlider = new MyGuiControlSlider(this, controlsOriginRight + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2, 0), MyGuiConstants.SLIDER_WIDTH,
                                        0, 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                        new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);

            m_seeDistanceLabel = new MyGuiControlLabel(this, controlsOriginRight + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH, 0), null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(m_seeDistanceSlider);
            Controls.Add(m_seeDistanceLabel);

            m_seeDistanceSlider.OnChange += OnSeeDistanceChanged;
            OnSeeDistanceChanged(m_seeDistanceSlider);

            #region Smallship Model

            MyGuiControlLabel smallShipLabel = new MyGuiControlLabel(this, controlsOriginLeft + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseModel, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(smallShipLabel);

            //COMBOBOX - small ship
            var comboboxPredefinedSize = MyGuiControlPreDefinedSize.LONGMEDIUM;
            var comboboxSize = MyGuiControlCombobox.GetPredefinedControlSize(comboboxPredefinedSize);
            m_selectSmallShipCombobox = new MyGuiControlCombobox(
                this,
                controlsOriginLeft + 5 * CONTROLS_DELTA + 0.5f * new Vector2(comboboxSize.X, 0) + new Vector2(0.19f, 0.01f),
                comboboxPredefinedSize,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                MyGuiConstants.COMBOBOX_TEXT_SCALE,
                6,
                true,
                false,
                true);

            if (m_templatesBuilders == null)
            {
                foreach (MyMwcObjectBuilder_SmallShip_TypesEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_TypesEnumValues)
                {
                    //MyGuiSmallShipHelperSmallShip smallShipHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperSmallShip(enumValue);
                    MyGuiSmallShipHelperSmallShip smallShipHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, (int)enumValue) as MyGuiSmallShipHelperSmallShip;
                    m_selectSmallShipCombobox.AddItem((int)enumValue, smallShipHelper.Icon, smallShipHelper.Name);
                }
                m_selectSmallShipCombobox.SelectItemByKey(1);
            }
            else 
            {
                for(int i = 0; i < m_templatesBuilders.Count; i++)
                {
                    var templateBuilder = m_templatesBuilders[i];
                    m_selectSmallShipCombobox.AddItem(i, templateBuilder.Name);
                }                
            }
            
            m_selectSmallShipCombobox.OnSelectItemDoubleClick += OnOkClick;
            Controls.Add(m_selectSmallShipCombobox);
            #endregion

            if (m_bot != null)
            {
                Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 10 * CONTROLS_DELTA + new Vector2(0.07f, 0.02f), 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));

                AddActivatedCheckbox(controlsOriginLeft, m_bot.Activated);
            }

            AddOkAndCancelButtonControls(new Vector2(0, -0.02f));
        }
        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);
        }
        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");
        }