Fix lobby faction tooltip rendering.
This commit is contained in:
@@ -77,8 +77,11 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
ModRules = modData.DefaultRules;
|
ModRules = modData.DefaultRules;
|
||||||
|
|
||||||
var tooltipCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
|
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
|
||||||
GetText = () => tooltipCache.Update(Text);
|
var tooltipTextCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
|
||||||
|
var tooltipDescCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
|
||||||
|
|
||||||
|
GetText = () => textCache.Update(Text);
|
||||||
GetColor = () => TextColor;
|
GetColor = () => TextColor;
|
||||||
GetColorDisabled = () => TextColorDisabled;
|
GetColorDisabled = () => TextColorDisabled;
|
||||||
GetContrastColorDark = () => ContrastColorDark;
|
GetContrastColorDark = () => ContrastColorDark;
|
||||||
@@ -86,9 +89,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
OnMouseUp = _ => OnClick();
|
OnMouseUp = _ => OnClick();
|
||||||
OnKeyPress = _ => OnClick();
|
OnKeyPress = _ => OnClick();
|
||||||
IsHighlighted = () => Highlighted;
|
IsHighlighted = () => Highlighted;
|
||||||
var tooltipDescCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
|
GetTooltipText = () => tooltipTextCache.Update(TooltipText);
|
||||||
GetTooltipText = () => tooltipDescCache.Update(TooltipText);
|
|
||||||
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
|
|
||||||
GetTooltipDesc = () => tooltipDescCache.Update(TooltipDesc);
|
GetTooltipDesc = () => tooltipDescCache.Update(TooltipDesc);
|
||||||
tooltipContainer = Exts.Lazy(() =>
|
tooltipContainer = Exts.Lazy(() =>
|
||||||
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
colorManager = modRules.Actors[SystemActors.World].TraitInfo<IColorPickerManagerInfo>();
|
colorManager = modRules.Actors[SystemActors.World].TraitInfo<IColorPickerManagerInfo>();
|
||||||
|
|
||||||
foreach (var f in modRules.Actors[SystemActors.World].TraitInfos<FactionInfo>())
|
foreach (var f in modRules.Actors[SystemActors.World].TraitInfos<FactionInfo>())
|
||||||
factions.Add(f.InternalName, new LobbyFaction { Selectable = f.Selectable, Name = f.Name, Side = f.Side, Description = f.Description });
|
factions.Add(f.InternalName, new LobbyFaction { Selectable = f.Selectable, Name = f.Name, Side = f.Side, Description = f.Description?.Replace(@"\n", "\n") });
|
||||||
|
|
||||||
var gameStarting = false;
|
var gameStarting = false;
|
||||||
Func<bool> configurationDisabled = () => !Game.IsHost || gameStarting ||
|
Func<bool> configurationDisabled = () => !Game.IsHost || gameStarting ||
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Splits a string into two parts on the first instance of a given token.</summary>
|
/// <summary>Splits a string into two parts on the first instance of a given token.</summary>
|
||||||
static (string First, string Second) SplitOnFirstToken(string input, string token = "\\n")
|
static (string First, string Second) SplitOnFirstToken(string input, string token = "\n")
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(input))
|
if (string.IsNullOrEmpty(input))
|
||||||
return (null, null);
|
return (null, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user