/** * Publishes a result to the toplist. If the user already has an equal or better score, this will be a no-op. * * @return False if an error occured. */ public bool ReportResult(IToplistIdentifier identifier, int score) { if (entries.Exists(e => e.Username == localUsername)) { ToplistEntry existingEntry = (ToplistEntry)entries.Find(e => e.Username == localUsername); if (existingEntry.Score >= score) { return(true); } entries.Remove(existingEntry); } entries.Add(new ToplistEntry(localUsername, score)); return(true); }
/** * Publishes a result to the toplist. If the user already has an equal or better score, this will be a no-op. * * @return False if an error occured. */ virtual public bool ReportResult(IToplistIdentifier identifier, int score) { try { if (entries.Exists(e => e.Username == localUsername)) { ToplistEntry existingEntry = (ToplistEntry)entries.Find(e => e.Username == localUsername); if (existingEntry.Score >= score) { return(true); } entries.Remove(existingEntry); } entries.Add(new ToplistEntry(localUsername, score)); return(true); } catch (Exception e) { Console.Write("Error in LocalTopList.ReportResult" + e); return(false); } }