public MyGuiControlProgressBar(Vector2?position = null, Vector2?size = null, Color?progressBarColor = null, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiCompositeTexture backgroundTexture = null, bool isHorizontal = true, bool potentialBarEnabled = true) : base(position: position, size: size, backgroundTexture: backgroundTexture, originAlign: originAlign, colorMask: null, toolTip: null) { ProgressColor = (progressBarColor.HasValue ? progressBarColor.Value : DEFAULT_PROGRESS_COLOR); IsHorizontal = isHorizontal; m_progressForeground = new MyGuiControlPanel(position: new Vector2(-Size.X / 2.0f, 0.0f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, backgroundColor: ProgressColor); m_progressForeground.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; m_potentialBar = new MyGuiControlPanel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, size: new Vector2(0f, Size.Y)); m_potentialBar.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; m_potentialBar.ColorMask = new Vector4(ProgressColor, 0.7f); m_potentialBar.Visible = false; m_potentialBar.Enabled = potentialBarEnabled; Elements.Add(m_potentialBar); Elements.Add(m_progressForeground); }
public MyGuiControlProgressBar( Vector2? position = null, Vector2? size = null, Color? progressBarColor = null, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiCompositeTexture backgroundTexture = null, bool isHorizontal = true, bool potentialBarEnabled = true) : base( position: position, size: size, backgroundTexture: backgroundTexture, originAlign: originAlign, colorMask: null, toolTip: null) { ProgressColor = (progressBarColor.HasValue ? progressBarColor.Value : DEFAULT_PROGRESS_COLOR); IsHorizontal = isHorizontal; m_progressForeground = new MyGuiControlPanel( position: new Vector2(-Size.X/2.0f, 0.0f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, backgroundColor: ProgressColor); m_progressForeground.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; m_potentialBar = new MyGuiControlPanel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, size: new Vector2(0f, Size.Y)); m_potentialBar.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; m_potentialBar.ColorMask = new Vector4(ProgressColor, 0.7f); m_potentialBar.Visible = false; m_potentialBar.Enabled = potentialBarEnabled; Elements.Add(m_potentialBar); Elements.Add(m_progressForeground); }
protected MyGuiControlBase( Vector2?position = null, Vector2?size = null, Vector4?colorMask = null, String toolTip = null, MyGuiCompositeTexture backgroundTexture = null, bool isActiveControl = true, bool canHaveFocus = false, bool allowFocusingElements = false, MyGuiControlHighlightType highlightType = MyGuiControlHighlightType.WHEN_ACTIVE, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER) { Name = GetType().Name; Visible = true; m_enabled = true; m_position = position ?? Vector2.Zero; m_canHaveFocus = canHaveFocus; m_size = size ?? Vector2.One; m_colorMask = colorMask ?? Vector4.One; BackgroundTexture = backgroundTexture; IsActiveControl = isActiveControl; HighlightType = highlightType; m_originAlign = originAlign; BorderSize = 1; BorderColor = Vector4.One; BorderEnabled = false; DrawWhilePaused = true; Elements = new MyGuiControls(this); AllowFocusingElements = allowFocusingElements; if (toolTip != null) { m_toolTip = new MyToolTips(toolTip); } }
private void RefreshInternals() { if (HasHighlight) { BackgroundTexture = m_styleDef.ComboboxTextureHighlight; m_selectedItemFont = m_styleDef.ItemFontHighlight; } else { BackgroundTexture = m_styleDef.ComboboxTextureNormal; m_selectedItemFont = m_styleDef.ItemFontNormal; } MinSize = BackgroundTexture.MinSizeGui; MaxSize = BackgroundTexture.MaxSizeGui; m_scrollbarTexture = (HasHighlight) ? MyGuiConstants.TEXTURE_SCROLLBAR_V_THUMB_HIGHLIGHT : MyGuiConstants.TEXTURE_SCROLLBAR_V_THUMB; m_selectedItemArea.Position = m_styleDef.SelectedItemOffset; m_selectedItemArea.Size = new Vector2(Size.X - (m_scrollbarTexture.MinSizeGui.X + m_styleDef.ScrollbarMargin.HorizontalSum + m_styleDef.SelectedItemOffset.X), ITEM_HEIGHT); var openedArea = GetOpenedArea(); m_openedArea.Position = openedArea.LeftTop; m_openedArea.Size = openedArea.Size; m_openedItemArea.Position = m_openedArea.Position + new Vector2(m_styleDef.SelectedItemOffset.X, m_styleDef.DropDownTexture.LeftTop.SizeGui.Y); m_openedItemArea.Size = new Vector2(m_selectedItemArea.Size.X, (m_showScrollBar ? m_openAreaItemsCount : m_items.Count) * m_selectedItemArea.Size.Y); m_textScaleWithLanguage = m_styleDef.TextScale * MyGuiManager.LanguageTextScale; }
public void SetTexture(string texture) { if (m_borderTexture != null) { BackgroundTexture = new MyGuiCompositeTexture() { CenterBottom = m_borderTexture.CenterBottom, CenterTop = m_borderTexture.CenterTop, LeftBottom = m_borderTexture.LeftBottom, LeftTop = m_borderTexture.LeftTop, LeftCenter = m_borderTexture.LeftCenter, RightBottom = m_borderTexture.RightBottom, RightCenter = m_borderTexture.RightCenter, RightTop = m_borderTexture.RightTop, Center = new MyGuiSizedTexture() { Texture = texture, }, }; } else { BackgroundTexture = new MyGuiCompositeTexture() { Center = new MyGuiSizedTexture() { Texture = texture, }, }; } }
protected MyScrollbar(MyGuiControlBase control, MyGuiCompositeTexture normalTexture, MyGuiCompositeTexture highlightTexture, MyGuiCompositeTexture backgroundTexture) { OwnerControl = control; m_normalTexture = normalTexture; m_highlightTexture = highlightTexture; m_backgroundTexture = backgroundTexture; RefreshInternals(); }
protected virtual void RefreshInternals() { Texture = (HasHighlight) ? m_highlightTexture : m_normalTexture; if (HasHighlight) { Texture = m_highlightTexture; } else { Texture = m_normalTexture; } }
protected MyGuiControlCompositePanel AddCompositePanel(MyGuiCompositeTexture texture, Vector2 position, Vector2 size, MyGuiDrawAlignEnum panelAlign) { var panel = new MyGuiControlCompositePanel() { BackgroundTexture = texture }; panel.Position = position; panel.Size = size; panel.OriginAlign = panelAlign; Controls.Add(panel); return panel; }
public MyGuiControlQuestlog(Vector2 position) { if (MyGuiManager.FullscreenHudEnabled) m_position = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(position); else m_position = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate(position); Size = MyHud.Questlog.QuestlogSize; Position = m_position + this.Size / 2; BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_MESSAGEBOX_BACKGROUND_INFO.Texture); QuestInfo = MyHud.Questlog; VisibleChanged += VisibilityChanged; QuestInfo.ValueChanged += QuestInfo_ValueChanged; }
public MyGuiControlMultilineText( Vector2?position = null, Vector2?size = null, Vector4?backgroundColor = null, MyFontEnum font = MyFontEnum.Blue, float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiDrawAlignEnum textAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, StringBuilder contents = null, bool drawScrollbar = true, MyGuiDrawAlignEnum textBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, int?visibleLinesCount = null, bool selectable = false, bool showTextShadow = false, MyGuiCompositeTexture backgroundTexture = null, MyGuiBorderThickness?textPadding = null ) : base(position: position, size: size, colorMask: backgroundColor, toolTip: null, backgroundTexture: backgroundTexture) { Font = font; TextScale = textScale; m_drawScrollbar = drawScrollbar; TextColor = new Color(Vector4.One); TextBoxAlign = textBoxAlign; m_selectable = selectable; m_textPadding = textPadding ?? new MyGuiBorderThickness(0, 0, 0, 0); m_scrollbar = new MyVScrollbar(this); m_scrollbarSize = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y); m_scrollbarSize = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE; float minLineHeight = MyGuiManager.MeasureString(Font, m_lineHeightMeasure, TextScaleWithLanguage).Y; m_label = new MyRichLabel(this, ComputeRichLabelWidth(), minLineHeight, visibleLinesCount) { ShowTextShadow = showTextShadow }; m_label.AdjustingScissorRectangle += AdjustScissorRectangleLabel; m_label.TextAlign = textAlign; m_text = new StringBuilder(); m_selection = new MyGuiControlMultilineSelection(); if (contents != null && contents.Length > 0) { Text = contents; } m_keyThrottler = new MyKeyThrottler(); }
public MyGuiDetailScreenBase(bool isTopMostScreen, MyGuiBlueprintScreenBase parent, MyGuiCompositeTexture thumbnailTexture, MyGuiControlListbox.Item selectedItem, float textScale) : base(new Vector2(0.37f, 0.325f), new Vector2(0.725f, 0.4f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, isTopMostScreen) { m_thumbnailImage = new MyGuiControlImageButton(true); if (thumbnailTexture == null) { m_thumbnailImage.Visible = false; } else { m_thumbnailImage.BackgroundTexture = thumbnailTexture; } m_selectedItem = selectedItem; m_blueprintName = selectedItem.Text.ToString(); m_textScale = textScale; m_parent = parent; }
private void RefreshInternals() { if (HasHighlight) { m_railTexture = m_styleDef.RailHighlightTexture; m_thumbTexture = m_styleDef.ThumbTexture.Highlight; } else { m_railTexture = m_styleDef.RailTexture; m_thumbTexture = m_styleDef.ThumbTexture.Normal; } MinSize = new Vector2(m_railTexture.MinSizeGui.X + m_labelSpaceWidth, Math.Max(m_railTexture.MinSizeGui.Y, m_label.Size.Y)) * DebugScale; MaxSize = new Vector2(m_railTexture.MaxSizeGui.X + m_labelSpaceWidth, Math.Max(m_railTexture.MaxSizeGui.Y, m_label.Size.Y)) * DebugScale; m_label.Position = new Vector2(Size.X * 0.5f, 0f); }
private void RefreshInternals() { if (HasHighlight) { m_compositeBackground = m_styleDef.HighlightTexture; MinSize = m_compositeBackground.MinSizeGui; MaxSize = m_compositeBackground.MaxSizeGui; TextFont = m_styleDef.HighlightFont; } else { m_compositeBackground = m_styleDef.NormalTexture; MinSize = m_compositeBackground.MinSizeGui; MaxSize = m_compositeBackground.MaxSizeGui; TextFont = m_styleDef.NormalFont; } RefreshTextArea(); }
public MyGuiControlMultilineEditableText( Vector2? position = null, Vector2? size = null, Vector4? backgroundColor = null, string font = MyFontEnum.Blue, float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiDrawAlignEnum textAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, StringBuilder contents = null, bool drawScrollbar = true, MyGuiDrawAlignEnum textBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, int? visibleLinesCount = null, MyGuiCompositeTexture backgroundTexture = null, MyGuiBorderThickness? textPadding = null ) : base(position, size, backgroundColor, font, textScale, textAlign, contents, drawScrollbar, textBoxAlign, visibleLinesCount, true, backgroundTexture: backgroundTexture, textPadding: textPadding) { m_fontHeight = MyGuiManager.GetFontHeight(Font, TextScaleWithLanguage); this.AllowFocusingElements = false; }
public MyGuiControlProgressBar( Vector2? position = null, Vector2? size = null, Color? progressBarColor = null, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiCompositeTexture backgroundTexture = null, bool isHorizontal = true) : base( position: position, size: size, backgroundTexture: backgroundTexture, originAlign: originAlign, colorMask: null, toolTip: null) { ProgressColor = (progressBarColor.HasValue ? progressBarColor.Value : DEFAULT_PROGRESS_COLOR); IsHorizontal = isHorizontal; var pixelHorizontal = 1.1f/MyGuiManager.GetFullscreenRectangle().Width; var pixelVertical = 1.1f / MyGuiManager.GetFullscreenRectangle().Height; m_progressForeground = new MyGuiControlPanel( position: new Vector2(-Size.X/2.0f + pixelHorizontal, 0.0f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, backgroundColor: ProgressColor); m_progressForeground.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; Elements.Add(m_progressForeground); }
public MyGuiControlMultilineEditableText( Vector2?position = null, Vector2?size = null, Vector4?backgroundColor = null, MyFontEnum font = MyFontEnum.Blue, float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiDrawAlignEnum textAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, StringBuilder contents = null, bool drawScrollbar = true, MyGuiDrawAlignEnum textBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, int?visibleLinesCount = null, MyGuiCompositeTexture backgroundTexture = null, MyGuiBorderThickness?textPadding = null ) : base(position, size, backgroundColor, font, textScale, textAlign, contents, drawScrollbar, textBoxAlign, visibleLinesCount, true, backgroundTexture: backgroundTexture, textPadding: textPadding) { m_fontHeight = MyGuiManager.GetFontHeight(Font, TextScaleWithLanguage); this.AllowFocusingElements = false; }
public virtual void Init(MyObjectBuilder_GuiControlBase builder) { m_position = builder.Position; Size = builder.Size; Name = builder.Name; if (builder.BackgroundColor != Vector4.One) { ColorMask = builder.BackgroundColor; } if (builder.ControlTexture != null) { BackgroundTexture = new MyGuiCompositeTexture() { Center = new MyGuiSizedTexture() { Texture = builder.ControlTexture } } } ; OriginAlign = builder.OriginAlign; }
public MyGuiControlImageButton(bool visible = true) { BackgroundTexture = new MyGuiCompositeTexture(); Visible = visible; HighlightType = MyGuiControlHighlightType.NEVER; }
protected virtual void RefreshInternals() { Texture = (HasHighlight) ? m_highlightTexture : m_normalTexture; if (HasHighlight) Texture = m_highlightTexture; else Texture = m_normalTexture; }
public MySessionComponentVoxelHand() { Static = this; SnapToVoxel = true; ScreenVisible = false; ShowGizmos = true; ShapeColor = new Vector4(0.6f, 0.6f, 0.6f, 0.25f); m_selectedMaterial = 0; m_materialCount = MyDefinitionManager.Static.VoxelMaterialCount; m_position = MIN_BRUSH_ZOOM*2f; m_rotation = MatrixD.Identity; m_texture = new MyGuiCompositeTexture(); m_texture.Center = new MyGuiSizedTexture { Texture = MyDefinitionManager.Static.GetVoxelMaterialDefinition(m_selectedMaterial).DiffuseY }; }
private void RefreshInternals() { if (m_styleDef == null) m_styleDef = m_styles[(int) MyGuiControlSliderStyleEnum.Default]; if (HasHighlight) { m_railTexture = m_styleDef.RailHighlightTexture; m_thumbTexture = m_styleDef.ThumbTexture.Highlight; } else { m_railTexture = m_styleDef.RailTexture; m_thumbTexture = m_styleDef.ThumbTexture.Normal; } MinSize = new Vector2(m_railTexture.MinSizeGui.X + m_labelSpaceWidth, Math.Max(m_railTexture.MinSizeGui.Y, m_label.Size.Y)) * DebugScale; MaxSize = new Vector2(m_railTexture.MaxSizeGui.X + m_labelSpaceWidth, Math.Max(m_railTexture.MaxSizeGui.Y, m_label.Size.Y)) * DebugScale; m_label.Position = new Vector2(Size.X * 0.5f, 0f); }
public MyGuiControlProgressBar(Vector2?position = null, Vector2?size = null, Color?progressBarColor = null, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiCompositeTexture backgroundTexture = null, bool isHorizontal = true) : base(position: position, size: size, backgroundTexture: backgroundTexture, originAlign: originAlign, colorMask: null, toolTip: null) { ProgressColor = (progressBarColor.HasValue ? progressBarColor.Value : DEFAULT_PROGRESS_COLOR); IsHorizontal = isHorizontal; var pixelHorizontal = 1.1f / MyGuiManager.GetFullscreenRectangle().Width; var pixelVertical = 1.1f / MyGuiManager.GetFullscreenRectangle().Height; m_progressForeground = new MyGuiControlPanel(position: new Vector2(-Size.X / 2.0f + pixelHorizontal, 0.0f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, backgroundColor: ProgressColor); m_progressForeground.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; Elements.Add(m_progressForeground); }
public MyGuiDetailScreenSteam(Action<MyGuiControlListbox.Item> callBack, MyGuiControlListbox.Item selectedItem, MyGuiBlueprintScreen parent , MyGuiCompositeTexture thumbnailTexture, float textScale) : base(false, parent, thumbnailTexture, selectedItem, textScale) { this.callBack = callBack; m_publishedItemId = (selectedItem.UserData as MyBlueprintItemInfo).PublishedItemId; var prefabPath = Path.Combine(m_workshopBlueprintFolder, m_publishedItemId.ToString() + m_workshopBlueprintSuffix); if (File.Exists(prefabPath)) { m_loadedPrefab = LoadWorkshopPrefab(prefabPath, m_publishedItemId); Debug.Assert(m_loadedPrefab != null); if (m_loadedPrefab == null) { m_killScreen = true; } else { var name = m_loadedPrefab.ShipBlueprints[0].CubeGrids[0].DisplayName; if (name.Length > 40) { var newName = name.Substring(0, 40); m_loadedPrefab.ShipBlueprints[0].CubeGrids[0].DisplayName = newName; } RecreateControls(true); } } else { m_killScreen = true; } }
public MyGuiDetailScreenLocal(Action<MyGuiControlListbox.Item> callBack, MyGuiControlListbox.Item selectedItem, MyGuiBlueprintScreenBase parent , MyGuiCompositeTexture thumbnailTexture, float textScale) : base(false, parent, thumbnailTexture, selectedItem, textScale) { var prefabPath = Path.Combine(m_localBlueprintFolder, m_blueprintName, "bp.sbc"); this.callBack = callBack; if (File.Exists(prefabPath)) { m_loadedPrefab = LoadPrefab(prefabPath); if (m_loadedPrefab == null) { MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox( buttonType: MyMessageBoxButtonsType.OK, styleEnum: MyMessageBoxStyleEnum.Error, messageCaption: new StringBuilder("Error"), messageText: new StringBuilder("Failed to load the blueprint file.") )); m_killScreen = true; } else { RecreateControls(true); } } else { m_killScreen = true; } }
public MyGuiControlMultilineText( Vector2? position = null, Vector2? size = null, Vector4? backgroundColor = null, MyFontEnum font = MyFontEnum.Blue, float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiDrawAlignEnum textAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, StringBuilder contents = null, bool drawScrollbar = true, MyGuiDrawAlignEnum textBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, int? visibleLinesCount = null, bool selectable = false, bool showTextShadow = false, MyGuiCompositeTexture backgroundTexture = null, MyGuiBorderThickness? textPadding = null ) : base(position: position, size: size, colorMask: backgroundColor, toolTip: null, backgroundTexture: backgroundTexture) { Font = font; TextScale = textScale; m_drawScrollbar = drawScrollbar; TextColor = new Color(Vector4.One); TextBoxAlign = textBoxAlign; m_selectable = selectable; m_textPadding = textPadding ?? new MyGuiBorderThickness(0, 0, 0, 0); m_scrollbar = new MyVScrollbar(this); m_scrollbarSize = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y); m_scrollbarSize = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE; float minLineHeight = MyGuiManager.MeasureString(Font, m_lineHeightMeasure, TextScaleWithLanguage).Y; m_label = new MyRichLabel(this, ComputeRichLabelWidth(), minLineHeight, visibleLinesCount) { ShowTextShadow = showTextShadow }; m_label.AdjustingScissorRectangle += AdjustScissorRectangleLabel; m_label.TextAlign = textAlign; m_text = new StringBuilder(); m_selection = new MyGuiControlMultilineSelection(); if (contents != null && contents.Length > 0) Text = contents; m_keyThrottler = new MyKeyThrottler(); }