#438. Show # Players in the map selector.

This commit is contained in:
Paul Chote
2011-01-04 10:50:50 +13:00
parent 6e7156e023
commit 6287b132a0
3 changed files with 34 additions and 9 deletions

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
}; };
var itemTemplate = ml.GetWidget<ContainerWidget>("MAP_TEMPLATE"); var itemTemplate = ml.GetWidget<ContainerWidget>("MAP_TEMPLATE");
foreach (var kv in Game.modData.AvailableMaps.OrderBy(kv => kv.Value.Title)) foreach (var kv in Game.modData.AvailableMaps.OrderBy(kv => kv.Value.Title).OrderBy(kv => kv.Value.PlayerCount))
{ {
var map = kv.Value; var map = kv.Value;
if (!map.Selectable) if (!map.Selectable)
@@ -66,8 +66,9 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
template.GetBackground = () => ((Map == map) ? "dialog2" : null); template.GetBackground = () => ((Map == map) ? "dialog2" : null);
template.OnMouseDown = mi => { if (mi.Button != MouseButton.Left) return false; Map = map; return true; }; template.OnMouseDown = mi => { if (mi.Button != MouseButton.Left) return false; Map = map; return true; };
template.IsVisible = () => true; template.IsVisible = () => true;
template.GetWidget<LabelWidget>("TITLE").GetText = () => " " + map.Title; template.GetWidget<LabelWidget>("TITLE").GetText = () => map.Title;
template.GetWidget<LabelWidget>("TYPE").GetText = () => map.Type + " "; template.GetWidget<LabelWidget>("PLAYERS").GetText = () => "{0}".F(map.PlayerCount);
template.GetWidget<LabelWidget>("TYPE").GetText = () => map.Type;
ml.AddChild(template); ml.AddChild(template);
} }
} }

View File

@@ -453,12 +453,18 @@ Background@MAP_CHOOSER:
Visible:false Visible:false
Children: Children:
Label@TITLE: Label@TITLE:
X:10
Id:TITLE Id:TITLE
Width:PARENT_RIGHT-100 Width:PARENT_RIGHT-100
Height:25 Height:25
Label@PLAYERS:
Id:PLAYERS
X:PARENT_RIGHT-150
Width:30
Height:25
Label@TYPE: Label@TYPE:
Id:TYPE Id:TYPE
Width:100 Width:90
X:PARENT_RIGHT-100 X:PARENT_RIGHT-100
Align:Right Align:Right
Height:25 Height:25
@@ -469,18 +475,24 @@ Background@MAP_CHOOSER:
Y:40 Y:40
Children: Children:
Label@TITLE: Label@TITLE:
Width:150 Width:125
Height:25 Height:25
X:0 X:0
Y:0 Y:0
Text:Title Text:Title
Align:Center Align:Center
Bold:True Bold:True
Label@PLAYERS:
Text:Players
Bold:true
Width:50
X:304
Height:25
Label@TYPE: Label@TYPE:
Text:Type Text:Type
Bold:true Bold:true
Width:50 Width:50
X:415 X:420
Height:25 Height:25
Background@MAPCHOOSER_MAP_BG: Background@MAPCHOOSER_MAP_BG:
X:PARENT_RIGHT-268 X:PARENT_RIGHT-268

View File

@@ -453,12 +453,18 @@ Background@MAP_CHOOSER:
Visible:false Visible:false
Children: Children:
Label@TITLE: Label@TITLE:
X:10
Id:TITLE Id:TITLE
Width:PARENT_RIGHT-100 Width:PARENT_RIGHT-100
Height:25 Height:25
Label@PLAYERS:
Id:PLAYERS
X:PARENT_RIGHT-150
Width:30
Height:25
Label@TYPE: Label@TYPE:
Id:TYPE Id:TYPE
Width:100 Width:90
X:PARENT_RIGHT-100 X:PARENT_RIGHT-100
Align:Right Align:Right
Height:25 Height:25
@@ -469,18 +475,24 @@ Background@MAP_CHOOSER:
Y:40 Y:40
Children: Children:
Label@TITLE: Label@TITLE:
Width:150 Width:125
Height:25 Height:25
X:0 X:0
Y:0 Y:0
Text:Title Text:Title
Align:Center Align:Center
Bold:True Bold:True
Label@PLAYERS:
Text:Players
Bold:true
Width:50
X:304
Height:25
Label@TYPE: Label@TYPE:
Text:Type Text:Type
Bold:true Bold:true
Width:50 Width:50
X:415 X:420
Height:25 Height:25
Background@MAPCHOOSER_MAP_BG: Background@MAPCHOOSER_MAP_BG:
X:PARENT_RIGHT-268 X:PARENT_RIGHT-268