Пример #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="xmlPath"></param>
        public RiskGame( string xmlPath )
        {
            Board = new RiskBoard(xmlPath);
            Players = new List<RiskPlayer>();
            PlayerTerritories = new List<PlayerTerritory>();

            BoardTerritory[] tempArray = new BoardTerritory[Board.Territories.Count];
            Board.Territories.CopyTo(tempArray);
            UnassignedTerritories = tempArray.ToList();

            CurrentPlayerIndex = -1;

            State = new NotStarted(this);
        }
Пример #2
0
        // UI Methods
        #region <UI methods>

        private void CreateBoard() 
        {
            TerritoryLinks = new Dictionary<string, LinkButton>();

            RiskBoard EmptyBoard = new RiskBoard(Server.MapPath("Risk.xml"));

            foreach (BoardTerritory t in EmptyBoard.Territories
                                            .OrderBy(n => n.Name)
                                            .OrderBy(n => n.Continent.Name))
            {
                LinkButton lb = new LinkButton();
                lb.ID = t.Name;
                lb.CommandArgument = t.Name;
                lb.Text = "0";
                lb.CssClass = GetCssClass(t.Name);
                lb.ToolTip = t.Name;
                
                TerritoryLinks.Add(t.Name, lb);
                PlaceHolder2.Controls.Add(lb);
            }
        }
Пример #3
0
 public BoardContinent(string name, int pointValue, RiskBoard board)
 {
     Board = board;
     Name = name;
     PointValue = pointValue;
     Territories = new List<BoardTerritory>();
 }
Пример #4
0
 public BoardTerritory(string name, BoardContinent continent, RiskBoard board)
 {
     Board = board;
     Continent = continent;
     Name = name;
     AdjacentTerritories = new List<BoardTerritory>();
 }