Beispiel #1
0
        //TODO make sure result returns autoLogin - don't pass it in
        public static void CreateUser(LoginResult result)
        {
            panelStack.Clear();

            TacoUser user = new TacoUser {
                email         = result.mail,
                userId        = result.userId,
                funds         = 0.0f,
                token         = result.token,
                gToken        = result.gToken,
                highScoreUser = result.highScoreUser,
                ticket        = result.ticket,
                //avatar = result.avatar,
            };

            User = user;
            PlayerPrefs.SetInt("highscoretype", 0);
            PlayerPrefs.SetFloat("highscoreArcade", result.highScoreUser);

            UpdateAvatar(result.userName, result.funds, result.gToken);

            GameId        = result.gameId;
            GameName      = result.gameName;
            currentUserId = result.userId;

            print(GameId + " - " + GameName + " - " + currentUserId);

            ShowPanel(PanelNames.MyTournamentsPanel);
            CloseMessage();
        }
Beispiel #2
0
        public static void LogoutUser()
        {
            User = null;

            ActiveTournamentsList.Instance.Destroy();
            PrivateTournamentsList.Instance.Destroy();
            PublicTournamentsList.Instance.Destroy();
            StripeAddFundsManager.Instance.Destroy();

            GamePlay.Instance.GameStatus = GameState.MainMenu;
            PlayerPrefs.SetInt(TacoConfig.TacoHighScoresType, 0);
            PlayerPrefs.SetFloat(TacoConfig.TacoHighScoresPerhapsText, 0);
            PlayerPrefs.SetFloat("highscoreArcade", 0);
            PlayerPrefs.Save();
            Highscore.Instance.highscore = PlayerPrefs.GetFloat("highscoreArcade");
            Highscore.Instance.UpdateManually();

            GameId        = 0;
            currentUserId = 0;

            // clear the user preferences that were for this user
            SetPreferenceString(UserPreferences.userToken, null);
            SetPreference(UserPreferences.autoLogin, 0);

            TacoAuthCanvas.SetActive(true);

            LoginPanel.GetComponent <LoginPanel>().Init();
            RegisterPanel.GetComponent <RegisterPanel>().Init();

            CloseTaco();
        }
Beispiel #3
0
        public static void UpdateUser(SessionResult result, string token)
        {
            panelStack.Clear();

            TacoUser user = new TacoUser {
                email         = result.user.email,            //.email,
                userId        = result.user.id,
                funds         = result.user.funds,
                token         = token,
                gToken        = result.gToken,
                highScoreUser = result.highScoreUser,
                ticket        = result.ticket,
                //avatar = result.avatar,
            };

            User = user;
            PlayerPrefs.SetInt("highscoretype", 0);
            PlayerPrefs.SetFloat("highscoreArcade", result.highScoreUser);

            UpdateAvatar(result.user.userName, result.user.funds, result.gToken);

            GameId        = result.game.id;
            GameName      = result.game.name;
            currentUserId = result.user.id;

            Setup();
            CloseMessage();
        }