private void AddMoreVotingTypesBasedOnPolicy(VotingTypeEnum votingType) { VotingTypes.Add(new SelectListItem() { Text = votingType.ToHumanReadable(), Value = ((int)votingType).ToString() }); }
private void AddMoreVotingTypesBasedOnPolicy(CountryPolicy countryPolicy) { if (countryPolicy.CountryCompanyBuildLawAllowHolder == (int)LawAllowHolderEnum.Congress || countryPolicy.CountryCompanyBuildLawAllowHolder == (int)LawAllowHolderEnum.PresidentAndCongress) { AddMoreVotingTypesBasedOnPolicy(VotingTypeEnum.CreateNationalCompany); } VotingTypes = VotingTypes.OrderBy(vt => vt.Text) .ToList(); }
public static string MakeVotingJson(IList mapItems, IList typeItems, List <VotingTypes> types) { Voting v = new Voting(); List <Maps> maps = new List <Maps>(); var m = mapItems; foreach (ListBoxItem x in m) { Maps newMap = new Maps(); if (Defaults.defaultMaps.ContainsKey(x.Content.ToString())) { newMap = new Maps(x.Content.ToString(), Defaults.defaultMaps[x.Content.ToString()]); } else { newMap = new Maps(x.Content.ToString()); } maps.Add(newMap); } v.Maps = maps; List <VotingTypes> _types = new List <VotingTypes>(); var t = typeItems; foreach (ListBoxItem x in t) { VotingTypes type = new VotingTypes(x.Content.ToString()); types.Add(type); foreach (VotingTypes y in types) { if (y.displayName == type.displayName && y.typeName == type.typeName) { type.commands = y.commands; type.SpecificMaps = y.SpecificMaps; } } } v.Types = types; if (maps.Count < 2 || types.Count < 2) { MessageBox.Show("You have less than 2 maps or game variants selected. There will be some compatibility issues with Eldewrito."); } return(JsonConvert.SerializeObject(v, Formatting.Indented)); }