Пример #1
0
 public void NewOnlineScore(float _score)
 {
     nickname = PlayerPrefs.GetString("localuser");
     if (_score > PlayerPrefs.GetFloat("bestlocalscore"))                 //check if the last score is higher than the best one, if so, update it.
     {
         PlayerPrefs.SetFloat("bestlocalscore", _score);                  // set the local player pref for the score
     }
     uniqueID = SystemInfo.deviceUniqueIdentifier + "_" + nickname + "_"; // creation of the unique identifier for the player
     online.updateOnlineHighscoreData(uniqueID, nickname, _score);        //this will be the information of the player in the database
     online.startPostScores();                                            // will create a new entry in the database with the info given before.
     online.Invoke("startGetScores", 1);                                  //update what the player see in the list, invoke in 1f in case update take more time than estimated
     print("NEW ONLINE SCORE UPDATED");
 }
    public void SubmitLeaderboardScore()
    {
        successStarted = true;
        UpdateFields();
        if (localName == "")
        {
            notificationBox.text = "ENTER A NAME!";
            ClearNotificationBox();
            // Debug.Log("ENTER A NAME!");
            return;
        }
        if (localPassword == "")
        {
            notificationBox.text = "ENTER A PASSWORD!";
            ClearNotificationBox();
            return;
        }

        for (int i = 0; i < badWords.Length; i++)
        {
            if (localName.Contains(badWords[i]))
            {
                Debug.Log("inapproriate username");

                notificationBox.text = "REJECTED:\nTASTELESS\nUSERNAME!";
                ClearNotificationBox();
                return;
            }
        }

        HSController.updateOnlineHighscoreData(localName, localScore, localPassword);
        HSController.startGetCurrentID();

        // Debug.Log("LOCALUNIQUEID" + localPassword);
        // Debug.Log("RETRIEVED ID: " + HSController.retrievedID);

        setTheScore  = true;
        startLoading = true;
    }