Exemplo n.º 1
0
 private void frmScores_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (btnAdd.Enabled)
     {
         HighScoreList.add(new HighScores(txtName.Text, curScore, coinsAdded, difficulty));
     }
     GTools.saveHighScores(GTools.saveFile);
 }
Exemplo n.º 2
0
 public static void loadHighScores(string savePath, string saveFile)
 {
     Directory.CreateDirectory(savePath);
     try
     {
         if (System.IO.File.Exists(saveFile))
         {
             HighScoreList.hsList.Clear();
             HighScoreList.hsList = JsonConvert.DeserializeObject <List <HighScores> >(System.IO.File.ReadAllText(saveFile));
             HighScoreList.hsList = HighScoreList.hsList.OrderByDescending(p => p.score).ToList();
         }
         else
         {
             GTools.createFile(saveFile, "[ ]");
             loadHighScores(savePath, saveFile);
         }
     }
     catch (Exception exc)
     {
         System.Diagnostics.Debug.WriteLine(exc.Message + " Load User Error.\n");
     }
 }
Exemplo n.º 3
0
 private void dgvInit()
 {
     dtDriveFiles             = null;
     dtDriveFiles             = GTools.ToDataTable <HighScores>(HighScoreList.hsList);
     dgvHighScores.DataSource = dtDriveFiles;
 }
Exemplo n.º 4
0
 private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     GTools.saveHighScores(saveFile);
 }
Exemplo n.º 5
0
 public frmMain()
 {
     InitializeComponent();
     GTools.loadHighScores(savePath, saveFile);
 }