private void UpdateHighscoreText(SongMeta selectedSong)
    {
        ResetHighscoreText();
        if (selectedSong == null)
        {
            return;
        }

        // Display local highscore
        LocalStatistic localStats = statistics.GetLocalStats(selectedSong);

        if (localStats != null)
        {
            SongStatistic localTopScore = localStats.StatsEntries.TopScore;
            if (localTopScore != null)
            {
                highscoreLocalPlayerText.text = localTopScore.PlayerName;
                highscoreLocalScoreText.text  = localTopScore.Score.ToString();
            }
        }

        // Display web highscore
        WebStatistic webStats = statistics.GetWebStats(selectedSong);

        if (webStats != null)
        {
            SongStatistic webTopScore = webStats.StatsEntries.TopScore;
            if (webTopScore != null)
            {
                highscoreWebPlayerText.text = webTopScore.PlayerName;
                highscoreWebScoreText.text  = webTopScore.Score.ToString();
            }
        }
    }
    private void UpdateSongInfoText(SongMeta selectedSong)
    {
        ResetInfoText();
        if (selectedSong == null)
        {
            return;
        }

        LocalStatistic localStats = statistics.GetLocalStats(selectedSong);

        if (localStats != null)
        {
            // Display local highscore
            SongStatistic localTopScore = localStats.StatsEntries.TopScore;
            if (localTopScore != null)
            {
                SetLocalHighscoreText(localTopScore.PlayerName, localTopScore.Score);
            }

            // Display count started/finished
            SetStartedFinishedText(localStats.TimesStarted, localStats.TimesFinished);
        }

        // Display web highscore
        WebStatistic webStats = statistics.GetWebStats(selectedSong);

        if (webStats != null)
        {
            SongStatistic webTopScore = webStats.StatsEntries.TopScore;
            if (webTopScore != null)
            {
                SetWebHighscoreText(webTopScore.PlayerName, webTopScore.Score);
            }
        }
    }
Beispiel #3
0
    public WebStatistic GetWebStats(SongMeta songMeta)
    {
        WebStatistic result = null;

        WebStatistics.TryGetValue(songMeta.SongHash, out result);
        return(result);
    }
Beispiel #4
0
    private void OnNewSongSelection(SongSelection selection)
    {
        SongMeta selectedSong = selection.SongMeta;

        if (selectedSong == null)
        {
            SetEmptySongDetails();
            return;
        }

        artistText.SetText(selectedSong.Artist);
        songTitleText.text = selectedSong.Title;
        songCountText.text = (selection.SongIndex + 1) + "/" + selection.SongsCount;

        //Display local highscore
        highscoreLocalPlayerText.text = "";
        highscoreLocalScoreText.text  = "0";
        LocalStatistic localStats = statsManager.GetLocalStats(selectedSong);
        SongStatistic  localTopScore;

        if (localStats != null)
        {
            localTopScore = localStats.StatsEntries.TopScore;

            if (localTopScore != null)
            {
                Debug.Log("Found local highscore: " + localTopScore.PlayerName + " " + localTopScore.Score.ToString());
                highscoreLocalPlayerText.text = localTopScore.PlayerName;
                highscoreLocalScoreText.text  = localTopScore.Score.ToString();
            }
        }

        //Display web highscore
        highscoreWebPlayerText.text = "";
        highscoreWebScoreText.text  = "0";
        WebStatistic  webStats = statsManager.GetWebStats(selectedSong);
        SongStatistic webTopScore;

        if (webStats != null)
        {
            webTopScore = webStats.StatsEntries.TopScore;

            if (webTopScore != null)
            {
                Debug.Log("Found web highscore: " + webTopScore.PlayerName + " " + webTopScore.Score.ToString());
                highscoreWebPlayerText.text = webTopScore.PlayerName;
                highscoreWebScoreText.text  = webTopScore.Score.ToString();
            }
        }

        bool hasVideo = !string.IsNullOrEmpty(selectedSong.Video);

        videoIndicator.SetActive(hasVideo);

        bool isDuet = selectedSong.VoiceNames.Count > 1;

        duetIndicator.SetActive(isDuet);
    }