コード例 #1
0
 public void DrawBoard(Board board, Canvas canvas)
 {
     int tilePixelHeight = (int)(canvas.Height / board.Height);
     int tilePixelWidth = (int)(canvas.Width / board.Width);
     for (int i = 0; i < board.Tiles.Length; i++)
     {
         int drawStartHeight = (int)(tilePixelHeight * board.Tiles[i].GridY);
         int drawStartWidth = (int)(tilePixelWidth * board.Tiles[i].GridX);
         Rectangle rect = new Rectangle();
         rect.Height = tilePixelHeight;
         rect.Width = tilePixelWidth;
         rect.Fill = GetColorFromGameColors(board.Tiles[i].Color);
         Canvas.SetTop(rect, drawStartHeight);
         Canvas.SetLeft(rect, drawStartWidth);
         board.Tiles[i].Rectangle = rect;
         canvas.Children.Add(board.Tiles[i].Rectangle);
     }
 }
コード例 #2
0
ファイル: Game.cs プロジェクト: GabrielWilds/Colorland
 public Game(Board _board)
 {
     Board = _board;
     Deck = new Deck();
 }