永久化保存 (排行榜的写法list)

 1  int max = PlayerPrefs.GetInt("max"), min = PlayerPrefs.GetInt("min"), cen = PlayerPrefs.GetInt("cen");
 2         3         List<int> arr = new List<int>();
 4         arr.Add(max);
 5         arr.Add(min);
 6         arr.Add(cen);
 7         arr.Add(num);
 8         arr.Sort();
 9         arr.Reverse();
10         PlayerPrefs.SetInt("max", arr[0]);
11         PlayerPrefs.SetInt("cen", arr[1]);
12         PlayerPrefs.SetInt("min", arr[2]);
13         df.text = "历史最高:" + PlayerPrefs.GetInt("max") + "\n" + "第二名:" + PlayerPrefs.GetInt("cen") + "\n" + "第三名:" + PlayerPrefs.GetInt("min");

猜你喜欢

转载自www.cnblogs.com/satanj/p/9716056.html
今日推荐