Add Checkbox/Dropdown to lobby options yaml fields.

This commit is contained in:
Paul Chote
2017-12-09 21:02:56 +00:00
committed by reaperrr
parent ea32c758eb
commit 36fccbc453
28 changed files with 333 additions and 226 deletions

View File

@@ -25,20 +25,20 @@ namespace OpenRA.Mods.Common.Traits
[Translate]
[Desc("Descriptive label for the starting units option in the lobby.")]
public readonly string Label = "Starting Units";
public readonly string DropdownLabel = "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";
public readonly string DropdownDescription = "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;
public readonly bool DropdownLocked = false;
[Desc("Whether to display the starting units option in the lobby.")]
public readonly bool Visible = true;
public readonly bool DropdownVisible = true;
[Desc("Display order for the starting units option in the lobby.")]
public readonly int DisplayOrder = 0;
public readonly int DropdownDisplayOrder = 0;
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
{
@@ -49,8 +49,8 @@ namespace OpenRA.Mods.Common.Traits
startingUnits[t.Class] = t.ClassName;
if (startingUnits.Any())
yield return new LobbyOption("startingunits", Label, Description, Visible, DisplayOrder,
new ReadOnlyDictionary<string, string>(startingUnits), StartingUnitsClass, Locked);
yield return new LobbyOption("startingunits", DropdownLabel, DropdownDescription, DropdownVisible, DropdownDisplayOrder,
new ReadOnlyDictionary<string, string>(startingUnits), StartingUnitsClass, DropdownLocked);
}
public object Create(ActorInitializer init) { return new SpawnMPUnits(this); }