public void Load(Action <UM_AchievementsLoadResult> callback) { Dictionary <string, ISN_GKAchievement> achievementsDict = new Dictionary <string, ISN_GKAchievement>(); foreach (var achievement in ISN_GKAchievement.GetGameAchievements()) { achievementsDict.Add(achievement.Identifier, achievement); } ISN_GKAchievement.LoadAchievements((result) => { UM_AchievementsLoadResult loadResult; if (result.IsSucceeded) { foreach (var achievement in result.Achievements) { if (achievementsDict.ContainsKey(achievement.Identifier)) { string name = achievementsDict[achievement.Identifier].Name; achievement.Name = name; achievementsDict[achievement.Identifier] = achievement; } else { achievementsDict.Add(achievement.Identifier, achievement); } } var achievements = new List <UM_iAchievement>(); foreach (var pair in achievementsDict) { var achievement = pair.Value; var iosAchievement = new UM_IOSAchievement(achievement); SetAchievementCahce(iosAchievement); achievements.Add(iosAchievement); } loadResult = new UM_AchievementsLoadResult(achievements); } else { loadResult = new UM_AchievementsLoadResult(result.Error); } callback.Invoke(loadResult); }); }
public void Load(Action <UM_AchievementsLoadResult> callback) { UM_EditorAPIEmulator.WaitForNetwork(() => { UM_AchievementsLoadResult loadResult; var achievements = new List <UM_iAchievement>(); foreach (var achievement in ISN_GKAchievement.GetGameAchievements()) { if (UM_EditorAPIEmulator.HasKey(achievement.Identifier)) { achievement.PercentComplete = UM_EditorAPIEmulator.GetFloat(achievement.Identifier); } var iosAchievement = new UM_IOSAchievement(achievement); SetAchievementCahce(iosAchievement); achievements.Add(iosAchievement); } loadResult = new UM_AchievementsLoadResult(achievements); callback.Invoke(loadResult); }); }