Expose default UI labels and tooltips to yaml.

This commit is contained in:
Paul Chote
2017-11-19 17:32:05 +00:00
committed by reaperrr
parent 99908c4d80
commit ea32c758eb
10 changed files with 123 additions and 43 deletions

View File

@@ -17,6 +17,14 @@ namespace OpenRA.Traits
{
public class PlayerResourcesInfo : ITraitInfo, ILobbyOptions
{
[Translate]
[Desc("Descriptive label for the starting cash option in the lobby.")]
public readonly string Label = "Starting Cash";
[Translate]
[Desc("Tooltip description for the starting cash option in the lobby.")]
public readonly string Description = "Change the amount of cash that players start with";
[Desc("Starting cash options that are available in the lobby options.")]
public readonly int[] SelectableCash = { 2500, 5000, 10000, 20000 };
@@ -43,10 +51,8 @@ namespace OpenRA.Traits
var startingCash = SelectableCash.ToDictionary(c => c.ToString(), c => "$" + c.ToString());
if (startingCash.Any())
yield return new LobbyOption("startingcash", "Starting Cash", "Change the amount of cash that players start with",
DefaultCashVisible, DefaultCashDisplayOrder,
new ReadOnlyDictionary<string, string>(startingCash),
DefaultCash.ToString(), DefaultCashLocked);
yield return new LobbyOption("startingcash", Label, Description, DefaultCashVisible, DefaultCashDisplayOrder,
new ReadOnlyDictionary<string, string>(startingCash), DefaultCash.ToString(), DefaultCashLocked);
}
public object Create(ActorInitializer init) { return new PlayerResources(init.Self, this); }

View File

@@ -17,6 +17,14 @@ namespace OpenRA.Traits
[Desc("Required for shroud and fog visibility checks. Add this to the player actor.")]
public class ShroudInfo : ITraitInfo, ILobbyOptions
{
[Translate]
[Desc("Descriptive label for the fog checkbox in the lobby.")]
public readonly string FogLabel = "Fog of War";
[Translate]
[Desc("Tooltip description for the fog checkbox in the lobby.")]
public readonly string FogDescription = "Line of sight is required to view enemy forces";
[Desc("Default value of the fog checkbox in the lobby.")]
public readonly bool FogEnabled = true;
@@ -29,6 +37,14 @@ namespace OpenRA.Traits
[Desc("Display order for the fog checkbox in the lobby.")]
public readonly int FogDisplayOrder = 0;
[Translate]
[Desc("Descriptive label for the explored map checkbox in the lobby.")]
public readonly string ExploredMapLabel = "Explored Map";
[Translate]
[Desc("Tooltip description for the explored map checkbox in the lobby.")]
public readonly string ExploredMapDescription = "Initial map shroud is revealed";
[Desc("Default value of the explore map checkbox in the lobby.")]
public readonly bool ExploredMapEnabled = false;
@@ -43,12 +59,10 @@ namespace OpenRA.Traits
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
{
yield return new LobbyBooleanOption("explored", "Explored Map", "Initial map shroud is revealed",
ExploredMapVisible, ExploredMapDisplayOrder,
ExploredMapEnabled, ExploredMapLocked);
yield return new LobbyBooleanOption("fog", "Fog of War", "Line of sight is required to view enemy forces",
FogVisible, FogDisplayOrder,
FogEnabled, FogLocked);
yield return new LobbyBooleanOption("explored", ExploredMapLabel, ExploredMapDescription,
ExploredMapVisible, ExploredMapDisplayOrder, ExploredMapEnabled, ExploredMapLocked);
yield return new LobbyBooleanOption("fog", FogLabel, FogDescription,
FogVisible, FogDisplayOrder, FogEnabled, FogLocked);
}
public object Create(ActorInitializer init) { return new Shroud(init.Self, this); }