private void btnNavigate_Click(object sender, EventArgs e) { distanceToDestination = 0; lblUpDir.Text = ""; timerUpdate.Restart(); upDirection = new Vector(0, 0); initialPos = new Vector(0, 0); var point = GetPointForText(txtNavPos.Text); destination = point.ToVector(); screenCenter = GetPointForText(txtScreenCenter.Text).ToVector(); screenUpPosition = directions[txtUp].ToVector(); WinUtils.ActivateWindow(Constants.KO_WINDOW); ActionManager.SendAction(() => { }, 0.01f, () => { screenPoint = directions[txtUp]; lastAngle = 0; ClickAt(screenPoint, () => { currentDirectionStartPoint = currentPos; isMoving = true; KeyUtils.SendCharDown('w'); }); }); }
private void btnDown_Click(object sender, EventArgs e) { txt1.Focus(); KeyUtils.SendCharDown('r'); //KeyUtils.Send(Keyboard.ScanCodeShort.KEY_R); //sim.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.VK_R); }
private void Move(EDirection direction, Action onCompleted = null) { this.onMoveCompleted = onCompleted; this.direction = direction; KeyUtils.SendCharUp('w'); startPos = Character.Position; double angle = GetAngleForDirection(); Point newPoint = ScreenPosition.RotateDirection(initialDirection, angle); ActionManager.SendDelayedAction(0.25f, () => { ClickAt(newPoint, () => { if (!IsActive) { return; } timerStuck.Start(); ScreenPosition.SetClickPoint(newPoint); KeyUtils.SendCharDown('w'); Character.PositionChanged -= OnMove; Character.PositionChanged += OnMove; }); }); }
protected void SendKeyDown(char key, float duration, Action callback) { if (!IsActive) { return; } ActionManager.SendAction(() => { KeyUtils.SendCharDown(key); }, duration, callback); }
private void PerformClickMove(Point screenPoint) { KeyUtils.SendCharUp('w'); ScreenPosition.StopCalculateDirection(); ActionManager.SendDelayedAction(0.1f, () => { ClickAt(screenPoint, () => { KeyUtils.SendCharDown('w'); }); }); }
private void StartMove() { if (isMoving || upDirection.Length == 0 || destination.IsZero()) { return; } screenPoint = GetScreenPointToMoveTo(); ClickAt(screenPoint, () => { currentDirectionStartPoint = currentPos; isMoving = true; KeyUtils.SendCharDown('w'); }); }
private void PerformClickMove(Point screenPoint) { Debug.Log("Perform click move: " + screenPoint); previousClickPoint = screenPoint; KeyUtils.SendCharUp('w'); ScreenPosition.StopCalculateDirection(); isMoving = false; ActionManager.SendDelayedAction(0.1f, () => { ClickAt(screenPoint, () => { isMoving = true; KeyUtils.SendCharDown('w'); ScreenPosition.SetClickPoint(screenPoint); isStuck = false; timerStuck.IntervalSeconds = settings.TimeBeforeStuck; timerStuck.Elapsed += OnStuck; timerStuck.Restart(); }); }); }