From 10738b0c7715766f1dd7cc251845e532c99f458d Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 26 Mar 2016 20:29:16 +0000 Subject: [PATCH] Remove dead space when viewing the observer menu stats. --- .../Logic/Ingame/GameInfoStatsLogic.cs | 24 ++++++---- mods/cnc/chrome/ingame-infostats.yaml | 47 ++++++++++--------- mods/d2k/chrome/ingame-infostats.yaml | 47 ++++++++++--------- mods/ra/chrome/ingame-infostats.yaml | 47 ++++++++++--------- 4 files changed, 91 insertions(+), 74 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs index e2b75f947b..c30f475fbe 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs @@ -25,19 +25,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic public GameInfoStatsLogic(Widget widget, World world, OrderManager orderManager) { var player = world.RenderPlayer ?? world.LocalPlayer; - - var checkbox = widget.Get("STATS_CHECKBOX"); - var missionLabel = widget.Get("MISSION"); - var statusLabel = widget.Get("STATS_STATUS"); - checkbox.IsVisible = () => player != null && !player.NonCombatant; - missionLabel.IsVisible = () => player != null && !player.NonCombatant; - statusLabel.IsVisible = () => player != null && !player.NonCombatant; + var playerPanel = widget.Get("PLAYER_LIST"); if (player != null && !player.NonCombatant) { + var checkbox = widget.Get("STATS_CHECKBOX"); + var statusLabel = widget.Get("STATS_STATUS"); + checkbox.IsChecked = () => player.WinState != WinState.Undefined; checkbox.GetCheckType = () => player.WinState == WinState.Won ? "checked" : "crossed"; + if (player.HasObjectives) { var mo = player.PlayerActor.Trait(); @@ -49,8 +47,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic statusLabel.GetColor = () => player.WinState == WinState.Won ? Color.LimeGreen : player.WinState == WinState.Lost ? Color.Red : Color.White; } + else + { + // Expand the stats window to cover the hidden objectives + var objectiveGroup = widget.Get("OBJECTIVE"); + var statsHeader = widget.Get("STATS_HEADERS"); + + objectiveGroup.Visible = false; + statsHeader.Bounds.Y -= objectiveGroup.Bounds.Height; + playerPanel.Bounds.Y -= objectiveGroup.Bounds.Height; + playerPanel.Bounds.Height += objectiveGroup.Bounds.Height; + } - var playerPanel = widget.Get("PLAYER_LIST"); var playerTemplate = playerPanel.Get("PLAYER_TEMPLATE"); playerPanel.RemoveChildren(); diff --git a/mods/cnc/chrome/ingame-infostats.yaml b/mods/cnc/chrome/ingame-infostats.yaml index a5d9871d80..8815d31a7e 100644 --- a/mods/cnc/chrome/ingame-infostats.yaml +++ b/mods/cnc/chrome/ingame-infostats.yaml @@ -3,28 +3,31 @@ Container@SKIRMISH_STATS: Width: PARENT_RIGHT Logic: GameInfoStatsLogic Children: - Label@STATS_OBJECTIVE: - X: 15 - Y: 10 - Width: 85 - Height: 25 - Font: MediumBold - Text: Mission: - Label@STATS_STATUS: - X: 100 - Y: 10 - Width: PARENT_RIGHT - 10 - Height: 25 - Font: MediumBold - Checkbox@STATS_CHECKBOX: - X: 15 - Y: 45 - Width: 482 - Height: 20 - Font: Bold - Text: Destroy all opposition! - Disabled: yes - TextColorDisabled: FFFFFF + Container@OBJECTIVE: + Height: 75 + Children: + Label@MISSION: + X: 15 + Y: 10 + Width: 85 + Height: 25 + Font: MediumBold + Text: Mission: + Label@STATS_STATUS: + X: 100 + Y: 10 + Width: PARENT_RIGHT - 10 + Height: 25 + Font: MediumBold + Checkbox@STATS_CHECKBOX: + X: 15 + Y: 45 + Width: 482 + Height: 20 + Font: Bold + Text: Destroy all opposition! + Disabled: yes + TextColorDisabled: FFFFFF Container@STATS_HEADERS: X: 17 Y: 80 diff --git a/mods/d2k/chrome/ingame-infostats.yaml b/mods/d2k/chrome/ingame-infostats.yaml index 78e6b7675e..46b29dd0c9 100644 --- a/mods/d2k/chrome/ingame-infostats.yaml +++ b/mods/d2k/chrome/ingame-infostats.yaml @@ -3,28 +3,31 @@ Container@SKIRMISH_STATS: Width: PARENT_RIGHT Logic: GameInfoStatsLogic Children: - Label@MISSION: - X: 20 - Y: 20 - Width: 482 - Height: 25 - Font: MediumBold - Text: Mission: - Label@STATS_STATUS: - X: 100 - Y: 20 - Width: PARENT_RIGHT - 10 - Height: 25 - Font: MediumBold - Checkbox@STATS_CHECKBOX: - X: 20 - Y: 55 - Width: 482 - Height: 20 - Font: Bold - Text: Destroy all opposition! - Disabled: yes - TextColorDisabled: FFFFFF + Container@OBJECTIVE: + Height: 75 + Children: + Label@MISSION: + X: 20 + Y: 20 + Width: 482 + Height: 25 + Font: MediumBold + Text: Mission: + Label@STATS_STATUS: + X: 100 + Y: 20 + Width: PARENT_RIGHT - 10 + Height: 25 + Font: MediumBold + Checkbox@STATS_CHECKBOX: + X: 20 + Y: 55 + Width: 482 + Height: 20 + Font: Bold + Text: Destroy all opposition! + Disabled: yes + TextColorDisabled: FFFFFF Container@STATS_HEADERS: X: 22 Y: 80 diff --git a/mods/ra/chrome/ingame-infostats.yaml b/mods/ra/chrome/ingame-infostats.yaml index 41236b2e49..9a48a61985 100644 --- a/mods/ra/chrome/ingame-infostats.yaml +++ b/mods/ra/chrome/ingame-infostats.yaml @@ -3,28 +3,31 @@ Container@SKIRMISH_STATS: Width: PARENT_RIGHT Logic: GameInfoStatsLogic Children: - Label@MISSION: - X: 20 - Y: 20 - Width: 482 - Height: 25 - Font: MediumBold - Text: Mission: - Label@STATS_STATUS: - X: 100 - Y: 20 - Width: PARENT_RIGHT - 10 - Height: 25 - Font: MediumBold - Checkbox@STATS_CHECKBOX: - X: 20 - Y: 55 - Width: 482 - Height: 20 - Font: Bold - Text: Destroy all opposition! - Disabled: yes - TextColorDisabled: FFFFFF + Container@OBJECTIVE: + Height: 75 + Children: + Label@MISSION: + X: 20 + Y: 20 + Width: 482 + Height: 25 + Font: MediumBold + Text: Mission: + Label@STATS_STATUS: + X: 100 + Y: 20 + Width: PARENT_RIGHT - 10 + Height: 25 + Font: MediumBold + Checkbox@STATS_CHECKBOX: + X: 20 + Y: 55 + Width: 482 + Height: 20 + Font: Bold + Text: Destroy all opposition! + Disabled: yes + TextColorDisabled: FFFFFF Container@STATS_HEADERS: X: 22 Y: 80