Add truncation to FactionLabel
This commit is contained in:
@@ -97,17 +97,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var flag = item.Get<ImageWidget>("FACTIONFLAG");
|
||||
flag.GetImageCollection = () => "flags";
|
||||
|
||||
var factionName = pp.DisplayFaction.Name;
|
||||
if (player == null || player.RelationshipWith(pp) == PlayerRelationship.Ally || player.WinState != WinState.Undefined)
|
||||
{
|
||||
flag.GetImageName = () => pp.Faction.InternalName;
|
||||
var factionName = pp.Faction.Name != pp.DisplayFaction.Name ? $"{pp.DisplayFaction.Name} ({pp.Faction.Name})" : pp.Faction.Name;
|
||||
item.Get<LabelWidget>("FACTION").GetText = () => factionName;
|
||||
factionName = pp.Faction.Name != factionName ? $"{factionName} ({pp.Faction.Name})" : pp.Faction.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag.GetImageName = () => pp.DisplayFaction.InternalName;
|
||||
item.Get<LabelWidget>("FACTION").GetText = () => pp.DisplayFaction.Name;
|
||||
}
|
||||
|
||||
WidgetUtils.TruncateLabelToTooltip(item.Get<LabelWithTooltipWidget>("FACTION"), factionName);
|
||||
|
||||
var scoreCache = new CachedTransform<int, string>(s => s.ToString());
|
||||
item.Get<LabelWidget>("SCORE").GetText = () => scoreCache.Update(p.PlayerStatistics?.Experience ?? 0);
|
||||
|
||||
@@ -109,11 +109,13 @@ Container@SKIRMISH_STATS:
|
||||
Y: 4
|
||||
Width: 32
|
||||
Height: 16
|
||||
Label@FACTION:
|
||||
LabelWithTooltip@FACTION:
|
||||
X: 264
|
||||
Width: 86
|
||||
Height: 25
|
||||
Shadow: True
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@SCORE:
|
||||
X: 360
|
||||
Width: 75
|
||||
|
||||
@@ -107,11 +107,13 @@ Container@SKIRMISH_STATS:
|
||||
Y: 5
|
||||
Width: 32
|
||||
Height: 16
|
||||
Label@FACTION:
|
||||
LabelWithTooltip@FACTION:
|
||||
X: 264
|
||||
Width: 86
|
||||
Height: 25
|
||||
Shadow: True
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@SCORE:
|
||||
X: 360
|
||||
Width: 75
|
||||
|
||||
@@ -108,11 +108,13 @@ Container@SKIRMISH_STATS:
|
||||
Y: 4
|
||||
Width: 32
|
||||
Height: 16
|
||||
Label@FACTION:
|
||||
LabelWithTooltip@FACTION:
|
||||
X: 264
|
||||
Width: 86
|
||||
Height: 25
|
||||
Shadow: True
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@SCORE:
|
||||
X: 360
|
||||
Width: 75
|
||||
|
||||
Reference in New Issue
Block a user