Add Checkbox/Dropdown to lobby options yaml fields.
This commit is contained in:
@@ -23,23 +23,23 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Translate]
|
||||
[Desc("Descriptive label for the crates checkbox in the lobby.")]
|
||||
public readonly string Label = "Crates";
|
||||
public readonly string CheckboxLabel = "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";
|
||||
public readonly string CheckboxDescription = "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;
|
||||
public readonly bool CheckboxEnabled = true;
|
||||
|
||||
[Desc("Prevent the crates state from being changed in the lobby.")]
|
||||
public readonly bool Locked = false;
|
||||
public readonly bool CheckboxLocked = false;
|
||||
|
||||
[Desc("Whether to display the crates checkbox in the lobby.")]
|
||||
public readonly bool Visible = true;
|
||||
public readonly bool CheckboxVisible = true;
|
||||
|
||||
[Desc("Display order for the crates checkbox in the lobby.")]
|
||||
public readonly int DisplayOrder = 0;
|
||||
public readonly int CheckboxDisplayOrder = 0;
|
||||
|
||||
[Desc("Minimum number of crates.")]
|
||||
public readonly int Minimum = 1;
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("crates", Label, Description, Visible, DisplayOrder, Enabled, Locked);
|
||||
yield return new LobbyBooleanOption("crates", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new CrateSpawner(init.Self, this); }
|
||||
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void INotifyCreated.Created(Actor self)
|
||||
{
|
||||
enabled = self.World.LobbyInfo.GlobalSettings
|
||||
.OptionOrDefault("crates", info.Enabled);
|
||||
.OptionOrDefault("crates", info.CheckboxEnabled);
|
||||
}
|
||||
|
||||
void ITick.Tick(Actor self)
|
||||
|
||||
Reference in New Issue
Block a user