Example #1
0
        public static void clickRandomArea(int x1, int y1, int x2, int y2, bool doubleClick = false)
        {
            int _x = GameRandom.RandomNumber(x1, x2);
            int _y = GameRandom.RandomNumber(y1, y2);

            AutoControl.SendDragAndDropOnPosition(Global.mainHandle, _x, _y, _x + 1, _y + 1, 10, 10, 0.2);
            //AutoControl.SendClickOnPosition(Global.mainHandle, _x, _y);
            if (doubleClick)
            {
                AutoControl.SendDragAndDropOnPosition(Global.mainHandle, _x, _y, _x + 1, _y + 1);
                //AutoControl.SendClickOnPosition(Global.mainHandle, _x, _y);
            }
        }
Example #2
0
        public void dragFoodToPosition(int position)
        {
            /*
             * position: 0 = left; 1 = center; 2 = right;
             * */
            int[] dropFoodPosition = GamePos.shikiPositionArray[position];
            int   xCenter          = this.x1 + this.x2 / 2;
            int   yCenter          = this.y1 + this.y2 / 2;

            int[] pointDrag = { GameRandom.RandomNumber(xCenter, xCenter + 10), GameRandom.RandomNumber(yCenter, yCenter + 10) };
            int   _xCenter  = dropFoodPosition[0] + dropFoodPosition[2] / 2;
            int   _yCenter  = dropFoodPosition[1] + dropFoodPosition[3] / 2;

            int[] pointDrop = { GameRandom.RandomNumber(_xCenter, _xCenter + 10), GameRandom.RandomNumber(_yCenter, _yCenter + 10) };
            GameHelper.dragAndDropGame(pointDrag[0], pointDrag[1], pointDrop[0], pointDrop[1]);
        }