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").
This commit is contained in:
Ivaylo Draganov
2021-06-22 19:26:40 +03:00
committed by Paul Chote
parent fa0adb5a1b
commit f018fdecdd
3 changed files with 0 additions and 32 deletions

View File

@@ -102,29 +102,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
activePanel = type;
}
// Handle empty space when tabs aren't displayed
var titleText = widget.Get<LabelWidget>("TITLE");
var titleTextNoTabs = widget.GetOrNull<LabelWidget>("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<BackgroundWidget>("BACKGROUND");
var bgNoTabs = widget.GetOrNull<BackgroundWidget>("BACKGROUND_NO_TABS");
bg.IsVisible = () => numTabs > 1 || (numTabs == 1 && bgNoTabs == null);
if (bgNoTabs != null)
bgNoTabs.IsVisible = () => numTabs == 1;
}
void SetupObjectivesPanel(ButtonWidget objectivesTabButton, Widget objectivesPanelContainer)

View File

@@ -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:

View File

@@ -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