예제 #1
0
        public HomelandGroup(IObjectStore data)
        {
            Homelands = new WeightedOptionTable <Homeland>();
            Name      = data.GetString("race");
            var table = data.GetObjectList("table");

            foreach (var entry in table)
            {
                var homeland = new Homeland(Name, entry);
                Homelands.AddEntry(homeland, homeland.Weighting);
            }
        }
예제 #2
0
 private void ParseYaml(YamlNodeWrapper yaml)
 {
     homelands = new List <Homeland>();
     foreach (var node in yaml.Children())
     {
         var table = node.GetNode("table");
         foreach (var entry in table.Children())
         {
             var homeland = new Homeland();
             homeland.Race      = node.GetString("race");
             homeland.Location  = entry.GetString("location");
             homeland.Weighting = entry.GetInteger("weight");
             homeland.Traits.Add(entry.GetCommaStringOptional("traits"));
             homelands.Add(homeland);
         }
     }
 }