Add tooltips to map name and author in map chooser
This commit is contained in:
committed by
abcdefg30
parent
453d59ae16
commit
7a1169744e
@@ -253,12 +253,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
() => selectedUid = preview.Uid, dblClick);
|
() => selectedUid = preview.Uid, dblClick);
|
||||||
item.IsVisible = () => item.RenderBounds.IntersectsWith(scrollpanels[tab].RenderBounds);
|
item.IsVisible = () => item.RenderBounds.IntersectsWith(scrollpanels[tab].RenderBounds);
|
||||||
|
|
||||||
var titleLabel = item.Get<LabelWidget>("TITLE");
|
var titleLabel = item.Get<LabelWithTooltipWidget>("TITLE");
|
||||||
if (titleLabel != null)
|
if (titleLabel != null)
|
||||||
{
|
{
|
||||||
var font = Game.Renderer.Fonts[titleLabel.Font];
|
WidgetUtils.TruncateLabelToTooltip(titleLabel, preview.Title);
|
||||||
var title = WidgetUtils.TruncateText(preview.Title, titleLabel.Bounds.Width, font);
|
|
||||||
titleLabel.GetText = () => title;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var previewWidget = item.Get<MapPreviewWidget>("PREVIEW");
|
var previewWidget = item.Get<MapPreviewWidget>("PREVIEW");
|
||||||
@@ -276,12 +274,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
detailsWidget.GetText = () => details;
|
detailsWidget.GetText = () => details;
|
||||||
}
|
}
|
||||||
|
|
||||||
var authorWidget = item.GetOrNull<LabelWidget>("AUTHOR");
|
var authorWidget = item.GetOrNull<LabelWithTooltipWidget>("AUTHOR");
|
||||||
if (authorWidget != null)
|
if (authorWidget != null)
|
||||||
{
|
{
|
||||||
var font = Game.Renderer.Fonts[authorWidget.Font];
|
WidgetUtils.TruncateLabelToTooltip(authorWidget, $"Created by {preview.Author}");
|
||||||
var author = WidgetUtils.TruncateText($"Created by {preview.Author}", authorWidget.Bounds.Width, font);
|
|
||||||
authorWidget.GetText = () => author;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var sizeWidget = item.GetOrNull<LabelWidget>("SIZE");
|
var sizeWidget = item.GetOrNull<LabelWidget>("SIZE");
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ Container@MAPCHOOSER_PANEL:
|
|||||||
Height: 262
|
Height: 262
|
||||||
X: 1
|
X: 1
|
||||||
Visible: false
|
Visible: false
|
||||||
|
EnableChildMouseOver: True
|
||||||
Children:
|
Children:
|
||||||
MapPreview@PREVIEW:
|
MapPreview@PREVIEW:
|
||||||
X: (PARENT_RIGHT - WIDTH) / 2
|
X: (PARENT_RIGHT - WIDTH) / 2
|
||||||
@@ -88,27 +89,35 @@ Container@MAPCHOOSER_PANEL:
|
|||||||
Height: 204
|
Height: 204
|
||||||
IgnoreMouseOver: true
|
IgnoreMouseOver: true
|
||||||
IgnoreMouseInput: true
|
IgnoreMouseInput: true
|
||||||
Label@TITLE:
|
LabelWithTooltip@TITLE:
|
||||||
X: 4
|
X: 4
|
||||||
Y: PARENT_BOTTOM - 46
|
Y: PARENT_BOTTOM - HEIGHT - 33
|
||||||
Width: PARENT_RIGHT - 8
|
Width: PARENT_RIGHT - 8
|
||||||
|
Height: 24
|
||||||
Align: Center
|
Align: Center
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@DETAILS:
|
Label@DETAILS:
|
||||||
Width: PARENT_RIGHT - 8
|
Width: PARENT_RIGHT - 8
|
||||||
|
Height: 12
|
||||||
X: 4
|
X: 4
|
||||||
Y: PARENT_BOTTOM - 32
|
Y: PARENT_BOTTOM - HEIGHT - 26
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Tiny
|
Font: Tiny
|
||||||
Label@AUTHOR:
|
LabelWithTooltip@AUTHOR:
|
||||||
Width: PARENT_RIGHT - 8
|
Width: PARENT_RIGHT - 8
|
||||||
|
Height: 12
|
||||||
X: 4
|
X: 4
|
||||||
Y: PARENT_BOTTOM - 20
|
Y: PARENT_BOTTOM - HEIGHT - 14
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Tiny
|
Font: Tiny
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@SIZE:
|
Label@SIZE:
|
||||||
Width: PARENT_RIGHT - 8
|
Width: PARENT_RIGHT - 8
|
||||||
|
Height: 12
|
||||||
X: 4
|
X: 4
|
||||||
Y: PARENT_BOTTOM - 8
|
Y: PARENT_BOTTOM - HEIGHT - 2
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Tiny
|
Font: Tiny
|
||||||
Button@BUTTON_CANCEL:
|
Button@BUTTON_CANCEL:
|
||||||
@@ -143,3 +152,4 @@ Container@MAPCHOOSER_PANEL:
|
|||||||
Width: 140
|
Width: 140
|
||||||
Height: 35
|
Height: 35
|
||||||
Text: Ok
|
Text: Ok
|
||||||
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ Background@MAPCHOOSER_PANEL:
|
|||||||
Height: 266
|
Height: 266
|
||||||
X: 2
|
X: 2
|
||||||
Visible: false
|
Visible: false
|
||||||
|
EnableChildMouseOver: True
|
||||||
Children:
|
Children:
|
||||||
MapPreview@PREVIEW:
|
MapPreview@PREVIEW:
|
||||||
X: (PARENT_RIGHT - WIDTH) / 2
|
X: (PARENT_RIGHT - WIDTH) / 2
|
||||||
@@ -59,27 +60,35 @@ Background@MAPCHOOSER_PANEL:
|
|||||||
Height: 202
|
Height: 202
|
||||||
IgnoreMouseOver: true
|
IgnoreMouseOver: true
|
||||||
IgnoreMouseInput: true
|
IgnoreMouseInput: true
|
||||||
Label@TITLE:
|
LabelWithTooltip@TITLE:
|
||||||
X: 4
|
X: 4
|
||||||
Y: PARENT_BOTTOM - 52
|
Y: PARENT_BOTTOM - HEIGHT - 39
|
||||||
Width: PARENT_RIGHT - 8
|
Width: PARENT_RIGHT - 8
|
||||||
|
Height: 24
|
||||||
Align: Center
|
Align: Center
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@DETAILS:
|
Label@DETAILS:
|
||||||
Width: PARENT_RIGHT - 8
|
Width: PARENT_RIGHT - 8
|
||||||
|
Height: 12
|
||||||
X: 4
|
X: 4
|
||||||
Y: PARENT_BOTTOM - 36
|
Y: PARENT_BOTTOM - HEIGHT - 30
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Tiny
|
Font: Tiny
|
||||||
Label@AUTHOR:
|
LabelWithTooltip@AUTHOR:
|
||||||
Width: PARENT_RIGHT - 8
|
Width: PARENT_RIGHT - 8
|
||||||
|
Height: 12
|
||||||
X: 4
|
X: 4
|
||||||
Y: PARENT_BOTTOM - 24
|
Y: PARENT_BOTTOM - HEIGHT - 18
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Tiny
|
Font: Tiny
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@SIZE:
|
Label@SIZE:
|
||||||
Width: PARENT_RIGHT - 8
|
Width: PARENT_RIGHT - 8
|
||||||
|
Height: 12
|
||||||
X: 4
|
X: 4
|
||||||
Y: PARENT_BOTTOM - 12
|
Y: PARENT_BOTTOM - HEIGHT - 6
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Tiny
|
Font: Tiny
|
||||||
Label@FILTER_DESC:
|
Label@FILTER_DESC:
|
||||||
@@ -145,3 +154,4 @@ Background@MAPCHOOSER_PANEL:
|
|||||||
Text: Back
|
Text: Back
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Key: escape
|
Key: escape
|
||||||
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
|
|||||||
Reference in New Issue
Block a user