public hs_data() { filename = "hs"; highscores = new List <hs_entry>(); for (int i = 0; i < 10; i++) { hs_entry e = new hs_entry("", 0); highscores.Add(e); } }
public void add_entry(string name, int score) { hs_entry e = new hs_entry(name, score); int idx = 9; while (idx >= 0 && score > data.highscores[idx].score) { idx--; } idx++; data.highscores.Insert(idx, e); data.highscores.RemoveAt(10); write_hs_file(); }