private void btnGoLeft_Click(object sender, EventArgs e) { ActionManager.SendAction(() => { WinUtils.ActivateWindow(Constants.KO_WINDOW); }, 2, () => { MouseOperations.Click(directions[txtLeft]); }); }
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'); }); }); }
void ClickAt(Point point, Action callback = null) { ActionManager.SendAction(() => { WinUtils.ActivateWindow(Constants.KO_WINDOW); }, 0.01f, () => { MouseOperations.Click(point); if (callback != null) { ActionManager.SendAction(() => { }, 0.1f, () => { callback.Invoke(); }); } }); }
private void OnInitTimer(object sender, ElapsedEventArgs e) { ActionManager.Start(); KeyUtils.Start(); Inventory.Clear(); MouseOperations.Start(); _initTimer.Stop(); _updateTimer.Elapsed -= OnUpdate; _updateTimer.Stop(); ActionManager.SendAction(() => { WinUtils.ActivateWindow(Constants.KO_WINDOW); }, 0.3f, () => { int attempts = 0; SkillBar.Reset(); while (!SkillBar.IsInitialized && attempts++ < MAX_ATTEMPT_INITIALIZE_SKILLBAR) { SkillBar.InitSkillsInfo(); } if (SkillBar.IsInitialized) { _gos.ForEach(g => { g.Active = true; }); Started?.Invoke(); _sendStart = false; _updateTimer.Restart(); _updateTimer.Elapsed += OnUpdate; } else { Stop(); throw new Exception("Failed to initialize SkillBarManager, aborting."); } }); }