public static void ListWithPlayer(Action done) { const string section = "PTestAchievements.ListWithPlayer"; Debug.Log(section); PAchievementOptions options = new PAchievementOptions { playerid = "1", filters = new PDictionary { { "rnd", rnd } } }; Playtomic.Achievements.List(options, (achievements, r) => { AssertTrue(section, "Request succeeded", r.success); AssertEquals(section, "No errorcode", r.errorcode, 0); AssertEquals(section, "Achievement 1 is correct", achievements[0].achievement, "Super Mega Achievement #1"); AssertEquals(section, "Achievement 2 is correct", achievements[1].achievement, "Super Mega Achievement #2"); AssertEquals(section, "Achievement 3 is correct", achievements[2].achievement, "Super Mega Achievement #3"); AssertTrue(section, "Achievement 1 has no friends", achievements[0].friends == null); AssertTrue(section, "Achievement 2 has no friends", achievements[1].friends == null); AssertTrue(section, "Achievement 3 has no friends", achievements[2].friends == null); AssertTrue(section, "Achievement 1 has does have player", achievements[0].player != null); AssertTrue(section, "Achievement 2 has no player", achievements[1].player == null); AssertTrue(section, "Achievement 3 has no player", achievements[2].player == null); AssertTrue(section, "Achievement 1 player is ben", achievements[0].player.playername == "ben"); done(); }); }
public static void ListWithFriends(Action done) { const string section = "PTestAchievements.ListWithFriends"; Debug.Log(section); PAchievementOptions options = new PAchievementOptions { friendslist = new List <string>(new [] { "1", "2", "3" }), filters = new PDictionary { { "rnd", rnd } } }; Playtomic.Achievements.List(options, (achievements, r) => { AssertTrue(section, "Request succeeded", r.success); AssertEquals(section, "No errorcode", r.errorcode, 0); AssertEquals(section, "Achievement 1 is correct", achievements[0].achievement, "Super Mega Achievement #1"); AssertEquals(section, "Achievement 2 is correct", achievements[1].achievement, "Super Mega Achievement #2"); AssertEquals(section, "Achievement 3 is correct", achievements[2].achievement, "Super Mega Achievement #3"); AssertTrue(section, "Achievement 1 has friends", achievements[0].friends != null); AssertTrue(section, "Achievement 2 has friends", achievements[1].friends != null); AssertTrue(section, "Achievement 3 has no friends", achievements[2].friends == null); AssertTrue(section, "Achievement 1 has 3 friends", achievements[0].friends.Count == 3); AssertTrue(section, "Achievement 1 friend 1", achievements[0].friends[0].playername == "ben"); AssertTrue(section, "Achievement 1 friend 2", achievements[0].friends[1].playername == "michelle"); AssertTrue(section, "Achievement 1 friend 3", achievements[0].friends[2].playername == "peter"); AssertTrue(section, "Achievement 2 has 2 friend", achievements[1].friends.Count == 2); AssertTrue(section, "Achievement 2 friend 1", achievements[1].friends[0].playername == "michelle"); AssertTrue(section, "Achievement 2 friend 2", achievements[1].friends[1].playername == "peter"); done(); }); }
public void List <T>(PAchievementOptions options, Action <List <T>, PResponse> callback) where T : PlayerAchievement, new() { Playtomic.API.StartCoroutine(SendListRequest(SECTION, LIST, callback, options)); }
/** * Lists all achievements * @param options The list options * @param callback Your callback Action<List<Achievement>, PResponse> */ public void List(PAchievementOptions options, Action <List <PlayerAchievement>, PResponse> callback) { List <PlayerAchievement>(options, callback); }
public static void List(Action done) { var section = "PTestAchievements.List"; Debug.Log(section); var achievements = new List <PlayerAchievement>(); achievements.Add(new PlayerAchievement( new Dictionary <string, object> { { "achievement", "Super Mega Achievement #1" }, { "achievementkey", "secretkey" }, { "playerid", "1" }, { "playername", "ben" }, { "fields", new Dictionary <string, object> { { "rnd", rnd } } } })); achievements.Add(new PlayerAchievement( new Dictionary <string, object> { { "achievement", "Super Mega Achievement #1" }, { "achievementkey", "secretkey" }, { "playerid", "2" }, { "playername", "michelle" }, { "fields", new Dictionary <string, object> { { "rnd", rnd } } } })); achievements.Add(new PlayerAchievement( new Dictionary <string, object> { { "achievement", "Super Mega Achievement #1" }, { "achievementkey", "secretkey" }, { "playerid", "3" }, { "playername", "peter" }, { "fields", new Dictionary <string, object> { { "rnd", rnd } } } })); achievements.Add(new PlayerAchievement( new Dictionary <string, object> { { "achievement", "Super Mega Achievement #2" }, { "achievementkey", "secretkey2" }, { "playerid", "3" }, { "playername", "peter" }, { "fields", new Dictionary <string, object> { { "rnd", rnd } } } })); achievements.Add(new PlayerAchievement( new Dictionary <string, object> { { "achievement", "Super Mega Achievement #2" }, { "achievementkey", "secretkey2" }, { "playerid", "2" }, { "playername", "michelle" }, { "fields", new Dictionary <string, object> { { "rnd", rnd } } } })); ListLoop(section, achievements, () => { PAchievementOptions options = new PAchievementOptions { filters = new PDictionary { { "rnd", rnd } } }; Playtomic.Achievements.List(options, (ach, r2) => { AssertTrue(section, "Request succeeded", r2.success); AssertEquals(section, "No errorcode", r2.errorcode, 0); AssertEquals(section, "Achievement 1 is correct", ach[0].achievement, "Super Mega Achievement #1"); AssertEquals(section, "Achievement 2 is correct", ach[1].achievement, "Super Mega Achievement #2"); AssertEquals(section, "Achievement 3 is correct", ach[2].achievement, "Super Mega Achievement #3"); done(); }); }); }
public static void ListWithPlayerAndFriends(Action done) { const string section = "PTestAchievements.ListWithPlayerAndFriends"; Debug.Log (section); PAchievementOptions options = new PAchievementOptions { playerid = "1", filters = new PDictionary{ {"rnd",rnd} }, friendslist = new List<string>(new [] {"1", "2", "3"}), }; Playtomic.Achievements.List(options, (achievements, r) => { AssertTrue(section, "Request succeeded", r.success); AssertEquals(section, "No errorcode", r.errorcode, 0); AssertEquals(section, "Achievement 1 is correct", achievements[0].achievement, "Super Mega Achievement #1"); AssertEquals(section, "Achievement 2 is correct", achievements[1].achievement, "Super Mega Achievement #2"); AssertEquals(section, "Achievement 3 is correct", achievements[2].achievement, "Super Mega Achievement #3"); AssertTrue(section, "Achievement 1 has player", achievements[0].player != null); AssertTrue(section, "Achievement 1 has friends", achievements[0].friends != null); AssertTrue(section, "Achievement 2 has friends", achievements[1].friends != null); AssertTrue(section, "Achievement 2 has no player", achievements[1].player == null); AssertTrue(section, "Achievement 3 has no friends", achievements[2].friends == null); AssertTrue(section, "Achievement 3 has no player", achievements[2].player == null); AssertTrue(section, "Achievement 1 player", achievements[0].player.playername == "ben"); AssertTrue(section, "Achievement 1 has 2 friend", achievements[0].friends.Count == 2); AssertTrue(section, "Achievement 1 friend 1", achievements[0].friends[0].playername == "michelle"); AssertTrue(section, "Achievement 1 friend 2", achievements[0].friends[1].playername == "peter"); AssertTrue(section, "Achievement 2 has 2 friend", achievements[1].friends.Count == 2); AssertTrue(section, "Achievement 2 friend 1", achievements[1].friends[0].playername == "michelle"); AssertTrue(section, "Achievement 2 friend 2", achievements[1].friends[1].playername == "peter"); done(); }); }
public static void ListWithPlayer(Action done) { const string section = "PTestAchievements.ListWithPlayer"; Debug.Log (section); PAchievementOptions options = new PAchievementOptions { playerid = "1", filters = new PDictionary{ {"rnd",rnd} } }; Playtomic.Achievements.List(options, (achievements, r) => { AssertTrue(section, "Request succeeded", r.success); AssertEquals(section, "No errorcode", r.errorcode, 0); AssertEquals(section, "Achievement 1 is correct", achievements[0].achievement, "Super Mega Achievement #1"); AssertEquals(section, "Achievement 2 is correct", achievements[1].achievement, "Super Mega Achievement #2"); AssertEquals(section, "Achievement 3 is correct", achievements[2].achievement, "Super Mega Achievement #3"); AssertTrue(section, "Achievement 1 has no friends", achievements[0].friends == null); AssertTrue(section, "Achievement 2 has no friends", achievements[1].friends == null); AssertTrue(section, "Achievement 3 has no friends", achievements[2].friends == null); AssertTrue(section, "Achievement 1 has does have player", achievements[0].player != null); AssertTrue(section, "Achievement 2 has no player", achievements[1].player == null); AssertTrue(section, "Achievement 3 has no player", achievements[2].player == null); AssertTrue(section, "Achievement 1 player is ben", achievements[0].player.playername == "ben"); done(); }); }
public static void List(Action done) { var section = "PTestAchievements.List"; Debug.Log (section); var achievements = new List<PlayerAchievement>(); achievements.Add(new PlayerAchievement( new Dictionary<string,object> { {"achievement", "Super Mega Achievement #1"}, {"achievementkey", "secretkey"}, {"playerid", "1"}, {"playername", "ben"}, {"fields", new Dictionary<string,object> { {"rnd", rnd} }} })); achievements.Add(new PlayerAchievement( new Dictionary<string,object> { {"achievement", "Super Mega Achievement #1"}, {"achievementkey", "secretkey"}, {"playerid", "2"}, {"playername", "michelle"}, {"fields", new Dictionary<string,object> { {"rnd", rnd} }} })); achievements.Add(new PlayerAchievement( new Dictionary<string,object> { {"achievement", "Super Mega Achievement #1"}, {"achievementkey", "secretkey"}, {"playerid", "3"}, {"playername", "peter"}, {"fields", new Dictionary<string,object> { {"rnd", rnd} }} })); achievements.Add(new PlayerAchievement( new Dictionary<string,object> { {"achievement", "Super Mega Achievement #2"}, {"achievementkey", "secretkey2"}, {"playerid", "3"}, {"playername", "peter"}, {"fields", new Dictionary<string,object> { {"rnd", rnd} }} })); achievements.Add(new PlayerAchievement( new Dictionary<string,object> { {"achievement", "Super Mega Achievement #2"}, {"achievementkey", "secretkey2"}, {"playerid", "2"}, {"playername", "michelle"}, {"fields", new Dictionary<string,object> { {"rnd", rnd} }} })); ListLoop (section, achievements, () => { PAchievementOptions options = new PAchievementOptions { filters = new PDictionary{ {"rnd",rnd} } }; Playtomic.Achievements.List(options, (ach, r2) => { AssertTrue(section, "Request succeeded", r2.success); AssertEquals(section, "No errorcode", r2.errorcode, 0); AssertEquals(section, "Achievement 1 is correct", ach[0].achievement, "Super Mega Achievement #1"); AssertEquals(section, "Achievement 2 is correct", ach[1].achievement, "Super Mega Achievement #2"); AssertEquals(section, "Achievement 3 is correct", ach[2].achievement, "Super Mega Achievement #3"); done(); }); }); }