Beispiel #1
0
    public static void Update()
    {
        PracticeManager.UpdateMessages();
        long currentTicks = DateTime.Now.Ticks;
        long tickDelta    = currentTicks - PracticeManager.LastTick - 166667L;

        PracticeManager.LastTick = currentTicks;
        if (PracticeManager.Countdown >= 0)
        {
            PracticeManager.Countdown--;
            if (Characters.Sein)
            {
                Characters.Sein.Position = PracticeManager.StartPosition;
            }
            if (PracticeManager.Countdown == 0)
            {
                PracticeManager.Start();
            }
        }
        if (PracticeManager.Running)
        {
            if (PracticeManager.FrameCount == 1)
            {
                foreach (Core.Input.InputButtonProcessor button in Core.Input.Buttons)
                {
                    if (button != Core.Input.AnyStart)
                    {
                        button.IsPressed  = false;
                        button.WasPressed = false;
                    }
                }
            }
            PracticeManager.ExtraTicks -= tickDelta;
            if (PracticeManager.ExtraTicks > 166667L)
            {
                PracticeManager.ExtraFrames += 1;
                PracticeManager.ExtraTicks  -= 166667L;
            }
            if (PracticeManager.ExtraTicks < -166667L)
            {
                PracticeManager.LagFrames  += 1;
                PracticeManager.ExtraTicks += 166667L;
            }
            if (tickDelta > 166667L)
            {
                PracticeManager.DroppedFrames += (int)(tickDelta / 166667L);
            }
            PracticeManager.MaxDelta = Math.Max(PracticeManager.MaxDelta, tickDelta);
            PracticeManager.FrameCount++;
            PracticeManager.CheckEnd();
        }
        if (MoonInput.GetKey(KeyCode.LeftAlt) || MoonInput.GetKey(KeyCode.RightAlt))
        {
            if (MoonInput.GetKeyDown(KeyCode.Keypad5) || MoonInput.GetKeyDown(KeyCode.Semicolon))
            {
                PracticeManager.SetStart();
            }
            if (MoonInput.GetKeyDown(KeyCode.R))
            {
                PracticeManager.QueueStart();
            }
            if (MoonInput.GetKeyDown(KeyCode.K))
            {
                PracticeManager.Initialize();
            }
            if (MoonInput.GetKeyDown(KeyCode.I))
            {
                PracticeManager.ShowPositionInfo();
            }
            if (MoonInput.GetKeyDown(KeyCode.T))
            {
                PracticeManager.MessageInQueue = 2;
            }
            if (MoonInput.GetKeyDown(KeyCode.E))
            {
                PracticeManager.ShowMessage(PracticeManager.GenerateEfficiencyStats());
            }
            if (MoonInput.GetKeyDown(KeyCode.Keypad1) || MoonInput.GetKeyDown(KeyCode.Comma))
            {
                PracticeManager.SetEnd(1);
            }
            if (MoonInput.GetKeyDown(KeyCode.Keypad2) || MoonInput.GetKeyDown(KeyCode.Period))
            {
                PracticeManager.SetEnd(2);
            }
            if (MoonInput.GetKeyDown(KeyCode.Keypad3) || MoonInput.GetKeyDown(KeyCode.Slash))
            {
                PracticeManager.SetEnd(3);
            }
            if (MoonInput.GetKeyDown(KeyCode.Keypad4) || MoonInput.GetKeyDown(KeyCode.L))
            {
                PracticeManager.SetEnd(4);
            }
            if (MoonInput.GetKeyDown(KeyCode.Keypad6) || MoonInput.GetKeyDown(KeyCode.Quote))
            {
                PracticeManager.SetEnd(6);
            }
            if (MoonInput.GetKeyDown(KeyCode.Keypad7) || MoonInput.GetKeyDown(KeyCode.P))
            {
                PracticeManager.SetEnd(7);
            }
            if (MoonInput.GetKeyDown(KeyCode.Keypad8) || MoonInput.GetKeyDown(KeyCode.LeftBracket))
            {
                PracticeManager.SetEnd(8);
            }
            if (MoonInput.GetKeyDown(KeyCode.Keypad9) || MoonInput.GetKeyDown(KeyCode.RightBracket))
            {
                PracticeManager.SetEnd(9);
            }
        }
    }