private void updateCombo(DDRRating rating)
 {
     this.comboText.text  = "";
     this.comboText.color = Color.white;
     this.comboText.GetComponent <Animation>().Play();
     if (rating != DDRRating.Miss && rating != DDRRating.Early)
     {
         this.manager.GameState.Combo++;
         if (this.manager.GameState.Combo > this.manager.GameState.LongestCombo)
         {
             this.manager.GameState.LongestCombo = this.manager.GameState.Combo;
             this.comboText.color = Color.yellow;
         }
         if (this.manager.GameState.Combo >= 2)
         {
             this.comboText.text  = string.Format("x{0} combo", this.manager.GameState.Combo);
             this.comboText.color = Color.white;
             return;
         }
     }
     else
     {
         this.manager.GameState.Combo = 0;
     }
 }
    private void registerRating(DDRRating rating)
    {
        Dictionary <DDRRating, int> ratings = this.manager.GameState.Ratings;

        ratings[rating]++;
        from x in this.manager.GameState.Ratings
        orderby x.Value
        select x;
    }
    private void registerKeypress(int track, float time)
    {
        DDRRating rating = this.getRating(track, time);

        this.displayHitRating(track, rating);
        this.assignPoints(rating);
        this.registerRating(rating);
        this.updateCombo(rating);
        if (rating != DDRRating.Miss)
        {
            this.removeNodeAt(track, 0f);
        }
    }
    private void displayHitRating(int track, DDRRating rating)
    {
        Text component = UnityEngine.Object.Instantiate <GameObject>(this.ratingTextPrefab, this.uiTracks[track]).GetComponent <Text>();

        component.rectTransform.anchoredPosition = new Vector2(0f, 280f);
        switch (rating)
        {
        case DDRRating.Perfect:
            component.text  = "Perfect";
            component.color = this.perfectColor;
            break;

        case DDRRating.Great:
            component.text  = "Great";
            component.color = this.greatColor;
            break;

        case DDRRating.Good:
            component.text  = "Good";
            component.color = this.goodColor;
            break;

        case DDRRating.Ok:
            component.text  = "Ok";
            component.color = this.okColor;
            break;

        case DDRRating.Miss:
            component.text  = "Miss";
            component.color = Color.red;
            this.shakeUi(5f);
            break;

        case DDRRating.Early:
            component.text  = "Early";
            component.color = this.earlyColor;
            break;
        }
        UnityEngine.Object.Destroy(component, 1f);
    }
    private DDRRating getRating(int track, float time)
    {
        float         num;
        RectTransform rectTransform;

        this.getFirstNodeOn(track, out num, out rectTransform);
        DDRRating result = DDRRating.Miss;
        float     num2   = this.offset.y - rectTransform.localPosition.y;

        if (num2 < 130f)
        {
            result = DDRRating.Early;
            if (num2 < 75f)
            {
                result = DDRRating.Ok;
            }
            if (num2 < 65f)
            {
                result = DDRRating.Good;
            }
            if (num2 < 50f)
            {
                result = DDRRating.Great;
            }
            if (num2 < 30f)
            {
                result = DDRRating.Perfect;
            }
            if (num2 < -30f)
            {
                result = DDRRating.Ok;
            }
            if (num2 < -130f)
            {
                result = DDRRating.Miss;
            }
        }
        return(result);
    }
    private void assignPoints(DDRRating rating)
    {
        int num = 0;

        switch (rating)
        {
        case DDRRating.Perfect:
            num = this.manager.LoadedLevel.PerfectScorePoints;
            break;

        case DDRRating.Great:
            num = this.manager.LoadedLevel.GreatScorePoints;
            break;

        case DDRRating.Good:
            num = this.manager.LoadedLevel.GoodScorePoints;
            break;

        case DDRRating.Ok:
            num = this.manager.LoadedLevel.OkScorePoints;
            break;

        case DDRRating.Miss:
            num = this.manager.LoadedLevel.MissScorePoints;
            break;

        case DDRRating.Early:
            num = this.manager.LoadedLevel.EarlyScorePoints;
            break;
        }
        if (rating != DDRRating.Miss)
        {
            this.manager.GameState.Score += num;
        }
        this.manager.GameState.Health += (float)num;
    }