Esempio n. 1
0
    private void Start()
    {
        playfabScript = playFab.GetComponent <PlayfabManager>();

        if (isNameSubmit)
        {
            inputField.text = playfabScript.GetDisplayName();
        }
    }
Esempio n. 2
0
    private void Update()
    {
        if (!Cursor.visible && SceneManager.GetActiveScene().buildIndex != 0)
        {
            currentTime = Time.time - startTime;

            string minutes = ((int)currentTime / 60).ToString();
            string seconds = (currentTime % 60).ToString("f2");



            if ((int)currentTime / 60 == 0)
            {
                levelTimer = seconds;
            }
            else
            {
                levelTimer = minutes + ":" + seconds;
            }

            timerText.GetComponent <UnityEngine.UI.Text>().text = levelTimer;
        }
        else if (SceneManager.GetActiveScene().buildIndex != 0)
        {
            if (playfab.IsSent())
            {
                playfab.GetLeaderboard(levelName);
                playfab.HasBeenSent();
            }


            if (playfab.IsLeaderboardUpdated())
            {
                List <string> leaderboardName = playfab.GetCurrentLeaderboard(1);
                List <string> leaderboardTime = playfab.GetCurrentLeaderboard(2);

                for (int i = 0; i < leaderboardName.Count; i++)
                {
                    leaderboardNumberText.GetComponent <UnityEngine.UI.Text>().text += i + 1 + "\n";
                    leaderboardText.GetComponent <UnityEngine.UI.Text>().text       += leaderboardName[i] + "\n";
                    leaderboardTimeText.GetComponent <UnityEngine.UI.Text>().text   += leaderboardTime[i] + "\n";
                }

                personalHighScoreText.GetComponent <UnityEngine.UI.Text>().text         = playfab.GetCurrectPlayerRecord();
                personalHighScorePositionText.GetComponent <UnityEngine.UI.Text>().text = "#" + playfab.GetCurrectPlayerPosition();

                loadingGifs[0].SetActive(false);
                loadingGifs[1].SetActive(false);

                playfab.LeaderboardIsUpdated();
            }
        }
        else
        {
            Cursor.visible = true;
            if (playfab.GetDisplayName() == "" && playfab.GetIsNameUpdated() && !NowUpdated)
            {
                loadingPage.gameObject.SetActive(false);
                usernameScreen.GetComponent <DisplayName>().OpenPlayerNameSubmit();
                NowUpdated = true;
            }
            else if (playfab.GetDisplayName() != "" && playfab.GetIsNameUpdated() && !NowUpdated)
            {
                loadingPage.gameObject.SetActive(false);
                NowUpdated = true;
            }
            else
            {
            }
        }
    }