Merge pull request #9715 from teees/mouseovereditor
Show owner and faction of units in map editor tooltips
This commit is contained in:
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
var tooltip = Info.TraitInfoOrDefault<TooltipInfo>();
|
var tooltip = Info.TraitInfoOrDefault<TooltipInfo>();
|
||||||
Tooltip = tooltip == null ? ID + ": " + Info.Name : ID + ": " + tooltip.Name + " (" + Info.Name + ")";
|
Tooltip = tooltip == null ? ID + ": " + Info.Name : ID + ": " + tooltip.Name + " (" + Info.Name + ")" + "\n" + owner.Name + " (" + owner.Faction + ")";
|
||||||
|
|
||||||
GeneratePreviews();
|
GeneratePreviews();
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
tooltipContainer.BeforeRender = () =>
|
tooltipContainer.BeforeRender = () =>
|
||||||
{
|
{
|
||||||
labelText = getText();
|
labelText = getText();
|
||||||
var textWidth = font.Measure(labelText).X;
|
var textDim = font.Measure(labelText);
|
||||||
if (textWidth != cachedWidth)
|
if (textDim.X != cachedWidth)
|
||||||
{
|
{
|
||||||
label.Bounds.Width = textWidth;
|
label.Bounds.Width = textDim.X;
|
||||||
widget.Bounds.Width = 2 * label.Bounds.X + textWidth;
|
widget.Bounds.Width = 2 * label.Bounds.X + textDim.X;
|
||||||
|
label.Bounds.Height = textDim.Y;
|
||||||
|
widget.Bounds.Height = 4 * label.Bounds.Y + textDim.Y;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user