Remove dead space when viewing the observer menu stats.

This commit is contained in:
Paul Chote
2016-03-26 20:29:16 +00:00
committed by Oliver Brakmann
parent 2490e4d67e
commit 10738b0c77
4 changed files with 91 additions and 74 deletions

View File

@@ -25,19 +25,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public GameInfoStatsLogic(Widget widget, World world, OrderManager orderManager) public GameInfoStatsLogic(Widget widget, World world, OrderManager orderManager)
{ {
var player = world.RenderPlayer ?? world.LocalPlayer; var player = world.RenderPlayer ?? world.LocalPlayer;
var playerPanel = widget.Get<ScrollPanelWidget>("PLAYER_LIST");
var checkbox = widget.Get<CheckboxWidget>("STATS_CHECKBOX");
var missionLabel = widget.Get<LabelWidget>("MISSION");
var statusLabel = widget.Get<LabelWidget>("STATS_STATUS");
checkbox.IsVisible = () => player != null && !player.NonCombatant;
missionLabel.IsVisible = () => player != null && !player.NonCombatant;
statusLabel.IsVisible = () => player != null && !player.NonCombatant;
if (player != null && !player.NonCombatant) if (player != null && !player.NonCombatant)
{ {
var checkbox = widget.Get<CheckboxWidget>("STATS_CHECKBOX");
var statusLabel = widget.Get<LabelWidget>("STATS_STATUS");
checkbox.IsChecked = () => player.WinState != WinState.Undefined; checkbox.IsChecked = () => player.WinState != WinState.Undefined;
checkbox.GetCheckType = () => player.WinState == WinState.Won ? checkbox.GetCheckType = () => player.WinState == WinState.Won ?
"checked" : "crossed"; "checked" : "crossed";
if (player.HasObjectives) if (player.HasObjectives)
{ {
var mo = player.PlayerActor.Trait<MissionObjectives>(); var mo = player.PlayerActor.Trait<MissionObjectives>();
@@ -49,8 +47,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
statusLabel.GetColor = () => player.WinState == WinState.Won ? Color.LimeGreen : statusLabel.GetColor = () => player.WinState == WinState.Won ? Color.LimeGreen :
player.WinState == WinState.Lost ? Color.Red : Color.White; 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<ScrollPanelWidget>("PLAYER_LIST");
var playerTemplate = playerPanel.Get("PLAYER_TEMPLATE"); var playerTemplate = playerPanel.Get("PLAYER_TEMPLATE");
playerPanel.RemoveChildren(); playerPanel.RemoveChildren();

View File

@@ -3,28 +3,31 @@ Container@SKIRMISH_STATS:
Width: PARENT_RIGHT Width: PARENT_RIGHT
Logic: GameInfoStatsLogic Logic: GameInfoStatsLogic
Children: Children:
Label@STATS_OBJECTIVE: Container@OBJECTIVE:
X: 15 Height: 75
Y: 10 Children:
Width: 85 Label@MISSION:
Height: 25 X: 15
Font: MediumBold Y: 10
Text: Mission: Width: 85
Label@STATS_STATUS: Height: 25
X: 100 Font: MediumBold
Y: 10 Text: Mission:
Width: PARENT_RIGHT - 10 Label@STATS_STATUS:
Height: 25 X: 100
Font: MediumBold Y: 10
Checkbox@STATS_CHECKBOX: Width: PARENT_RIGHT - 10
X: 15 Height: 25
Y: 45 Font: MediumBold
Width: 482 Checkbox@STATS_CHECKBOX:
Height: 20 X: 15
Font: Bold Y: 45
Text: Destroy all opposition! Width: 482
Disabled: yes Height: 20
TextColorDisabled: FFFFFF Font: Bold
Text: Destroy all opposition!
Disabled: yes
TextColorDisabled: FFFFFF
Container@STATS_HEADERS: Container@STATS_HEADERS:
X: 17 X: 17
Y: 80 Y: 80

View File

@@ -3,28 +3,31 @@ Container@SKIRMISH_STATS:
Width: PARENT_RIGHT Width: PARENT_RIGHT
Logic: GameInfoStatsLogic Logic: GameInfoStatsLogic
Children: Children:
Label@MISSION: Container@OBJECTIVE:
X: 20 Height: 75
Y: 20 Children:
Width: 482 Label@MISSION:
Height: 25 X: 20
Font: MediumBold Y: 20
Text: Mission: Width: 482
Label@STATS_STATUS: Height: 25
X: 100 Font: MediumBold
Y: 20 Text: Mission:
Width: PARENT_RIGHT - 10 Label@STATS_STATUS:
Height: 25 X: 100
Font: MediumBold Y: 20
Checkbox@STATS_CHECKBOX: Width: PARENT_RIGHT - 10
X: 20 Height: 25
Y: 55 Font: MediumBold
Width: 482 Checkbox@STATS_CHECKBOX:
Height: 20 X: 20
Font: Bold Y: 55
Text: Destroy all opposition! Width: 482
Disabled: yes Height: 20
TextColorDisabled: FFFFFF Font: Bold
Text: Destroy all opposition!
Disabled: yes
TextColorDisabled: FFFFFF
Container@STATS_HEADERS: Container@STATS_HEADERS:
X: 22 X: 22
Y: 80 Y: 80

View File

@@ -3,28 +3,31 @@ Container@SKIRMISH_STATS:
Width: PARENT_RIGHT Width: PARENT_RIGHT
Logic: GameInfoStatsLogic Logic: GameInfoStatsLogic
Children: Children:
Label@MISSION: Container@OBJECTIVE:
X: 20 Height: 75
Y: 20 Children:
Width: 482 Label@MISSION:
Height: 25 X: 20
Font: MediumBold Y: 20
Text: Mission: Width: 482
Label@STATS_STATUS: Height: 25
X: 100 Font: MediumBold
Y: 20 Text: Mission:
Width: PARENT_RIGHT - 10 Label@STATS_STATUS:
Height: 25 X: 100
Font: MediumBold Y: 20
Checkbox@STATS_CHECKBOX: Width: PARENT_RIGHT - 10
X: 20 Height: 25
Y: 55 Font: MediumBold
Width: 482 Checkbox@STATS_CHECKBOX:
Height: 20 X: 20
Font: Bold Y: 55
Text: Destroy all opposition! Width: 482
Disabled: yes Height: 20
TextColorDisabled: FFFFFF Font: Bold
Text: Destroy all opposition!
Disabled: yes
TextColorDisabled: FFFFFF
Container@STATS_HEADERS: Container@STATS_HEADERS:
X: 22 X: 22
Y: 80 Y: 80