internal static ResponseStatus SendMouseDoubleClick()
        {
            using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                PointerInput.Click(button: PointerButtons.Primary, count: 2);
            }

            return(ResponseStatus.Success);
        }
        internal static ResponseStatus SendMouseAction(
            string actionType,
            int buttonNumber)
        {
            var            responseStatus = ResponseStatus.UnknownError;
            PointerButtons button;

            switch (buttonNumber)
            {
            case 0:
                button = PointerButtons.Primary;
                break;

            case 1:
                button = PointerButtons.Middle;
                break;

            case 2:
                button = PointerButtons.Secondary;
                break;

            default:
                throw new ArgumentException(message: string.Format(format: "Bad mouse button value: {0}. Valid values are LEFT = 0, MIDDLE = 1, RIGHT = 2", arg0: buttonNumber));
            }

            if (!(actionType == "buttondown"))
            {
                if (!(actionType == "buttonup"))
                {
                    if (actionType == "click")
                    {
                        using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                            PointerInput.Click(button: button, count: 1);
                        }

                        responseStatus = ResponseStatus.Success;
                    }
                }
                else
                {
                    using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                        PointerInput.Release(button: button);
                    }

                    responseStatus = ResponseStatus.Success;
                }
            }
            else
            {
                using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                    PointerInput.Press(button: button);
                }

                responseStatus = ResponseStatus.Success;
            }

            return(responseStatus);
        }
        internal static ResponseStatus SendMouseMoveToElementCenter(
            string mouseMoveType,
            UIObject element)
        {
            var rectangleCenterPosition = element.GetAdjustedBoundingRectangleCenterPosition();

            using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                PointerInput.Move(point: rectangleCenterPosition);
                return(ResponseStatus.Success);
            }
        }
 internal static ResponseStatus SendMouseMoveToRelative(
     string mouseMoveType,
     int xOffset,
     int yOffset)
 {
     using (InputController.Activate(inputType: PointerInputType.Mouse)) {
         var location = PointerInput.Location;
         location.X += xOffset;
         location.Y += yOffset;
         PointerInput.Move(point: location);
         return(ResponseStatus.Success);
     }
 }
Exemple #5
0
    public void Play()
    {
        if (costs.total > 100)
        {
            return;
        }
        gameObject.SetActive(false);
        GameObject     player = PlayerController.GetObject();
        CharacterState state  = player.GetComponent <CharacterState>();

        state.character = character;
        PlayerController.Activate();
        InputController.Activate();
        EnemiesController.CreateEnemy();
    }
        internal static ResponseStatus SendMouseMoveToElementRelative(
            string mouseMoveType,
            UIObject element,
            int xOffset,
            int yOffset)
        {
            var topLeft = element.GetAdjustedBoundingRectangle().TopLeft;

            topLeft.X += xOffset;
            topLeft.Y += yOffset;
            using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                PointerInput.Move(point: topLeft);
                return(ResponseStatus.Success);
            }
        }
Exemple #7
0
        internal static ResponseStatus SendTouchTypePress(string touchType, int x, int y)
        {
            var responseStatus = ResponseStatus.UnknownError;
            var point          = new PointI(x: x, y: y);

            if (!(touchType == "down"))
            {
                if (!(touchType == "move"))
                {
                    if (touchType == "up")
                    {
                        using (InputController.Activate(inputType: PointerInputType.MultiTouch)) {
                            PointerInput.Move(point: point);
                            PointerInput.Release(button: PointerButtons.Primary);
                        }

                        responseStatus = ResponseStatus.Success;
                    }
                }
                else
                {
                    using (InputController.Activate(inputType: PointerInputType.MultiTouch)) {
                        PointerInput.Move(point: point);
                    }

                    responseStatus = ResponseStatus.Success;
                }
            }
            else
            {
                using (InputController.Activate(inputType: PointerInputType.MultiTouch)) {
                    PointerInput.Move(point: point);
                    PointerInput.Press(button: PointerButtons.Primary);
                }

                responseStatus = ResponseStatus.Success;
            }

            return(responseStatus);
        }