Make lobby option tooltips work the same as factions.
This commit is contained in:
@@ -583,7 +583,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
Name = map.GetLocalisedString(name);
|
Name = map.GetLocalisedString(name);
|
||||||
Description = description != null ? map.GetLocalisedString(description) : null;
|
Description = description != null ? map.GetLocalisedString(description).Replace(@"\n", "\n") : null;
|
||||||
IsVisible = visible;
|
IsVisible = visible;
|
||||||
DisplayOrder = displayorder;
|
DisplayOrder = displayorder;
|
||||||
Values = values.ToDictionary(v => v.Key, v => map.GetLocalisedString(v.Value));
|
Values = values.ToDictionary(v => v.Key, v => map.GetLocalisedString(v.Value));
|
||||||
|
|||||||
@@ -107,7 +107,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
checkbox.GetText = () => option.Name;
|
checkbox.GetText = () => option.Name;
|
||||||
if (option.Description != null)
|
if (option.Description != null)
|
||||||
checkbox.GetTooltipText = () => option.Description;
|
{
|
||||||
|
var (text, desc) = LobbyUtils.SplitOnFirstToken(option.Description);
|
||||||
|
checkbox.GetTooltipText = () => text;
|
||||||
|
checkbox.GetTooltipDesc = () => desc;
|
||||||
|
}
|
||||||
|
|
||||||
checkbox.IsVisible = () => true;
|
checkbox.IsVisible = () => true;
|
||||||
checkbox.IsChecked = () => optionEnabled.Update(orderManager.LobbyInfo.GlobalSettings);
|
checkbox.IsChecked = () => optionEnabled.Update(orderManager.LobbyInfo.GlobalSettings);
|
||||||
@@ -148,7 +152,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
dropdown.GetText = () => getOptionLabel.Update(optionValue.Update(orderManager.LobbyInfo.GlobalSettings).Value);
|
dropdown.GetText = () => getOptionLabel.Update(optionValue.Update(orderManager.LobbyInfo.GlobalSettings).Value);
|
||||||
if (option.Description != null)
|
if (option.Description != null)
|
||||||
dropdown.GetTooltipText = () => option.Description;
|
{
|
||||||
|
var (text, desc) = LobbyUtils.SplitOnFirstToken(option.Description);
|
||||||
|
dropdown.GetTooltipText = () => text;
|
||||||
|
dropdown.GetTooltipDesc = () => desc;
|
||||||
|
}
|
||||||
|
|
||||||
dropdown.IsVisible = () => true;
|
dropdown.IsVisible = () => true;
|
||||||
dropdown.IsDisabled = () => configurationDisabled() ||
|
dropdown.IsDisabled = () => configurationDisabled() ||
|
||||||
optionValue.Update(orderManager.LobbyInfo.GlobalSettings).IsLocked;
|
optionValue.Update(orderManager.LobbyInfo.GlobalSettings).IsLocked;
|
||||||
|
|||||||
@@ -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")
|
public 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);
|
||||||
|
|||||||
@@ -342,7 +342,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
checkbox.GetText = () => option.Name;
|
checkbox.GetText = () => option.Name;
|
||||||
if (option.Description != null)
|
if (option.Description != null)
|
||||||
checkbox.GetTooltipText = () => option.Description;
|
{
|
||||||
|
var (text, desc) = LobbyUtils.SplitOnFirstToken(option.Description);
|
||||||
|
checkbox.GetTooltipText = () => text;
|
||||||
|
checkbox.GetTooltipDesc = () => desc;
|
||||||
|
}
|
||||||
|
|
||||||
checkbox.IsVisible = () => true;
|
checkbox.IsVisible = () => true;
|
||||||
checkbox.IsChecked = () => missionOptions[option.Id] == "True";
|
checkbox.IsChecked = () => missionOptions[option.Id] == "True";
|
||||||
@@ -376,7 +380,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
dropdown.GetText = () => option.Values[missionOptions[option.Id]];
|
dropdown.GetText = () => option.Values[missionOptions[option.Id]];
|
||||||
if (option.Description != null)
|
if (option.Description != null)
|
||||||
dropdown.GetTooltipText = () => option.Description;
|
{
|
||||||
|
var (text, desc) = LobbyUtils.SplitOnFirstToken(option.Description);
|
||||||
|
dropdown.GetTooltipText = () => text;
|
||||||
|
dropdown.GetTooltipDesc = () => desc;
|
||||||
|
}
|
||||||
|
|
||||||
dropdown.IsVisible = () => true;
|
dropdown.IsVisible = () => true;
|
||||||
dropdown.IsDisabled = () => option.IsLocked;
|
dropdown.IsDisabled = () => option.IsLocked;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user