-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathNote.cs
49 lines (45 loc) · 1.24 KB
/
Note.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
namespace Holocure_Auto_Fishing_Bot
{
internal struct Note
{
#region Properties
public ReadonlyImage Image { get; }
public string Button { get; }
public int Left { get; set; }
public int Top { get; }
public int Right { get; }
public int Bottom { get; }
#endregion
public Note(ReadonlyImage image, string button, int left, int top, int right, int bottom)
{
Image = image;
Button = button;
Left = left;
Top = top;
Right = right;
Bottom = bottom;
}
}
internal static class NoteExtensions
{
public static bool ContainsNote(
this ReadonlyImage self,
Note note,
int xOffset,
int yOffset
)
{
for (int x = note.Left; x <= note.Right - note.Image.Width; x++)
{
for (int y = note.Top; y <= note.Bottom - note.Image.Height; y++)
{
if (self.CroppedEquals(note.Image, x - xOffset, y - yOffset))
{
return true;
}
}
}
return false;
}
}
}