void HandleGetMe(bool success, GDUserProfile profile) { if (this.callback != null) { callback(true); } }
void OnGetMe(bool success, GDUserProfile userProfile) { if (success) { this.userProfile = userProfile; } else { errorMsg = Gamedonia.getLastError().ToString(); Debug.Log(errorMsg); } }
void OnGetMe(bool success, GDUserProfile userProfile) { if (success) { LoggedInUser = userProfile; // Set playerprefs, store so we dont need to use http requests when we dont need it PlayerManager.I.player.playerID = LoggedInUser._id; // Player id fillExistingProfile(); } else { errorMsg = GamedoniaBackend.getLastError().ToString(); } }
public static void LinkUser(Credentials credentials, Action <bool, GDUserProfile> callback) { Gamedonia.RunCoroutine( GamedoniaRequest.post("/account/link", JsonMapper.ToJson(credentials), null, sessionToken.session_token, null, delegate(bool success, object data) { if (success) { me = JsonMapper.ToObject <GDUserProfile>((string)data); } if (callback != null) { callback(success, me); } } ) ); }
public static void GetMe(Action <bool, GDUserProfile> callback) { Gamedonia.RunCoroutine( GamedoniaRequest.get("/account/me", sessionToken.session_token, delegate(bool success, object data) { if (success) { me = JsonMapper.ToObject <GDUserProfile>((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); Gamedonia.RunCoroutine( GamedoniaRequest.post("/account/retrieve", JsonMapper.ToJson(body), null, sessionToken.session_token, null, delegate(bool success, object data) { GDUserProfile user = null; if (success) { user = JsonMapper.ToObject <GDUserProfile>((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) { Gamedonia.RunCoroutine( GamedoniaRequest.post("/account/update", JsonMapper.ToJson(profile), null, sessionToken.session_token, null, delegate(bool success, object data) { if (success) { me = JsonMapper.ToObject <GDUserProfile>((string)data); } if (callback != null) { callback(success); } } ) ); } else { Gamedonia.RunCoroutine( GamedoniaRequest.put("/account/update", JsonMapper.ToJson(profile), null, sessionToken.session_token, null, delegate(bool success, object data) { if (success) { me = JsonMapper.ToObject <GDUserProfile>((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) { Gamedonia.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 { Gamedonia.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) { Gamedonia.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) { Gamedonia.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); }
void OnGetMe(bool success, GDUserProfile userProfile) { if (success) { LoggedInUser = userProfile; // Set playerprefs, store so we dont need to use http requests when we dont need it Debug.Log(LoggedInUser._id); PlayerManager.I.player.playerID = LoggedInUser._id; // Player id fillExistingProfile (); }else { errorMsg = GamedoniaBackend.getLastError().ToString(); } }