public void Formatting() { foreach (var yaml in RoleRegistry.LoadYaml()) { var children = yaml.Children; Assert.That(children, Contains.Key((YamlNode)"id")); Assert.That(children["id"].AsString().Length, Is.Positive); Assert.That(children, Contains.Key((YamlNode)"team")); var team = children["team"].AsString(); Assert.That(team.Length, Is.Positive); Assert.NotNull(TeamRegistry.Default[team]); Assert.That(children, Contains.Key((YamlNode)"categories")); var categoryNames = children["categories"]; Assert.That(categoryNames.AsStringList().Count, Is.Positive); foreach (var category in (YamlSequenceNode)categoryNames) { Assert.NotNull(CategoryRegistry.Default[category.AsString()]); } Assert.That(children, Contains.Key((YamlNode)"color")); Assert.That(children["color"].AsColor(), Is.Not.EqualTo(Color.Empty)); } }
public RoleSetup( RoleRegistry roles, AbilityRegistry abilities, AbilitySetupRegistry abilitySetups, IEnumerable <IRoleSelector> selectors) { Roles = roles; Abilities = abilities; AbilitySetups = abilitySetups; Perks = new PerkRegistry(roles); Selectors = selectors.ToList(); }
public List <IRoleSelector> Selectors(RoleRegistry roles) { var selectors = new List <IRoleSelector>(); foreach (var category in CategoryRegistry.Default.Entries()) { var selector = new RoleSelector(roles, category); selectors.Add(selector); } var random = new RoleSelector(roles, this); selectors.Add(random); return(selectors); }
public static List <SelectorGroup> Default(RoleRegistry roles) { var groups = new List <SelectorGroup>(); var randomSelectors = new List <RoleSelector>(); var anyRandom = new RoleSelector(roles); randomSelectors.Add(anyRandom); var teams = TeamRegistry.Default.Entries(); foreach (var team in teams) { var selectors = roles.Team(team) .Where(role => role.Natural) .Select(role => new RoleSelector(role)).ToList(); var group = new SelectorGroup(team.Id, team.Name, selectors, team.Color); groups.Add(group); var teamRandom = new RoleSelector(roles, team); randomSelectors.Add(teamRandom); } foreach (var category in CategoryRegistry.Default.Entries()) { var selector = new RoleSelector(roles, category); randomSelectors.Add(selector); } var randomGroup = new SelectorGroup("Random", SelectorKey.Random, randomSelectors, ColorTranslator.FromHtml("#00CCFF")); groups.Add(randomGroup); return(groups); }
public PerkRegistry(RoleRegistry roles) { Roles = roles; }