Пример #1
0
        public FakeDetector(string testImageName, Tetris99BotForm form, PictureBox pictureBox, Action <Bitmap> imageDetected)
        {
            this.form          = form;
            this.pictureBox    = pictureBox;
            this.imageDetected = imageDetected;


            var bmptje = new Bitmap(testImageName);

            pictureBox.Image = bmptje;

            Task.Run(() =>
            {
                Task.Delay(1000).Wait();
                while (true)
                {
                    var ss = new Bitmap(testImageName);

                    try
                    {
                        imageDetected(ss);
                    }
                    catch (Exception ex)
                    {
                    }

                    Task.Delay(100).Wait();
                }
            });
        }
Пример #2
0
        public DirectShowCapturer(Tetris99BotForm form, PictureBox pictureBox, Action <Bitmap> imageDetected)
        {
            this.form          = form;
            this.pictureBox    = pictureBox;
            this.imageDetected = imageDetected;

            InitDevice();
        }
Пример #3
0
        public RealGame(Tetris99BotForm tetris99Form, Panel drawPanel, Panel drawPanelBlocks, Panel drawPanelDanger, Label linesClearedLabel, Label dangerCountLabel)
        {
            board = new Board(TetrisConstants.BoardWidth, TetrisConstants.BoardHeight);

            this.tetris99Form      = tetris99Form;
            this.drawPanel         = drawPanel;
            this.drawPanelBlocks   = drawPanelBlocks;
            panelDanger            = drawPanelDanger;
            this.linesClearedLabel = linesClearedLabel;
            this.dangerCountLabel  = dangerCountLabel;
            g       = drawPanel.CreateGraphics();
            gBlocks = drawPanelBlocks.CreateGraphics();
            gDanger = drawPanelDanger.CreateGraphics();
        }