Ejemplo n.º 1
0
 public void tempoCheck()
 {
     if (totalClearedLines % 10 == 0)
     {
         window.setTempo();
         window.setLevel();
     }
 }
Ejemplo n.º 2
0
        public void loadGame()
        {
            Array.Clear(currentBlockPosition, 0, currentBlockPosition.Length);
            Array.Clear(board.boardGrid, 0, board.boardGrid.Length);
            board.cleanBoard();
            initializeGame();
            window.resetLevel();
            window.resetTempo();
            window.TimerToggle();

            StreamReader file = new StreamReader(System.AppDomain.CurrentDomain.BaseDirectory + "/saves/saveFile.txt");

            for (int y = 17; y >= 0; y--)
            {
                for (int x = 0; x < 10; x++)
                {
                    String   line   = file.ReadLine();
                    String[] values = line.Split(",");
                    board.boardGrid[x, y] = Int32.Parse(values[0]);
                    board.BlockControls[x, y].Background = (Brush)converter.ConvertFromString(values[1]);
                }
            }
            board.currentScore = Int32.Parse(file.ReadLine());
            window.setScore(board.currentScore);
            board.totalClearedLines = Int32.Parse(file.ReadLine());
            int numberOfCalls = (int)Math.Floor((decimal)(board.totalClearedLines / 10));

            for (int i = 0; i < numberOfCalls; i++)
            {
                window.setTempo();
                window.setLevel();
            }

            file.Close();
            window.TimerToggle();
        }