Esempio n. 1
0
    private void OnLeaderboardDataReceived(IScore[] obj)
    {
        Debug.LogFormat("Received {0} scores", obj.Length);

        if (obj.Length == 0)
        {
            return;
        }

        foreach (var s in obj)
        {
            Debug.LogFormat("Score {0} for playerId: {1} in leaderboardId: {2}", s.value, s.userID, s.leaderboardID);
        }

        // Find the playter's high score.
        var playerId = Cloud.PlayerID;

        var score = obj.FirstOrDefault(s => s.userID == playerId);

        if (score != null)
        {
            PlayerAllTimeHighScore = (int)score.value;

            // Update the high score text
            PlayerAllTimeHighScoreText.text = PlayerAllTimeHighScore.ToString();
        }
    }
Esempio n. 2
0
    public void Awake()
    {
        Debug.Log("Caching Video");
        Chartboost.cacheRewardedVideo(CBLocation.MainMenu);
        Chartboost.cacheInterstitial(CBLocation.Default);

        SFXIcon = SFXIcon.gameObject.GetComponent <Image>();

        if (SFXIcon.sprite == MuteIcon)
        {
            //Mute sounds
            AudioListener.volume = 0;
        }
        else if (SFXIcon.sprite == UnMuteIcon)
        {
            //UnMute sounds
            AudioListener.volume = 1;
        }

        //disable settings panel by default
        SettingsPanel.SetActive(false);

        PlayerAllTimeHighScoreText = PlayerAllTimeHighScoreGameObject.GetComponent <Text>();

        //LoadStoredHighScoreValue();

        PlayerAllTimeHighScoreText.text = PlayerAllTimeHighScore.ToString();

        Cloud.Storage.Save();

        // Update player name

        if (Cloud.IsSignedIn)
        {
            playerNameText.text = string.Format("Welcome {0}", Cloud.PlayerDisplayName);
        }
    }