Esempio n. 1
0
        // Método Game Over
        private void gameOver()
        {
            isGameOver = true;
            reset();
            SCORETETRIS c = new SCORETETRIS();

            c.Date                 = DateTime.Now;
            c.PlayerName           = txtNome.Text;
            c.Score                = gameScore;
            startStopBtn.Content   = "Start Game";
            GameOverTxt.Visibility = Visibility.Visible;
            btnReturn.Visibility   = Visibility.Visible;
            rowCount               = 0;
            columnCount            = 0;
            leftPos                = 0;
            gameSpeedCounter       = 0;
            gameSpeed              = GAMESPEED;
            gameLevel              = 1;
            gameActive             = false;
            gameScore              = 0;
            nextShapeDrawed        = false;
            currentTetromino       = null;
            currentShapeNumber     = shapeRandom.Next(1, 8);
            nextShapeNumber        = shapeRandom.Next(1, 8);
            timer.Interval         = new TimeSpan(0, 0, 0, 0, gameSpeed);



            using (dbSEQUORBS0023Entities3 dados = new dbSEQUORBS0023Entities3())
            {
                dados.SCORETETRIS.Add(c);
                dados.SaveChanges();
            }
        }
 private void ListarScores()
 {
     using (dbSEQUORBS0023Entities3 dados = new dbSEQUORBS0023Entities3())
     {
         var consulta = dados.SCORETETRIS;
         myDataGrid.ItemsSource = consulta.OrderByDescending(s => s.Score).Take(10).ToList();
     }
 }