// 多重インスタンス作成を防止 void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } // 保存していたハイスコアの取得(なければ初期値0) iHighScore = PlayerPrefs.GetInt(key, 0); }
public void Awake() { //debugInit(); _instance = this; _hiScores = new List <KeyValuePair <string, ulong> >(); _hiScores.Add(new KeyValuePair <string, ulong>( PlayerPrefs.GetString(Tags.HiScoreName1, "aaa"), System.Convert.ToUInt64(PlayerPrefs.GetString(Tags.HiScoreValue1, "1000000")) )); _hiScores.Add(new KeyValuePair <string, ulong>( PlayerPrefs.GetString(Tags.HiScoreName2, "bbb"), System.Convert.ToUInt64(PlayerPrefs.GetString(Tags.HiScoreValue2, "500000")) )); _hiScores.Add(new KeyValuePair <string, ulong>( PlayerPrefs.GetString(Tags.HiScoreName3, "ccc"), System.Convert.ToUInt64(PlayerPrefs.GetString(Tags.HiScoreValue3, "10000")) )); _hiScores.OrderByDescending(entry => entry.Value); }