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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100using System;
using System.Drawing;
using System.Windows.Forms;
namespace Monopoly
{
public partial class Form1 : Form
{
Joc tempJoc;
Jucator jucatorActiv;
public Form1()
{
InitializeComponent();
jucatorActiv = Joc.jucatorActiv;
tempJoc = new Joc();
foreach (var pion in Joc.pioni)
{
pion.Visible = true;
pion.Refresh();
pion.Show();
ListaCelule.Instanta[0].Controls.Add(pion);
}
}
private void button1_Click(object sender, EventArgs e)
{
actualizeazaInformatiile();
}
private void rollDice_Click(object sender, EventArgs e)
{
Zar tempZar = new Zar();
zar1.BackgroundImage = tempZar.zar1Image;
zar2.BackgroundImage = tempZar.zar2Image;
if(jucatorActiv.numarDuble == 3)
{
jucatorActiv.mergiLa(10);
MessageBox.Show("Ai dat 3 duble la rand ! Mergi la inchisoare !");
}
if (tempZar.zar1 == tempZar.zar2)
{
MessageBox.Show("Ai dat dubla. Mai dai o data !");
jucatorActiv.numarDuble++;
} else
{
daCuZarul.Enabled = false;
}
jucatorActiv.muta(tempZar.zar1 + tempZar.zar2);
actualizeazaInformatiile();
}
private void actualizeazaInformatiile()
{
jucatorActiv = Joc.jucatorActiv;
numeJucator.Text = jucatorActiv.nume;
baniJucator.Text = jucatorActiv.bani.ToString();
pozitieJucator.Text = jucatorActiv.pozitieCurenta.ToString();
pionJucator.BackgroundImage = jucatorActiv.pion;
zar1.BackgroundImage = null;
zar2.BackgroundImage = null;
}
private void incheieTura_Click(object sender, EventArgs e)
{
jucatorActiv.aFost = true;
Jucator urmatorulJucator = Joc.jucatori.Find(jucator => jucator.aFost == false);
if(urmatorulJucator != null)
{
int indexulJucatoruluiTrecut = Joc.jucatori.IndexOf(jucatorActiv);
Joc.jucatori[indexulJucatoruluiTrecut] = jucatorActiv;
Joc.jucatorActiv = urmatorulJucator;
daCuZarul.Enabled = true;
actualizeazaInformatiile();
} else
{
foreach (Jucator jucator in Joc.jucatori)
{
jucator.aFost = false;
}
jucatorActiv = Joc.jucatori.Find(jucator => jucator.aFost == false);
daCuZarul.Enabled = true;
actualizeazaInformatiile();
}
}
}
}