/// <summary> /// Centers the mouse and execute ability (F2, W, E) /// </summary> public void UseAbility(List <string> buttons) { Program.PrintInfo("Center click to prepate keyboard entries", Message.Info); int x = 1920 / 2; int y = 1080 / 2; int p = 200; Click(x, y, p); Program.PrintInfo("Pressing keys of \"UsedButtons.Json\"", Message.Info); buttons.ForEach(item => KeyOperations.PressKey(item)); }
/// <summary> /// Executes the commands out of the StartGame.json and RestartGame.json /// It simulates a mouse click on a specefic position, write a word or /// letter if necessary and wait the entered time to execute the following /// command out of the json-files. /// </summary> public void ManagedClick(Click click) { Program.PrintInfo($"Executing managed click => Name:{click.Name} X:{click.X}, Y:{click.Y} and wait {click.Pause} milliseconds", Message.Info); MouseOperations.SetCursorPosition(click.X, click.Y); MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftDown); Thread.Sleep(10); MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftUp); if (click.Word != null) { KeyOperations.PressKey(click.Word); } Thread.Sleep(click.Pause); }