Example #1
0
        private void Tap(GameElement element, bool doubleTap = false)
        {
            if (element == null)
            {
                throw new Exception("Element not found");
            }

            if (!element.IsActive)
            {
                throw new Exception("Element is inactive");
            }

            // TODO: Look this up, 0, 0 is 0, 1920 for some reason
            // float y = DeviceInfo.Height - element.Location.Y;

            float y = (DeviceInfo.Height - element.Location.Y) + element.Rectangle.Height / 3;
            float x = element.Location.X + (element.Rectangle.Width / 3);

            if (element.GetType() == typeof(GameButton))
            {
                y = DeviceInfo.Height - element.Location.Y;
                x = element.Location.X;
            }

            if (doubleTap)
            {
                App.DoubleTapCoordinates(x, y);
            }
            else
            {
                App.TapCoordinates(x, y);
            }
        }