TheTime Posted November 30, 2011 Report Posted November 30, 2011 Salut baieti.In incercarea mea de a ma familiariza cu C#, am facut un mic joculet pe care-l cautam de ceva vreme, dar nu-l mai gaseam.Scopul e sa te imbogatesti! Trebuie sa ghicesti ce culoare va avea cartea ce urmeaza sa apara. Daca ghicesti, banii de la masa ti se dubleaza. Daca nu, pierzi totul. Va prindeti voi.Link de download executabil: http://dl.transfer.ro/transfer_ro-30nov-3f00ac8464.zipO parte din codul sursa: namespace Random{ public partial class Form1 : Form { private long baniLaMasa = 0, baniCash = 200; System.Random rand = new System.Random(); String[] refinantare = new string[10]; public Form1() { InitializeComponent(); textBox1.Text = "0"; refinantare[0] = "Ai intrat intr-un magazin de vechituri si, cand nimeni nu se uita, ai <<gasit>> 200$."; refinantare[1] = "Te duci in vizita la matusa ta bogata si primesti 200$ pentru acadele."; refinantare[2] = "Esti un bun sustinator al spitalelor, donezi cateva butoaie de sange si castigi 200$."; refinantare[3] = "Scoti la licitatie colectia ta de carti Pokemon. Este vanduta pe Okazii cu 200$."; refinantare[4] = "Realizezi ca nu mai ai bani de mancare, deci iti vinzi dintele de aur cu 200$."; refinantare[5] = "Te duci pe stadion la cersit. Primesti cate 1$ de la fiecare fan al Stelei!"; refinantare[6] = "Faci afaceri de milioane cu Becali. Tu primesti 200$, el ia restul."; refinantare[7] = "Iti convingi prietenii ca telefonul tau este iPhone 5. Il vinzi cu 200$."; refinantare[8] = "Te duci intr-un bar sa canti Nickelback - Rockstar. Primesti o gramada de bani ca sa taci din gura."; } private void Form1_Load(object sender, EventArgs e) { } //Pluseaza +1 private void button3_Click(object sender, EventArgs e) { int bani = Convert.ToInt32(textBox1.Text); if (baniCash>0) { textBox1.Text = Convert.ToString(bani + 1); baniCash--; label1.Text = "Bani lichizi: " + baniCash + " $"; } else MessageBox.Show("Nu mai ai bani cash! Ia o pauza si du-te la produs, sau multumeste-te cu ce mai ai!", "Oops..."); } //Pluseaza -1 private void button2_Click(object sender, EventArgs e) { int bani = Convert.ToInt32(textBox1.Text); if (bani > 0) { textBox1.Text = Convert.ToString(bani - 1); baniCash++; label1.Text = "Bani lichizi: " + baniCash + " $"; } else MessageBox.Show("Mai jos de 0 nici tu nu poti sa ajungi! Lasa zgarcenia si pluseaza ceva cash!", "Oops..."); } //Buton Pluseaza private void button1_Click(object sender, EventArgs e) { int bani = Convert.ToInt32(textBox1.Text); baniLaMasa += bani; label2.Text = "Bani la masa: " + baniLaMasa + " $"; textBox1.Text = "0"; statutSocial(); } //Buton Incaseaza private void button5_Click(object sender, EventArgs e) { baniCash += baniLaMasa; baniLaMasa = 0; label2.Text = "Bani la masa: " + baniLaMasa + " $"; label1.Text = "Bani lichizi: " + baniCash + " $"; statutSocial(); } //Buton Negru private void button6_Click(object sender, EventArgs e) { int i = rand.Next(54) + 1; if (i == 53) { baniLaMasa = baniLaMasa * 10; pictureBox2.Image = carti._53; MessageBox.Show("Ti-ai nimerit jockerul norocos! Suma ta de bani s-a inzecit!", "Yeyyy..."); label2.Text = "Bani la masa: " + baniLaMasa + " $"; label3.Text = "Felicitari! Ai castigat!!"; label3.ForeColor = Color.Blue; } else if (i == 54) { label3.Text = "Ghinion! Mai incearca."; label3.ForeColor = Color.Red; pictureBox2.Image = carti._54; MessageBox.Show("Ti-ai nimerit jockerul norocos! Dar de alta culore... si nu primesti NIMIC!", "Yeyyy..."); } else if (i == 45) { label3.Text = "Ghinion! Mai incearca."; label3.ForeColor = Color.Red; pictureBox2.Image = carti._45; MessageBox.Show("Intalnesti o dama de inima neagra. Te lasa fara bani cash si cu inima rupta!", "Yeyyy..."); baniCash = 0; label1.Text = "Bani lichizi: " + baniCash + " $"; statutSocial(); } else if (i == 50) { baniCash += 500; pictureBox2.Image = carti._50; MessageBox.Show("Intalnesti un rege cu inima buna si iti ofera o comoara in valoare de 500$.", "Yeyyy..."); label1.Text = "Bani lichizi: " + baniCash + " $"; label3.Text = "Felicitari! Ai castigat!!"; label3.ForeColor = Color.Blue; statutSocial(); } else if (i < 5) { baniLaMasa += 500; pictureBox2.Image = (System.Drawing.Image)carti.ResourceManager.GetObject("_" + i); MessageBox.Show("Scoti Ace-ul din maneca! Runda aceasta castigi 500$.", "Yeyyy..."); label2.Text = "Bani la masa: " + baniLaMasa + " $"; label3.Text = "Felicitari! Ai castigat!!"; label3.ForeColor = Color.Blue; } else if (i % 2 == 1) { baniLaMasa += baniLaMasa; pictureBox2.Image = (System.Drawing.Image)carti.ResourceManager.GetObject("_" + i); label2.Text = "Bani la masa: " + baniLaMasa + " $"; label3.Text = "Felicitari! Ai castigat!!"; label3.ForeColor = Color.Blue; } else { baniLaMasa = 0; pictureBox2.Image = (System.Drawing.Image)carti.ResourceManager.GetObject("_" + i); label2.Text = "Bani la masa: " + baniLaMasa + " $"; label3.Text = "Ghinion! Mai incearca."; label3.ForeColor = Color.Red; } } //Buton Rosu private void button4_Click(object sender, EventArgs e) { int i = rand.Next(54) + 1; if (i == 53) { label3.Text = "Ghinion! Mai incearca."; label3.ForeColor = Color.Red; pictureBox2.Image = carti._53; MessageBox.Show("Ti-ai nimerit jockerul norocos! Dar de alta culore... si nu primesti NIMIC!", "Yeyyy..."); } else if (i == 54) { baniLaMasa = baniLaMasa * 10; pictureBox2.Image = carti._54; MessageBox.Show("Ti-ai nimerit jockerul norocos! Suma ta de bani s-a inzecit!", "Yeyyy..."); label2.Text = "Bani la masa: " + baniLaMasa + " $"; label3.Text = "Felicitari! Ai castigat!!"; label3.ForeColor = Color.Blue; } else if (i == 45) { label3.Text = "Ghinion! Mai incearca."; label3.ForeColor = Color.Red; pictureBox2.Image = carti._45; MessageBox.Show("Intalnesti o dama de inima neagra. Te lasa fara bani cash si cu inima rupta!", "Yeyyy..."); baniCash = 0; label1.Text = "Bani lichizi: " + baniCash + " $"; statutSocial(); } else if (i == 50) { baniCash += 500; pictureBox2.Image = carti._50; MessageBox.Show("Intalnesti un rege cu inima buna si iti ofera o comoara in valoare de 500$.", "Yeyyy..."); label1.Text = "Bani lichizi: " + baniCash + " $"; label3.Text = "Felicitari! Ai castigat!!"; label3.ForeColor = Color.Blue; statutSocial(); } else if (i < 5) { baniLaMasa += 500; pictureBox2.Image = (System.Drawing.Image)carti.ResourceManager.GetObject("_" + i); MessageBox.Show("Scoti Ace-ul din maneca! Runda aceasta castigi 500$.", "Yeyyy..."); label2.Text = "Bani la masa: " + baniLaMasa + " $"; label3.Text = "Felicitari! Ai castigat!!"; label3.ForeColor = Color.Blue; } else if (i % 2 == 1) { label3.Text = "Ghinion! Mai incearca."; label3.ForeColor = Color.Red; baniLaMasa = 0; pictureBox2.Image = (System.Drawing.Image)carti.ResourceManager.GetObject("_" + i); label2.Text = "Bani la masa: " + baniLaMasa + " $"; } else { baniLaMasa += baniLaMasa; pictureBox2.Image = (System.Drawing.Image)carti.ResourceManager.GetObject("_" + i); label2.Text = "Bani la masa: " + baniLaMasa + " $"; label3.Text = "Felicitari! Ai castigat!!"; label3.ForeColor = Color.Blue; } } //Buton Refinantare private void button7_Click(object sender, EventArgs e) { int i = Convert.ToInt32(textBox1.Text); if ((baniLaMasa == 0) && (baniCash == 0) && (i == 0)) { baniCash = 200; label1.Text = "Bani lichizi: " + baniCash + " $"; System.Random g = new System.Random(); MessageBox.Show(refinantare[g.Next(9)], "Good Game!"); statutSocial(); } else { MessageBox.Show("Inca mai ai bani, joaca-i cu cap!", "Game on!"); } } //buton pluseaza +10 private void button8_Click(object sender, EventArgs e) { int bani = Convert.ToInt32(textBox1.Text); if (baniCash > 9) { textBox1.Text = Convert.ToString(bani + 10); baniCash -= 10; label1.Text = "Bani lichizi: " + baniCash + " $"; } else MessageBox.Show("Abia mai ai bani de-o paine, mai treci pe la produs!", "Oops..."); } //buton pluseaza -10 private void button9_Click(object sender, EventArgs e) { int bani = Convert.ToInt32(textBox1.Text); if (bani > 9) { textBox1.Text = Convert.ToString(bani - 10); baniCash += 10; label1.Text = "Bani lichizi: " + baniCash + " $"; } else MessageBox.Show("Nu ai atatia bani in mana! Lasa zgarcenia si pluseaza ceva cash!", "Oops..."); } //Actualizarea statutului social private void statutSocial() { long bani = baniCash + Convert.ToInt32(textBox1.Text); if (bani < 50) { label4.Text = "Falimentar"; label4.ForeColor = Color.Red; } else if (bani < 250) { label4.Text = "Salariat"; label4.ForeColor = Color.Black; } else if (bani < 1000) { label4.Text = "Instarit"; label4.ForeColor = Color.Blue; } else if (bani < 3000) { label4.Text = "Bogat"; label4.ForeColor = Color.Gold; } else if (bani < 10000) { label4.Text = "Afacerist"; label4.ForeColor = Color.YellowGreen; } else { label4.Text = "RockStar"; label4.ForeColor = Color.Green; } } }Enjoy! 1 Quote
Sylvian17 Posted November 30, 2011 Report Posted November 30, 2011 imi spune ceva legat de net framework:) Quote
TheTime Posted November 30, 2011 Author Report Posted November 30, 2011 Trebuie sa instalezi .NET framework 4.http://msdn.microsoft.com/en-us/netframework/aa569263 Quote
Sylvian17 Posted November 30, 2011 Report Posted November 30, 2011 Could not locate remote server .. o sa-l caut pe net sa-l iau Quote
visan15 Posted November 30, 2011 Report Posted November 30, 2011 Destul de dragut , pacat ca trebuie sa faci manual cand plusezi ( +1 / +10 ) Quote
unknown. Posted November 30, 2011 Report Posted November 30, 2011 (edited) Foarte frumos jocul,mai astept jocuri de genul din partea ta;)BTW: Ajungi bogat prea devreme...pe la 1000$LE: Scuze,n-am vazut ca mai sunt si alte rank-uri..LE2: Ai un bug,cand nimeresc joker-ul imi zice ca suma mea s-a inzecit,dar ea defapt nu-si modifica valoarea. Edited November 30, 2011 by unknown. Quote
TheTime Posted November 30, 2011 Author Report Posted November 30, 2011 Se refera la suma de bani de la masa, nu banii cash. dama de inima neagra si popa de inima rosie sunt singurele carti care umble cu banii cash.Ma bucur ca-ti place Quote