grid layout mapchooser in cnc too

This commit is contained in:
Chris Forbes
2011-10-09 11:12:57 +13:00
parent d6f4b61b1c
commit 57308773a2
2 changed files with 35 additions and 192 deletions

View File

@@ -30,21 +30,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{
map = Game.modData.AvailableMaps[WidgetUtils.ChooseInitialMap(initialMap)];
var mapPreview = widget.GetWidget<MapPreviewWidget>("MAP_PREVIEW");
if (mapPreview != null)
mapPreview.Map = () => map;
if (WidgetUtils.ActiveModTitle() != "Red Alert") // hack
{
widget.GetWidget<LabelWidget>("CURMAP_TITLE").GetText = () => map.Title;
widget.GetWidget<LabelWidget>("CURMAP_AUTHOR").GetText = () => map.Author;
widget.GetWidget<LabelWidget>("CURMAP_DESC").GetText = () => map.Description;
widget.GetWidget<LabelWidget>("CURMAP_DESC_LABEL").IsVisible = () => map.Description != null;
widget.GetWidget<LabelWidget>("CURMAP_SIZE").GetText = () => "{0}x{1}".F(map.Bounds.Width, map.Bounds.Height);
widget.GetWidget<LabelWidget>("CURMAP_THEATER").GetText = () => Rules.TileSets[map.Tileset].Name;
widget.GetWidget<LabelWidget>("CURMAP_PLAYERS").GetText = () => map.PlayerCount.ToString();
}
widget.GetWidget<ButtonWidget>("BUTTON_OK").OnClick = () => { Widget.CloseWindow(); onSelect(map); };
widget.GetWidget<ButtonWidget>("BUTTON_CANCEL").OnClick = () => { Widget.CloseWindow(); onExit(); };
@@ -86,11 +71,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
void EnumerateMaps()
{
scrollpanel.RemoveChildren();
// hack for RA's new 2d mapchooser
if (WidgetUtils.ActiveModTitle() == "Red Alert")
scrollpanel.Layout = new GridLayout(scrollpanel);
scrollpanel.Layout = new GridLayout(scrollpanel);
scrollpanel.ScrollToTop();
var maps = Game.modData.AvailableMaps
@@ -107,21 +88,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var titleLabel = item.GetWidget<LabelWidget>("TITLE");
titleLabel.GetText = () => m.Title;
var playersLabel = item.GetWidget<LabelWidget>("PLAYERS");
if (playersLabel != null)
playersLabel.GetText = () => "{0}".F(m.PlayerCount);
var previewWidget = item.GetWidget<MapPreviewWidget>("PREVIEW");
if (previewWidget != null)
{
previewWidget.IgnoreMouseOver = true;
previewWidget.IgnoreMouseInput = true;
previewWidget.Map = () => m;
}
var typeWidget = item.GetWidget<LabelWidget>("TYPE");
if (typeWidget != null)
typeWidget.GetText = () => m.Type;
previewWidget.IgnoreMouseOver = true;
previewWidget.IgnoreMouseInput = true;
previewWidget.Map = () => m;
var detailsWidget = item.GetWidget<LabelWidget>("DETAILS");
if (detailsWidget != null)

View File

@@ -7,188 +7,61 @@ Container@MAPCHOOSER_PANEL:
Height:535
Children:
Label@TITLE:
Width:740
Width:790
Y:0-25
Font:BigBold
Contrast:true
Align:Center
Text: Select Map
Background@bg:
Width:740
Width:790
Height:500
Background:panel-black
Children:
Background@MAP_BG:
X:PARENT_RIGHT-15-WIDTH
Y:30
Width:194
Height:194
Background:panel-gray
Children:
MapPreview@MAP_PREVIEW:
Id:MAP_PREVIEW
X:1
Y:1
Width:192
Height:192
ScrollPanel@MAP_LIST:
Id:MAP_LIST
X:15
Y:30
Width:504
Width:PARENT_RIGHT - 30
Height:455
Children:
ScrollItem@MAP_TEMPLATE:
Id:MAP_TEMPLATE
Width:PARENT_RIGHT-27
Height:25
Width:180
Height:208
X:2
Y:0
Visible:false
Children:
Label@TITLE:
X:10
X:2
Y:PARENT_BOTTOM-47
Id:TITLE
Width:PARENT_RIGHT-100
Width:PARENT_RIGHT-4
Height:25
Label@PLAYERS:
Id:PLAYERS
X:PARENT_RIGHT-150
Width:30
Align:Center
Label@DETAILS:
Id:DETAILS
Width:PARENT_RIGHT-4
X:2
Y:PARENT_BOTTOM-35
Align:Center
Height:25
Label@TYPE:
Id:TYPE
Width:90
X:PARENT_RIGHT-100
Align:Right
Font:Tiny
Label@AUTHOR:
Id:AUTHOR
Width:PARENT_RIGHT-4
X:2
Y:PARENT_BOTTOM-26
Align:Center
Height:25
Container@LABEL_CONTAINER:
X:25
Y:5
Children:
Label@TITLE:
Width:125
Height:25
X:0
Y:0
Text:Title
Align:Center
Font:Bold
Label@PLAYERS:
Text:Players
Font:Bold
Width:50
X:294
Height:25
Label@TYPE:
Text:Type
Font:Bold
Width:50
X:410
Height:25
Container@MAP_LABEL_CONTAINER:
X:PARENT_RIGHT-15-WIDTH-10
Y:232
Width:192
Height:200
Children:
Label@CURMAP_TITLE_LABEL:
Id:CURMAP_TITLE_LABEL
X:0
Y:0
Align:Right
Width:70
Height:20
Text:Title:
Font:Bold
Label@CURMAP_TITLE:
Id:CURMAP_TITLE
X:75
Y:0
Align:Left
Width:70
Height:20
Label@CURMAP_AUTHOR_LABEL:
Id:CURMAP_AUTHOR_LABEL
X:0
Y:20
Align:Right
Width:70
Height:20
Text:Author:
Font:Bold
Label@CURMAP_AUTHOR:
Id:CURMAP_AUTHOR
X:75
Y:20
Align:Left
Width:175
Height:20
WordWrap:True
Label@CURMAP_SIZE_LABEL:
Id:CURMAP_SIZE_LABEL
X:0
Y:40
Align:Right
Width:70
Height:20
Text:Size:
Font:Bold
Label@CURMAP_SIZE:
Id:CURMAP_SIZE
X:75
Y:40
Align:Left
Width:70
Height:20
Label@CURMAP_THEATER_LABEL:
Id:CURMAP_THEATER_LABEL
X:0
Y:60
Align:Right
Width:70
Height:20
Text:Theater:
Font:Bold
Label@CURMAP_THEATER:
Id:CURMAP_THEATER
X:75
Y:60
Align:Left
Width:70
Height:20
Label@CURMAP_PLAYERS_LABEL:
Id:CURMAP_PLAYERS_LABEL
X:0
Y:80
Align:Right
Width:70
Height:20
Text:Players:
Font:Bold
Label@CURMAP_PLAYERS:
Id:CURMAP_PLAYERS
X:75
Y:80
Align:Left
Width:70
Height:20
Label@CURMAP_DESC_LABEL:
Id:CURMAP_DESC_LABEL
X:0
Y:100
Align:Right
Width:70
Height:20
Text:Desc:
Font:Bold
Label@CURMAP_DESC:
Id:CURMAP_DESC
X:75
Y:100
Align:Left
Width:117
Height:20
WordWrap:True
Font:Tiny
MapPreview@PREVIEW:
Id:PREVIEW
X:(PARENT_RIGHT - WIDTH)/2
Y:4
Width:160
Height:160
Button@BUTTON_CANCEL:
Id:BUTTON_CANCEL
Key:escape
@@ -200,7 +73,7 @@ Container@MAPCHOOSER_PANEL:
Button@BUTTON_OK:
Id:BUTTON_OK
Key:return
X:600
X:790 - WIDTH
Y:499
Width:140
Height:35