private void button1_Click(object sender, EventArgs e) { string HeroName = comboBox1.Text.ToString(); var LoLClient = DM.FindWindow("", "League of Legends"); DM.BindWindow(LoLClient, "gdi", "windows3", "normal", 1); DM.MoveTo(860, 97); DM.LeftClick(); DM.Capture(0, 0, 2000, 2000, "1.bmp"); int isExsit = -1; //Enter hero name X Y; int x = 784, y = 100; object x1, y2; while (true) { isExsit = DM.FindPic(0, 0, 2000, 2000, "Icon.bmp", "000000", 0.9, 0, out x1, out y2); if (isExsit >= 0) { DM.MoveTo(860, 97); Thread.Sleep(300); DM.LeftClick(); Thread.Sleep(300); foreach (int key in Hero[HeroName]) { DM.KeyPress(key); } DM.MoveTo(370, 163); Thread.Sleep(500); DM.LeftClick(); } } }
private static void DebugBmp(int x1, int y1, int x2, int y2, string bmp) { if (isDebug) { string debugBmp = System.AppDomain.CurrentDomain.BaseDirectory + "bmp\\debug\\" + debug.ToString() + bmp + ".bmp"; dmsoft dm = GetDm(); x1 = x1 + gameX1; y1 = y1 + gameY1; x2 = x2 + gameX1; y2 = y2 + gameY1; dm.Capture(x1, y1, x2, y2, debugBmp); debug++; } }
/// <summary> /// 抓取指定区域(x1, y1, x2, y2)的图像,保存为file(24位位图) /// </summary> /// <param name="dmsoft"></param> /// <param name="capture"></param> /// <returns></returns> public static bool Capture(this dmsoft dmsoft, Capture capture) { return(dmsoft.Capture(capture.X1, capture.Y1, capture.X2, capture.Y2, capture.File) == 1); }
public int Capture(int x1, int y1, int x2, int y2, string file) { return(dm.Capture(x1, y1, x2, y2, file)); }