private void PopulateStaticData() { PPrefsSetting lss = Resources.Load(settingPath) as PPrefsSetting; this._achievementDescriptions = lss.GetAchievementDescription(); this._leaderboards = lss.GetLeaderboards(); PlayerPrefsSerializer.handleNonSerializable = true; foreach (AchievementDescription adesc in _achievementDescriptions) { //Debug.Log(" - AchieveDesc : "+adesc.id); if (PlayerPrefs.HasKey("achieve_" + adesc.id)) { _achievements.Add(PlayerPrefsSerializer.Load <Achievement>("achieve_" + adesc.id)); } } foreach (Leaderboard lboard in _leaderboards) { //Debug.Log(" - Leaderboard : "+lboard.id); if (PlayerPrefs.HasKey("scores_" + lboard.id)) { lboard.SetScores(PlayerPrefsSerializer.Load <Score[]>("scores_" + lboard.id)); } } }
static void CreatePPrefsSetting() { string path = defaultAssetPath; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path += defaultAssetName; if (File.Exists(path)) { EditorUtility.DisplayDialog("Fatal error", path.Substring(Application.dataPath.Length - 6) + " already exists", "Ok"); return; } path = path.Substring(Application.dataPath.Length - 6); PPrefsSetting setting = ScriptableObject.CreateInstance("PPrefsSetting") as PPrefsSetting; setting.achievements = new PPrefsSetting.SeAchivementDescription[0]; AssetDatabase.CreateAsset(setting, path); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); //select to new one Object[] selection = new Object[1]; selection[0] = setting; Selection.objects = selection; }