如何通过 C# 将默认的 int 和字符串名称值添加到 JSON .txt?
我将首先使用所有这些假播放器创建HighScore的默认集合:
private List<Score> scores = null;
void Start()
{
this.scores = new List<Score>()
{
new Score("Adam", 10000), new Score("Eve",7500); // ...
};
Score[]scores = GetJsonFileWithScore(); // This is where you get the real players score
this.scores.AddRange(scores);
this.scores.OrderBy (s => s.score); // Order it by score
int index = 4;
this.scores.RemoveRange(index, list.Count - index); // keep only the best 5
}