private IEnumerator ClickSlot(RectangleF slotRect, MouseButtons buttonToClick, int msBetweenClicks) { Input.SetCursorPos(slotRect.ClickRandom()); yield return(new WaitTime(msBetweenClicks)); Input.Click(buttonToClick); Input.MouseMove(); yield return(new WaitTime(10)); }
static public void MouseAsJoystickNonSmooth(GameController gameController, float desiredAngle) { var gameWindowRect = gameController.Window.GetWindowRectangle(); var centerOfScreen = gameController.Game.IngameState.Camera.WorldToScreen(gameController.Player.Pos); float mouseDistance = 0.25f * gameWindowRect.Height; // prev 0.15 float xPos = mouseDistance * (float)Math.Cos(desiredAngle * Math.PI / 180); float yPos = -mouseDistance * (float)Math.Sin(desiredAngle * Math.PI / 180); Vector2 mousePositionClient = new Vector2(centerOfScreen.X + xPos, centerOfScreen.Y + yPos); Vector2 mousePositionToClick = gameWindowRect.TopLeft + mousePositionClient; Input.SetCursorPos(mousePositionToClick); Thread.Sleep(50); //yield return Input.SetCursorPositionSmooth(mousePositionToClick); }
private IEnumerator UnstackTheDecks() { _DebugTimer.Restart(); yield return(ParseInventory()); var originalCursorPosition = Input.ForceMousePosition; if (_SlotsWithStackedDecks.Count > 0) { _DebugTimer.Restart(); yield return(PopTheStacks()); } if (Settings.PreserveOriginalCursorPosition) { _DebugTimer.Restart(); Input.SetCursorPos(originalCursorPosition); Input.MouseMove(); } _UnstackCoroutine = Core.ParallelRunner.FindByName(Name); _UnstackCoroutine?.Done(); _DebugTimer.Stop(); }