public void InitControls() { AddActivatedCheckbox(new Vector2(-0.07f, -0.1f), CargoBox.Activated); AddIdTextBox(new Vector2(-0.16f, -0.15f), CargoBox.EntityId.Value.NumericValue); m_cargoBoxTypeCombobox = new MyGuiControlCombobox( this, new Vector2(0, -0.2f), MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 6, false, false, false); foreach (MyMwcObjectBuilder_CargoBox_TypesEnum cargoBoxType in Enum.GetValues(typeof(MyMwcObjectBuilder_CargoBox_TypesEnum))) { var cargoBoxHelper = MyGuiObjectBuilderHelpers.GetGuiHelper( MyMwcObjectBuilderTypeEnum.CargoBox, (int)cargoBoxType); m_cargoBoxTypeCombobox.AddItem((int)cargoBoxType, MyGuiManager.GetBlankTexture(), cargoBoxHelper.Description); } m_cargoBoxTypeCombobox.SortItemsByValueText(); m_cargoBoxTypeCombobox.SelectItemByKey((int)CargoBox.CargoBoxType); Controls.Add(m_cargoBoxTypeCombobox); }
public virtual void Draw() { if (m_backgroundColor.HasValue) { MyTexture2D controlTexture = MyGuiManager.GetBlankTexture(); Vector4 backgroundColor = m_backgroundColor.Value; if (m_controlTexture != null) { controlTexture = m_controlTexture; if (m_mouseButtonPressed && m_pressedTexture != null) { controlTexture = m_pressedTexture; } else if (IsMouseOverOrKeyboardActive()) { if ((m_highlightType == MyGuiControlHighlightType.WHEN_ACTIVE) || (m_highlightType == MyGuiControlHighlightType.WHEN_CURSOR_OVER && IsMouseOver()) || (m_hasKeyboardActiveControl && m_canHandleKeyboardActiveControl)) { backgroundColor = m_backgroundColor.Value * MyGuiConstants.CONTROL_MOUSE_OVER_BACKGROUND_COLOR_MULTIPLIER; } } } if (!Enabled) { backgroundColor = m_backgroundColor.Value * MyGuiConstants.DISABLED_BUTTON_COLOR_VECTOR; } MyGuiManager.DrawSpriteBatch(controlTexture, m_parent.GetPositionAbsolute() + m_position, m_size.Value * m_scale, GetColorAfterTransitionAlpha(backgroundColor), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } }
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 override bool Draw(float backgroundFadeAlpha) { if (base.Draw(backgroundFadeAlpha) == false) { return(false); } if (m_colorArea.Checked || m_particleEffect.Checked) { MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), GetPosition() + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2 + 0.02f, 0) + m_redSlider.GetPosition(), MyGuiConstants.CHECKBOX_SIZE, new Color(m_redSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, 0, 0), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), GetPosition() + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2 + 0.02f, 0) + m_greenSlider.GetPosition(), MyGuiConstants.CHECKBOX_SIZE, new Color(0, m_greenSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, 0), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), GetPosition() + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2 + 0.02f, 0) + m_blueSlider.GetPosition(), MyGuiConstants.CHECKBOX_SIZE, new Color(0, 0, m_blueSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); float height = MyGuiConstants.CHECKBOX_SIZE.Y + CONTROLS_DELTA.Y * 2; float width = MyGuiConstants.CHECKBOX_SIZE.X / MyGuiConstants.CHECKBOX_SIZE.Y * height; MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), GetPosition() + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2 + 0.04f + width / 2, 0) + m_greenSlider.GetPosition(), new Vector2(width, height), new Color(m_redSlider.GetValue() / 255, m_greenSlider.GetValue() / 255, m_blueSlider.GetValue() / 255), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } return(true); }
private static void OffsetInnerBorder(Vector2 normalizedPosition, Vector2 normalizedSize, int pixelWidth, int offset, Color color, bool top = true, bool bottom = true, bool left = true, bool right = true, Vector2?normalizedOffset = null) { Vector2 screenPosition = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(normalizedPosition - (normalizedOffset.HasValue ? normalizedOffset.Value : Vector2.Zero)); var a = new Point((int)screenPosition.X - offset, (int)screenPosition.Y - offset); // for precission Vector2 screenPositionDownRight = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(normalizedPosition + normalizedSize + (normalizedOffset.HasValue ? normalizedOffset.Value : Vector2.Zero)); var b = new Point((int)screenPositionDownRight.X + offset, (int)screenPositionDownRight.Y + offset); if (top) { MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), a.X, a.Y, b.X - a.X, pixelWidth, color); // Top } if (bottom) { MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), a.X, b.Y - pixelWidth, b.X - a.X, pixelWidth, color); // Bottom } if (left) { MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), a.X, a.Y + (top ? pixelWidth : 0), pixelWidth, b.Y - a.Y - (bottom ? pixelWidth : 0) - (top ? pixelWidth : 0), color); // Left } if (right) { MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), b.X - pixelWidth, a.Y + (top ? pixelWidth : 0), pixelWidth, b.Y - a.Y - (bottom ? pixelWidth : 0) - (top ? pixelWidth : 0), color); // Right } }
public override void Draw() { if (!Visible) { return; } base.Draw(); Vector2 textAreaSize = GetTextAreaSize(); Vector2 textAreaPosition = GetTextAreaPosition(); Vector4 tempTextColor = (IsMouseOverOrKeyboardActive() == false) ? m_textColor : m_textColor * MyGuiConstants.CONTROL_MOUSE_OVER_BACKGROUND_COLOR_MULTIPLIER; Vector2 carriagePosition = GetCarriagePosition(m_carriagePositionIndex); // End our standard sprite batch MyGuiManager.EndSpriteBatch(); // Draw the rectangle to stencil buffer, so later when we draw, only pixels with stencil=1 will be rendered // Textbox interior must be increased by 1 pixel in all four directions (thus adding 2.0 to its height and width - because it's centered). // Otherwise stencil would cut out something from textbox interior. MyGuiManager.DrawStencilMaskRectangle(new MyRectangle2D(textAreaPosition + new Vector2(textAreaSize.X / 2.0f, 0), textAreaSize + MyGuiManager.GetNormalizedSizeFromScreenSize(new Vector2(2.0f, 2.0f))), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); // Set up the stencil operation and parameters MyGuiManager.BeginSpriteBatch_StencilMask(); UpdateSlidingWindowPosition(); float slidingWindowPositionDeltaX = m_slidingWindowPosition.X - textAreaPosition.X; // Show "sliding window" rectangle - only for debugging //MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), m_slidingWindowPosition, textAreaSize, // GetColorAfterTransitionAlpha(new Vector4(0, 1, 0, 0.3f)), MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); // Draw text in textbox MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), new StringBuilder(GetTextByType()), new Vector2(textAreaPosition.X - slidingWindowPositionDeltaX, textAreaPosition.Y), m_textScale, GetColorAfterTransitionAlpha(tempTextColor), MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); // Draw carriage line // Carriage blinker time is solved here in Draw because I want to be sure it will be drawn even in low FPS if (m_hasKeyboardActiveControl == true) { // This condition controls "blinking", so most often is carrier visible and blinks very fast // It also depends on FPS, but as we have max FPS set to 60, it won't go faster, nor will it omit a "blink". int carriageInterval = m_carriageBlinkerTimer % 20; if ((carriageInterval >= 0) && (carriageInterval <= 15)) { MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), new Vector2(carriagePosition.X - slidingWindowPositionDeltaX, carriagePosition.Y), 1, m_size.Value.Y * 0.5f, GetColorAfterTransitionAlpha(tempTextColor), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } } m_carriageBlinkerTimer++; // End stencil-mask batch, and restart the standard sprite batch //MyGuiManager.EndSpriteBatch(); MyGuiManager.EndSpriteBatch_StencilMask(); //MyGuiManager.BeginSpriteBatch_StencilMask(); MyGuiManager.BeginSpriteBatch(); }
public override bool Draw(float backgroundFadeAlpha) { if (!base.Draw(backgroundFadeAlpha)) { return(false); } MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), this.GetPositionAbsolute() + m_colorDrawPosition, new Vector2(0.04f, 0.04f), Scanner.Color, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); return(true); }
public static void FillRectangle(Vector2 position, Vector2 size, Color color) { Vector2 screenPosition = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(position); var a = new Point((int)screenPosition.X, (int)screenPosition.Y); // for precission Vector2 screenPositionDownRight = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(position + size); var b = new Point((int)screenPositionDownRight.X, (int)screenPositionDownRight.Y); MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), a.X, a.Y, b.X - a.X, b.Y - a.Y, color); }
public override void Draw() { base.Draw(); if (m_selected == true) { Vector4 selectedColor = (IsMouseOverOrKeyboardActive() == false) ? m_backgroundColor.Value : m_backgroundColor.Value * MyGuiConstants.CONTROL_MOUSE_OVER_BACKGROUND_COLOR_MULTIPLIER; // because checkbox texture is not aligned to center, then we must add offset to selected texture position Vector2 selectedTextureOffset = new Vector2(m_size.Value.X / 40f, 0f); // Selected sprite MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), m_parent.GetPositionAbsolute() + m_position + selectedTextureOffset, m_size.Value * new Vector2(0.5f, 0.5f), GetColorAfterTransitionAlpha(selectedColor), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } }
// Returns true or false to let child implementation know if it has to run its own version of draw. public virtual bool Draw(float backgroundFadeAlpha) { // If this screen has focus and there are other screens too, draw large black-transparent rectangle below it, so all other screens will look darker // Only one screen can draw this sort of background, and it is always top-most screen! //if ((hasFocus == true) && (MyGuiManager.GetScreensCount() > 1)) //if (MyGuiManager.GetScreensCount() > 1) if (backgroundFadeAlpha > 0) { Vector4 fadeColorVec = m_backgroundFadeColor; fadeColorVec.W *= backgroundFadeAlpha; if (m_backgroundColor.HasValue) { fadeColorVec.X *= m_backgroundColor.Value.X; fadeColorVec.Y *= m_backgroundColor.Value.Y; fadeColorVec.Z *= m_backgroundColor.Value.Z; } Color fadeColor = new Color(fadeColorVec); // Blank background fade MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), new Rectangle(0, 0, MyMinerGame.ScreenSize.X, MyMinerGame.ScreenSize.Y), fadeColor); } // This is just background of the screen rectangle if ((m_backgroundColor.HasValue) && (m_size.HasValue)) { // Background texture if (m_backgroundTexture == null) { if (m_size.HasValue) { // If this screen doesn't have custom texture, we will use one of the default - but with respect to screen's aspect ratio m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>(MyGuiManager.GetBackgroundTextureFilenameByAspectRatio(m_size.Value), loadingMode: LoadingMode.LazyBackground); } } MyGuiManager.DrawSpriteBatch(m_backgroundTexture, m_position, m_size.Value, GetColorAfterTransitionAlpha(m_backgroundColor.Value), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } DrawControls(); //DrawControlsFinal(); return(true); }
public override void Draw() { //base.Draw(); if (IsActive()) { // draw item's background if (m_backgroundColor != null && DrawBackgroundTexture) { MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), MyGuiManager.MouseCursorPosition, m_size.Value, /*new Color(m_backgroundColor.Value)*/ GetColorAfterTransitionAlpha(m_backgroundColor.Value * (new Color(50, 66, 70, 255).ToVector4())), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } Vector2 itemPosition = MyGuiManager.MouseCursorPosition - m_size.Value / 2.0f; Vector2 textPosition = itemPosition + m_textOffset; textPosition.Y += (m_size.Value.Y / 2.0f); // draw item's icon if (m_supportIcon == true && m_draggingListboxItem.Icon != null) { MyGuiManager.DrawSpriteBatch(m_draggingListboxItem.Icon, itemPosition, m_size.Value, GetColorAfterTransitionAlpha(m_backgroundColor.Value), MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); } // draw item's text else if (m_draggingListboxItem.Value != null) { // End our standard sprite batch MyGuiManager.EndSpriteBatch(); // Draw the rectangle(basically the opened area) to stencil buffer to be used for clipping partial item MyGuiManager.DrawStencilMaskRectangle(new MyRectangle2D(itemPosition, m_size.Value), MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); // Set up the stencil operation and parameters MyGuiManager.BeginSpriteBatch_StencilMask(); m_draggingListboxItem.ColoredText.Draw(textPosition, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, m_parent.GetTransitionAlpha(), true); // End stencil-mask batch, and restart the standard sprite batch //MyGuiManager.EndSpriteBatch(); MyGuiManager.EndSpriteBatch_StencilMask(); MyGuiManager.BeginSpriteBatch(); } ShowToolTip(); } }
protected void DrawBorders(Vector2 topLeftPosition, Vector2 size, Color color, int borderSize) { Vector2 sizeInPixels = MyGuiManager.GetScreenSizeFromNormalizedSize(size); sizeInPixels = new Vector2((int)sizeInPixels.X, (int)sizeInPixels.Y); Vector2 leftTopInPixels = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(topLeftPosition); leftTopInPixels = new Vector2((int)leftTopInPixels.X, (int)leftTopInPixels.Y); Vector2 rightTopInPixels = leftTopInPixels + new Vector2(sizeInPixels.X, 0); Vector2 leftBottomInPixels = leftTopInPixels + new Vector2(0, sizeInPixels.Y); // top MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), (int)leftTopInPixels.X, (int)leftTopInPixels.Y, (int)sizeInPixels.X, borderSize, color); // right MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), (int)rightTopInPixels.X - borderSize, (int)rightTopInPixels.Y + borderSize, borderSize, (int)sizeInPixels.Y - borderSize * 2, color); // bottom MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), (int)leftBottomInPixels.X, (int)leftBottomInPixels.Y - borderSize, (int)sizeInPixels.X, borderSize, color); //left MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), (int)leftTopInPixels.X, (int)leftTopInPixels.Y + borderSize, borderSize, (int)sizeInPixels.Y - borderSize * 2, color); }
//StringBuilder m_drawPositionSb = new StringBuilder(); private void DrawControlDebugPosition(MyGuiControlBase control) { m_drawPositionSb.Clear(); m_drawPositionSb.Append("["); m_drawPositionSb.Append(control.GetPosition().X.ToString("0.0000")); m_drawPositionSb.Append(","); m_drawPositionSb.Append(control.GetPosition().Y.ToString("0.0000")); m_drawPositionSb.Append("]"); float scale = 0.7f; Vector2 size = MyGuiManager.GetNormalizedSizeFromScreenSize(MyGuiManager.GetFontMinerWarsBlue().MeasureString(m_drawPositionSb, scale)); Vector4 color = new Vector4(0f, 0f, 0f, 0.5f); MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), control.GetPosition() + control.GetParent().GetPositionAbsolute(), size, new Color(color), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), m_drawPositionSb, control.GetPosition() + control.GetParent().GetPositionAbsolute(), scale, Color.Green, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); }
public override bool Draw(float backgroundFadeAlpha) { if (base.Draw(backgroundFadeAlpha) == false) { return(false); } Vector2 opacityPosition = m_position + m_opacitySlider.GetPosition() + new Vector2(0.13f, 0); Vector2 finalColorPosition = m_position + m_redColorSlider.GetPosition() + new Vector2(0.18f, -MyGuiConstants.SLIDER_HEIGHT / 2); Vector2 finalColorScreenCoord = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(finalColorPosition); Vector2 finalColorSize = MyGuiManager.GetScreenSizeFromNormalizedSize(new Vector2(3 * MyGuiConstants.SLIDER_HEIGHT, 3 * MyGuiConstants.SLIDER_HEIGHT) + new Vector2(0, 0.024f)); // Draws one big final color rectangle to see result of each RGBA component in one MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsWhite(), m_opacityValueText, opacityPosition, MyGuiConstants.LABEL_TEXT_SCALE, new Color(MyGuiConstants.LABEL_TEXT_COLOR), MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), (int)finalColorScreenCoord.X, (int)finalColorScreenCoord.Y, (int)finalColorSize.X, (int)finalColorSize.Y, m_sphereDustColor); return(true); }
private void DrawColors() { if (m_prefabLights.Count > 0) { MyPrefabLight myLight = m_prefabLights[0] as MyPrefabLight; MyGuiControlSlider rS = m_spotNormalLightColorSlider[0]; Color color = new Color(myLight.GetLight().ReflectorColor); color.A = 255; if (m_pointLightCheckbox.Visible) { rS = m_pointNormalLightColorSlider[0]; color = new Color(myLight.GetLight().Color); color.A = 255; } Vector2 posOffset = new Vector2(-0.08f, -0.005f); Vector2 pos = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(rS.GetPosition() - MyGuiConstants.CONTROLS_DELTA + posOffset); Vector2 colorLabelSize = MyGuiManager.GetScreenSizeFromNormalizedSize(new Vector2(0.5f * MyGuiConstants.SLIDER_HEIGHT, 0.5f * MyGuiConstants.SLIDER_HEIGHT)); // Draw one big final color rectangle to see result of each RGBA component in one MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), (int)pos.X, (int)pos.Y, (int)colorLabelSize.X, (int)colorLabelSize.Y, color); if (m_pointLightCheckbox.Visible) { Vector2 pos2 = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(m_specularLightColorSlider[0].GetPosition() - MyGuiConstants.CONTROLS_DELTA + posOffset); Color color2 = new Color(myLight.GetLight().SpecularColor); color2.A = 255; // Draw color rectangles next to each color slider and then draw one big final color rectangle to see result of each RGBA component in one MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), (int)pos2.X, (int)pos2.Y, (int)colorLabelSize.X, (int)colorLabelSize.Y, color2); } } }
protected override void AddPrefabItems(MyTreeViewItem parentItem, MyMwcObjectBuilder_Prefab_AppearanceEnum appearanceTextureEnum, BuildTypesEnum buildType, CategoryTypesEnum categoryType) { MyMwcLog.WriteLine("GAME AddPrefabItems - START"); Vector2 itemSize = MyGuiConstants.CHECKBOX_SIZE * 3; foreach (MyMwcObjectBuilderTypeEnum enumValue in MyGuiPrefabHelpers.MyMwcPrefabTypesEnumValues) { foreach (int prefabId in MyMwcObjectBuilder_Base.GetObjectBuilderIDs(enumValue)) { MyPrefabConfiguration config = MyPrefabConstants.GetPrefabConfiguration(enumValue, prefabId); MyGuiPrefabHelper prefabModuleHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(enumValue, prefabId) as MyGuiPrefabHelper; if (config == null) { continue; } if (config.FactionSpecific.HasValue && config.FactionSpecific.Value != appearanceTextureEnum) { continue; } if (config.BuildType == buildType && config.CategoryType == categoryType && config.EnabledInEditor) { MyMwcObjectBuilder_PrefabBase prefabObjectBuilder = MyPrefabFactory.GetInstance().CreatePrefabObjectBuilder(enumValue, prefabId, appearanceTextureEnum); MyBuildingSpecification buildingSpecification = MyBuildingSpecifications.GetBuildingSpecification(prefabObjectBuilder); MyTexture2D previewTexture = MyGuiManager.GetPrefabPreviewTexture(enumValue, prefabId, appearanceTextureEnum); AddTreeViewItem(parentItem, prefabModuleHelper.Description, previewTexture, itemSize, MyGuiManager.GetBlankTexture(), MyGuiManager.GetBlankTexture(), MyGuiConstants.CHECKBOX_SIZE, prefabObjectBuilder, buildingSpecification); } } } MyMwcLog.WriteLine("GAME AddPrefabItems - END"); }
public MyGuiScreenFake() : base(new Vector2(0.5f, 0.5f), new Vector4(0f, 1f, 0f, 0.5f), new Vector2(1f, 1f)) { MyGuiControlList controlList = new MyGuiControlList(this, new Vector2(0f, 0f), new Vector2(0.8f, 0.5f), MyGuiConstants.DEFAULT_CONTROL_BACKGROUND_COLOR, new StringBuilder("ToolTip"), MyGuiManager.GetBlankTexture()); Controls.Add(controlList); List <MyGuiControlBase> fakeControls = new List <MyGuiControlBase>(); MyGuiControlParent parent1 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 0f, 0f, 1f), new StringBuilder("Parent1"), null); parent1.Controls.Add(new MyGuiControlTextbox(parent1, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "AAA", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); parent1.Controls.Add(new MyGuiControlCheckbox(parent1, new Vector2(0f, 0.07f), MyGuiConstants.CHECKBOX_SIZE, true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR)); fakeControls.Add(parent1); MyGuiControlParent parent2 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(0f, 1f, 0f, 1f), new StringBuilder("Parent2"), null); parent2.Controls.Add(new MyGuiControlTextbox(parent2, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "CCC", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); MyGuiControlCombobox combobox1 = new MyGuiControlCombobox(parent2, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 10, false, true, false); combobox1.AddItem(0, new StringBuilder("Item1 Item1 Item1 Item1 Item1 Item1 Item1 ")); combobox1.AddItem(1, new StringBuilder("Item2 Item2 Item2 Item2 Item2 Item2 Item2 ")); combobox1.AddItem(2, new StringBuilder("Item3 Item3 Item3 Item3 Item3 Item3 Item3 ")); combobox1.AddItem(3, new StringBuilder("Item4")); combobox1.AddItem(4, new StringBuilder("Item5")); combobox1.AddItem(5, new StringBuilder("Item6")); combobox1.AddItem(6, new StringBuilder("Item7")); combobox1.AddItem(7, new StringBuilder("Item8")); combobox1.AddItem(8, new StringBuilder("Item9")); combobox1.AddItem(9, new StringBuilder("Item10")); combobox1.AddItem(10, new StringBuilder("Item11")); combobox1.AddItem(11, new StringBuilder("Item12")); combobox1.AddItem(12, new StringBuilder("Item13")); parent2.Controls.Add(combobox1); fakeControls.Add(parent2); MyGuiControlParent parent3 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(0f, 0f, 1f, 1f), new StringBuilder("Parent3"), null); parent3.Controls.Add(new MyGuiControlTextbox(parent3, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "EEE", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); MyGuiControlCombobox combobox2 = new MyGuiControlCombobox(parent3, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 10, false, true, false); combobox2.AddItem(0, new StringBuilder("Item1 Item1 Item1 Item1 Item1 Item1 Item1 ")); combobox2.AddItem(1, new StringBuilder("Item2 Item2 Item2 Item2 Item2 Item2 Item2 ")); combobox2.AddItem(2, new StringBuilder("Item3 Item3 Item3 Item3 Item3 Item3 Item3 ")); combobox2.AddItem(3, new StringBuilder("Item4")); combobox2.AddItem(4, new StringBuilder("Item5")); combobox2.AddItem(5, new StringBuilder("Item6")); combobox2.AddItem(6, new StringBuilder("Item7")); combobox2.AddItem(7, new StringBuilder("Item8")); combobox2.AddItem(8, new StringBuilder("Item9")); combobox2.AddItem(9, new StringBuilder("Item10")); combobox2.AddItem(10, new StringBuilder("Item11")); combobox2.AddItem(11, new StringBuilder("Item12")); combobox2.AddItem(12, new StringBuilder("Item13")); parent3.Controls.Add(combobox2); fakeControls.Add(parent3); MyGuiControlParent parent4 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 0f, 1f, 1f), new StringBuilder("Parent4"), null); parent4.Controls.Add(new MyGuiControlTextbox(parent4, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "GGG", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); parent4.Controls.Add(new MyGuiControlTextbox(parent4, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.LARGE, "HHH", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); fakeControls.Add(parent4); MyGuiControlParent parent5 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 1f, 0f, 1f), new StringBuilder("Parent5"), null); parent5.Controls.Add(new MyGuiControlTextbox(parent5, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "III", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); parent5.Controls.Add(new MyGuiControlTextbox(parent5, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.LARGE, "JJJ", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); fakeControls.Add(parent5); controlList.InitControls(fakeControls); }
public override void Draw() { base.Draw(); MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), m_parent.GetPositionAbsolute() + m_position + new Vector2(0.19f, 0.005f), new Vector2(0.1f, 0.03f), m_color, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); }
private void AddSmallShipWeaponsItems(MyTreeViewItem parentItem) { Vector2 itemSize = MyGuiManager.GetNormalizedSizeFromScreenSize(new Vector2(64, 64)); foreach (MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_Weapon_TypesEnumValues) { MyMwcObjectBuilder_SmallShip_Weapon weaponObjectBuilder = new MyMwcObjectBuilder_SmallShip_Weapon(enumValue); MyBuildingSpecification buildingSpecification = MyBuildingSpecifications.GetBuildingSpecification(weaponObjectBuilder); MyGuiSmallShipHelperWeapon smallShipWeaponHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip_Weapon, (int)enumValue) as MyGuiSmallShipHelperWeapon; AddTreeViewItem(parentItem, smallShipWeaponHelper.Description, smallShipWeaponHelper.Icon, itemSize, MyGuiManager.GetBlankTexture(), MyGuiManager.GetBlankTexture(), MyGuiConstants.CHECKBOX_SIZE, weaponObjectBuilder, buildingSpecification); } }
public override void RecreateControls(bool contructor) { base.RecreateControls(contructor); Controls.Clear(); m_entitiesGuiList = new MyGuiControlList( this, new Vector2(0.0034f, -0.030f), new Vector2(0.489f, 0.65f), Vector4.Zero, null,//MyTextsWrapper.Get(MyTextsWrapperEnum.SecurityControlHUB), MyGuiManager.GetBlankTexture(), new Vector2(0.01f, 0.0f)); if (!contructor) { foreach (var entityGui in m_entitiesGui) { entityGui.ClearAfterRemove(); } } m_entitiesGui.Clear(); foreach (IMyUseableEntity connectedEntity in m_prefabSecurityControlHUB.ConnectedEntities) { MyEntity entity = connectedEntity as MyEntity; if (!entity.Visible) { continue; } Debug.Assert((connectedEntity.UseProperties.UseType & MyUseType.FromHUB) != 0); IMyHasGuiControl entityWithGuiControl = connectedEntity as IMyHasGuiControl; Debug.Assert(entityWithGuiControl != null); // if entity is not hacked and could be hacked from HUB, then try hack it if (!connectedEntity.UseProperties.IsHacked && (connectedEntity.UseProperties.HackType & MyUseType.FromHUB) != 0) { if (m_useBy.HackingTool != null && m_useBy.HackingTool.HackingLevel >= connectedEntity.UseProperties.HackingLevel) { connectedEntity.UseProperties.IsHacked = true; } } MyGuiControlEntityUse entityGui = entityWithGuiControl.GetGuiControl(m_entitiesGuiList); entityGui.ParentScreen = this; m_entitiesGui.Add(entityGui); } m_entitiesGuiList.InitControls(m_entitiesGui); Controls.Add(m_entitiesGuiList); var exitButton = new MyGuiControlButton( this, new Vector2(0f, 0.3740f), new Vector2(0.161f, 0.0637f), Vector4.One, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Exit, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnExitClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(exitButton); }
public MyGuiPrefabHelper(MyTextsWrapperEnum description) : base(description) { Icon = MyGuiManager.GetBlankTexture(); }