Allow picking of a random subfaction

This commit is contained in:
abcdefg30
2015-03-06 16:02:40 +01:00
parent 687403ab89
commit 63fe578ba8
19 changed files with 65 additions and 19 deletions

View File

@@ -144,7 +144,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
colorPreview = lobby.Get<ColorPreviewManagerWidget>("COLOR_MANAGER");
colorPreview.Color = Game.Settings.Player.Color;
countries.Add("random", new LobbyCountry { Name = "Any" });
foreach (var c in modRules.Actors["world"].Traits.WithInterface<CountryInfo>().Where(c => c.Selectable))
countries.Add(c.Race, new LobbyCountry { Name = c.Name, Side = c.Side, Description = c.Description });

View File

@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (race, itemTemplate) =>
{
var item = ScrollItemWidget.Setup(itemTemplate,
() => client.Country == race,
() => client.Race == race,
() => orderManager.IssueOrder(Order.Command("race {0} {1}".F(client.Index, race))));
var country = countries[race];
item.Get<LabelWidget>("LABEL").GetText = () => country.Name;
@@ -398,7 +398,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var dropdown = parent.Get<DropDownButtonWidget>("FACTION");
dropdown.IsDisabled = () => s.LockRace || orderManager.LocalClient.IsReady;
dropdown.OnMouseDown = _ => ShowRaceDropDown(dropdown, c, orderManager, countries);
var factionDescription = countries[c.Country].Description;
var factionDescription = countries[c.Race].Description;
dropdown.GetTooltipText = () => factionDescription;
SetupFactionWidget(dropdown, s, c, countries);
}
@@ -407,9 +407,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Dictionary<string, LobbyCountry> countries)
{
var factionName = parent.Get<LabelWidget>("FACTIONNAME");
factionName.GetText = () => countries[c.Country].Name;
factionName.GetText = () => countries[c.Race].Name;
var factionFlag = parent.Get<ImageWidget>("FACTIONFLAG");
factionFlag.GetImageName = () => c.Country;
factionFlag.GetImageName = () => c.Race;
factionFlag.GetImageCollection = () => "flags";
}