Truncate long map name in replay browser.
This commit is contained in:
@@ -71,9 +71,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
preview.SpawnOccupants = () => selectedSpawns;
|
preview.SpawnOccupants = () => selectedSpawns;
|
||||||
preview.Preview = () => selectedReplay != null ? selectedReplay.GameInfo.MapPreview : null;
|
preview.Preview = () => selectedReplay != null ? selectedReplay.GameInfo.MapPreview : null;
|
||||||
|
|
||||||
var title = panel.GetOrNull<LabelWidget>("MAP_TITLE");
|
var titleLabel = panel.GetOrNull<LabelWidget>("MAP_TITLE");
|
||||||
if (title != null)
|
if (titleLabel != null)
|
||||||
title.GetText = () => selectedReplay != null ? selectedReplay.GameInfo.MapPreview.Title : null;
|
{
|
||||||
|
titleLabel.IsVisible = () => selectedReplay != null;
|
||||||
|
|
||||||
|
var font = Game.Renderer.Fonts[titleLabel.Font];
|
||||||
|
var title = new CachedTransform<MapPreview, string>(m => WidgetUtils.TruncateText(m.Title, titleLabel.Bounds.Width, font));
|
||||||
|
titleLabel.GetText = () => title.Update(selectedReplay.GameInfo.MapPreview);
|
||||||
|
}
|
||||||
|
|
||||||
var type = panel.GetOrNull<LabelWidget>("MAP_TYPE");
|
var type = panel.GetOrNull<LabelWidget>("MAP_TYPE");
|
||||||
if (type != null)
|
if (type != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user