public void ResetStatsButton_Pressed() { PopupManager.Get().NewQuestion(PopupType.Warning, "", "Reset Your Local and Server Stats?", (PopupQuestionResult result) => { if (result == PopupQuestionResult.Accept) { PlayerPrefs.DeleteAll(); StartCoroutine(TaskExtension.YieldWait(UserDatabase.Get().PostUserHighScore(0))); } }); }
public void GameOver() { Time.timeScale = 0.0f; InputController.DisableInput(); UIManager.GetInstance().ShowGameOverPanel(); TetrisGame.GetInstance().GameOver(); // Post highscore to database. if (isHighscoreBitten) { isHighscoreBitten = false; UserDatabase.Get().SyncUserHighscore(); } }
private void LoginClick(object sender, RoutedEventArgs e) { User logged = _db.Get(textboxLogin.Text, textboxPassword.Password); if (logged != null) { _parent.LoggedUser = logged; _parent.Close(); } else { MessageBox.Show("Login and/or password is invalid"); } }
void AuthStateChanged(object sender, System.EventArgs eventArgs) { if (auth.CurrentUser != user) { user = auth.CurrentUser; if (auth.CurrentUser == null) { // SignedOut PlayerPrefs.SetInt("highscore", 0); PlayerPrefs.Save(); } else { // SignedIn UserDatabase.Get().SyncUserHighscore(); } } }
private void Signup_Click(object sender, RoutedEventArgs e) { if (textboxPassword.Password == textboxConfirm.Password) { if (_db.Add(textboxLogin.Text, textboxPassword.Password)) { _parent.LoggedUser = _db.Get(textboxLogin.Text, textboxPassword.Password); _parent.Close(); } else { MessageBox.Show("User with such login already exists"); } } else { MessageBox.Show("Passwords don't match"); } }
public object Login(User user) { User authUser = UserDatabase.Get(user.Login, user.Password); if (authUser == null) { return(NotFound(new { message = "Invalid credentials" })); } string token = TokenService.GenerateToken(user, Startup.PrivateKey); user.Password = ""; return(new { user = user, token = token }); }
IEnumerator LoadUserDatas() { PopupManager.Get().OpenLoading("", "Loading..."); Task <UserData[]> task = UserDatabase.Get().GetAllUserData(); yield return(TaskExtension.YieldWait(task)); if (task.IsCompleted) { UserData[] userDatas = task.Result; if (userDatas.Length > 0) { foreach (UserData userData in userDatas) { ScoreBoardEntry entry = Instantiate(scoreBoardEntryPrefab, scoreBoardTable); entry.Init(userData.iconURL, userData.name, userData.highScore); scoreBoardEntries.Add(entry); } } } PopupManager.Get().CloseLoading(); }