Example #1
0
        private void LoadContinents() 
        {
            foreach( XmlNode n in xml.SelectNodes("/Risk/Continent") )
            {
                BoardContinent c = new BoardContinent( n.Attributes["name"].Value, Int32.Parse(n.Attributes["pointValue"].Value), this);

                foreach (XmlNode cn in n.ChildNodes)
                {
                    BoardTerritory t = new BoardTerritory(cn.Attributes["name"].Value, c, this);
                    Territories.Add(t);
                    c.AddTerritory(t);
                }
                
                Continents.Add(c);
            }

            // Load the Adjacent Territories

            foreach (BoardTerritory t in Territories)
            {
                foreach (XmlNode n in xml.SelectNodes("/Risk/Continent/Territory[@name='" + t.Name + "']"))
                {
                    foreach (XmlNode cn in n.ChildNodes)
                    {
                        t.AddAdjacentTerritory(Territories.Where(x => x.Name == cn.Attributes["name"].Value).Single());
                    }
                }
            }
        }
Example #2
0
 public BoardTerritory(string name, BoardContinent continent, RiskBoard board)
 {
     Board = board;
     Continent = continent;
     Name = name;
     AdjacentTerritories = new List<BoardTerritory>();
 }