| | |
| | | public static bool IsInSaiLiYaHouse(ZTRectangle gameRect) |
| | | { |
| | | ZTRectangle mailText = ZTRectangle.Empty; |
| | | ZTPoint limitPoint = gameRect.GetRatioPoint(0.667f); |
| | | Structs.ZTPoint limitPoint = gameRect.GetRatioPoint(0.667f); |
| | | ZTRectangle limit = new ZTRectangle(limitPoint.X, gameRect.Start.Y, gameRect.End.X, gameRect.End.Y); |
| | | //截图 |
| | | System.Drawing.Bitmap bitmap = ScreenCapture.Instance.CaptureScreen(); |
| | |
| | | //min:(0,0.,0.0352941192686558),max:(0.,0.,0.0980392172932625) |
| | | private static ZTHsvFloatColor equipmentColorMin = new ZTHsvFloatColor(0,0, 0); |
| | | private static ZTHsvFloatColor equipmentColorMax = new ZTHsvFloatColor(1, 0.7827f, 0.1099f); |
| | | private static ZTPoint[] equipmentComparePositionss; |
| | | private static Structs.ZTPoint[] equipmentComparePositionss; |
| | | /// <summary> |
| | | /// 获取有装备的所有点,只便利前两行 |
| | | /// </summary> |
| | | /// <param name="startPoint"></param> |
| | | /// <returns></returns> |
| | | public static List<Int32> GetEquipmentIndexs(ZTPoint startPoint) |
| | | public static List<Int32> GetEquipmentIndexs(Structs.ZTPoint startPoint) |
| | | { |
| | | Image<Rgb, byte> image = ScreenCapture.Instance.CaptureScreenReturnImage(); |
| | | return GetEquipmentIndexs(image, startPoint); |
| | | } |
| | | |
| | | public static List<Int32> GetEquipmentIndexs(Image<Rgb, byte> image,ZTPoint startPoint) |
| | | public static List<Int32> GetEquipmentIndexs(Image<Rgb, byte> image, Structs.ZTPoint startPoint) |
| | | { |
| | | if (equipmentComparePositionss == null) |
| | | { |
| | | equipmentComparePositionss = new ZTPoint[15 * 15]; |
| | | equipmentComparePositionss = new Structs.ZTPoint[15 * 15]; |
| | | for (int y = 0; y < 15; y++) |
| | | { |
| | | for (int x = 0; x < 15; x++) |
| | | { |
| | | equipmentComparePositionss[y * 15 + x] = new ZTPoint(x, y); |
| | | equipmentComparePositionss[y * 15 + x] = new Structs.ZTPoint(x, y); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (rects.Count <= 0) |
| | | { |
| | | return ZTPoint.Empty; |
| | | return Structs.ZTPoint.Empty; |
| | | } |
| | | |
| | | //主角位置 |
| | | ZTPoint rolePosition = gameRect.Start + new ZTPoint(rects[0].Start.X + rolePositionOffset.Width, rects[0].Start.Y + rolePositionOffset.Height); |
| | | Structs.ZTPoint rolePosition = gameRect.Start + new Structs.ZTPoint(rects[0].Start.X + rolePositionOffset.Width, rects[0].Start.Y + rolePositionOffset.Height); |
| | | |
| | | return rolePosition; |
| | | } |
| | |
| | | /// <param name="image"></param> |
| | | /// <param name="gameRect"></param> |
| | | /// <returns></returns> |
| | | public static List<ZTPoint> GetThingItemPoints(Image<Rgb, byte> image, ZTRectangle gameRect) |
| | | public static List<Structs.ZTPoint> GetThingItemPoints(Image<Rgb, byte> image, ZTRectangle gameRect) |
| | | { |
| | | List<ZTLine> lines = CVHelper.FindLines(image, xLineMin,gameRect, Orientation.Horizontal, min, max); |
| | | List<ZTLine> filterLines = new List<ZTLine>(); |
| | | List<ZTPoint> points = new List<ZTPoint>(); |
| | | List<Structs.ZTPoint> points = new List<Structs.ZTPoint>(); |
| | | Func<ZTLine, bool> existsLines = (line) => |
| | | { |
| | | for (int i = 0; i < filterLines.Count; i++) |
| | |
| | | } |
| | | |
| | | filterLines.Add(line); |
| | | points.Add(new ZTPoint(line.X + line.Length / 2, line.Y + thingItemYOffset)); |
| | | points.Add(new Structs.ZTPoint(line.X + line.Length / 2, line.Y + thingItemYOffset)); |
| | | } |
| | | return points; |
| | | } |
| | |
| | | number = 0; |
| | | byte[,,] datas = rangeImage.Data; |
| | | bool one = false, two = false, four = false, eight = false; |
| | | ZTPoint center = locationPointRect.GetCenterPoint(); |
| | | Structs.ZTPoint center = locationPointRect.GetCenterPoint(); |
| | | |
| | | //格1 |
| | | ZTPoint lefttop = center.Add(-11); |
| | | Structs.ZTPoint lefttop = center.Add(-11); |
| | | if (!BlockOf6x6IsColor(datas, lefttop, black)) |
| | | { |
| | | if (!BlockOf6x6IsColor(datas, lefttop, white)) |
| | |
| | | one = true; |
| | | } |
| | | //格2 |
| | | ZTPoint righttop = center.Add(new ZTPoint(5,-11)); |
| | | Structs.ZTPoint righttop = center.Add(new Structs.ZTPoint(5,-11)); |
| | | if (!BlockOf6x6IsColor(datas, righttop, black)) |
| | | { |
| | | if (!BlockOf6x6IsColor(datas, righttop, white)) |
| | |
| | | } |
| | | |
| | | //格4 |
| | | ZTPoint leftbottom = center.Add(new ZTPoint(-11, 5)); |
| | | Structs.ZTPoint leftbottom = center.Add(new Structs.ZTPoint(-11, 5)); |
| | | if (!BlockOf6x6IsColor(datas, leftbottom, black)) |
| | | { |
| | | if (!BlockOf6x6IsColor(datas, leftbottom, white)) |
| | |
| | | } |
| | | |
| | | //格8 |
| | | ZTPoint rightbottom = center.Add(5); |
| | | Structs.ZTPoint rightbottom = center.Add(5); |
| | | if (!BlockOf6x6IsColor(datas, rightbottom, black)) |
| | | { |
| | | if (!BlockOf6x6IsColor(datas, rightbottom, white)) |
| | |
| | | /// <param name="starty"></param> |
| | | /// <param name="color"></param> |
| | | /// <returns></returns> |
| | | private static bool BlockOf6x6IsColor(byte[,,] datas,ZTPoint start, byte color) |
| | | private static bool BlockOf6x6IsColor(byte[,,] datas, Structs.ZTPoint start, byte color) |
| | | { |
| | | for (int y = start.Y; y < start.Y + 6; y++) |
| | | { |