void HandleGetMe(bool success, GDUserProfile profile) { if (this.callback != null) { callback(success); } }
void HandleGetMe(bool success, GDUserProfile profile) { if (_callback != null) { _callback(true); } }
private static List <GDMatch> DeserializeMatches(List <object> matches) { List <GDMatch> matchesList = new List <GDMatch> (); foreach (object matchObj in matches) { Dictionary <string, object> matchMap = matchObj as Dictionary <string, object>; GDMatch match = new GDMatch(); match._id = matchMap ["_id"] as string; match.state = matchMap ["state"] as string; match.properties = matchMap ["properties"] as Dictionary <string, object>; List <object> usersList = matchMap ["users"] as List <object>; foreach (object userObj in usersList) { Dictionary <string, object> userMap = userObj as Dictionary <string, object>; GDUserProfile user = new GDUserProfile(); user._id = userMap["_id"] as string; user.profile = userMap["profile"] as Dictionary <string, object>; match.users.Add(user); } matchesList.Add(match); } return(matchesList); }
private static GDUserProfile DeserializeUserProfile(string data) { //Debug.Log ("Deserializing user"); IDictionary userMap = Json.Deserialize((string)data) as IDictionary; GDUserProfile user = new GDUserProfile(); user._id = userMap["_id"] as string; user.profile = userMap["profile"] as Dictionary <string, object>; return(user); }
public static void LinkUser(Credentials credentials, Action <bool, GDUserProfile> callback) { GamedoniaBackend.RunCoroutine( GamedoniaRequest.post("/account/link", JsonMapper.ToJson(credentials), null, sessionToken.session_token, null, delegate(bool success, object data) { if (success) { me = DeserializeUserProfile((string)data); } if (callback != null) { callback(success, me); } } ) ); }
public static void GetMe(Action <bool, GDUserProfile> callback) { GamedoniaBackend.RunCoroutine( GamedoniaRequest.get("/account/me", sessionToken.session_token, delegate(bool success, object data) { //if (success) me = JsonMapper.ToObject<GDUserProfile>((string)data); if (success) { me = DeserializeUserProfile((string)data); } if (callback != null) { callback(success, me); } } ) ); }
public static void GetUser(string userId, Action <bool, GDUserProfile> callback) { Dictionary <string, string> body = new Dictionary <string, string>(); body.Add("_id", userId); GamedoniaBackend.RunCoroutine( GamedoniaRequest.post("/account/retrieve", JsonMapper.ToJson(body), null, sessionToken.session_token, null, delegate(bool success, object data) { GDUserProfile user = null; if (success) { user = DeserializeUserProfile((string)data); } if (callback != null) { callback(success, user); } } ) ); }
public static void UpdateUser(Dictionary <string, object> profile, Action <bool> callback = null, bool overwrite = false) { if (!overwrite) { GamedoniaBackend.RunCoroutine( GamedoniaRequest.post("/account/update", JsonMapper.ToJson(profile), null, sessionToken.session_token, null, delegate(bool success, object data) { if (success) { me = DeserializeUserProfile((string)data); } if (callback != null) { callback(success); } } ) ); } else { GamedoniaBackend.RunCoroutine( GamedoniaRequest.put("/account/update", JsonMapper.ToJson(profile), null, sessionToken.session_token, null, delegate(bool success, object data) { if (success) { me = DeserializeUserProfile((string)data); } if (callback != null) { callback(success); } } ) ); } }
void HandleGetMe(bool success, GDUserProfile profile) { if (this.callback != null) callback(success); }
private static GDUserProfile DeserializeUserProfile(string data) { //Debug.Log ("Deserializing user"); IDictionary userMap = Json.Deserialize((string)data) as IDictionary; GDUserProfile user = new GDUserProfile (); user._id = userMap["_id"] as string; user.profile = userMap["profile"] as Dictionary<string,object>; return user; }
public static void UpdateUser(Dictionary<string,object> profile, Action<bool> callback = null, bool overwrite = false) { if (!overwrite) { GamedoniaBackend.RunCoroutine( GamedoniaRequest.post("/account/update",JsonMapper.ToJson(profile),null,sessionToken.session_token,null, delegate (bool success, object data) { if (success) me = DeserializeUserProfile((string)data); if (callback != null) callback(success); } ) ); }else { GamedoniaBackend.RunCoroutine( GamedoniaRequest.put("/account/update",JsonMapper.ToJson(profile),null,sessionToken.session_token,null, delegate (bool success, object data) { if (success) me = DeserializeUserProfile((string)data); if (callback != null) callback(success); } ) ); } }
public static void LinkUser(Credentials credentials, Action<bool, GDUserProfile> callback) { GamedoniaBackend.RunCoroutine( GamedoniaRequest.post("/account/link", JsonMapper.ToJson(credentials), null, sessionToken.session_token, null, delegate (bool success, object data) { if (success) me = DeserializeUserProfile((string)data); if (callback != null) callback(success, me); } ) ); }
public static void GetMe(Action<bool, GDUserProfile> callback) { GamedoniaBackend.RunCoroutine( GamedoniaRequest.get("/account/me",sessionToken.session_token, delegate (bool success, object data) { //if (success) me = JsonMapper.ToObject<GDUserProfile>((string)data); if (success) me = DeserializeUserProfile((string)data); if (callback != null) callback(success, me); } ) ); }
void HandleGetMe(bool success, GDUserProfile profile) { if (_callback != null) _callback(true); }
private static List<GDMatch> DeserializeMatches(List<object> matches) { List<GDMatch> matchesList = new List<GDMatch> (); foreach (object matchObj in matches) { Dictionary<string,object> matchMap = matchObj as Dictionary<string,object>; GDMatch match = new GDMatch (); match._id = matchMap ["_id"] as string; match.state = matchMap ["state"] as string; match.properties = matchMap ["properties"] as Dictionary<string,object>; List<object> usersList = matchMap ["users"] as List<object>; foreach(object userObj in usersList) { Dictionary<string,object> userMap = userObj as Dictionary<string,object>; GDUserProfile user = new GDUserProfile(); user._id = userMap["_id"] as string; user.profile = userMap["profile"] as Dictionary<string,object>; match.users.Add(user); } matchesList.Add(match); } return matchesList; }