private TaskResult RunStep4(TaskContext arg) { Role role = (Role)Role; role.OpenMenu("资源"); Delegater.WaitTrue(() => role.OpenWindowMenu("祭祀"), () => role.IsExistWindowMenu("祭祀"), () => Dm.Delay(1000)); Dm.FindPicAndClick(699, 63, 868, 118, @"\bmp\祭祀十次.bmp"); Dm.Delay(1000); Delegater.WaitTrue(() => { if (Dm.GetColorNum(738, 500, 761, 522, "79a03b-303030", 1.0) > 20) { Dm.MoveToClick(783, 512); Dm.Delay(1000); return(false); } return(true); }, () => Dm.Delay(50), 10); Dm.UseDict(1); Delegater.WaitTrue(() => { if (Dm.IsExistPic(197, 59, 288, 102, @"\bmp\祭祀0.bmp", 0.7)) { if (Dm.GetColorNum(204, 61, 278, 96, "C59E00-3A2E00", 0.9) < 75) { return(true); } } bool result = Dm.IsChangeColorNumEx(204, 61, 278, 96, "C59E00-3A2E00", () => { Dm.MoveToClick(322, 451); //祭祀木材 //Dm.MoveToClick(162, 454);//祭祀银子 Dm.Delay(500); }); if (!result) { Dm.DebugPrint("操作完颜色结果不变,可能已经完成!~"); if (Dm.FindPicAndClick(475, 315, 628, 415, @"\bmp\取消.bmp")) { Dm.Delay(1000); } return(true); } return(false); }, () => Dm.Delay(50), 40); Dm.UseDict(0); role.CloseWindow(); return(TaskResult.Success); }
private TaskResult RunStep7(TaskContext arg) { Role role = (Role)Role; Dm.UseDict(0); Delegater.WaitTrue(() => role.OpenMenu("资源"), () => role.IsExistWindowMenu("集市"), () => Dm.Delay(1000)); Delegater.WaitTrue(() => role.OpenWindowMenu("集市"), () => Dm.Delay(1000)); Dm.UseDict(1); Dm.Delay(1000); Delegater.WaitTrue(() => { bool result = Dm.IsChangeColorNumEx(170, 72, 237, 107, "49A031-152F0F", () => { Dm.StartWatch(); var rt1 = GetResourceType(160, 129, 346, 377); var rc1 = GetColor(176, 119, 328, 178); Dm.DebugPrint("第一个资源:" + rt1.ToString() + ",颜色:" + rc1.ToString()); var rt2 = GetResourceType(395, 132, 573, 373); var rc2 = GetColor(409, 129, 566, 175); Dm.DebugPrint("第二个资源:" + rt2.ToString() + ",颜色:" + rc2.ToString()); var rt3 = GetResourceType(630, 131, 810, 377); var rc3 = GetColor(633, 124, 804, 180); Dm.DebugPrint("第三个资源:" + rt3.ToString() + ",颜色:" + rc3.ToString()); Dm.StopWatch(); Dm.StartWatch(); List <Resource> list = new List <Resource>() { new Resource() { Pos = 1, Type = rt1, Color = rc1, Buypos = new Tuple <int, int>(253, 353) }, new Resource() { Pos = 2, Type = rt2, Color = rc2, Buypos = new Tuple <int, int>(495, 353) }, new Resource() { Pos = 3, Type = rt3, Color = rc3, Buypos = new Tuple <int, int>(727, 353) } }; var rlist = list.OrderByDescending(q => q.Type).ThenByDescending(x => x.Color).ToList(); Dm.DebugPrint(string.Format("购买位置:{0},资源类型:{1},资源颜色:{2}", rlist.First().Pos, rlist.First().Type.ToString(), rlist.First().Color.ToString())); Dm.MoveToClick(rlist.First().Buypos.Item1, rlist.First().Buypos.Item2); Dm.StopWatch(); Dm.Delay(1000); }); if (!result) { Dm.DebugPrint("操作完颜色结果不变,可能已经完成!~"); if (Dm.IsExistPic(171, 71, 247, 105, @"\bmp\集市0.bmp")) { return(true); } } if (Dm.FindPicAndClick(475, 315, 628, 415, @"\bmp\取消.bmp")) { Dm.Delay(1000); } return(false); }, () => Dm.Delay(50), 40); Dm.UseDict(0); role.CloseWindow(); return(TaskResult.Success); }