/* * Drawing * Each 'player' has their own logic. */ public void paintForPlayer(PaintEventArgs e, TetrisPlayer player, bool drawScore) { //Draw game Graphics g = e.Graphics; //New Graphics Object //Get box PictureBox drawingBox = player.getBox(); //Draw moving piece player.thisTetromino().drawGhost(g); player.thisTetromino().draw(g); //Draw all blocks foreach (TetrisBlock block in player.tetrisBlocks.ToArray()) // (SignalData error?) https://stackoverflow.com/questions/604831/collection-was-modified-enumeration-operation-may-not-execute { block.draw(g, false); } //Draw Score if (drawScore) { tetrisForm.setPanelInfo(player.playerScore, player.state, steps); } }
/* * Invalidates the panels and forces them to execute their paint event */ public void redraw() { localPlayer.getBox().Invalidate(); tetrisForm.getPreviewPanel().Invalidate(); otherPlayer?.getBox().Invalidate(); }