public DomineeringView(DomineeringBoard myboard, int centerx = 300, int centery = 300, int targetwidth = 480) { _myboard = myboard; // prepare graphics: cell = new AnimationSprite[myboard._height, myboard._width]; for (int row = 0; row < _myboard._height; row++) { for (int col = 0; col < _myboard._width; col++) { AnimationSprite newcell = new AnimationSprite("../../assets/tileset.png", 3, 1); newcell.x = col * newcell.width; newcell.y = row * newcell.width; AddChild(newcell); cell [row, col] = newcell; } } float realwidth = cell [0, 0].width * _myboard._width; scaleX = targetwidth / realwidth; scaleY = targetwidth / realwidth; x = centerx - targetwidth / 2; y = centery - targetwidth / 2; // assuming that we have a square board // set callbacks: _myboard.OnCellChange += CellChangeHandler; wincells = new List <AnimationSprite> (); }
public DomineeringBoard(DomineeringBoard orig) : base(orig._width, orig._height) { for (int i = 0; i < _height; i++) { for (int j = 0; j < _width; j++) { board [i, j] = orig.board[i, j]; } } activeplayer = orig.activeplayer; movesmade = orig.movesmade; }