public void OnAchievementsLoaded(string result) { // Result is a multiline string with new line terminating character for each achievement // format of string is // achievementId;name;type;description;state;totalSteps;currentSteps // for more information look at // https://developer.android.com/reference/com/google/android/gms/games/achievement/Achievement.html /* code from java * String sach = ach.getAchievementId()+";"+ach.getName()+";"+ach.getType()+";" +ach.getDescription()+";"+ach.getState()+";"+totSteps+";" +currentSteps; * * achs = achs + sach +"\n"; */ Debug.Log("OnAchievementsLoaded: " + result); string[] achievements = result.Split('\n'); acDescList = new List <GPGAchievementDescription>(achievements.Length); acList = new List <GPGAchievement>(achievements.Length); acExtraData = new List <ExtraACData>(achievements.Length); for (int i = 0; i < achievements.Length; i++) { string[] acInfo = achievements[i].Split(';'); if (acInfo.Length != 7) { continue; } GPGAchievementDescription desc = new GPGAchievementDescription(); GPGAchievement ac = new GPGAchievement(); ExtraACData acData = new ExtraACData(); desc.id = acInfo[0]; desc.title = acInfo[1]; desc.achievedDescription = acInfo[3]; desc.unachievedDescription = acInfo[3]; desc.hidden = (acInfo[4] == "STATE_HIDDEN"); desc.image = null; desc.points = 0; ac.id = acInfo[0]; ac.completed = (acInfo[4] == "STATE_UNLOCKED"); ac.hidden = (acInfo[4] == "STATE_HIDDEN"); ac.percentCompleted = (double)((double)System.Convert.ToInt32(acInfo[6]) / (double)System.Convert.ToInt32(acInfo[5])) * 100.0; acDescList.Add(desc); acList.Add(ac); acData.type = System.Convert.ToInt32(acInfo[2]); acData.state = System.Convert.ToInt32(acInfo[4]); acData.totalSteps = System.Convert.ToInt32(acInfo[5]); acData.currSteps = System.Convert.ToInt32(acInfo[6]); acExtraData.Add(acData); } if (onACLoadCB != null) { onACLoadCB(); } }
public void OnAchievementsLoaded(string result) { // Result is a multiline string with new line terminating character for each achievement // format of string is // achievementId;name;type;description;state;totalSteps;currentSteps // for more information look at // https://developer.android.com/reference/com/google/android/gms/games/achievement/Achievement.html /* code from java String sach = ach.getAchievementId()+";"+ach.getName()+";"+ach.getType()+";" +ach.getDescription()+";"+ach.getState()+";"+totSteps+";" +currentSteps; achs = achs + sach +"\n"; */ Debug.Log("OnAchievementsLoaded: " + result); string[] achievements = result.Split('\n'); acDescList = new List<GPGAchievementDescription>(achievements.Length); acList = new List<GPGAchievement>(achievements.Length); acExtraData = new List<ExtraACData>(achievements.Length); for (int i=0;i<achievements.Length;i++) { string[] acInfo = achievements[i].Split(';'); if (acInfo.Length != 7) continue; GPGAchievementDescription desc = new GPGAchievementDescription(); GPGAchievement ac = new GPGAchievement(); ExtraACData acData = new ExtraACData(); desc.id = acInfo[0]; desc.title = acInfo[1]; desc.achievedDescription = acInfo[3]; desc.unachievedDescription = acInfo[3]; desc.hidden = (acInfo[4] == "STATE_HIDDEN"); desc.image = null; desc.points = 0; ac.id = acInfo[0]; ac.completed = (acInfo[4] == "STATE_UNLOCKED"); ac.hidden = (acInfo[4] == "STATE_HIDDEN"); ac.percentCompleted = (double)((double)System.Convert.ToInt32(acInfo[6]) / (double)System.Convert.ToInt32(acInfo[5])) * 100.0; acDescList.Add(desc); acList.Add(ac); acData.type = System.Convert.ToInt32(acInfo[2]); acData.state = System.Convert.ToInt32(acInfo[4]); acData.totalSteps = System.Convert.ToInt32(acInfo[5]); acData.currSteps = System.Convert.ToInt32(acInfo[6]); acExtraData.Add(acData); } if (onACLoadCB != null) onACLoadCB(); }