示例#1
0
        private void AddMod(bool active, StringBuilder title, StringBuilder toolTip, StringBuilder modState, MyGuiHighlightTexture? icon, MyObjectBuilder_Checkpoint.ModItem mod, Color? textColor = null)
        {
            var row = new MyGuiControlTable.Row(mod);
            row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, toolTip: modState.ToString(), icon: icon));
            row.AddCell(new MyGuiControlTable.Cell(text: title, toolTip: toolTip.ToString(), textColor: textColor));

            if (active)
                m_modsTableEnabled.Insert(0, row);
            else
                m_modsTableDisabled.Insert(0, row);
        }
 private void RefreshInternals()
 {
     if (IsChecked)
     {
         if (HasHighlight)
             BackgroundTexture = m_styleDef.HighlightCheckedTexture;
         else
             BackgroundTexture = m_styleDef.NormalCheckedTexture;
         m_icon = m_styleDef.CheckedIcon;
         Size = m_styleDef.SizeOverride ?? BackgroundTexture.MinSizeGui;
     }
     else
     {
         if (HasHighlight)
             BackgroundTexture = m_styleDef.HighlightUncheckedTexture;
         else
             BackgroundTexture = m_styleDef.NormalUncheckedTexture;
         m_icon = m_styleDef.UncheckedIcon;
         Size = m_styleDef.SizeOverride ?? BackgroundTexture.MinSizeGui;
     }
     MinSize = BackgroundTexture.MinSizeGui;
     MaxSize = BackgroundTexture.MaxSizeGui;
 }
        private void AddFaction(IMyFaction faction, Color? color = null, MyGuiHighlightTexture? icon = null, String iconToolTip = null)
        {
            System.Diagnostics.Debug.Assert(m_tableFactions != null);
            if (m_tableFactions == null)
                return;

            var row  = new MyGuiControlTable.Row(faction);
            var tag  = new StringBuilder(faction.Tag);
            var name = new StringBuilder(faction.Name);
            row.AddCell(new MyGuiControlTable.Cell(text: tag, userData: tag, textColor: color));
            row.AddCell(new MyGuiControlTable.Cell(text: name, userData: name, textColor: color, toolTip: faction.Name));
            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(), icon: icon, toolTip: iconToolTip));
            m_tableFactions.Add(row);
        }
示例#4
0
 private MyGuiControlButton MakeButtonTiny(Vector2 position, float rotation, MyStringId toolTip, MyGuiHighlightTexture icon, Action<MyGuiControlButton> onClick, Vector2? size = null)
 {
     var button = new MyGuiControlButton(
                     position: position,
                     toolTip: MyTexts.GetString(toolTip),
                     onButtonClick: onClick,
                     visualStyle: MyGuiControlButtonStyleEnum.Square,
                     size: size);
     button.Icon = icon;
     button.IconRotation = rotation;
     button.IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
     return button;
 }
示例#5
0
        private void RefreshGameList()
        {
            m_selectedRow   = null;
            m_selectedTable = null;

            ListReader <MyObjectBuilder_Checkpoint.ModItem> lastActiveMods;

            if (m_keepActiveMods)
            {
                var tmp = new List <MyObjectBuilder_Checkpoint.ModItem>(m_modsTableEnabled.RowsCount);
                GetActiveMods(tmp);
                lastActiveMods = tmp;
            }
            else
            {
                lastActiveMods = m_modListToEdit;
            }
            m_keepActiveMods = true;
            GetWorldMods(lastActiveMods);

            m_modsTableEnabled.Clear();
            m_modsTableDisabled.Clear();
            AddHeaders();

            foreach (var mod in lastActiveMods)
            {
                if (mod.PublishedFileId == 0)
                {
                    var   title                = new StringBuilder(mod.Name);
                    var   modFullPath          = Path.Combine(MyFileSystem.ModsPath, mod.Name);
                    var   toolTip              = new StringBuilder(modFullPath);
                    var   modState             = MyTexts.Get(MySpaceTexts.ScreenMods_LocalMod);
                    Color?textColor            = null;
                    MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_LOCAL;

                    if (!Directory.Exists(modFullPath) && !File.Exists(modFullPath))
                    {
                        toolTip   = MyTexts.Get(MySpaceTexts.ScreenMods_MissingLocalMod);
                        modState  = toolTip;
                        textColor = MyHudConstants.MARKER_COLOR_RED;
                    }

                    AddMod(true, title, toolTip, modState, icon, mod, textColor);
                }
                else
                {
                    var   title     = new StringBuilder();
                    var   toolTip   = new StringBuilder();
                    var   modState  = MyTexts.Get(MySpaceTexts.ScreenMods_WorkshopMod);
                    Color?textColor = null;

                    var subscribedItem = GetSubscribedItem(mod.PublishedFileId);
                    if (subscribedItem != null)
                    {
                        title.Append(subscribedItem.Title);

                        var shortLen     = Math.Min(subscribedItem.Description.Length, 128);
                        var newlineIndex = subscribedItem.Description.IndexOf("\n");
                        if (newlineIndex > 0)
                        {
                            shortLen = Math.Min(shortLen, newlineIndex - 1);
                        }
                        toolTip.Append(subscribedItem.Description.Substring(0, shortLen));
                    }
                    else
                    {
                        title.Append(mod.PublishedFileId.ToString());
                        toolTip   = MyTexts.Get(MySpaceTexts.ScreenMods_MissingDetails);
                        textColor = MyHudConstants.MARKER_COLOR_RED;
                    }

                    MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP;

                    AddMod(true, title, toolTip, modState, icon, mod, textColor);
                }
            }

            if (!Directory.Exists(MyFileSystem.ModsPath))
            {
                Directory.CreateDirectory(MyFileSystem.ModsPath);
            }

            foreach (var modFullPath in Directory.GetDirectories(MyFileSystem.ModsPath, "*", SearchOption.TopDirectoryOnly))
            {
                var modName = Path.GetFileName(modFullPath);
                if (m_worldLocalMods.Contains(modName))
                {
                    continue;
                }

                if (Directory.GetFileSystemEntries(modFullPath).Length == 0)
                {
                    continue;
                }

                if (MyFakes.ENABLE_MOD_CATEGORIES)
                {
                    if (!CheckSearch(modName))
                    {
                        continue;
                    }
                }

                var titleSB       = new StringBuilder(modName);
                var descriptionSB = modFullPath;
                var modStateSB    = MyTexts.GetString(MySpaceTexts.ScreenMods_LocalMod);

                var publishedFileId = MySteamWorkshop.GetWorkshopIdFromLocalMod(modFullPath);

                MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_LOCAL;

                var row = new MyGuiControlTable.Row(new MyObjectBuilder_Checkpoint.ModItem(modName, 0));
                row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(), toolTip: modStateSB, icon: icon));
                row.AddCell(new MyGuiControlTable.Cell(text: titleSB, toolTip: descriptionSB));
                m_modsTableDisabled.Add(row);
            }

            if (m_subscribedMods != null)
            {
                foreach (var mod in m_subscribedMods)
                {
                    if (m_worldWorkshopMods.Contains(mod.PublishedFileId))
                    {
                        continue;
                    }
                    if (MyFakes.ENABLE_MOD_CATEGORIES)
                    {
                        bool add = false;
                        foreach (var tag in mod.Tags)
                        {
                            if (m_selectedCategories.Contains(tag.ToLower()) || m_selectedCategories.Count == 0)
                            {
                                add = true;
                                break;
                            }
                        }
                        if (!CheckSearch(mod.Title))
                        {
                            continue;
                        }
                        if (!add)
                        {
                            continue;
                        }
                    }
                    var titleSB      = new StringBuilder(mod.Title);
                    var shortLen     = Math.Min(mod.Description.Length, 128);
                    var newlineIndex = mod.Description.IndexOf("\n");
                    if (newlineIndex > 0)
                    {
                        shortLen = Math.Min(shortLen, newlineIndex - 1);
                    }
                    var descriptionSB = new StringBuilder();
                    var modStateSB    = MyTexts.GetString(MySpaceTexts.ScreenMods_WorkshopMod);

                    var path = Path.Combine(MyFileSystem.ModsPath, string.Format("{0}.sbm", mod.PublishedFileId));

                    if (mod.Description.Length != 0)
                    {
                        descriptionSB.AppendLine(path);
                    }
                    else
                    {
                        descriptionSB.Append(path);
                    }
                    descriptionSB.Append(mod.Description.Substring(0, shortLen));

                    MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP;

                    var row = new MyGuiControlTable.Row(new MyObjectBuilder_Checkpoint.ModItem(null, mod.PublishedFileId));
                    row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(), toolTip: modStateSB, icon: icon));
                    row.AddCell(new MyGuiControlTable.Cell(text: titleSB, toolTip: descriptionSB.ToString()));
                    m_modsTableDisabled.Add(row);
                }
            }
        }
示例#6
0
        private MyGuiControlButton MakeButtonTiny(Vector2 position, float rotation, MyStringId toolTip, MyGuiHighlightTexture icon, Action <MyGuiControlButton> onClick, Vector2?size = null)
        {
            var button = new MyGuiControlButton(
                position: position,
                toolTip: MyTexts.GetString(toolTip),
                onButtonClick: onClick,
                visualStyle: MyGuiControlButtonStyleEnum.Square,
                size: size);

            button.Icon            = icon;
            button.IconRotation    = rotation;
            button.IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            return(button);
        }
 public Cell(StringBuilder text, object userData = null, String toolTip = null, Color? textColor = null,
             MyGuiHighlightTexture? icon = null, MyGuiDrawAlignEnum iconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)
 {
     if (text != null)
         Text = new StringBuilder().AppendStringBuilder(text);
     if (toolTip != null)
         ToolTip = new MyToolTips(toolTip);
     UserData = userData;
     Icon = icon;
     IconOriginAlign = iconOriginAlign;
     TextColor = textColor;
 }
示例#8
0
        protected override unsafe void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);
            this.Textures          = new Dictionary <MyStringId, MyGuiCompositeTexture>(MyStringId.Comparer);
            this.IconStyles        = new Dictionary <MyStringId, IconStyleDefinition>(MyStringId.Comparer);
            this.ButtonStyles      = new Dictionary <MyStringId, MyGuiControlButton.StyleDefinition>(MyStringId.Comparer);
            this.ComboboxStyles    = new Dictionary <MyStringId, MyGuiControlCombobox.StyleDefinition>(MyStringId.Comparer);
            this.LabelStyles       = new Dictionary <MyStringId, MyGuiControlLabel.StyleDefinition>(MyStringId.Comparer);
            this.CheckboxStyles    = new Dictionary <MyStringId, MyGuiControlCheckbox.StyleDefinition>(MyStringId.Comparer);
            this.SliderStyles      = new Dictionary <MyStringId, MyGuiControlSliderBase.StyleDefinition>(MyStringId.Comparer);
            this.ImageButtonStyles = new Dictionary <MyStringId, MyGuiControlImageButton.StyleDefinition>(MyStringId.Comparer);
            this.ListboxStyles     = new Dictionary <MyStringId, MyGuiControlListbox.StyleDefinition>(MyStringId.Comparer);
            this.TextboxStyles     = new Dictionary <MyStringId, MyGuiControlTextbox.StyleDefinition>(MyStringId.Comparer);
            this.ImageStyles       = new Dictionary <MyStringId, MyGuiControlImage.StyleDefinition>(MyStringId.Comparer);
            this.ContextMenuStyles = new Dictionary <MyStringId, MyContextMenuStyleDefinition>(MyStringId.Comparer);
            this.ButtonListStyles  = new Dictionary <MyStringId, MyButtonListStyleDefinition>(MyStringId.Comparer);
            MyObjectBuilder_GuiSkinDefinition definition = builder as MyObjectBuilder_GuiSkinDefinition;

            if (definition != null)
            {
                MyGuiHighlightTexture texture;
                if (definition.GuiTextures != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.TextureStyleDefinition definition2 in definition.GuiTextures)
                    {
                        this.Textures[MyStringId.GetOrCompute(definition2.StyleName)] = definition2.Texture;
                    }
                }
                if (definition.GuiIcons != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.IconStyleDefinition definition3 in definition.GuiIcons)
                    {
                        IconStyleDefinition definition1 = new IconStyleDefinition();
                        definition1.Normal          = definition3.Normal;
                        definition1.Highlight       = definition3.Highlight;
                        definition1.Active          = definition3.Active;
                        definition1.ActiveHighlight = definition3.ActiveHighlight;
                        definition1.Disabled        = definition3.Disabled;
                        IconStyleDefinition definition4 = definition1;
                        this.IconStyles[MyStringId.GetOrCompute(definition3.StyleName)] = definition4;
                    }
                }
                if (definition.Buttons != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.ButtonStyleDefinition definition5 in definition.Buttons)
                    {
                        MyGuiControlButton.StyleDefinition definition26 = new MyGuiControlButton.StyleDefinition();
                        definition26.BackgroundColor  = (Vector4)definition5.BackgroundColor;
                        definition26.NormalTexture    = definition5.Normal.Texture;
                        definition26.HighlightTexture = definition5.Highlight.Texture;
                        definition26.NormalFont       = definition5.Normal.Font;
                        definition26.HighlightFont    = definition5.Highlight.Font;
                        definition26.Padding          = new MyGuiBorderThickness(definition5.Padding.Left / MyGuiConstants.GUI_OPTIMAL_SIZE.X, definition5.Padding.Right / MyGuiConstants.GUI_OPTIMAL_SIZE.X, definition5.Padding.Top / MyGuiConstants.GUI_OPTIMAL_SIZE.Y, definition5.Padding.Bottom / MyGuiConstants.GUI_OPTIMAL_SIZE.Y);
                        MyGuiControlButton.StyleDefinition      definition6  = definition26;
                        MyGuiControlImageButton.StyleDefinition definition27 = new MyGuiControlImageButton.StyleDefinition();
                        definition27.BackgroundColor = (Vector4)definition5.BackgroundColor;
                        definition27.Padding         = new MyGuiBorderThickness(definition5.Padding.Left / MyGuiConstants.GUI_OPTIMAL_SIZE.X, definition5.Padding.Right / MyGuiConstants.GUI_OPTIMAL_SIZE.X, definition5.Padding.Top / MyGuiConstants.GUI_OPTIMAL_SIZE.Y, definition5.Padding.Bottom / MyGuiConstants.GUI_OPTIMAL_SIZE.Y);
                        MyGuiControlImageButton.StyleDefinition definition7  = definition27;
                        MyGuiControlImageButton.StateDefinition definition28 = new MyGuiControlImageButton.StateDefinition();
                        definition28.Font           = definition5.Normal.Font;
                        definition28.Texture        = definition5.Normal.Texture;
                        definition28.CornerTextFont = definition5.Normal.CornerTextFont;
                        definition28.CornerTextSize = definition5.Normal.CornerTextSize;
                        definition7.Normal          = definition28;
                        if (definition5.Disabled == null)
                        {
                            definition7.Disabled = definition7.Normal;
                        }
                        else
                        {
                            MyGuiControlImageButton.StateDefinition definition29 = new MyGuiControlImageButton.StateDefinition();
                            definition29.Font           = definition5.Disabled.Font;
                            definition29.Texture        = definition5.Disabled.Texture;
                            definition29.CornerTextFont = definition5.Disabled.CornerTextFont;
                            definition29.CornerTextSize = definition5.Disabled.CornerTextSize;
                            definition7.Disabled        = definition29;
                        }
                        if (definition5.Active == null)
                        {
                            definition7.Active = definition7.Normal;
                        }
                        else
                        {
                            MyGuiControlImageButton.StateDefinition definition30 = new MyGuiControlImageButton.StateDefinition();
                            definition30.Font           = definition5.Active.Font;
                            definition30.Texture        = definition5.Active.Texture;
                            definition30.CornerTextFont = definition5.Active.CornerTextFont;
                            definition30.CornerTextSize = definition5.Active.CornerTextSize;
                            definition7.Active          = definition30;
                        }
                        if (definition5.Highlight == null)
                        {
                            definition7.Highlight = definition7.Normal;
                        }
                        else
                        {
                            MyGuiControlImageButton.StateDefinition definition31 = new MyGuiControlImageButton.StateDefinition();
                            definition31.Font           = definition5.Highlight.Font;
                            definition31.Texture        = definition5.Highlight.Texture;
                            definition31.CornerTextFont = definition5.Highlight.CornerTextFont;
                            definition31.CornerTextSize = definition5.Highlight.CornerTextSize;
                            definition7.Highlight       = definition31;
                        }
                        if (definition5.ActiveHighlight == null)
                        {
                            definition7.ActiveHighlight = definition7.Highlight;
                        }
                        else
                        {
                            MyGuiControlImageButton.StateDefinition definition32 = new MyGuiControlImageButton.StateDefinition();
                            definition32.Font           = definition5.ActiveHighlight.Font;
                            definition32.Texture        = definition5.ActiveHighlight.Texture;
                            definition32.CornerTextFont = definition5.ActiveHighlight.CornerTextFont;
                            definition32.CornerTextSize = definition5.ActiveHighlight.CornerTextSize;
                            definition7.ActiveHighlight = definition32;
                        }
                        this.ButtonStyles[MyStringId.GetOrCompute(definition5.StyleName)]      = definition6;
                        this.ImageButtonStyles[MyStringId.GetOrCompute(definition5.StyleName)] = definition7;
                    }
                }
                if (definition.Labels != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.LabelStyleDefinition definition8 in definition.Labels)
                    {
                        MyGuiControlLabel.StyleDefinition definition33 = new MyGuiControlLabel.StyleDefinition();
                        definition33.Font      = definition8.Font;
                        definition33.ColorMask = (Vector4)definition8.Color;
                        definition33.TextScale = definition8.TextScale;
                        MyGuiControlLabel.StyleDefinition definition9 = definition33;
                        this.LabelStyles[MyStringId.GetOrCompute(definition8.StyleName)] = definition9;
                    }
                }
                if (definition.Checkboxes != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.CheckboxStyleDefinition definition10 in definition.Checkboxes)
                    {
                        MyGuiControlCheckbox.StyleDefinition definition34 = new MyGuiControlCheckbox.StyleDefinition();
                        definition34.NormalCheckedTexture      = definition10.NormalChecked.Texture;
                        definition34.NormalUncheckedTexture    = definition10.NormalUnchecked.Texture;
                        definition34.HighlightCheckedTexture   = definition10.HighlightChecked.Texture;
                        definition34.HighlightUncheckedTexture = definition10.HighlightUnchecked.Texture;
                        texture = new MyGuiHighlightTexture {
                            Highlight = definition10.HighlightChecked.Icon,
                            Normal    = definition10.NormalChecked.Icon,
                            SizePx    = (Vector2)definition10.IconSize
                        };
                        definition34.CheckedIcon = texture;
                        texture = new MyGuiHighlightTexture {
                            Highlight = definition10.HighlightUnchecked.Icon,
                            Normal    = definition10.NormalUnchecked.Icon,
                            SizePx    = (Vector2)definition10.IconSize
                        };
                        definition34.UncheckedIcon = texture;
                        MyGuiControlCheckbox.StyleDefinition definition11 = definition34;
                        this.CheckboxStyles[MyStringId.GetOrCompute(definition10.StyleName)] = definition11;
                    }
                }
                if (definition.Sliders != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.SliderStyleDefinition definition12 in definition.Sliders)
                    {
                        MyGuiHighlightTexture *texturePtr1;
                        MyGuiControlSliderBase.StyleDefinition definition35 = new MyGuiControlSliderBase.StyleDefinition();
                        definition35.RailTexture          = definition12.Normal.TrackTexture;
                        definition35.RailHighlightTexture = (definition12.Highlight != null) ? definition12.Highlight.TrackTexture : definition12.Normal.TrackTexture;
                        texture = new MyGuiHighlightTexture();
                        MyGuiControlSliderBase.StyleDefinition local3 = definition35;
                        MyGuiControlSliderBase.StyleDefinition local4 = definition35;
                        texturePtr1->Highlight = (definition12.Highlight != null) ? definition12.Highlight.Thumb : definition12.Normal.Thumb;
                        texturePtr1            = (MyGuiHighlightTexture *)ref texture;
                        texture.Normal         = definition12.Normal.Thumb;
                        texture.SizePx         = (Vector2)definition12.ThumbSize;
                        local4.ThumbTexture    = texture;
                        MyGuiControlSliderBase.StyleDefinition definition13 = local4;
                        this.SliderStyles[MyStringId.GetOrCompute(definition12.StyleName)] = definition13;
                    }
                }
                if (definition.Comboboxes != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.ComboboxStyleDefinition definition14 in definition.Comboboxes)
                    {
                        MyGuiControlCombobox.StyleDefinition definition36 = new MyGuiControlCombobox.StyleDefinition();
                        definition36.TextScale                = definition14.TextScale;
                        definition36.ComboboxTextureNormal    = definition14.Normal.Texture;
                        definition36.ComboboxTextureHighlight = (definition14.Highlight != null) ? definition14.Highlight.Texture : definition14.Normal.Texture;
                        MyGuiControlCombobox.StyleDefinition local1 = definition36;
                        local1.ItemFontNormal    = definition14.Normal.ItemFont;
                        local1.ItemFontHighlight = (definition14.Highlight != null) ? definition14.Highlight.ItemFont : definition14.Normal.ItemFont;
                        MyGuiControlCombobox.StyleDefinition local2 = local1;
                        local2.ItemTextureHighlight        = definition14.ItemTextureHighlight;
                        local2.DropDownHighlightExtraWidth = 0.007f;
                        local2.SelectedItemOffset          = new Vector2(0.01f, 0.005f);
                        MyGuiBorderThickness thickness = new MyGuiBorderThickness {
                            Left   = definition14.ScrollbarMargin.Left / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
                            Right  = definition14.ScrollbarMargin.Right / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
                            Bottom = definition14.ScrollbarMargin.Bottom / MyGuiConstants.GUI_OPTIMAL_SIZE.Y,
                            Top    = definition14.ScrollbarMargin.Top / MyGuiConstants.GUI_OPTIMAL_SIZE.Y
                        };
                        local2.ScrollbarMargin = thickness;
                        local2.DropDownTexture = definition14.DropDownTexture;
                        MyGuiControlCombobox.StyleDefinition definition15 = local2;
                        this.ComboboxStyles[MyStringId.GetOrCompute(definition14.StyleName)] = definition15;
                    }
                }
                if (definition.Listboxes != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.ListboxStyleDefinition definition16 in definition.Listboxes)
                    {
                        MyGuiControlListbox.StyleDefinition definition17 = new MyGuiControlListbox.StyleDefinition {
                            TextScale            = definition16.TextScale,
                            ItemFontHighlight    = definition16.ItemFontHighlight,
                            ItemFontNormal       = definition16.ItemFontNormal,
                            ItemSize             = (Vector2)definition16.ItemSize,
                            ItemsOffset          = (Vector2)definition16.ItemOffset,
                            ItemTextureHighlight = definition16.ItemTextureHighlight,
                            Texture       = definition16.Texture,
                            XSizeVariable = definition16.XSizeVariable,
                            DrawScroll    = definition16.DrawScrollbar
                        };
                        this.ListboxStyles[MyStringId.GetOrCompute(definition16.StyleName)] = definition17;
                    }
                }
                if (definition.Textboxes != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.TextboxStyleDefinition definition18 in definition.Textboxes)
                    {
                        MyGuiControlTextbox.StyleDefinition definition19 = new MyGuiControlTextbox.StyleDefinition {
                            NormalFont    = definition18.Normal.Font,
                            NormalTexture = definition18.Normal.Texture
                        };
                        if (definition18.Highlight != null)
                        {
                            definition19.HighlightFont    = definition18.Highlight.Font;
                            definition19.HighlightTexture = definition18.Highlight.Texture;
                        }
                        else
                        {
                            definition19.HighlightFont    = definition18.Normal.Font;
                            definition19.HighlightTexture = definition18.Normal.Texture;
                        }
                        this.TextboxStyles[MyStringId.GetOrCompute(definition18.StyleName)] = definition19;
                    }
                }
                if (definition.Images != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.ImageStyleDefinition definition20 in definition.Images)
                    {
                        MyGuiControlImage.StyleDefinition definition37 = new MyGuiControlImage.StyleDefinition();
                        definition37.BackgroundTexture = definition20.Texture;
                        definition37.Padding           = new MyGuiBorderThickness(definition20.Padding.Left / MyGuiConstants.GUI_OPTIMAL_SIZE.X, definition20.Padding.Right / MyGuiConstants.GUI_OPTIMAL_SIZE.X, definition20.Padding.Top / MyGuiConstants.GUI_OPTIMAL_SIZE.Y, definition20.Padding.Bottom / MyGuiConstants.GUI_OPTIMAL_SIZE.Y);
                        MyGuiControlImage.StyleDefinition definition21 = definition37;
                        this.ImageStyles[MyStringId.GetOrCompute(definition20.StyleName)] = definition21;
                    }
                }
                if (definition.ContextMenus != null)
                {
                    foreach (MyObjectBuilder_GuiSkinDefinition.ContextMenuStyleDefinition definition22 in definition.ContextMenus)
                    {
                        MyContextMenuStyleDefinition definition38 = new MyContextMenuStyleDefinition();
                        definition38.TitleTexture    = definition22.TitleTexture;
                        definition38.ImageStyle      = MyStringId.GetOrCompute(definition22.ImageStyle);
                        definition38.SeparatorStyle  = MyStringId.GetOrCompute(definition22.SeparatorStyle);
                        definition38.SeparatorHeight = definition22.SeparatorHeight;
                        definition38.Margin          = (Vector2)definition22.Margin;
                        MyContextMenuStyleDefinition definition23 = definition38;
                        this.ContextMenuStyles[MyStringId.GetOrCompute(definition22.StyleName)] = definition23;
                    }
                }
                if (definition.ButtonListStyles != null)
                {
                    foreach (MyObjectBuilder_ButtonListStyleDefinition definition24 in definition.ButtonListStyles)
                    {
                        MyButtonListStyleDefinition definition25 = new MyButtonListStyleDefinition {
                            ButtonMargin = (Vector2)definition24.ButtonMargin,
                            ButtonSize   = (Vector2)definition24.ButtonSize
                        };
                        this.ButtonListStyles[MyStringId.GetOrCompute(definition24.StyleName)] = definition25;
                    }
                }
            }
        }
        private void RefreshInternals()
        {
            if (m_styleDef == null)
                m_styleDef = m_styles[(int)MyGuiControlCheckboxStyleEnum.Default];

            if (IsChecked)
            {
                if (HasHighlight)
                    BackgroundTexture = m_styleDef.HighlightCheckedTexture;
                else
                    BackgroundTexture = m_styleDef.NormalCheckedTexture;
                m_icon = m_styleDef.CheckedIcon;
                Size = m_styleDef.SizeOverride ?? BackgroundTexture.MinSizeGui;
            }
            else
            {
                if (HasHighlight)
                    BackgroundTexture = m_styleDef.HighlightUncheckedTexture;
                else
                    BackgroundTexture = m_styleDef.NormalUncheckedTexture;
                m_icon = m_styleDef.UncheckedIcon;
                Size = m_styleDef.SizeOverride ?? BackgroundTexture.MinSizeGui;
            }
            MinSize = BackgroundTexture.MinSizeGui;
            MaxSize = BackgroundTexture.MaxSizeGui;
        }