void OnFacebookLogin(bool success) { if (success) { // Optional stuff if you want to store the Facebook username inside the Gamedonia user profile Dictionary <string, object> profile = new Dictionary <string, object>(); profile.Add("nickname", fbUserName); profile.Add("registerDate", DateTime.Now); GamedoniaUsers.UpdateUser(profile, OnLogin); } else { errorMsg = GamedoniaBackend.getLastError().ToString(); Debug.Log(errorMsg); } }
public void saveAvatar() { string avatar = skinCode.ToString() + "_" + a_hairstyle + "_" + currentHairstyleMaterial.ToString() + "_" + currentHead.ToString() + "_" + a_shirt + "_" + currentShirtMaterial.ToString() + "_" + a_trouser + "_" + currentTrouserMaterial.ToString(); Dictionary <string, object> profile = new Dictionary <string, object>(); profile.Add("avatar", avatar); PlayerManager.I.player.avatar = avatar; GamedoniaUsers.UpdateUser(profile, OnUpdate); }
public void AddFriend(string name) { friends.Add(name, new List <int> ()); GamedoniaUsers.GetUser(name, delegate(bool success, GDUserProfile friendProfile) { if (success) { Dictionary <string, object> oppProfile = new Dictionary <string, object>(); oppProfile = friendProfile.profile; friendProfiles.Add(name, oppProfile); Save(); } }); // Update player list in backend Dictionary <string, object> profile = GetPlayerById(player.playerID); profile ["friends"] = friends; GamedoniaUsers.UpdateUser(profile); }
void OnFacebookLogin(bool success) { if (success) { //Application.LoadLevel("UserDetailsScene"); //Optional stuf if oyu want to store the facebook username inside the Gamedonia user profile Dictionary <string, object> profile = new Dictionary <string, object>(); profile.Add("nickname", fbUserName); profile.Add("registerDate", DateTime.Now); GamedoniaUsers.UpdateUser(profile, OnLogin); } else { errorMsg = Gamedonia.getLastError().ToString(); Debug.Log(errorMsg); } }
public void UnlockNewAttribute(string id = "") { // Get friend by id from dictionary if (id == "") { id = currentOpponentInfo["_id"].ToString(); } List <int> attributesList = GetFriendAttributes(id); if (attributesList.Count != 5) { player.playerWonAttr++; if (attributesList.Count == 0) { attributesList.Add(0); // We use this in the end scene to determine which attribute to show MatchManager.I.lastAttributeKey = 0; } else { attributesList.Add(attributesList.Count); MatchManager.I.lastAttributeKey = attributesList.Count - 1; } //string attributeName = GetPlayerAttribute (attributesList.Count); if (friends.ContainsKey(id)) { Dictionary <string, object> updateProfile = new Dictionary <string, object> (); friends [id] = attributesList; updateProfile ["_id"] = player.playerID; updateProfile ["wonAttr"] = player.playerWonAttr; updateProfile ["friends"] = friends; GamedoniaUsers.UpdateUser(updateProfile, delegate(bool success) { }); } } else { MatchManager.I.lastAttributeKey = -1; } }
private void addEmptyProfile() { Dictionary <string, object> profile = new Dictionary <string, object>(); profile.Add("name", fbUserName); profile.Add("color", ""); profile.Add("hobby", ""); profile.Add("film", ""); profile.Add("age", 0); profile.Add("lvl", 1); profile.Add("instelling", ""); profile.Add("wonAttr", 0); profile.Add("friends", new Dictionary <string, object> ()); profile.Add("admin", false); profile.Add("avatar", ""); profile.Add("created_profile", false); GamedoniaUsers.UpdateUser(profile, OnLogin); }
private IEnumerator processInformation() { checkAvailableName(); while (!searchComplete) { yield return(new WaitForSeconds(1)); } bool returnValue = true; foreach (KeyValuePair <string, string> error in errorData) { InputField input = (InputField)GameObject.Find(error.Key).GetComponent <InputField>(); ValidateField(input); if (input.text == error.Value) { returnValue = false; } } if (returnValue && nameIsAvailable) { // Store to database LoggedInUser.profile ["name"] = p_name.text; LoggedInUser.profile ["age"] = int.Parse(p_age.text); LoggedInUser.profile ["color"] = p_color.text; LoggedInUser.profile ["hobby"] = p_hobby.text; LoggedInUser.profile ["film"] = p_film.text; LoggedInUser.profile ["instelling"] = p_instelling.text; LoggedInUser.profile ["created_profile"] = true; // Store locally PlayerManager.I.changeProfile(new PlayerProfile(p_name.text, int.Parse(p_age.text), p_color.text, p_hobby.text, p_film.text, p_instelling.text)); PlayerManager.I.player.avatar = LoggedInUser.profile ["avatar"].ToString(); PlayerManager.I.player.admin = (LoggedInUser.profile ["admin"].ToString() == "True" ? true : false); if (!PlayerManager.I.changingProfile) { PlayerManager.I.player.playerLvl = int.Parse(LoggedInUser.profile ["lvl"].ToString()); int attributesAmount = PlayerManager.I.getTotalFriendAttributes((Dictionary <string, object>)LoggedInUser.profile["friends"]); PlayerManager.I.player.playerWonAttr = attributesAmount; LoggedInUser.profile ["wonAttr"] = attributesAmount; } loader.enableLoader(); GamedoniaUsers.UpdateUser(LoggedInUser.profile, delegate(bool success) { if (success) { if (PlayerManager.I.changingProfile) { Loader.SetActive(false); SceneManager.LoadScene("Profile"); } else { Loader.SetActive(false); PlayerManager.I.player.createdProfile = true; SceneManager.LoadScene("Avatar"); } } }, true); } }