Example #1
0
    public IEnumerator GetNewTimes()
    {
        int counter = 0;

        yield return(StartCoroutine(GetLapScore.GetTimes()));

        string[] times   = GetLapScore.times.Split('~');
        int      levelID = 0;

        if (levels.captionText.text.Contains("First"))
        {
            levelID = 1;
        }
        else if (levels.captionText.text.Contains("Second"))
        {
            levelID = 2;
        }
        else if (levels.captionText.text.Contains("Third"))
        {
            levelID = 3;
        }
        for (int i = 5 * (levelID - 1); i < 5 * (levelID - 1) + 5; i++)
        {
            string[] s = times[i].Split('|');
            highscores[counter].text = "#" + (i - (5 * (levelID - 1)) + 1) + ": " + s[5];
            counter++;
        }
    }
Example #2
0
    IEnumerator UpdateScoreIfNeeded()
    {
        int counter = 1;

        yield return(StartCoroutine(GetLapScore.GetTimes()));

        yield return(new WaitForSeconds(1));

        foreach (string s in GetLapScore.times.Split('~'))
        {
            if (s == "")
            {
                break;
            }
            Debug.LogError(s);
            string[] sA = s.Split('|');
            if (int.Parse(sA[1]) == int.Parse(SceneManager.GetActiveScene().name.Remove(0, 5)) - 1)
            {
                Debug.LogWarning(sA[5]);
                if (timer < int.Parse(sA[5]))
                {
                    StartCoroutine(UpdateLapScore.UpdateScores((int.Parse(SceneManager.GetActiveScene().name.Remove(0, 5)) - 1).ToString(), Mathf.Ceil(timer).ToString(), counter));
                    break;
                }
            }
            counter++;
        }
    }