Merge pull request #13005 from rob-v/LobbyMapTooltips
Added tooltip to Lobby Map title #12930 #12595
This commit is contained in:
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public Func<string> GetTooltipText = () => "";
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public LabelWithTooltipWidget(World world)
|
||||
public LabelWithTooltipWidget()
|
||||
: base()
|
||||
{
|
||||
tooltipContainer = Exts.Lazy(() =>
|
||||
|
||||
@@ -36,12 +36,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
preview.OnMouseDown = mi => LobbyUtils.SelectSpawnPoint(orderManager, preview, lobby.Map, mi);
|
||||
preview.SpawnOccupants = () => LobbyUtils.GetSpawnOccupants(orderManager.LobbyInfo, lobby.Map);
|
||||
|
||||
var titleLabel = available.GetOrNull<LabelWidget>("MAP_TITLE");
|
||||
var titleLabel = available.GetOrNull<LabelWithTooltipWidget>("MAP_TITLE");
|
||||
if (titleLabel != 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(lobby.Map);
|
||||
titleLabel.GetTooltipText = () => lobby.Map.Title;
|
||||
}
|
||||
|
||||
var typeLabel = available.GetOrNull<LabelWidget>("MAP_TYPE");
|
||||
|
||||
@@ -18,18 +18,21 @@ Container@LOBBY_MAP_PREVIEW:
|
||||
Width: PARENT_RIGHT-2
|
||||
Height: PARENT_BOTTOM-2
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
Label@MAP_TITLE:
|
||||
LabelWithTooltip@MAP_TITLE:
|
||||
Y: 172
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Font: Bold
|
||||
Align: Center
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@MAP_TYPE:
|
||||
Y: 187
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Font: TinyBold
|
||||
Align: Center
|
||||
IgnoreMouseOver: true
|
||||
Label@MAP_AUTHOR:
|
||||
Y: 200
|
||||
Width: PARENT_RIGHT
|
||||
|
||||
@@ -18,18 +18,21 @@ Container@LOBBY_MAP_PREVIEW:
|
||||
Width: PARENT_RIGHT-2
|
||||
Height: PARENT_BOTTOM-2
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
Label@MAP_TITLE:
|
||||
LabelWithTooltip@MAP_TITLE:
|
||||
Y: 172
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Font: Bold
|
||||
Align: Center
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@MAP_TYPE:
|
||||
Y: 187
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Font: TinyBold
|
||||
Align: Center
|
||||
IgnoreMouseOver: true
|
||||
Label@MAP_AUTHOR:
|
||||
Y: 200
|
||||
Width: PARENT_RIGHT
|
||||
|
||||
Reference in New Issue
Block a user