Beispiel #1
0
        public ScoresScreen(Player player)
        {
            this.player = player;

            scoresObj = JsonConvert.DeserializeObject <Scores>(File.ReadAllText(Values.scoresJsonPath));

            foreach (ScoreItem score in scoresObj.Items)
            {
                if (score.IsLast)
                {
                    score.IsLast = false;
                }
            }

            scoresObj.Items.Add(new ScoreItem(player.Name, player.CoinsCount, true));
            scoresObj.Items = scoresObj.Items.OrderByDescending(scoreString => scoreString.Score).ToList <ScoreItem>();
            File.WriteAllText(Values.scoresJsonPath, JsonConvert.SerializeObject(scoresObj, Formatting.Indented));
        }
Beispiel #2
0
 public ScoresScreen()
 {
     scoresObj = JsonConvert.DeserializeObject <Scores>(File.ReadAllText(Values.scoresJsonPath));
 }