public void SaveScore(int score) { var date = DateTime.Now; if (_recordManager == null) { _recordManager = RecordManager.Load(); } _recordManager.Records.Add(new Record(score, date)); }
public PracticeHistoryScreen() : base("Practice History") { MenuPosition = new Vector2(0.125f, 0.8f); _back.OnSelected += (sender, args) => CancelScreen(); MenuItems.AddItems(_back); _recordManager = RecordManager.Load(); }
public static RecordManager Load() { var rm = new RecordManager(); if (File.Exists(FileName)) { var bf = new BinaryFormatter(); var fs = new FileStream(FileName, FileMode.Open); rm.Records = (List <Record>)bf.Deserialize(fs); fs.Close(); } return(rm); }
public static RecordManager Load() { var rm = new RecordManager(); if (File.Exists(FileName)) { var bf = new BinaryFormatter(); var fs = new FileStream(FileName, FileMode.Open); rm.Records = (List<Record>) bf.Deserialize(fs); fs.Close(); } return rm; }