Double clicking a map in the chooser now selects it.
This commit is contained in:
@@ -65,9 +65,10 @@ namespace OpenRA.Widgets
|
||||
return w;
|
||||
}
|
||||
|
||||
public static ScrollItemWidget Setup(string key, ScrollItemWidget template, Func<bool> isSelected, Action onClick)
|
||||
public static ScrollItemWidget Setup(string key, ScrollItemWidget template, Func<bool> isSelected, Action onClick, Action onDoubleClick)
|
||||
{
|
||||
var w = Setup(template, isSelected, onClick);
|
||||
w.OnDoubleClick = onDoubleClick;
|
||||
w.ItemKey = key;
|
||||
return w;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(template,
|
||||
() => gameMode == ii.First,
|
||||
() => { gameMode = ii.First; EnumerateMaps(); });
|
||||
() => { gameMode = ii.First; EnumerateMaps(onSelect); });
|
||||
item.Get<LabelWidget>("LABEL").GetText = () => showItem(ii);
|
||||
return item;
|
||||
};
|
||||
@@ -83,10 +83,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
randomMapButton.IsDisabled = () => visibleMaps == null || visibleMaps.Count == 0;
|
||||
}
|
||||
|
||||
EnumerateMaps();
|
||||
EnumerateMaps(onSelect);
|
||||
}
|
||||
|
||||
void EnumerateMaps()
|
||||
void EnumerateMaps(Action<Map> onSelect)
|
||||
{
|
||||
var maps = Game.modData.AvailableMaps
|
||||
.Where(kv => kv.Value.Selectable)
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
foreach (var kv in maps)
|
||||
{
|
||||
var m = kv.Value;
|
||||
var item = ScrollItemWidget.Setup(kv.Key, itemTemplate, () => m == map, () => map = m);
|
||||
var item = ScrollItemWidget.Setup(kv.Key, itemTemplate, () => m == map, () => map = m, () => { Ui.CloseWindow(); onSelect(m); });
|
||||
|
||||
var titleLabel = item.Get<LabelWidget>("TITLE");
|
||||
titleLabel.GetText = () => m.Title;
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
currentSong = song;
|
||||
|
||||
// TODO: We leak the currentSong MusicInfo across map load, so compare the Filename instead.
|
||||
var item = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong.Filename == song.Filename, () => { currentSong = song; Play(); });
|
||||
var item = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong.Filename == song.Filename, () => { currentSong = song; Play(); }, () => {});
|
||||
item.Get<LabelWidget>("TITLE").GetText = () => song.Title;
|
||||
item.Get<LabelWidget>("LENGTH").GetText = () => SongLengthLabel(song);
|
||||
musicList.AddChild(item);
|
||||
|
||||
Reference in New Issue
Block a user