Esempio n. 1
0
        /// <summary>
        /// Randomizes a the current player's scores
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRandomize_Click(object sender, EventArgs e)
        {
            Player updatedPlayer = RandomizePlayerScores(CurrentPlayer);

            SQLiteDataAccess.SavePlayer(updatedPlayer);
            RefreshListView();
        }
        public static void ResetAllStats()
        {
            using (IDbConnection connection = new SQLiteConnection(LoadConnectionString()))
            {
                var           output        = connection.Query <Player>("select * from Players", new DynamicParameters());
                List <Player> outputPlayers = output.ToList();

                try
                {
                    foreach (Player p in outputPlayers)
                    {
                        p.RankName       = "-";
                        p.TotalScore     = 0;
                        p.TalkativeScore = 0;
                        p.ShoutScore     = 0;
                        p.QuietScore     = 0;
                        p.SwearCount     = 0;
                        p.MannersCount   = 0;
                        SQLiteDataAccess.SavePlayer(p);
                    }
                    MessageBox.Show("Reset Player Stats", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Couldn't reset player stats", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     CurrentPlayer.Username = txtBoxEditName.Text;
     SQLiteDataAccess.SavePlayer(CurrentPlayer);
 }
Esempio n. 4
0
 //Allows the player in this context to be saved when this is called.
 private void UpdatePlayerInDb()
 {
     SQLiteDataAccess.SavePlayer(Player);
 }