public void sort() //This sorts high score from highest to lowest. { Console.WriteLine("SORT1"); var comparer = new ItemComparer(); this.items.Sort(comparer); Console.WriteLine("SORT"); this.update(); }
//Check if a player would be on the leaderboard. private bool isTopPlayer(Item item) { Console.WriteLine(this.items.Count < this.maxItems); if (this.items.Count < this.maxItems) { return(true); } List <Item> tempList = new List <Item>(); this.items.ForEach((i) => tempList.Add(i)); tempList.Add(item); var comparer = new ItemComparer(); tempList.Sort(comparer); return(tempList.IndexOf(item) <= maxItems); }