Esempio n. 1
0
        public void TestRemoveFields()
        {
            IObjectState state = new MutableObjectState {
                ServerData = new Dictionary <string, object>()
                {
                    { "username", "kevin" },
                    { "name", "andrew" }
                }
            };
            ParseUser user = ParseObjectExtensions.FromState <ParseUser>(state, "_User");

            Assert.Throws <ArgumentException>(() => user.Remove("username"));
            Assert.DoesNotThrow(() => user.Remove("name"));
            Assert.False(user.ContainsKey("name"));
        }
Esempio n. 2
0
        public void TestRemoveFields()
        {
            IObjectState state = new MutableObjectState
            {
                ServerData = new Dictionary <string, object>
                {
                    ["username"] = "******",
                    ["name"]     = "andrew"
                }
            };
            ParseUser user = ParseObjectExtensions.FromState <ParseUser>(state, "_User");

            Assert.ThrowsException <ArgumentException>(() => user.Remove("username"));
            try { user.Remove("name"); }
            catch { Assert.Fail(); }
            Assert.IsFalse(user.ContainsKey("name"));
        }
Esempio n. 3
0
    private void checkIfParseUserFbIdSaved(string fbId)
    {
        ParseUser user             = ParseUser.CurrentUser;
        bool      parseUserFbSaved = false;

        if (user.ContainsKey("fbId"))
        {
            if (user["fbId"].Equals(fbId))
            {
                parseUserFbSaved = true;
            }
        }

        if (!parseUserFbSaved)
        {
            user["fbId"] = fbId;
        }

        parseUserUpdatePending = true;
    }
Esempio n. 4
0
    private void updateProfileInfo(ParseUser parsedata)
    {
        (ProfileUsername.placeholder as Text).text = parsedata.Username;
        (ProfileEmail.placeholder as Text).text    = parsedata.Email;
        FbIdLabel.text = "not linked";

        bool isFBLinked = parsedata.ContainsKey(ParsePlayer.KEY_FBID);

        DefaultProfilePic.gameObject.SetActive(!isFBLinked);
        FBProfilePic.gameObject.SetActive(false);

        if (isFBLinked)
        {
            FbIdLabel.text = parsedata[ParsePlayer.KEY_FBID] as string;
            FB.API("/me/picture?redirect=false", HttpMethod.GET, this.refreshFBImage);
        }

        ProfileUsername.text = "";
        ProfilePassword.text = "";
        ProfileEmail.text    = "";

        UpdateButton.interactable = false;
    }
Esempio n. 5
0
        private void ProfileView_Loaded(object sender, RoutedEventArgs e)
        {
            ParseUser user = ParseUser.CurrentUser;

            if (user != null)
            {
                if (user["nameSurname"] != null)
                {
                    nameSurname.Text = user["nameSurname"].ToString();
                }

                if (user.ContainsKey("withFacebook") == true)
                {
                    if (user["withFacebook"].ToString() == "True")
                    {
                        username.Text = "Facebook ile bağlanıldı.";
                    }

                    else
                    {
                        username.Text = user["username"].ToString();
                    }
                }

                else
                {
                    username.Text = user["username"].ToString();
                }

                if (user["email"] != null)
                {
                    email.Text = user["email"].ToString();
                }
            }

            setUserPets();
        }
Esempio n. 6
0
    // Update is called once per frame
    void Update()
    {
        if (bufferedLog.Count > 0)
        {
            while (bufferedLog.Count > 0)
            {
                AddLog(bufferedLog.Pop());
            }
        }

        if (objectsToEnable.Count > 0)
        {
            while (objectsToEnable.Count > 0)
            {
                GameObject objectToEnable = objectsToEnable.Pop();

                if (objectToEnable.GetComponent <LoginPanel>() != null)
                {
                    refreshLoginPanel();
                }

                else if (objectToEnable.GetComponent <Button>() != null)
                {
                    objectToEnable.GetComponent <Button>().interactable = true;
                }
            }
        }

        if (globalLeaderboardUsers != null)
        {
            string tempResult = "updated " + DateTime.Now.ToString() + "\n";
            int    position   = 1;

            foreach (ParseUser user in globalLeaderboardUsers)
            {
                int score = 0;

                if (user.ContainsKey("highscore"))
                {
                    score = user.Get <int>("highscore");
                }

                tempResult = tempResult + position + ". " +
                             user.Username.Substring(0, Mathf.Min(user.Username.Length, 10)) + "  |  " + score + "\n";
                position++;
            }

            leaderboard.StoreResult(true, tempResult);
            leaderboard.UpdateResult(true);
            globalLeaderboardUsers = null;
            resetLeaderboardMode();
        }

        if (friendsLeaderboardUsers != null)
        {
            string tempResult = "updated " + DateTime.Now.ToString() + "\n";
            int    position   = 1;

            int       playerScore = 0;
            ParseUser currentUser = ParseUser.CurrentUser;
            if (currentUser.ContainsKey("highscore"))
            {
                playerScore = currentUser.Get <int>("highscore");
            }

            bool playerAdded = false;

            foreach (ParseUser user in friendsLeaderboardUsers)
            {
                int score = 0;

                if (user.ContainsKey("highscore"))
                {
                    score = user.Get <int>("highscore");
                }

                if (!playerAdded)
                {
                    if (score <= playerScore)
                    {
                        tempResult = tempResult + position + "." +
                                     currentUser.Username.Substring(0, Mathf.Min(currentUser.Username.Length, 10))
                                     + "  |  " + playerScore + "\n";

                        position++;
                        playerAdded = true;
                    }
                }

                tempResult = tempResult + position + ". " +
                             user.Username.Substring(0, Mathf.Min(user.Username.Length, 10)) + "  |  " + score + "\n";
                position++;
            }

            if (!playerAdded)
            {
                tempResult = tempResult + position + "." +
                             currentUser.Username.Substring(0, Mathf.Min(currentUser.Username.Length, 10))
                             + "  |  " + playerScore + "\n";

                position++;
                playerAdded = true;
            }

            leaderboard.StoreResult(false, tempResult);
            friendsLeaderboardUsers = null;
        }

        if (parseUserUpdatePending)
        {
            StartUpdate();
            parseUserUpdatePending = false;
        }
    }