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)
{
var player = world.RenderPlayer ?? world.LocalPlayer;
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;
var playerPanel = widget.Get<ScrollPanelWidget>("PLAYER_LIST");
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.GetCheckType = () => player.WinState == WinState.Won ?
"checked" : "crossed";
if (player.HasObjectives)
{
var mo = player.PlayerActor.Trait<MissionObjectives>();
@@ -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<ScrollPanelWidget>("PLAYER_LIST");
var playerTemplate = playerPanel.Get("PLAYER_TEMPLATE");
playerPanel.RemoveChildren();

View File

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

View File

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

View File

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