public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, textEnum, textColor, textScale, textAlignment, onButtonClick, canHandleKeyboardInput, align, implementedFeature, canHandleKeyboardActiveControl, MyGuiControlHighlightType.WHEN_ACTIVE) { }
public MyGuiControlCheckbox(IMyGuiControlsParent parent, Vector2 position, Vector2 size, MyTexture2D texture, MyTexture2D checkedTexture, StringBuilder toolTip, bool checkedVal, Vector4 color, bool highlightWhenChecked, MyGuiControlLabel label, Vector2?innerSize = null) : base(parent, position, size, color, toolTip, texture, null, null, true) { m_canHandleKeyboardActiveControl = true; m_checked = checkedVal; m_highlightWhenChecked = false; // highlightWhenChecked; this feature is depracted m_checkedTexture = checkedTexture; m_label = label; if (m_label != null) { m_label.MouseEnter += delegate { m_highlight = true; }; m_label.MouseLeave += delegate { m_highlight = false; }; m_label.Click += delegate { UserCheck(); }; } if (innerSize == null) { m_innerSize = size; } else { m_innerSize = innerSize; } }
public MyGuiControlTabControl(IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector2 headSize, Vector4 color) : base(parent, position, size, color, null, null) //: base(parent, position, size, color, null, null, null, null, true) { m_headSize = headSize; m_color = color; }
// with delegate for indexed onButtonClick public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, OnIndexedButtonClick onIndexedButtonClick, int buttonIndex, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature) : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), textColor, textScale, onIndexedButtonClick, buttonIndex, textAlignment, canHandleKeyboardInput, align, null, implementedFeature) { }
public MyGuiControlMultilineText( IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector4? backgroundColor, MyGuiFont font, float textScale, MyGuiDrawAlignEnum textAlign, StringBuilder contents, bool drawBorders = true, bool drawScrollbar = true) : base(parent, position, size, backgroundColor, null) { m_font = font; m_textScale = textScale; m_textAlign = textAlign; m_drawBorders = drawBorders; m_drawScrollbar = drawScrollbar; TextColor = new Color(MyGuiConstants.LABEL_TEXT_COLOR); m_scrollbar = new MyVScrollbar(this); m_scrollbar.TopBorder = m_scrollbar.RightBorder = m_scrollbar.BottomBorder = false; m_scrollbar.LeftBorder = drawBorders; m_scrollbarSize = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y); m_scrollbarSize = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE; float minLineHeight = MyGuiManager.MeasureString(m_font, MyTextsWrapper.Get(MyTextsWrapperEnum.ServerShutdownNotificationCaption), m_parent.GetPositionAbsolute() + m_position, m_textScale, m_textAlign).Size.Y; m_label = new MyRichLabel(size.X, minLineHeight); if (contents != null && contents.Length > 0) { SetText(contents); } }
public MyGuiControlBase(IMyGuiControlsParent parent, Vector2 position, MyGuiControlPreDefinedSize predefinedSize, Vector4?backgroundColor, StringBuilder toolTip, MyTexture2D controlTexture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, bool isActiveControl) : this(parent, position, backgroundColor, toolTip, controlTexture, hoverTexture, pressedTexture, isActiveControl, null, null /*, null, null*/) { m_predefinedSize = predefinedSize; m_size = GetPredefinedControlSize(); }
public MyLayoutTable(IMyGuiControlsParent parent) { m_parent = parent; m_parentTopLeft = -0.5f * (m_parent.GetSize() ?? Vector2.One); m_prefixScanX = null; m_prefixScanY = null; }
public MyGuiControlMultilineText( IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector4?backgroundColor, MyGuiFont font, float textScale, MyGuiDrawAlignEnum textAlign, StringBuilder contents, bool drawBorders = true, bool drawScrollbar = true) : base(parent, position, size, backgroundColor, null) { m_font = font; m_textScale = textScale; m_textAlign = textAlign; m_drawBorders = drawBorders; m_drawScrollbar = drawScrollbar; TextColor = new Color(MyGuiConstants.LABEL_TEXT_COLOR); m_scrollbar = new MyVScrollbar(this); m_scrollbar.TopBorder = m_scrollbar.RightBorder = m_scrollbar.BottomBorder = false; m_scrollbar.LeftBorder = drawBorders; m_scrollbarSize = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y); m_scrollbarSize = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE; float minLineHeight = MyGuiManager.MeasureString(m_font, MyTextsWrapper.Get(MyTextsWrapperEnum.ServerShutdownNotificationCaption), m_parent.GetPositionAbsolute() + m_position, m_textScale, m_textAlign).Size.Y; m_label = new MyRichLabel(size.X, minLineHeight); if (contents != null && contents.Length > 0) { SetText(contents); } }
public MyGuiControlTabControl(IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector2 headSize, Vector4 color) : base(parent, position, size, color, null, null) //: base(parent, position, size, color, null, null, null, null, true) { m_headSize = headSize; m_color = color; }
public MyGuiControlUseProperties(IMyGuiControlsParent parent, Vector2 position, MyUseProperties useProperties, Vector4 labelColor) : base(parent, position, new Vector2(0.7f, 0.35f), Vector4.Zero, null, MyGuiManager.GetBlankTexture()) { m_labelColor = labelColor; m_useProperties = useProperties; InitControls(); }
public MyLayoutTable(IMyGuiControlsParent parent) { m_parent = parent; m_parentTopLeft = -0.5f * (m_parent.GetSize() ?? Vector2.One); m_prefixScanX = null; m_prefixScanY = null; }
public MyGuiControlUseProperties(IMyGuiControlsParent parent, Vector2 position, MyUseProperties useProperties, Vector4 labelColor) : base(parent, position, new Vector2(0.7f, 0.35f), Vector4.Zero, null, MyGuiManager.GetBlankTexture()) { m_labelColor = labelColor; m_useProperties = useProperties; InitControls(); }
private MyGuiControlBase(IMyGuiControlsParent parent, Vector2 position, Vector4?backgroundColor, StringBuilder toolTip, MyTexture2D controlTexture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, bool isActiveControl, MyTexture2D mouseCursorHoverTexture, MyTexture2D mouseCursorPressedTexture /*, * System.Drawing.Bitmap mouseCursorHoverBitmap, System.Drawing.Bitmap mouseCursorPressedBitmap*/) { Visible = true; Enabled = true; m_parent = parent; m_position = position; m_backgroundColor = backgroundColor; //m_toolTip = toolTip; if (toolTip != null) { m_toolTip = new MyToolTips(toolTip); } m_controlTexture = controlTexture; m_hoverTexture = hoverTexture; m_pressedTexture = pressedTexture; m_isActiveControl = isActiveControl; m_mouseCursorHoverTexture = mouseCursorHoverTexture; m_mouseCursorPressedTexture = mouseCursorPressedTexture; /* * m_mouseCursorHoverBitmap = mouseCursorHoverBitmap; * m_mouseCursorPressedBitmap = mouseCursorPressedBitmap; */ }
public MyGuiControlCheckbox(IMyGuiControlsParent parent, Vector2 position, Vector2 size, MyTexture2D texture, MyTexture2D checkedTexture, StringBuilder toolTip, bool checkedVal, Vector4 color, bool highlightWhenChecked, MyGuiControlLabel label, Vector2? innerSize = null) : base(parent, position, size, color, toolTip, texture, null, null, true) { m_canHandleKeyboardActiveControl = true; m_checked = checkedVal; m_highlightWhenChecked = false; // highlightWhenChecked; this feature is depracted m_checkedTexture = checkedTexture; m_label = label; if (m_label != null) { m_label.MouseEnter += delegate { m_highlight = true; }; m_label.MouseLeave += delegate { m_highlight = false; }; m_label.Click += delegate { UserCheck(); }; } if (innerSize == null) m_innerSize = size; else m_innerSize = innerSize; }
public void Close() { UnregisterEvents(); // left controls m_selectedFaction = null; m_tableFactions = null; m_buttonCreate = null; m_buttonJoin = null; m_buttonCancelJoin = null; m_buttonLeave = null; m_buttonSendPeace = null; m_buttonCancelPeace = null; m_buttonAcceptPeace = null; m_buttonMakeEnemy = null; // right controls m_labelFactionName = null; m_labelFactionDesc = null; m_labelFactionPriv = null; m_labelMembers = null; m_labelAutoAcceptMember = null; m_labelAutoAcceptPeace = null; m_checkAutoAcceptMember = null; m_checkAutoAcceptPeace = null; m_textFactionDesc = null; m_textFactionPriv = null; m_tableMembers = null; m_buttonKick = null; m_buttonAcceptJoin = null; m_controlsParent = null; }
public void Close() { if (m_terminalSystem != null) { if (m_blockListbox != null) { ClearBlockList(); m_blockListbox.ItemsSelected -= blockListbox_ItemSelected; } m_terminalSystem.BlockAdded -= TerminalSystem_BlockAdded; m_terminalSystem.BlockRemoved -= TerminalSystem_BlockRemoved; m_terminalSystem.GroupAdded -= TerminalSystem_GroupAdded; m_terminalSystem.GroupRemoved -= TerminalSystem_GroupRemoved; } if (m_tmpGroup != null) { m_tmpGroup.Blocks.Clear(); } m_controlsParent = null; m_blockListbox = null; m_blockNameLabel = null; m_terminalSystem = null; m_currentGroups.Clear(); }
public MyGuiControlWheelControl(IMyGuiControlsParent parent) : base(parent, new Vector2(0.5f, 0.5f), new Vector2(1, 1), null, null) { Visible = false; m_selected = 0; m_first = 0; m_size = new Vector2(673 / 1600f, 910 / 1200f); }
public MyLayoutTable(IMyGuiControlsParent parent, Vector2 topLeft, Vector2 size) { m_parent = parent; m_parentTopLeft = topLeft; m_size = size; m_prefixScanX = null; m_prefixScanY = null; }
// Image without text constructor public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, StringBuilder tooltip, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, tooltip, onButtonClick, canHandleKeyboardInput, align, implementedFeature, canHandleKeyboardActiveControl, highlightType, null, null /*, null, null*/) { }
public MyGuiControlPanel(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D texture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, MyTexture2D shadowTexture, MyGuiDrawAlignEnum align) : base(parent, position, size, backgroundColor, new StringBuilder(), texture, hoverTexture, pressedTexture, false) { Visible = true; }
public MyGuiControlWheelControl(IMyGuiControlsParent parent) : base(parent, new Vector2(0.5f, 0.5f), new Vector2(1,1), null, null) { Visible = false; m_selected = 0; m_first = 0; m_size = new Vector2(673/1600f, 910/1200f); }
public MyGuiControlPanel(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D texture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, int borderSize, Vector4 borderColor, StringBuilder toolTip) : base(parent, position, size, backgroundColor, toolTip, texture, hoverTexture, pressedTexture, false) { Visible = true; m_borderSize = borderSize; m_borderColor = borderColor; }
public MyGuiControlPanel(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTexture2D texture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, MyTexture2D shadowTexture, MyGuiDrawAlignEnum align) : base(parent, position, size, backgroundColor, new StringBuilder(), texture, hoverTexture, pressedTexture, false) { Visible = true; }
public MyGuiControlPanel(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTexture2D texture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, int borderSize, Vector4 borderColor, StringBuilder toolTip) : base(parent, position, size, backgroundColor, toolTip, texture, hoverTexture, pressedTexture, false) { Visible = true; m_borderSize = borderSize; m_borderColor = borderColor; }
public MyGuiControlRadioButton(IMyGuiControlsParent parent, Vector2 position, Vector2 size, int key, Vector4 color) : base(parent, position, size, color, null, MyGuiManager.GetCheckboxOffTexture(), null, null, true) { m_canHandleKeyboardActiveControl = true; m_selected = false; m_backgroundColor = color; m_key = key; }
public MyLayoutTable(IMyGuiControlsParent parent, Vector2 topLeft, Vector2 size) { m_parent = parent; m_parentTopLeft = topLeft; m_size = size; m_prefixScanX = null; m_prefixScanY = null; }
private void SetParentCollectionChangeEvent(IMyGuiControlsParent parentControl, bool addDelegate) { parentControl.Controls.CollectionChanged -= ChildCollectionChanged; if (addDelegate) { parentControl.Controls.CollectionChanged += ChildCollectionChanged; } }
public MyLayoutVertical(IMyGuiControlsParent parent, float horizontalPaddingPx) { m_parent = parent; // not sure if Vector2.One is correct, screens without size might be positioning things differently m_parentSize = parent.GetSize() ?? Vector2.One; m_currentPosY = m_parentSize.Y * -0.5f; m_horizontalPadding = horizontalPaddingPx / MyGuiConstants.GUI_OPTIMAL_SIZE.X; }
protected MyGuiControlEntityUse(IMyGuiControlsParent parent, Vector2 size, MyEntity entity, MyTexture2D texture) : base(parent, Vector2.Zero, size, Vector4.One, new StringBuilder(entity.DisplayName), MyGuiManager.GetHubItemBackground()) { m_entity = entity; m_topLeftPosition = -m_size.Value / 2f + new Vector2(0.025f, 0.025f); Controls.Add(new MyGuiControlLabel(this, m_topLeftPosition + new Vector2(0.063f, 0.0f), null, GetEntityName(entity), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); LoadControls(); m_texture = texture; }
private static void HideError(IMyGuiControlsParent controlsParent) { controlsParent.Controls.RemoveControlByName("ErrorMessage"); foreach (var control in controlsParent.Controls) { control.Visible = true; } }
public MyGuiControlLabel(IMyGuiControlsParent parent, Vector2 position, Vector2?size, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiDrawAlignEnum textAlign) : base(parent, position, size, null, null, false) { m_type = MyGuiControlLabelType.DEFINED_BY_TEXT_WRAPPER_ENUM; m_textEnum = textEnum; Init(textColor, textScale, textAlign); }
public MyGuiControlLabel(IMyGuiControlsParent parent, Vector2 position, Vector2? size, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiDrawAlignEnum textAlign) : base(parent, position, size, null, null, false) { m_type = MyGuiControlLabelType.DEFINED_BY_TEXT_WRAPPER_ENUM; m_textEnum = textEnum; Init(textColor, textScale, textAlign); }
public MyGuiControlBase(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4?backgroundColor, StringBuilder toolTip, MyTexture2D controlTexture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, bool isActiveControl, MyGuiControlHighlightType highlightType, MyTexture2D mouseCursorHoverTexture, MyTexture2D mouseCursorPressedTexture /*, * System.Drawing.Bitmap mouseCursorHoverBitmap, System.Drawing.Bitmap mouseCursorPressedBitmap*/) : this(parent, position, backgroundColor, toolTip, controlTexture, hoverTexture, pressedTexture, isActiveControl, mouseCursorHoverTexture, mouseCursorPressedTexture /*, mouseCursorHoverBitmap, mouseCursorPressedBitmap*/) { m_size = size; m_highlightType = highlightType; }
// Image without text constructor and with custom mouse cursor textures public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, StringBuilder tooltip, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType, MyTexture2D mouseCursorHoverTexture, MyTexture2D mouseCursorPressedTexture /*, * System.Drawing.Bitmap mouseCursorHoverBitmap, System.Drawing.Bitmap mouseCursorPressedBitmap*/) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, onButtonClick, canHandleKeyboardInput, align, tooltip, implementedFeature, canHandleKeyboardActiveControl, highlightType, mouseCursorHoverTexture, mouseCursorPressedTexture /*, mouseCursorHoverBitmap, mouseCursorPressedBitmap*/) { }
public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, MyTextsWrapperEnum?accessForbiddenReason) : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), null, textColor, textScale, onButtonClick, textAlignment, canHandleKeyboardInput, align, implementedFeature) { m_accessForbiddenReason = accessForbiddenReason; m_canHandleKeyboardActiveControl &= m_accessForbiddenReason == null; }
protected MyGuiControlEntityUse(IMyGuiControlsParent parent, Vector2 size, MyEntity entity, MyTexture2D texture) : base(parent, Vector2.Zero, size, Vector4.One, new StringBuilder(entity.DisplayName), MyGuiManager.GetHubItemBackground()) { m_entity = entity; m_topLeftPosition = -m_size.Value / 2f + new Vector2(0.025f, 0.025f); Controls.Add(new MyGuiControlLabel(this, m_topLeftPosition + new Vector2(0.063f, 0.0f), null, GetEntityName(entity), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); LoadControls(); m_texture = texture; }
public MyLayoutVertical(IMyGuiControlsParent parent, float horizontalPaddingPx) { m_parent = parent; // not sure if Vector2.One is correct, screens without size might be positioning things differently m_parentSize = parent.GetSize() ?? Vector2.One; m_currentPosY = m_parentSize.Y * -0.5f; m_horizontalPadding = horizontalPaddingPx / MyGuiConstants.GUI_OPTIMAL_SIZE.X; }
public MyGuiControlRotatingWheel(IMyGuiControlsParent parent, Vector2 position, Vector4 color, float scale, MyGuiDrawAlignEnum align, MyTexture2D texture) : base(parent, position, null, null, null, false) { m_rotatingAngle = MyMwcUtils.GetRandomRadian(); m_color = color; m_wheelScale = scale; //m_scale = 4; m_align = align; m_texture = texture; }
// Base constructor with delegate for indexed onButtonClick and tooltip private MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, OnIndexedButtonClick onIndexedButtonClick, int buttonIndex, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, StringBuilder toolTip, bool implementedFeature, bool canHandleKeyboardActiveControl) : base(parent, MyGuiManager.GetAlignedCoordinate(position, size.Value, align) + new Vector2(size.Value.X / 2.0f, size.Value.Y / 2.0f), size, backgroundColor, toolTip) { m_canHandleKeyboardActiveControl = canHandleKeyboardActiveControl; m_onIndexedButtonClick = onIndexedButtonClick; m_buttonIndex = buttonIndex; m_canHandleKeyboardInput = canHandleKeyboardInput; m_implementedFeature = implementedFeature; }
// Image constructor public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, onButtonClick, canHandleKeyboardInput, align, null, implementedFeature, canHandleKeyboardActiveControl, highlightType, null, null /*, null, null*/) { Text = MyTextsWrapper.Get(textEnum); m_textColor = textColor; m_textAlignment = textAlignment; m_textScale = textScale; }
// Text constructor with delegate for indexed onButtonClick public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, StringBuilder text, Vector4 textColor, float textScale, OnIndexedButtonClick onIndexedButtonClick, int buttonIndex, MyGuiControlButtonTextAlignment textAlignement, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, StringBuilder tooltip, bool implementedFeature) : this(parent, position, size, backgroundColor, onIndexedButtonClick, buttonIndex, canHandleKeyboardInput, align, tooltip, implementedFeature, true) { m_textColor = textColor; Text = text; m_textScale = textScale; m_textAlignment = textAlignement; }
protected MyGuiScreenBase GetTopMostParentScreen() { IMyGuiControlsParent currentParent = m_parent; while (!(currentParent is MyGuiScreenBase)) { currentParent = ((MyGuiControlBase)currentParent).GetParent(); } return(currentParent as MyGuiScreenBase); }
public MyGuiControlRotatingWheel(IMyGuiControlsParent parent, Vector2 position, Vector4 color, float scale, MyGuiDrawAlignEnum align, MyTexture2D texture) : base(parent, position, null, null, null, false) { m_rotatingAngle = MyMwcUtils.GetRandomRadian(); m_color = color; m_wheelScale = scale; //m_scale = 4; m_align = align; m_texture = texture; }
public MyGuiControlSize(IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector4 backgroundColor, StringBuilder toolTip, float value, float minValue, float maxValue, StringBuilder description, MyGuiSizeEnumFlags flags, float offset) : base(parent, position, size, backgroundColor, toolTip, null) { m_minValue = minValue; m_maxValue = maxValue; m_flags = flags; m_description = description; m_offset = offset; InitControls(); SetValue(value); }
public MyGuiControlProgressBar(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, Vector4 progressColor, Vector4 textColor, float textScale, float value, int decimals) : base(parent, position, size, backgroundColor, null) { m_progressColor = progressColor; m_textColor = textColor; m_textScale = textScale; m_value = value; m_progressValueText = new StringBuilder(); m_decimals = decimals; }
public MyGuiControlListboxScrollBar(IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector4? backgroundColor, Color sliderColor, MyScrollDirection scrollDirection, MyTexture2D texture) { m_parent = parent; m_position = position; m_size = size; m_scrollDirection = scrollDirection; m_texture = texture; m_isScrollSliderDragging = false; InitializeScrollBar(1.0f); SetScrollValue(1.0f); }
public MyGuiControlListboxDragAndDrop(IMyGuiControlsParent parent, List<MyGuiControlListbox> listboxesToDrop, MyGuiControlPreDefinedSize predefinedSize, Vector4 backgroundColor, Vector4 textColor, float textScale, Vector2 textOffset, bool supportIcon) : base(parent, new Vector2(0.0f, 0.0f), predefinedSize, backgroundColor, null, true) { m_listboxesToDrop = listboxesToDrop; m_textColor = textColor; m_textScale = textScale; m_textOffset = textOffset; m_supportIcon = supportIcon; m_size = GetPredefinedControlSize(); DrawBackgroundTexture = true; }
public MyGuiControlEditLights(IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector4 bgColor) : base(parent, position, size, bgColor, null) { m_controls = new List<MyGuiControlBase>(); m_prefabLights = new List<MyPrefabLight>(); m_pointLightControls = new List<MyGuiControlBase>(); m_spotLightControls = new List<MyGuiControlBase>(); Init(); MyEntities.OnEntityRemove += MyEntities_OnEntityRemove; }
public MyGuiControlLabel(IMyGuiControlsParent parent, Vector2 position, Vector2? size, StringBuilder text, Vector4 textColor, float textScale, MyGuiDrawAlignEnum textAlign) : base(parent, position, size, null, null, false) { m_type = MyGuiControlLabelType.DEFINED_BY_STRING_BUILDER; if (text != null) { // Create COPY of the text (Don't just point to one string builder!!! This was my original mistake!) m_textDefinition = new StringBuilder(text.ToString()); m_textDraw = new StringBuilder(text.ToString()); } Init(textColor, textScale, textAlign); }
public MyGuiControlList(IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector4 backgroundColor, StringBuilder toolTip, MyTexture2D controlTexture) : base(parent, position, size, backgroundColor, toolTip, controlTexture) { m_realSize = size; m_verticalScrollbar = new MyVScrollbar(this); m_verticalScrollbar.TopBorder = m_verticalScrollbar.RightBorder = m_verticalScrollbar.BottomBorder = false; m_verticalScrollbar.LeftBorder = false; m_verticalScrollbar.OnScrollValueChanged += OnScrollValueChanged; RecalculateScrollbar(); Controls.CollectionChanged += ControlsCollectionChanged; }
public MyGuiControlTreeView( IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector4 backgroundColor, bool canHandleKeyboardActiveControl) : base(parent, position, size, null, null) { Visible = true; m_treeBackgroundColor = backgroundColor; m_canHandleKeyboardActiveControl = canHandleKeyboardActiveControl; m_treeView = new MyTreeView(this, m_parent.GetPositionAbsolute() + m_position - m_size.Value / 2, m_size.Value); }
public void Init(IMyGuiControlsParent controlsParent) { m_playerList = (MyGuiControlListbox)controlsParent.Controls.GetControlByName("PlayerListbox"); m_factionList = (MyGuiControlListbox)controlsParent.Controls.GetControlByName("FactionListbox"); m_chatHistory = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("ChatHistory"); m_chatbox = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("Chatbox"); m_playerList.ItemsSelected += m_playerList_ItemsSelected; m_playerList.MultiSelect = false; m_factionList.ItemsSelected += m_factionList_ItemsSelected; m_factionList.MultiSelect = false; m_sendButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("SendButton"); m_sendButton.ButtonClicked += m_sendButton_ButtonClicked; m_chatbox.TextChanged += m_chatbox_TextChanged; m_chatbox.EnterPressed += m_chatbox_EnterPressed; if (MySession.Static.LocalCharacter != null) { MySession.Static.ChatSystem.PlayerMessageReceived += MyChatSystem_PlayerMessageReceived; MySession.Static.ChatSystem.FactionMessageReceived += MyChatSystem_FactionMessageReceived; MySession.Static.ChatSystem.GlobalMessageReceived += MyChatSystem_GlobalMessageReceived; MySession.Static.ChatSystem.FactionHistoryDeleted += ChatSystem_FactionHistoryDeleted; MySession.Static.ChatSystem.PlayerHistoryDeleted += ChatSystem_PlayerHistoryDeleted; } MySession.Static.Players.PlayersChanged += Players_PlayersChanged; RefreshLists(); m_chatbox.SetText(m_emptyText); m_sendButton.Enabled = false; if (MyMultiplayer.Static != null) { MyMultiplayer.Static.ChatMessageReceived += Multiplayer_ChatMessageReceived; } m_closed = false; }
public MyGuiControlEditVoxelHand(IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector4 backgroundColor) : base(parent, position, size, backgroundColor, null) { LoadControls(); if (MyEditorVoxelHand.VoxelHandShape.Material != null) { m_voxelShapeMaterialCombobox.SelectItemByKey((int)MyEditorVoxelHand.VoxelHandShape.Material); } else { m_voxelShapeMaterialCombobox.SelectItemByKey(0); } m_canSelect = true; //MyEditorVoxelHand.OnVoxelShapeSize += OnVoxelHandSizeChanged; //MyEditorVoxelHand.OnVoxelShapeDistance += OnVoxelHandDistanceChanged; }
public MyGuiControlSlider(IMyGuiControlsParent parent, Vector2 position, float width, float minValue, float maxValue, Vector4 color, StringBuilder labelText, float labelWidth, int labelDecimalPlaces, float labelScale, float scale) : base(parent, position, new Vector2(width, MyGuiConstants.SLIDER_HEIGHT), MyGuiConstants.SLIDER_BACKGROUND_COLOR, null, MyGuiManager.GetSliderControlTexture(), null, null, true) { m_canHandleKeyboardActiveControl = true; m_color = color; m_minValue = minValue; m_maxValue = maxValue; m_blinkerTimer = 0; m_value = minValue; m_scale = scale; //m_valuePrevious = 0; MyCommonDebugUtils.AssertDebug(m_maxValue > m_minValue && m_maxValue != m_minValue); m_tempForDraw = new StringBuilder(labelText.Length); m_labelText = labelText.ToString(); m_labelWidth = labelWidth; LabelDecimalPlaces = labelDecimalPlaces; m_labelScale = labelScale; }
public void Init(IMyGuiControlsParent controlsParent, MyPlayer controller, MyCubeGrid grid, MyTerminalBlock currentBlock, MyGridColorHelper colorHelper) { m_controlsParent = controlsParent; m_controller = controller; m_colorHelper = colorHelper; if (grid == null) { foreach (var control in controlsParent.Controls) control.Visible = false; var label = MyGuiScreenTerminal.CreateErrorLabel(MySpaceTexts.ScreenTerminalError_ShipNotConnected, "ErrorMessage"); controlsParent.Controls.Add(label); return; } m_terminalSystem = grid.GridSystems.TerminalSystem; m_tmpGroup = new MyBlockGroup(grid); m_blockSearch = (MyGuiControlTextbox)m_controlsParent.Controls.GetControlByName("FunctionalBlockSearch"); m_blockSearch.TextChanged += blockSearch_TextChanged; m_blockSearchClear = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("FunctionalBlockSearchClear"); m_blockSearchClear.ButtonClicked += blockSearchClear_ButtonClicked; m_blockListbox = (MyGuiControlListbox)m_controlsParent.Controls.GetControlByName("FunctionalBlockListbox"); m_blockNameLabel = (MyGuiControlLabel)m_controlsParent.Controls.GetControlByName("BlockNameLabel"); m_blockNameLabel.Text = ""; m_groupName = (MyGuiControlTextbox)m_controlsParent.Controls.GetControlByName("GroupName"); m_groupName.TextChanged += m_groupName_TextChanged; m_showAll = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("ShowAll"); m_showAll.Selected = m_showAllTerminalBlocks; m_showAll.ButtonClicked += showAll_Clicked; m_showAll.SetToolTip(MySpaceTexts.Terminal_ShowAllInTerminal); m_showAll.IconRotation = 0f; m_showAll.Icon = new MyGuiHighlightTexture { Normal = @"Textures\GUI\Controls\button_hide.dds", Highlight = @"Textures\GUI\Controls\button_unhide.dds", SizePx = new Vector2(40f, 40f), }; m_showAll.Size = new Vector2(0, 0); m_showAll.HighlightType = MyGuiControlHighlightType.FORCED; m_showAll.IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_groupSave = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("GroupSave"); m_groupSave.TextEnum = MySpaceTexts.TerminalButton_GroupSave; m_groupSave.TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER; m_groupSave.ButtonClicked += groupSave_ButtonClicked; m_groupDelete = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("GroupDelete"); m_groupDelete.ButtonClicked += groupDelete_ButtonClicked; m_groupDelete.Enabled = false; m_blockListbox.ItemsSelected += blockListbox_ItemSelected; RefreshBlockList(); m_terminalSystem.BlockAdded += TerminalSystem_BlockAdded; m_terminalSystem.BlockRemoved += TerminalSystem_BlockRemoved; m_terminalSystem.GroupAdded += TerminalSystem_GroupAdded; m_terminalSystem.GroupRemoved += TerminalSystem_GroupRemoved; if (currentBlock != null) SelectBlocks(new MyTerminalBlock[] { currentBlock }); }
public void Close() { if (m_terminalSystem != null) { if (m_blockListbox != null) { ClearBlockList(); m_blockListbox.ItemsSelected -= blockListbox_ItemSelected; } m_terminalSystem.BlockAdded -= TerminalSystem_BlockAdded; m_terminalSystem.BlockRemoved -= TerminalSystem_BlockRemoved; m_terminalSystem.GroupAdded -= TerminalSystem_GroupAdded; m_terminalSystem.GroupRemoved -= TerminalSystem_GroupRemoved; } if (m_tmpGroup != null) { m_tmpGroup.Blocks.Clear(); } m_controlsParent = null; m_blockListbox = null; m_blockNameLabel = null; m_terminalSystem = null; m_currentGroups.Clear(); }
public void Init(IMyGuiControlsParent controlsParent, MyEntity thisEntity, MyEntity interactedEntity, MyGridColorHelper colorHelper) { ProfilerShort.Begin("MyGuiScreenTerminal.ControllerInventory.Init"); m_userAsEntity = thisEntity; m_interactedAsEntity = interactedEntity; m_colorHelper = colorHelper; m_leftOwnersControl = (MyGuiControlList)controlsParent.Controls.GetControlByName("LeftInventory"); m_rightOwnersControl = (MyGuiControlList)controlsParent.Controls.GetControlByName("RightInventory"); m_leftSuitButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftSuitButton"); m_leftGridButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftGridButton"); m_leftFilterStorageButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterStorageButton"); m_leftFilterSystemButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterSystemButton"); m_leftFilterEnergyButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterEnergyButton"); m_leftFilterAllButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterAllButton"); m_rightSuitButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightSuitButton"); m_rightGridButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightGridButton"); m_rightFilterStorageButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterStorageButton"); m_rightFilterSystemButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterSystemButton"); m_rightFilterEnergyButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterEnergyButton"); m_rightFilterAllButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterAllButton"); m_throwOutButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("ThrowOutButton"); m_hideEmptyLeft = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("CheckboxHideEmptyLeft"); m_hideEmptyLeftLabel = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("LabelHideEmptyLeft"); m_hideEmptyRight = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("CheckboxHideEmptyRight"); m_hideEmptyRightLabel = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("LabelHideEmptyRight"); m_blockSearchLeft = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("BlockSearchLeft"); m_blockSearchClearLeft = (MyGuiControlButton)controlsParent.Controls.GetControlByName("BlockSearchClearLeft"); m_blockSearchRight = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("BlockSearchRight"); m_blockSearchClearRight = (MyGuiControlButton)controlsParent.Controls.GetControlByName("BlockSearchClearRight"); m_hideEmptyLeft.Visible = false; m_hideEmptyLeftLabel.Visible = false; m_hideEmptyRight.Visible = true; m_hideEmptyRightLabel.Visible = true; m_blockSearchLeft.Visible = false; m_blockSearchClearLeft.Visible = false; m_blockSearchRight.Visible = true; m_blockSearchClearRight.Visible = true; m_hideEmptyLeft.IsCheckedChanged += HideEmptyLeft_Checked; m_hideEmptyRight.IsCheckedChanged += HideEmptyRight_Checked; m_blockSearchLeft.TextChanged += BlockSearchLeft_TextChanged; m_blockSearchClearLeft.ButtonClicked += BlockSearchClearLeft_ButtonClicked; m_blockSearchRight.TextChanged += BlockSearchRight_TextChanged; m_blockSearchClearRight.ButtonClicked += BlockSearchClearRight_ButtonClicked; m_leftSuitButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowCharacter); m_leftGridButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowConnected); m_rightSuitButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowInteracted); m_rightGridButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowConnected); m_leftFilterAllButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterAll); m_leftFilterEnergyButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterEnergy); m_leftFilterStorageButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterStorage); m_leftFilterSystemButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterSystem); m_rightFilterAllButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterAll); m_rightFilterEnergyButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterEnergy); m_rightFilterStorageButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterStorage); m_rightFilterSystemButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterSystem); m_throwOutButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ThrowOut); m_throwOutButton.CueEnum = GuiSounds.None; m_leftTypeGroup.Add(m_leftSuitButton); m_leftTypeGroup.Add(m_leftGridButton); m_rightTypeGroup.Add(m_rightSuitButton); m_rightTypeGroup.Add(m_rightGridButton); m_leftFilterGroup.Add(m_leftFilterAllButton); m_leftFilterGroup.Add(m_leftFilterEnergyButton); m_leftFilterGroup.Add(m_leftFilterStorageButton); m_leftFilterGroup.Add(m_leftFilterSystemButton); m_rightFilterGroup.Add(m_rightFilterAllButton); m_rightFilterGroup.Add(m_rightFilterEnergyButton); m_rightFilterGroup.Add(m_rightFilterStorageButton); m_rightFilterGroup.Add(m_rightFilterSystemButton); m_throwOutButton.DrawCrossTextureWhenDisabled = false; //m_throwOutButton.Enabled = false; // initialize drag and drop // maybe this requires screen? m_dragAndDrop = new MyGuiControlGridDragAndDrop(MyGuiConstants.DRAG_AND_DROP_BACKGROUND_COLOR, MyGuiConstants.DRAG_AND_DROP_TEXT_COLOR, 0.7f, MyGuiConstants.DRAG_AND_DROP_TEXT_OFFSET, true); controlsParent.Controls.Add(m_dragAndDrop); m_dragAndDrop.DrawBackgroundTexture = false; m_throwOutButton.ButtonClicked += throwOutButton_OnButtonClick; m_dragAndDrop.ItemDropped += dragDrop_OnItemDropped; var thisInventoryOwner = (m_userAsEntity != null && m_userAsEntity.HasInventory) ? m_userAsEntity : null; if (thisInventoryOwner != null) m_userAsOwner = thisInventoryOwner; var targetInventoryOwner = (m_interactedAsEntity != null && m_interactedAsEntity.HasInventory) ? m_interactedAsEntity : null; if (targetInventoryOwner != null) m_interactedAsOwner = targetInventoryOwner; var parentGrid = (m_interactedAsEntity != null) ? m_interactedAsEntity.Parent as MyCubeGrid : null; m_interactedGridOwners.Clear(); if (parentGrid != null) { var group = MyCubeGridGroups.Static.Logical.GetGroup(parentGrid); foreach (var node in group.Nodes) { GetGridInventories(node.NodeData, m_interactedGridOwners); node.NodeData.GridSystems.ConveyorSystem.BlockAdded += ConveyorSystem_BlockAdded; node.NodeData.GridSystems.ConveyorSystem.BlockRemoved += ConveyorSystem_BlockRemoved; m_registeredConveyorSystems.Add(node.NodeData.GridSystems.ConveyorSystem); } } m_leftTypeGroup.SelectedIndex = 0; m_rightTypeGroup.SelectedIndex = (m_interactedAsEntity is MyCharacter) || (m_interactedAsEntity is MyInventoryBagEntity) ? 0 : 1; m_leftFilterGroup.SelectedIndex = 0; m_rightFilterGroup.SelectedIndex = 0; LeftTypeGroup_SelectedChanged(m_leftTypeGroup); RightTypeGroup_SelectedChanged(m_rightTypeGroup); SetLeftFilter(null); SetRightFilter(null); m_leftTypeGroup.SelectedChanged += LeftTypeGroup_SelectedChanged; m_rightTypeGroup.SelectedChanged += RightTypeGroup_SelectedChanged; m_leftFilterAllButton.SelectedChanged += (button) => { if (button.Selected) SetLeftFilter(null); }; m_leftFilterEnergyButton.SelectedChanged += (button) => { if (button.Selected) SetLeftFilter(MyInventoryOwnerTypeEnum.Energy); }; m_leftFilterStorageButton.SelectedChanged += (button) => { if (button.Selected) SetLeftFilter(MyInventoryOwnerTypeEnum.Storage); }; m_leftFilterSystemButton.SelectedChanged += (button) => { if (button.Selected) SetLeftFilter(MyInventoryOwnerTypeEnum.System); }; m_rightFilterAllButton.SelectedChanged += (button) => { if (button.Selected) SetRightFilter(null); }; m_rightFilterEnergyButton.SelectedChanged += (button) => { if (button.Selected) SetRightFilter(MyInventoryOwnerTypeEnum.Energy); }; m_rightFilterStorageButton.SelectedChanged += (button) => { if (button.Selected) SetRightFilter(MyInventoryOwnerTypeEnum.Storage); }; m_rightFilterSystemButton.SelectedChanged += (button) => { if (button.Selected) SetRightFilter(MyInventoryOwnerTypeEnum.System); }; if (m_interactedAsEntity == null) { m_leftGridButton.Enabled = false; m_rightGridButton.Enabled = false; m_rightTypeGroup.SelectedIndex = 0; } RefreshSelectedInventoryItem(); ProfilerShort.End(); }
public void Init(IMyGuiControlsParent controlsParent, MyCubeGrid grid) { if (grid == null) { ShowError(MySpaceTexts.ScreenTerminalError_ShipNotConnected, controlsParent); return; } grid.RaiseGridChanged(); m_assemblerKeyCounter = 0; m_assemblersByKey.Clear(); foreach (var block in grid.GridSystems.TerminalSystem.Blocks) { var assembler = block as MyAssembler; if (assembler == null) continue; if (!assembler.HasLocalPlayerAccess()) continue; m_assemblersByKey.Add(m_assemblerKeyCounter++, assembler); } m_controlsParent = controlsParent; m_terminalSystem = grid.GridSystems.TerminalSystem; m_blueprintsArea = (MyGuiControlScrollablePanel)controlsParent.Controls.GetControlByName("BlueprintsScrollableArea"); m_queueArea = (MyGuiControlScrollablePanel)controlsParent.Controls.GetControlByName("QueueScrollableArea"); m_inventoryArea = (MyGuiControlScrollablePanel)controlsParent.Controls.GetControlByName("InventoryScrollableArea"); m_blueprintsBgPanel = controlsParent.Controls.GetControlByName("BlueprintsBackgroundPanel"); m_blueprintsLabel = controlsParent.Controls.GetControlByName("BlueprintsLabel"); m_comboboxAssemblers = (MyGuiControlCombobox)controlsParent.Controls.GetControlByName("AssemblersCombobox"); m_blueprintsGrid = (MyGuiControlGrid)m_blueprintsArea.ScrolledControl; m_queueGrid = (MyGuiControlGrid)m_queueArea.ScrolledControl; m_inventoryGrid = (MyGuiControlGrid)m_inventoryArea.ScrolledControl; m_materialsList = (MyGuiControlComponentList)controlsParent.Controls.GetControlByName("MaterialsList"); m_repeatCheckbox = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("RepeatCheckbox"); m_slaveCheckbox = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("SlaveCheckbox"); m_disassembleAllButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("DisassembleAllButton"); m_controlPanelButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("ControlPanelButton"); m_inventoryButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("InventoryButton"); { var assemblingButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("AssemblingButton"); var disassemblingButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("DisassemblingButton"); assemblingButton.Key = (int)AssemblerMode.Assembling; disassemblingButton.Key = (int)AssemblerMode.Disassembling; m_modeButtonGroup.Add(assemblingButton); m_modeButtonGroup.Add(disassemblingButton); } foreach (var entry in m_assemblersByKey) { if (entry.Value.IsFunctional == false) { m_incompleteAssemblerName.Clear(); m_incompleteAssemblerName.AppendStringBuilder(entry.Value.CustomName); m_incompleteAssemblerName.AppendStringBuilder(MyTexts.Get(MySpaceTexts.Terminal_BlockIncomplete)); m_comboboxAssemblers.AddItem(entry.Key, m_incompleteAssemblerName); } else { m_comboboxAssemblers.AddItem(entry.Key, entry.Value.CustomName); } } m_comboboxAssemblers.ItemSelected += Assemblers_ItemSelected; m_comboboxAssemblers.SelectItemByIndex(0); m_dragAndDrop = new MyGuiControlGridDragAndDrop(MyGuiConstants.DRAG_AND_DROP_BACKGROUND_COLOR, MyGuiConstants.DRAG_AND_DROP_TEXT_COLOR, 0.7f, MyGuiConstants.DRAG_AND_DROP_TEXT_OFFSET, true); controlsParent.Controls.Add(m_dragAndDrop); m_dragAndDrop.DrawBackgroundTexture = false; m_dragAndDrop.ItemDropped += dragDrop_OnItemDropped; RefreshBlueprints(); Assemblers_ItemSelected(); RegisterEvents(); if (m_assemblersByKey.Count == 0) ShowError(MySpaceTexts.ScreenTerminalError_NoAssemblers, controlsParent); }
internal void Close() { UnregisterEvents(); UnregisterAssemblerEvents(m_selectedAssembler); m_assemblersByKey.Clear(); m_blueprintButtonGroup.Clear(); m_modeButtonGroup.Clear(); m_selectedAssembler = null; m_controlsParent = null; m_terminalSystem = null; m_comboboxAssemblers = null; m_dragAndDrop = null; m_dragAndDropInfo = null; }
private static void HideError(IMyGuiControlsParent controlsParent) { controlsParent.Controls.RemoveControlByName("ErrorMessage"); foreach (var control in controlsParent.Controls) control.Visible = true; }