public static Point FindPicE(this dmsoft dmsoft, FindPicE findPic) { var res = dmsoft.FindPicE(findPic.X1, findPic.Y1, findPic.X2, findPic.Y2, findPic.PicName, findPic.DeltaColor, findPic.Sim, findPic.Dir); if (string.IsNullOrWhiteSpace(res)) { var arr = res.Split('|'); return(new Point(int.Parse(arr[0]), int.Parse(arr[1]))); } else { return(new Point()); } }
static void Main(string[] args) { DM.SetPath(Environment.CurrentDirectory + @"\Image"); var hwnd = DM.GetMousePointWindow(); DM.BindWindow(hwnd, "normal", "normal", "dx", 0); while (true) { int keyState = DM.GetKeyState(162); //ctrl :162 1:49 2:50 3:51 if (DM.GetKeyState(162) == 1) { //Red Card if (DM.GetKeyState(49) == 1) { string IsRed; Thread.Sleep(500); DM.KeyPress((int)Keys.W); for (int i = 0; i < 30; i++) { IsRed = DM.FindPicE(792, 939, 861, 1025, "Card_R.bmp|Card_Y.bmp|Card_B.bmp", "000000", 0.5, 0).Split('|')[0]; if (IsRed == "0") { DM.KeyPress((int)Keys.W); break; } Thread.Sleep(100); } continue; } //Yellow Card else if (DM.GetKeyState(50) == 1) { string IsYow; Thread.Sleep(500); DM.KeyPress((int)Keys.W); for (int i = 0; i < 30; i++) { IsYow = DM.FindPicE(792, 939, 861, 1025, "Card_R.bmp|Card_Y.bmp|Card_B.bmp", "000000", 0.5, 0).Split('|')[0]; if (IsYow == "1") { DM.KeyPress((int)Keys.W); break; } Thread.Sleep(100); } continue; } //Blue Card else if (DM.GetKeyState(51) == 1) { string IsBlue; Thread.Sleep(500); DM.KeyPress((int)Keys.W); for (int i = 0; i < 30; i++) { IsBlue = DM.FindPicE(792, 939, 861, 1025, "Card_R.bmp|Card_Y.bmp|Card_B.bmp", "000000", 0.5, 0).Split('|')[0]; if (IsBlue == "2") { DM.KeyPress((int)Keys.W); break; } Thread.Sleep(100); } continue; } } } }
public string FindPicE(int x1, int y1, int x2, int y2, string imagePath, string deltaColor, double sim, int dir) { return(dm.FindPicE(x1, y1, x2, y2, imagePath, deltaColor, sim, dir)); }