public override void Init(MyObjectBuilder_GuiControlBase builder) { base.Init(builder); var ob = (MyObjectBuilder_GuiControlRadioButton)builder; Key = ob.Key; if (ob.VisualStyle == MyGuiControlRadioButtonStyleEnum.Custom) { if (ob.CustomVisualStyle.HasValue) { MyGuiCustomVisualStyle customVs = ob.CustomVisualStyle.Value; m_styleDef = new StyleDefinition(); m_styleDef.HighlightFont = customVs.HighlightFont; m_styleDef.NormalFont = customVs.NormalFont; m_styleDef.HighlightTexture = new MyGuiCompositeTexture() { LeftTop = new MyGuiSizedTexture() { SizePx = customVs.Size, Texture = customVs.HighlightTexture } }; m_styleDef.NormalTexture = new MyGuiCompositeTexture() { LeftTop = new MyGuiSizedTexture() { SizePx = customVs.Size, Texture = customVs.NormalTexture } }; m_styleDef.Padding = new MyGuiBorderThickness(customVs.HorizontalPadding, customVs.VerticalPadding); VisualStyle = ob.VisualStyle; } else { VisualStyle = MyGuiControlRadioButtonStyleEnum.Rectangular; } } else { VisualStyle = ob.VisualStyle; } }
public override MyObjectBuilder_GuiControlBase GetObjectBuilder() { var ob = (MyObjectBuilder_GuiControlRadioButton)base.GetObjectBuilder(); ob.Key = Key; ob.VisualStyle = VisualStyle; if (VisualStyle == MyGuiControlRadioButtonStyleEnum.Custom) { MyGuiCustomVisualStyle customStyle = new MyGuiCustomVisualStyle(); customStyle.HighlightTexture = m_styleDef.HighlightTexture.LeftTop.Texture; customStyle.NormalTexture = m_styleDef.NormalTexture.LeftTop.Texture; customStyle.Size = m_styleDef.HighlightTexture.LeftTop.SizePx; customStyle.HighlightFont = m_styleDef.HighlightFont; customStyle.NormalFont = m_styleDef.NormalFont; customStyle.VerticalPadding = m_styleDef.Padding.VerticalSum; customStyle.HorizontalPadding = m_styleDef.Padding.HorizontalSum; } return(ob); }