public void start(int level, TBSUi.HitType type, float width)
 {
     this.totalWith = width;
     this.TypeEnum  = type;
     if (!this.isStopped)
     {
         this.SetDifficulty(level);
     }
     this.lastHitText     = string.Empty;
     this.progress        = 0f;
     this.lastHitProgress = -1f;
     this.isStarted       = true;
     this.isStopped       = false;
 }
        public int CreateProgressGame(int marginLeft, int marginTop, TBSUi.HitGame game, int level, TBSUi.HitType type, long timeProgressed)
        {
            float num  = GuiBase.Width(150f);
            float num2 = GuiBase.Height(20f);

            if (type == TBSUi.HitType.left || type == TBSUi.HitType.right || type == TBSUi.HitType.eyes || type == TBSUi.HitType.eyes_non_mirror)
            {
                if (game.lastHitText != null && game.lastHitText.Contains("Double"))
                {
                    GUI.Label(new Rect(GuiBase.Width((float)(marginLeft + 30)), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), game.lastHitText);
                }
                else
                {
                    GUI.Label(new Rect(GuiBase.Width((float)(marginLeft + 50)), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), game.lastHitText);
                }
                GUI.BeginGroup(new Rect(GuiBase.Width((float)marginLeft), GuiBase.Height((float)(marginTop + 30)), num, GuiBase.Height(100f)));
                GUI.DrawTexture(new Rect(0f, 0f, num, num2), GuiBase.progressBg);
                float progress = game.progress;
                float x        = 0f;
                if (type == TBSUi.HitType.right)
                {
                    x = GuiBase.Width(150f) - progress;
                }
                GUI.DrawTexture(new Rect(x, 0f, progress, num2), GuiBase.progressFgBlue);
                x = (float)game.hitAreaLeft;
                float x2 = game.lastHitProgress;
                if (type == TBSUi.HitType.eyes)
                {
                    x  = num - (float)game.hitAreaWith - (float)game.hitAreaLeft;
                    x2 = num - game.lastHitProgress;
                    GUI.DrawTexture(new Rect(num / 2f - 1f, -5f, GuiBase.Width(2f), num2 + 10f), TBSUi.center);
                }
                GUI.DrawTexture(new Rect(x, 1f, (float)game.hitAreaWith, num2 - 2f), TBSUi.hitArea);
                if (game.lastHitProgress != -1f)
                {
                    GUI.DrawTexture(new Rect(x2, 1f, 2f, num2 - 2f), TBSUi.lastHitPoint);
                }
            }
            else if (type == TBSUi.HitType.top || type == TBSUi.HitType.bottom)
            {
                if (game.lastHitText != null && game.lastHitText.Contains("Double"))
                {
                    GUI.Label(new Rect(GuiBase.Width((float)(marginLeft - 10)), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), game.lastHitText);
                }
                else
                {
                    GUI.Label(new Rect(GuiBase.Width((float)(marginLeft + 20)), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), game.lastHitText);
                }
                GUI.BeginGroup(new Rect(GuiBase.Width((float)marginLeft), GuiBase.Height((float)marginTop), GuiBase.Width(150f), GuiBase.Height(200f)));
                GUI.DrawTexture(new Rect(GuiBase.Width(80f), 0f, num2, num), GuiBase.progressBgRotated);
                float progress2 = game.progress;
                float y         = 0f;
                if (type == TBSUi.HitType.bottom)
                {
                    y = GuiBase.Width(150f) - progress2;
                }
                float y2 = (float)game.hitAreaLeft;
                float y3 = game.lastHitProgress;
                if (type == TBSUi.HitType.bottom)
                {
                    y2 = num - (float)game.hitAreaWith - (float)game.hitAreaLeft;
                    y3 = num - game.lastHitProgress;
                }
                GUI.DrawTexture(new Rect(GuiBase.Width(80f), y, num2, progress2), GuiBase.progressFgBlueRotated);
                GUI.DrawTexture(new Rect(GuiBase.Width(81f), y2, num2 - GuiBase.Width(2f), (float)game.hitAreaWith), TBSUi.hitArea);
                if (game.lastHitProgress != -1f)
                {
                    GUI.DrawTexture(new Rect(GuiBase.Width(81f), y3, num2 - 2f, 2f), TBSUi.lastHitPoint);
                }
            }
            if (TBSUi.ScreenChanged)
            {
                bool isStarted = game.isStarted;
                game.stop();
                game.start(level, type, num);
                game.SetDifficulty(level);
                if (!isStarted)
                {
                    game.stop();
                }
            }
            if (game.isStarted)
            {
                game.progress += game.progressSpeed * (float)timeProgressed / 14f;
                if (game.progress > game.totalWith)
                {
                    game.progress = 0f;
                }
                int num3 = 80;
                int num4 = 30;
                if (type == TBSUi.HitType.top || type == TBSUi.HitType.bottom)
                {
                    num3 = 0;
                    num4 = 70;
                }
                if (GUI.Button(new Rect(GuiBase.Width((float)num3), GuiBase.Height((float)num4), GuiBase.Width(70f), GuiBase.Height(30f)), "Stop"))
                {
                    game.stop();
                }
            }
            else if (GUI.Button(new Rect(GuiBase.Width(0f), GuiBase.Height(30f), GuiBase.Width(70f), GuiBase.Height(30f)), "Start"))
            {
                game.start(level, type, num);
            }
            GUI.EndGroup();
            int num5 = marginTop + 60;
            int num6 = 70;
            int num7 = 30;

            if (type == TBSUi.HitType.top || type == TBSUi.HitType.bottom)
            {
                num5 = marginTop + 30;
            }
            if (game.isStarted && GUI.RepeatButton(new Rect(GuiBase.Width((float)marginLeft), GuiBase.Height((float)num5), GuiBase.Width((float)num6), GuiBase.Height((float)num7)), "Hit"))
            {
                if (this.isFirstDown)
                {
                    if (game.IsHit(level))
                    {
                        game.lastHitText = "Hit!";
                        level++;
                        int num8 = UnityEngine.Random.Range(0, 100);
                        if (num8 < App.State.PremiumBoni.TbsDoublePoints)
                        {
                            game.lastHitText = "Double Hit!";
                            level++;
                        }
                    }
                    else
                    {
                        game.lastHitText = "Miss!";
                        game.MissCount++;
                        if (game.MissCount == 5)
                        {
                            game.SetDifficulty(level);
                        }
                        int num9 = UnityEngine.Random.Range(0, 100);
                        if (num9 > App.State.PremiumBoni.TbsMissreduction)
                        {
                            level--;
                        }
                        if (level < 0)
                        {
                            level = 0;
                        }
                    }
                    this.isFirstDown = false;
                }
                Event current = Event.current;
                if (current.type == EventType.Used)
                {
                    this.isFirstDown = true;
                }
            }
            return(level);
        }