public static string CheckEnemy(MyDm dm) { if (string.IsNullOrEmpty(enemy_fonts)) { enemy_fonts = string.Join("|", GetEnemyNames()); dm.SetDict(0, font_file); } var p = dm.FindPic(0, 0, 2000, 2000, "resources/arrow1.bmp"); if (p.X <= 0) { return(null); } var w = 203; var h = 331; var left = p.X - w; var top = p.Y; var mask_str = ""; for (int i = 0; i < 5; i++) { var x1 = left + 13; var y1 = top + 9 + 68 * i; var r = dm.FindStr(x1, y1, x1 + 157, y1 + 15, enemy_fonts, "f1ffb1-555555"); mask_str += r.X > 0 ? 1 : 0; } return(mask_str); }
private void ctrl_find_img_Click(object sender, EventArgs e) { var p1 = getPoint(ctrl_start_pos.Text); var p2 = getPoint(ctrl_end_pos.Text); var path = ctrl_file_path.Text.Trim(); if (String.IsNullOrEmpty(path)) { return; } var p = dm.FindPic(p1.X, p1.Y, p2.X, p2.Y, path, 0); if (p.X > 0) { AddLog("图片位置在:" + p.X + "," + p.Y); } else { AddLog("未找到图片"); } }
public Point findImage(string str, int x1 = 0, int y1 = 0, int x2 = 2000, int y2 = 2000, int dir = 0) { var s = str.Split(new char[] { '|' }).Select(src => String.Format("resources/{0}.bmp", src)); return(dm.FindPic(x1, y1, x2, y2, string.Join("|", s.ToArray()), dir)); }