public void FaceBookLogin() { GetMethods.GetUserId(email, (id) => { if (id != "0") // The user exits in the data base // Verify if an Update is necessary. { UpdateMethods.UpdateUsersDatabase(id, userName, age, AppManeger.instance.userGender.ToString(), (result) => { Debug.Log(string.Format("Update {0}", result)); }); string fileName = string.Format("Prefs_{0}", AppManeger.instance.userID); //GetMethods.GetUserPrefs(id, (prefsResult) => {PrefsResult(prefsResult);}); // Check if the user are in the Prefs Database if (SaveLoadData.FileExits(fileName)) // If exit { SaveLoadData.Load(fileName, SaveLoadData.DataType.UserPrefs); // load from device GoToCheersPanel(); // Means the user has everyting setted; } else { GetMethods.GetUserPrefs(id, (prefsResult) => { PrefsResult(prefsResult); }); // Check if the user are in the Prefs Database } } else // User don't exit in the data base { PostMethods.InsertUserIntoUsersDatabase(userName, age, email, gender, (result) => { InsertUserResult(result); }); } }); }
void OnEnable() { string fileName = string.Format("Prefs_{0}", AppManeger.instance.userID); if (SaveLoadData.FileExits(fileName)) // If exit, user already used it before. { Text contButText = continueBut.GetComponentInChildren <Text> (); contButText.text = "Salvar"; OnChooseSex(YourSexIsMale, YourSexIsFemale, WantToMeetMan, WantToMeetWoman, UpdatePrefs); SetInitialConditions(); } else //Otherwise, means the user is using it for the first time { OnChooseSex(YourSexIsMale, YourSexIsFemale, WantToMeetMan, WantToMeetWoman, Continue); AppManeger.instance.wantAge [0] = (int)minAgeSlider.value; AppManeger.instance.wantAge [1] = -1 * (int)maxAgeSlider.value; } }