From f018fdecdd8115b7e29d22c7a3e6e3f2de2bda8a Mon Sep 17 00:00:00 2001 From: Ivaylo Draganov Date: Tue, 22 Jun 2021 19:26:40 +0300 Subject: [PATCH] Remove special handling for cases when there's only one game info tab The addition of the lobby options tab ensures that there will always be at least two tabs ("Objectives" and "Options"). --- .../Widgets/Logic/Ingame/GameInfoLogic.cs | 15 --------------- mods/cnc/chrome/ingame-info.yaml | 7 ------- mods/common/chrome/ingame-info.yaml | 10 ---------- 3 files changed, 32 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs index 00c9d9a13e..f54a5e899f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs @@ -102,29 +102,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic activePanel = type; } - // Handle empty space when tabs aren't displayed var titleText = widget.Get("TITLE"); - var titleTextNoTabs = widget.GetOrNull("TITLE_NO_TABS"); var mapTitle = world.Map.Title; var firstCategory = world.Map.Categories.FirstOrDefault(); if (firstCategory != null) mapTitle = firstCategory + ": " + mapTitle; - titleText.IsVisible = () => numTabs > 1 || (numTabs == 1 && titleTextNoTabs == null); titleText.GetText = () => mapTitle; - if (titleTextNoTabs != null) - { - titleTextNoTabs.IsVisible = () => numTabs == 1; - titleTextNoTabs.GetText = () => mapTitle; - } - - var bg = widget.Get("BACKGROUND"); - var bgNoTabs = widget.GetOrNull("BACKGROUND_NO_TABS"); - - bg.IsVisible = () => numTabs > 1 || (numTabs == 1 && bgNoTabs == null); - if (bgNoTabs != null) - bgNoTabs.IsVisible = () => numTabs == 1; } void SetupObjectivesPanel(ButtonWidget objectivesTabButton, Widget objectivesPanelContainer) diff --git a/mods/cnc/chrome/ingame-info.yaml b/mods/cnc/chrome/ingame-info.yaml index 14b6320180..1c1782bb48 100644 --- a/mods/cnc/chrome/ingame-info.yaml +++ b/mods/cnc/chrome/ingame-info.yaml @@ -13,13 +13,6 @@ Container@GAME_INFO_PANEL: Align: Center Font: BigBold Contrast: true - Label@TITLE_NO_TABS: - Width: PARENT_RIGHT - Y: 18 - Text: Game Information - Align: Center - Font: BigBold - Contrast: true Container@TAB_CONTAINER_2: Visible: False Children: diff --git a/mods/common/chrome/ingame-info.yaml b/mods/common/chrome/ingame-info.yaml index 060dd2b208..211bf9a165 100644 --- a/mods/common/chrome/ingame-info.yaml +++ b/mods/common/chrome/ingame-info.yaml @@ -9,22 +9,12 @@ Container@GAME_INFO_PANEL: Background@BACKGROUND: Width: PARENT_RIGHT Height: PARENT_BOTTOM - Background@BACKGROUND_NO_TABS: - Y: 25 - Width: PARENT_RIGHT - Height: PARENT_BOTTOM - 25 Label@TITLE: Y: 21 Width: PARENT_RIGHT Height: 25 Align: Center Font: Bold - Label@TITLE_NO_TABS: - Y: 46 - Width: PARENT_RIGHT - Height: 25 - Align: Center - Font: Bold Container@TAB_CONTAINER_2: X: (PARENT_RIGHT - WIDTH) / 2 Width: 280