示例#1
0
 public static void AddPlayerScore(string name, int score)
 {
     try
     {
         var newPlayerScore = new TableLeaderboard()
         {
             Name = name, Score = score
         };
         Con.Insert(newPlayerScore);
     }
     catch (Exception e)
     {
         Console.WriteLine("Database SQLite Error thrown: " + e);
         throw e;
     }
 }
示例#2
0
        //load fake data method (This method will only be initiated if there are no data inside)
        private static List <TableLeaderboard> LoadFakeData()
        {
            string[] name  = { "Declan", "Winston", "O-10", "Bee Lat", "Mr. Noob" };
            int[]    score = { 4, 9, 4, 5, 1 };

            TableLeaderboard[] fakeLeaderboard = new TableLeaderboard[5];

            for (int i = 0; i < 5; i++)
            {
                TableLeaderboard data = new TableLeaderboard();
                data.Name  = name[i];
                data.Score = score[i];

                fakeLeaderboard[i] = data;
            }

            return(fakeLeaderboard.ToList());
        }