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 = () => "";
|
public Func<string> GetTooltipText = () => "";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public LabelWithTooltipWidget(World world)
|
public LabelWithTooltipWidget()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
tooltipContainer = Exts.Lazy(() =>
|
tooltipContainer = Exts.Lazy(() =>
|
||||||
|
|||||||
@@ -36,12 +36,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
preview.OnMouseDown = mi => LobbyUtils.SelectSpawnPoint(orderManager, preview, lobby.Map, mi);
|
preview.OnMouseDown = mi => LobbyUtils.SelectSpawnPoint(orderManager, preview, lobby.Map, mi);
|
||||||
preview.SpawnOccupants = () => LobbyUtils.GetSpawnOccupants(orderManager.LobbyInfo, lobby.Map);
|
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)
|
if (titleLabel != null)
|
||||||
{
|
{
|
||||||
var font = Game.Renderer.Fonts[titleLabel.Font];
|
var font = Game.Renderer.Fonts[titleLabel.Font];
|
||||||
var title = new CachedTransform<MapPreview, string>(m => WidgetUtils.TruncateText(m.Title, titleLabel.Bounds.Width, font));
|
var title = new CachedTransform<MapPreview, string>(m => WidgetUtils.TruncateText(m.Title, titleLabel.Bounds.Width, font));
|
||||||
titleLabel.GetText = () => title.Update(lobby.Map);
|
titleLabel.GetText = () => title.Update(lobby.Map);
|
||||||
|
titleLabel.GetTooltipText = () => lobby.Map.Title;
|
||||||
}
|
}
|
||||||
|
|
||||||
var typeLabel = available.GetOrNull<LabelWidget>("MAP_TYPE");
|
var typeLabel = available.GetOrNull<LabelWidget>("MAP_TYPE");
|
||||||
|
|||||||
@@ -18,18 +18,21 @@ Container@LOBBY_MAP_PREVIEW:
|
|||||||
Width: PARENT_RIGHT-2
|
Width: PARENT_RIGHT-2
|
||||||
Height: PARENT_BOTTOM-2
|
Height: PARENT_BOTTOM-2
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Label@MAP_TITLE:
|
LabelWithTooltip@MAP_TITLE:
|
||||||
Y: 172
|
Y: 172
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Center
|
Align: Center
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@MAP_TYPE:
|
Label@MAP_TYPE:
|
||||||
Y: 187
|
Y: 187
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
Align: Center
|
Align: Center
|
||||||
|
IgnoreMouseOver: true
|
||||||
Label@MAP_AUTHOR:
|
Label@MAP_AUTHOR:
|
||||||
Y: 200
|
Y: 200
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
@@ -18,18 +18,21 @@ Container@LOBBY_MAP_PREVIEW:
|
|||||||
Width: PARENT_RIGHT-2
|
Width: PARENT_RIGHT-2
|
||||||
Height: PARENT_BOTTOM-2
|
Height: PARENT_BOTTOM-2
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Label@MAP_TITLE:
|
LabelWithTooltip@MAP_TITLE:
|
||||||
Y: 172
|
Y: 172
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Center
|
Align: Center
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@MAP_TYPE:
|
Label@MAP_TYPE:
|
||||||
Y: 187
|
Y: 187
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
Align: Center
|
Align: Center
|
||||||
|
IgnoreMouseOver: true
|
||||||
Label@MAP_AUTHOR:
|
Label@MAP_AUTHOR:
|
||||||
Y: 200
|
Y: 200
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
Reference in New Issue
Block a user