Пример #1
0
        public void HandleNote(FNFSong.FNFNote n)
        {
            while (watch.Elapsed.TotalMilliseconds < (double)n.Time - kBot.offset)
            {
                Thread.Sleep(1);
                if (!Playing)
                {
                    Thread.CurrentThread.Abort();
                }
            }

            bool shouldHold = n.Length > 0;


            switch (n.Type)
            {
            case FNFSong.NoteType.Left:
            case FNFSong.NoteType.RLeft:
                if (shouldHold)
                {
                    simulator.Keyboard.KeyDown(VirtualKeyCode.LEFT);
                    Thread.Sleep(Convert.ToInt32(n.Length));
                    simulator.Keyboard.KeyUp(VirtualKeyCode.LEFT);
                }
                else
                {
                    kBot.KeyPress(0x25, 0x1e);
                }

                break;

            case FNFSong.NoteType.Down:
            case FNFSong.NoteType.RDown:
                if (shouldHold)
                {
                    simulator.Keyboard.KeyDown(VirtualKeyCode.DOWN);
                    Thread.Sleep(Convert.ToInt32(n.Length));
                    simulator.Keyboard.KeyUp(VirtualKeyCode.DOWN);
                }
                else
                {
                    kBot.KeyPress(0x28, 0x1f);
                }

                break;

            case FNFSong.NoteType.Up:
            case FNFSong.NoteType.RUp:
                if (shouldHold)
                {
                    simulator.Keyboard.KeyDown(VirtualKeyCode.UP);
                    Thread.Sleep(Convert.ToInt32(n.Length));
                    simulator.Keyboard.KeyUp(VirtualKeyCode.UP);
                }
                else
                {
                    kBot.KeyPress(0x26, 0x11);
                }


                break;

            case FNFSong.NoteType.Right:
            case FNFSong.NoteType.RRight:
                if (shouldHold)
                {
                    simulator.Keyboard.KeyDown(VirtualKeyCode.RIGHT);
                    Thread.Sleep(Convert.ToInt32(n.Length));
                    simulator.Keyboard.KeyUp(VirtualKeyCode.RIGHT);
                }
                else
                {
                    kBot.KeyPress(0x27, 0x20);
                }

                break;
            }
            notesPlayed++;
        }
Пример #2
0
        public void HandleNote(FNFSong.FNFNote n)
        {
            bool shouldHold = n.Length > 0;

            if (shouldHold)
            {
                holdTimes[(int)n.Type % 4] = ((float)n.Length + (float)watch.Elapsed.TotalMilliseconds) + 10;
            }


            switch (n.Type)
            {
            case FNFSong.NoteType.Left:
            case FNFSong.NoteType.RLeft:
                if (shouldHold)
                {
                    simulator.Keyboard.KeyDown(VirtualKeyCode.LEFT);
                    Thread.Sleep(Convert.ToInt32(n.Length));
                    simulator.Keyboard.KeyUp(VirtualKeyCode.LEFT);
                }
                else
                {
                    kBot.KeyPress(0x25, 0x1e);
                }

                break;

            case FNFSong.NoteType.Down:
            case FNFSong.NoteType.RDown:
                if (shouldHold)
                {
                    simulator.Keyboard.KeyDown(VirtualKeyCode.DOWN);
                }
                else
                {
                    kBot.KeyPress(0x28, 0x1f);
                }

                break;

            case FNFSong.NoteType.Up:
            case FNFSong.NoteType.RUp:
                if (shouldHold)
                {
                    simulator.Keyboard.KeyDown(VirtualKeyCode.UP);
                }
                else
                {
                    kBot.KeyPress(0x26, 0x11);
                }


                break;

            case FNFSong.NoteType.Right:
            case FNFSong.NoteType.RRight:
                if (shouldHold)
                {
                    simulator.Keyboard.KeyDown(VirtualKeyCode.RIGHT);
                }
                else
                {
                    kBot.KeyPress(0x27, 0x20);
                }


                break;
            }
            notesPlayed++;
        }