-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodigoCores.cs
82 lines (73 loc) · 1.61 KB
/
CodigoCores.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Drawing;
namespace Mastermind
{
/// <summary>
/// Summary description for CodigoCores.
/// </summary>
public class CodigoCores
{
private Rectangle r1;
private Rectangle r2;
private Rectangle r3;
private Rectangle r4;
private SolidBrush[] brs;
public CodigoCores(int x, int y, Color cor)
{
r1 = new Rectangle(x,y,20,20);
r2 = new Rectangle(x+25,y,20,20);
r3 = new Rectangle(x+50,y,20,20);
r4 = new Rectangle(x+75,y,20,20);
brs = new SolidBrush[4];
for(int i=0;i<4;i++)
{
brs[i] = new SolidBrush(cor);
}
}//construtor
public void Draw(Graphics grafico)
{
Pen p = new Pen(Color.Black);
grafico.DrawEllipse(p,r1);
grafico.FillEllipse(brs[0],r1);
grafico.DrawEllipse(p,r2);
grafico.FillEllipse(brs[1],r2);
grafico.DrawEllipse(p,r3);
grafico.FillEllipse(brs[2],r3);
grafico.DrawEllipse(p,r4);
grafico.FillEllipse(brs[3],r4);
}//Draw
public void pintaBola(int bola, SolidBrush br)
{
switch(bola)
{
case 1: brs[0] = br;
break;
case 2: brs[1] = br;
break;
case 3: brs[2] = br;
break;
case 4: brs[3] = br;
break;
default: break;
}
}//pintaBola
public bool CodigoValido()
{
bool result = true;
for(int i=0; i<4; i++)
{
if (brs[i].Equals(Color.Black)) result = false;
break;
}
return result;
}//CodigoValido
public SolidBrush[] getCodigo()
{
return brs;
}//getCodigo
public void setCodigo(SolidBrush[] sbrs)
{
brs = sbrs;
}//setCodigo
}
}