Fix map title not updating after remote query completes.

This commit is contained in:
Paul Chote
2019-02-23 15:21:03 +00:00
committed by abcdefg30
parent fc9169a633
commit f63d0272a7

View File

@@ -235,9 +235,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (mapTitle != null)
{
var font = Game.Renderer.Fonts[mapTitle.Font];
var title = new CachedTransform<MapPreview, string>(m => m == null ? "No Server Selected" :
var title = new CachedTransform<MapPreview, string>(m =>
WidgetUtils.TruncateText(m.Title, mapTitle.Bounds.Width, font));
mapTitle.GetText = () => title.Update(currentMap);
mapTitle.GetText = () =>
{
if (currentMap == null)
return "No Server Selected";
if (currentMap.Status == MapStatus.Searching)
return "Searching...";
if (currentMap.Class == MapClassification.Unknown)
return "Unknown Map";
return title.Update(currentMap);
};
}
var ip = widget.GetOrNull<LabelWidget>("SELECTED_IP");