Expose default UI labels and tooltips to yaml.
This commit is contained in:
@@ -18,6 +18,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Attach this to the player actor.")]
|
||||
public class DeveloperModeInfo : ITraitInfo, ILobbyOptions
|
||||
{
|
||||
[Translate]
|
||||
[Desc("Descriptive label for the developer mode checkbox in the lobby.")]
|
||||
public readonly string Label = "Debug Menu";
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the developer mode checkbox in the lobby.")]
|
||||
public readonly string Description = "Enables cheats and developer commands";
|
||||
|
||||
[Desc("Default value of the developer mode checkbox in the lobby.")]
|
||||
public readonly bool Enabled = false;
|
||||
|
||||
@@ -56,9 +64,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("cheats", "Debug Menu",
|
||||
"Enables cheats and developer commands",
|
||||
Visible, DisplayOrder, Enabled, Locked);
|
||||
yield return new LobbyBooleanOption("cheats", Label, Description, Visible, DisplayOrder, Enabled, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
||||
|
||||
@@ -21,6 +21,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public class CrateSpawnerInfo : ITraitInfo, ILobbyOptions
|
||||
{
|
||||
[Translate]
|
||||
[Desc("Descriptive label for the crates checkbox in the lobby.")]
|
||||
public readonly string Label = "Crates";
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the crates checkbox in the lobby.")]
|
||||
public readonly string Description = "Collect crates with units to recieve random bonuses or penalties";
|
||||
|
||||
[Desc("Default value of the crates checkbox in the lobby.")]
|
||||
public readonly bool Enabled = true;
|
||||
|
||||
@@ -73,9 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("crates", "Crates",
|
||||
"Collect crates with units to recieve random bonuses or penalties",
|
||||
Visible, DisplayOrder, Enabled, Locked);
|
||||
yield return new LobbyBooleanOption("crates", Label, Description, Visible, DisplayOrder, Enabled, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new CrateSpawner(init.Self, this); }
|
||||
|
||||
@@ -17,6 +17,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Controls the build radius checkboxes in the lobby options.")]
|
||||
public class MapBuildRadiusInfo : ITraitInfo, ILobbyOptions
|
||||
{
|
||||
[Translate]
|
||||
[Desc("Descriptive label for the ally build radius checkbox in the lobby.")]
|
||||
public readonly string AllyBuildRadiusLabel = "Build off Allies";
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the ally build radius checkbox in the lobby.")]
|
||||
public readonly string AllyBuildRadiusDescription = "Allow allies to place structures inside your build area";
|
||||
|
||||
[Desc("Default value of the ally build radius checkbox in the lobby.")]
|
||||
public readonly bool AllyBuildRadiusEnabled = true;
|
||||
|
||||
@@ -29,6 +37,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Display order for the ally build radius checkbox in the lobby.")]
|
||||
public readonly int AllyBuildRadiusDisplayOrder = 0;
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the build radius checkbox in the lobby.")]
|
||||
public readonly string BuildRadiusLabel = "Limit Build Area";
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the build radius checkbox in the lobby.")]
|
||||
public readonly string BuildRadiusDescription = "Limits structure placement to areas around Construction Yards";
|
||||
|
||||
[Desc("Default value of the build radius checkbox in the lobby.")]
|
||||
public readonly bool BuildRadiusEnabled = true;
|
||||
|
||||
@@ -43,13 +59,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("allybuild", "Build off Allies", "Allow allies to place structures inside your build area",
|
||||
AllyBuildRadiusVisible, AllyBuildRadiusDisplayOrder,
|
||||
AllyBuildRadiusEnabled, AllyBuildRadiusLocked);
|
||||
yield return new LobbyBooleanOption("allybuild", AllyBuildRadiusLabel, AllyBuildRadiusDescription,
|
||||
AllyBuildRadiusVisible, AllyBuildRadiusDisplayOrder, AllyBuildRadiusEnabled, AllyBuildRadiusLocked);
|
||||
|
||||
yield return new LobbyBooleanOption("buildradius", "Limit Build Area", "Limits structure placement to areas around Construction Yards",
|
||||
BuildRadiusVisible, BuildRadiusDisplayOrder,
|
||||
BuildRadiusEnabled, BuildRadiusLocked);
|
||||
yield return new LobbyBooleanOption("buildradius", BuildRadiusLabel, BuildRadiusDescription,
|
||||
BuildRadiusVisible, BuildRadiusDisplayOrder, BuildRadiusEnabled, BuildRadiusLocked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new MapBuildRadius(this); }
|
||||
|
||||
@@ -17,6 +17,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Controls the 'Creeps' checkbox in the lobby options.")]
|
||||
public class MapCreepsInfo : ITraitInfo, ILobbyOptions
|
||||
{
|
||||
[Translate]
|
||||
[Desc("Descriptive label for the creeps checkbox in the lobby.")]
|
||||
public readonly string Label = "Creep Actors";
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the creeps checkbox in the lobby.")]
|
||||
public readonly string Description = "Hostile forces spawn on the battlefield";
|
||||
|
||||
[Desc("Default value of the creeps checkbox in the lobby.")]
|
||||
public readonly bool Enabled = true;
|
||||
|
||||
@@ -31,8 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("creeps", "Worms", "Worms roam the map and devour unprepared forces",
|
||||
Visible, DisplayOrder, Enabled, Locked);
|
||||
yield return new LobbyBooleanOption("creeps", Label, Description, Visible, DisplayOrder, Enabled, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new MapCreeps(this); }
|
||||
|
||||
@@ -18,6 +18,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Controls the game speed, tech level, and short game lobby options.")]
|
||||
public class MapOptionsInfo : ITraitInfo, ILobbyOptions, IRulesetLoaded
|
||||
{
|
||||
[Translate]
|
||||
[Desc("Descriptive label for the short game checkbox in the lobby.")]
|
||||
public readonly string ShortGameLabel = "Short Game";
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the short game checkbox in the lobby.")]
|
||||
public readonly string ShortGameDescription = "Players are defeated when their bases are destroyed";
|
||||
|
||||
[Desc("Default value of the short game checkbox in the lobby.")]
|
||||
public readonly bool ShortGameEnabled = true;
|
||||
|
||||
@@ -30,6 +38,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Display order for the short game checkbox in the lobby.")]
|
||||
public readonly int ShortGameDisplayOrder = 0;
|
||||
|
||||
[Translate]
|
||||
[Desc("Descriptive label for the tech level option in the lobby.")]
|
||||
public readonly string TechLevelLabel = "Tech Level";
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the tech level option in the lobby.")]
|
||||
public readonly string TechLevelDescription = "Change the units and abilities at your disposal";
|
||||
|
||||
[Desc("Default tech level.")]
|
||||
public readonly string TechLevel = "unrestricted";
|
||||
|
||||
@@ -42,6 +58,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Display order for the tech level option in the lobby.")]
|
||||
public readonly int TechLevelDisplayOrder = 0;
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the game speed option in the lobby.")]
|
||||
public readonly string GameSpeedLabel = "Game Speed";
|
||||
|
||||
[Translate]
|
||||
[Desc("Description of the game speed option in the lobby.")]
|
||||
public readonly string GameSpeedDescription = "Change the rate at which time passes";
|
||||
|
||||
[Desc("Default game speed.")]
|
||||
public readonly string GameSpeed = "default";
|
||||
|
||||
@@ -56,27 +80,22 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("shortgame", "Short Game", "Players are defeated when their bases are destroyed",
|
||||
ShortGameVisible, ShortGameDisplayOrder,
|
||||
ShortGameEnabled, ShortGameLocked);
|
||||
yield return new LobbyBooleanOption("shortgame", ShortGameLabel, ShortGameDescription,
|
||||
ShortGameVisible, ShortGameDisplayOrder, ShortGameEnabled, ShortGameLocked);
|
||||
|
||||
var techLevels = rules.Actors["player"].TraitInfos<ProvidesTechPrerequisiteInfo>()
|
||||
.ToDictionary(t => t.Id, t => t.Name);
|
||||
|
||||
if (techLevels.Any())
|
||||
yield return new LobbyOption("techlevel", "Tech Level", "Change the units and abilities at your disposal",
|
||||
TechLevelVisible, TechLevelDisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(techLevels),
|
||||
TechLevel, TechLevelLocked);
|
||||
yield return new LobbyOption("techlevel", TechLevelLabel, TechLevelDescription, TechLevelVisible, TechLevelDisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(techLevels), TechLevel, TechLevelLocked);
|
||||
|
||||
var gameSpeeds = Game.ModData.Manifest.Get<GameSpeeds>().Speeds
|
||||
.ToDictionary(s => s.Key, s => s.Value.Name);
|
||||
|
||||
// NOTE: The server hardcodes special-case logic for this option id
|
||||
yield return new LobbyOption("gamespeed", "Game Speed", "Change the rate at which time passes",
|
||||
GameSpeedVisible, GameSpeedDisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(gameSpeeds),
|
||||
GameSpeed, GameSpeedLocked);
|
||||
yield return new LobbyOption("gamespeed", GameSpeedLabel, GameSpeedDescription, GameSpeedVisible, GameSpeedDisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(gameSpeeds), GameSpeed, GameSpeedLocked);
|
||||
}
|
||||
|
||||
void IRulesetLoaded<ActorInfo>.RulesetLoaded(Ruleset rules, ActorInfo info)
|
||||
|
||||
@@ -22,10 +22,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Internal id for this option.")]
|
||||
public readonly string ID = null;
|
||||
|
||||
[Translate]
|
||||
[FieldLoader.Require]
|
||||
[Desc("Descriptive label for this option.")]
|
||||
public readonly string Label = null;
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for this option.")]
|
||||
public readonly string Description = null;
|
||||
|
||||
@@ -48,10 +50,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyOption(ID, Label, Description,
|
||||
Visible, DisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(Values),
|
||||
Default, Locked);
|
||||
yield return new LobbyOption(ID, Label, Description, Visible, DisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(Values), Default, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new ScriptLobbyDropdown(this); }
|
||||
|
||||
@@ -23,6 +23,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public readonly string StartingUnitsClass = "none";
|
||||
|
||||
[Translate]
|
||||
[Desc("Descriptive label for the starting units option in the lobby.")]
|
||||
public readonly string Label = "Starting Units";
|
||||
|
||||
[Translate]
|
||||
[Desc("Tooltip description for the starting units option in the lobby.")]
|
||||
public readonly string Description = "Change the units that you start the game with";
|
||||
|
||||
[Desc("Prevent the starting units option from being changed in the lobby.")]
|
||||
public readonly bool Locked = false;
|
||||
|
||||
@@ -41,10 +49,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
startingUnits[t.Class] = t.ClassName;
|
||||
|
||||
if (startingUnits.Any())
|
||||
yield return new LobbyOption("startingunits", "Starting Units", "Change the units that you start the game with",
|
||||
Visible, DisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(startingUnits),
|
||||
StartingUnitsClass, Locked);
|
||||
yield return new LobbyOption("startingunits", Label, Description, Visible, DisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(startingUnits), StartingUnitsClass, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new SpawnMPUnits(this); }
|
||||
|
||||
Reference in New Issue
Block a user