Exemple #1
0
        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));
        }
        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));
        }