protected override void OnSizeChanged() { if (m_currentBlocks.Length == 0) { return; } var topLeftRelative = Size * -0.5f; Vector2 leftColumnSize = new Vector2(0.3f, 0.55f); m_separatorList.Clear(); m_separatorList.AddHorizontal(topLeftRelative, Size.X); m_separatorList.AddVertical(topLeftRelative + new Vector2(leftColumnSize.X, 0), Size.Y); m_separatorList.AddHorizontal(topLeftRelative + new Vector2(leftColumnSize.X + 0.008f, 0.18f), leftColumnSize.X * 0.96f);//above ownership m_terminalControlList.Position = topLeftRelative + new Vector2(leftColumnSize.X * 0.5f, 0.01f); m_terminalControlList.Size = new Vector2(leftColumnSize.X, 0.625f); float propertiesOffset = 0.06f; if (MyFakes.SHOW_FACTIONS_GUI) { foreach (var block in m_currentBlocks) { if (block.IDModule != null) { propertiesOffset = 0.22f; m_separatorList.AddHorizontal(topLeftRelative + new Vector2(leftColumnSize.X + 0.008f, propertiesOffset + 0.11f), leftColumnSize.X * 0.96f); break; } } } m_blockPropertiesMultilineText.Position = topLeftRelative + new Vector2(leftColumnSize.X + 0.008f, propertiesOffset + 0.12f); m_blockPropertiesMultilineText.Size = 0.5f * Size - m_blockPropertiesMultilineText.Position; base.OnSizeChanged(); }
void Reposition() { this.Size = new Vector2(this.Size.X, 0.12f * baseScale + itemHeight * BlockInfo.Components.Count); //BackgroundTexture = @"Textures\GUI\Screens\aa"; var topleft = -this.Size / 2; var topRight = new Vector2(this.Size.X / 2, -this.Size.Y / 2); var rightColumn = topleft + (m_progressMode ? new Vector2(0.0815f, 0) : new Vector2(0.036f, 0)); var titleHeight = 0.072f * baseScale; Vector2 borderGap = new Vector2(0.0055f) * new Vector2(0.75f, 1) * baseScale; if (!m_progressMode) { borderGap.Y *= 0.5f; } m_installedRequiredLabel.TextToDraw = MyTexts.Get(BlockInfo.BlockIntegrity > 0 ? m_style.InstalledRequiredLabelText : m_style.RequiredLabelText); m_leftColumnBackground.ColorMask = m_style.LeftColumnBackgroundColor; m_leftColumnBackground.Position = topleft + borderGap; m_leftColumnBackground.Size = new Vector2(rightColumn.X - topleft.X, this.Size.Y) - new Vector2(borderGap.X, 0.0088f); m_leftColumnBackground.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; m_titleBackground.ColorMask = m_style.TitleBackgroundColor; if (m_progressMode) { m_titleBackground.Position = rightColumn + new Vector2(-0.0015f, borderGap.Y); } else { m_titleBackground.Position = topleft + borderGap; } m_titleBackground.Size = new Vector2(topRight.X - m_titleBackground.Position.X - (m_progressMode ? borderGap.X : 0), 0.101f * baseScale); m_titleBackground.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; Vector2 separatorPos; if (m_progressMode) { separatorPos = rightColumn + new Vector2(0, titleHeight); } else { separatorPos = topleft + new Vector2(borderGap.X, titleHeight); } m_separator.Clear(); m_separator.AddHorizontal(separatorPos, this.Size.X + topleft.X - separatorPos.X - 0.002f, 0.003f); // Title separator if (m_progressMode) { if (BlockInfo.BlockIntegrity > 0) { float integrityHeight = itemHeight * BlockInfo.Components.Count - 0.002f; float integrityWidth = 0.032f; var integrityPos = topleft + new Vector2(0.01f, 0.11f + integrityHeight); m_integrityBackground.ColorMask = m_style.IntegrityBackgroundColor; m_integrityBackground.Position = integrityPos; m_integrityBackground.Size = new Vector2(integrityWidth, integrityHeight); m_integrityBackground.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; var color = (BlockInfo.BlockIntegrity > BlockInfo.CriticalIntegrity) ? m_style.IntegrityForegroundColorOverCritical : m_style.IntegrityForegroundColor; m_integrityForeground.ColorMask = color; m_integrityForeground.Position = integrityPos; m_integrityForeground.Size = new Vector2(integrityWidth, integrityHeight * BlockInfo.BlockIntegrity); m_integrityForeground.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK; if (ShowCriticalIntegrity) { float lineWidth = 0; if (Math.Abs(BlockInfo.CriticalIntegrity - BlockInfo.OwnershipIntegrity) < 0.005f) { lineWidth = 0.004f; //if lines are overdrawing } m_separator.AddHorizontal(integrityPos - new Vector2(0, integrityHeight * BlockInfo.CriticalIntegrity), integrityWidth, width: lineWidth, color: CriticalIntegrityColor); } if (ShowOwnershipIntegrity && BlockInfo.OwnershipIntegrity > 0) { m_separator.AddHorizontal(integrityPos - new Vector2(0, integrityHeight * BlockInfo.OwnershipIntegrity), integrityWidth, color: OwnershipIntegrityColor); } m_integrityLabel.Position = integrityPos + new Vector2(integrityWidth / 2, -0.005f); m_integrityLabel.Font = MyFontEnum.White; m_integrityLabel.TextToDraw.Clear(); m_integrityLabel.TextToDraw.AppendInt32((int)Math.Floor(BlockInfo.BlockIntegrity * 100)).Append("%"); m_integrityBackground.Visible = true; m_integrityForeground.Visible = true; m_integrityLabel.Visible = true; } else { m_integrityBackground.Visible = false; m_integrityForeground.Visible = false; m_integrityLabel.Visible = false; } } if (m_progressMode) { m_blockNameLabel.Position = rightColumn + new Vector2(0.006f, 0.026f * baseScale); if (m_style.ShowAvailableComponents) { Vector2 offset = new Vector2(0, -0.006f); m_componentsLabel.Position = m_blockNameLabel.Position + new Vector2(0, m_blockNameLabel.Size.Y) + offset; m_blockNameLabel.Position = m_blockNameLabel.Position + offset; } else { m_componentsLabel.Position = rightColumn + new Vector2(0.006f, 0.076f * baseScale); } m_blockNameLabel.Size = new Vector2(Size.X / 2 - m_blockNameLabel.Position.X, m_blockNameLabel.Size.Y); m_blockTypeLabel.Visible = false; m_blockTypePanel.Visible = false; m_blockTypePanelBackground.Visible = false; } else { m_blockTypePanel.Position = topRight + new Vector2(-0.0085f, 0.012f); m_blockTypePanelBackground.Position = topRight + new Vector2(-0.0085f, 0.012f); if (m_style.EnableBlockTypePanel) { m_blockTypePanel.Visible = true; m_blockTypePanelBackground.Visible = true; m_blockNameLabel.Size = new Vector2(m_blockTypePanel.Position.X - m_blockTypePanel.Size.X - m_blockNameLabel.Position.X, m_blockNameLabel.Size.Y); } else { m_blockTypePanel.Visible = false; m_blockTypePanelBackground.Visible = false; m_blockNameLabel.Size = new Vector2(m_blockTypePanel.Position.X - m_blockNameLabel.Position.X, m_blockNameLabel.Size.Y); } m_blockNameLabel.TextScale = 0.95f * baseScale; m_blockNameLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; m_blockNameLabel.Position = m_blockIconPanel.Position + m_blockIconPanel.Size + new Vector2(0.004f, 0); m_blockTypeLabel.Visible = true; m_blockTypeLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_blockTypeLabel.TextScale = m_smallerFontSize * baseScale; m_blockTypeLabel.Position = m_blockIconPanel.Position + new Vector2(m_blockIconPanel.Size.X, 0) + new Vector2(0.004f, -0.0025f); m_componentsLabel.Position = rightColumn + new Vector2(0.006f, 0.076f * baseScale); } m_installedRequiredLabel.Position = topRight + new Vector2(-0.011f, 0.076f * baseScale); m_blockIconPanel.Position = topleft + new Vector2(0.0085f, 0.012f); m_blockIconPanelBackground.Position = topleft + new Vector2(0.0085f, 0.012f); Vector2 listPos; if (m_progressMode) { listPos = topleft + new Vector2(0.0485f, 0.102f); } else { listPos = topleft + new Vector2(0.008f, 0.102f * baseScale); } for (int i = 0; i < BlockInfo.Components.Count; i++) { m_componentLines[i].Position = listPos + new Vector2(0, (BlockInfo.Components.Count - i - 1) * itemHeight); m_componentLines[i].IconPanelProgress.Visible = ShowComponentProgress; m_componentLines[i].IconPanel.BorderColor = CriticalComponentColor; m_componentLines[i].NameLabel.TextScale = m_smallerFontSize * baseScale; m_componentLines[i].NumbersLabel.TextScale = m_smallerFontSize * baseScale; } }