public void BeginTestMethod() { const int CELL_SIZE = 20; const int COLS = 12; const int ROWS = 24; var cvs = new Canvas(); cvs.Width = Piece.PC_SIZE * CELL_SIZE; cvs.Height = Piece.PC_SIZE * CELL_SIZE; var nextField = new Field(cvs, Piece.PC_SIZE, Piece.PC_SIZE); cvs = new Canvas(); cvs.Width = COLS * CELL_SIZE; cvs.Height = ROWS * CELL_SIZE; var field = new Field(cvs, COLS, ROWS, Piece.PC_SIZE / 2, Piece.PC_SIZE / 2, 1); target = new Board(field, nextField); }
public void Initialize(GamePage page) { this.page = page; setResources(); this.timer = new DispatcherTimer(); timer.Tick += this.OnTick; timer.Interval = new TimeSpan(days: 0, hours: 0, minutes: 0, seconds: 1, milliseconds: 0); this.page.MainWnd.KeyDown += this.OnKeyDown; // Generate model objects var field = new Field(this.page.cvField, cols:12, rows:24, yOffset: Piece.PC_SIZE / 2, wallThickness: Piece.PC_SIZE / 2, dispWallThickness: 1); var nextField = new Field(this.page.cvNextField, cols: Piece.PC_SIZE, rows: Piece.PC_SIZE); board = new Board(field, nextField); recorder = new Recorder(); setBinding(); this.Reset(); }
public void Terminate() { this.Stop(); releaseResources(); this.page.MainWnd.KeyDown -= this.OnKeyDown; this.board = null; this.recorder = null; }