public void PrintPlayer() { Dictionary <string, int> ordered = SkillsByPositions .OrderByDescending(s => s.Value) .ThenBy(p => p.Key) .ToDictionary(x => x.Key, x => x.Value); Console.WriteLine($"{Name}: {TotalSkill} skill"); foreach (var kvp in ordered) { Console.WriteLine($"- {kvp.Key} <::> {kvp.Value}"); } }
public void AddSkill(string position, int skill) { if (!SkillsByPositions.ContainsKey(position)) { //add his position and skill SkillsByPositions.Add(position, skill); Positions.Add(position); } else { //update his skill, only if the current position skill is lower than the new value. if (SkillsByPositions[position] < skill) { SkillsByPositions[position] = skill; } } }