public void SwitchWindow(AbstractPanel panel) { if (m_panelOnUI != null) { m_panelOnUI.isVisible = false; if (!m_panelOnUI.IsSpecialWindow) { m_lastStandardPanel = m_panelOnUI; } } panel.isVisible = true; m_panelOnUI = panel; float cumulativeHeight = m_topSection.height; if (panel.ShowDropDown) { dropDown.relativePosition = new Vector2(8, cumulativeHeight); cumulativeHeight += dropDown.height + 8; dropDown.isVisible = true; } else { dropDown.isVisible = false; } dropDown.Populate(true); panel.relativePosition = new Vector2(0, cumulativeHeight); cumulativeHeight += panel.height; if (ModLoadingExtension.tmpeDetected && panel.ShowTmpeSetup) { m_setupTmpeSection.relativePosition = new Vector2(0, cumulativeHeight); cumulativeHeight += m_setupTmpeSection.height; m_setupTmpeSection.isVisible = true; } else { m_setupTmpeSection.isVisible = false; } m_bottomSection.relativePosition = new Vector2(0, cumulativeHeight); cumulativeHeight += m_bottomSection.height; backButton.isVisible = panel.ShowBackButton; height = cumulativeHeight; }
public void SwitchWindow(AbstractPanel panel) { if (m_panelOnUI != null) { m_panelOnUI.isVisible = false; if (!m_panelOnUI.IsSpecialWindow) { m_lastStandardPanel = m_panelOnUI; } } panel.isVisible = true; m_panelOnUI = panel; float cumulativeHeight = m_topSection.height; if (panel.ShowDropDown) { dropDown.relativePosition = new Vector2(8, cumulativeHeight); cumulativeHeight += dropDown.height + 8; dropDown.isVisible = true; } else { dropDown.isVisible = false; } dropDown.Populate(true); panel.relativePosition = new Vector2(0, cumulativeHeight); cumulativeHeight += panel.height; if (ModLoadingExtension.tmpeDetected && panel.ShowTmpeSetup) { m_setupTmpeSection.relativePosition = new Vector2(0, cumulativeHeight); cumulativeHeight += m_setupTmpeSection.height; m_setupTmpeSection.isVisible = true; } else { m_setupTmpeSection.isVisible = false; } // THIS IS HELL ON EARTH // Adjust position of other buttons and height of the panel if the back button is visible if (panel.ShowBackButton) { if (!backButton.enabled) { m_bottomSection.height += backButton.height + 8; closeButton.relativePosition = new Vector2(closeButton.relativePosition.x, closeButton.relativePosition.y + backButton.height + 8); undoButton.relativePosition = new Vector2(undoButton.relativePosition.x, undoButton.relativePosition.y + backButton.height + 8); } backButton.enabled = true; } else { if (backButton.enabled) { m_bottomSection.height -= backButton.height + 8; closeButton.relativePosition = new Vector2(closeButton.relativePosition.x, closeButton.relativePosition.y - backButton.height - 8); undoButton.relativePosition = new Vector2(undoButton.relativePosition.x, undoButton.relativePosition.y - backButton.height - 8); } backButton.enabled = false; } m_bottomSection.relativePosition = new Vector2(0, cumulativeHeight); cumulativeHeight += m_bottomSection.height; height = cumulativeHeight; }