public void SignUpWithEmail() { //Clearing result text if there was any message before UnityMainThreadDispatcher.Instance().Enqueue(ShowSignUpResults(string.Empty)); string email = uiController.signUpPanel.email.text; string password = uiController.signUpPanel.password.text; if (!string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(password)) { int day, month, year; try { day = int.Parse(daysList[uiController.dayDropDown.value]); month = int.Parse(monthsList[uiController.monthDropDown.value]); year = int.Parse(yearsList[uiController.yearDropDown.value]); } catch { string errorText = "Please Fill In Your Birthday!"; UnityMainThreadDispatcher.Instance().Enqueue(ShowSignUpResults(errorText)); return; } DateTime birthday = new DateTime(year, month, day); //Showing loading panel UnityMainThreadDispatcher.Instance().Enqueue(ShowLoadingPanel(true)); authController.SignUpWithEmail(email, password, (userID, _resultText, taskCompleted) => { UnityMainThreadDispatcher.Instance().Enqueue(ShowSignUpResults(_resultText)); if (taskCompleted) { //Adding user in Database after signing up databaseController.AddUser(userID, email, birthday, userData => { //Subscribing to the SetValueChange event, if value changes in DB it SetUserSettings(userData); }); } UnityMainThreadDispatcher.Instance().Enqueue(ShowLoadingPanel(false)); }); } else { string errorText = "Please Fill In Email and Password Fields!"; UnityMainThreadDispatcher.Instance().Enqueue(ShowSignUpResults(errorText)); } }
public void AddUser(User user) => DatabaseController.AddUser(user);