Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Automat
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.  
  21.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  22.         {
  23.  
  24.             int PenizeNaKredit = Convert.ToInt32(cmbPenizeNaKredit.SelectedItem);
  25.             lblCenaZaKredit.Text = (PenizeNaKredit * 2).ToString();
  26.  
  27.         }
  28.         int Kredity = 0;
  29.         private void button1_Click(object sender, EventArgs e)
  30.         {
  31.  
  32.             int Penize = Convert.ToInt32(lblPenizeVPenezence.Text);
  33.             int PenizeNaKredit = Convert.ToInt32(cmbPenizeNaKredit.SelectedItem) * 2;
  34.             if (Penize < PenizeNaKredit)
  35.             {
  36.                 MessageBox.Show("Nemáš dostatek peněz, začni makat a až pak hazarduj !");
  37.  
  38.             }
  39.             else
  40.             {
  41.                 lblPenizeVPenezence.Text = (Penize - PenizeNaKredit).ToString();
  42.                 lblKredity.Text = (Kredity + Convert.ToInt32(cmbPenizeNaKredit.SelectedItem)).ToString();
  43.                 Kredity = Convert.ToInt32(lblKredity.Text);
  44.                 MessageBox.Show("Právě sis úspěšně koupil " + cmbPenizeNaKredit.SelectedItem + " kreditů za " + PenizeNaKredit + " Kč.\n Tvůj aktuální pozůstatek činí " + lblPenizeVPenezence.Text + " Kč.");
  45.  
  46.  
  47.  
  48.  
  49.             }
  50.         }
  51.  
  52.         private void button2_Click(object sender, EventArgs e)
  53.         {
  54.             Form2 ProdejRudy = new Form2();
  55.             ProdejRudy.Show();
  56.         }
  57.  
  58.         private void button2_Click_1(object sender, EventArgs e)
  59.         {
  60.             Form3 Hazard = new Form3();
  61.             Hazard.Show();
  62.         }
  63.         int Cobblestone = 0;
  64.         int Stone = 0;
  65.         int Gravel = 0;
  66.         int Sand = 0;
  67.         int Iron = 0;
  68.         int Gold = 0;
  69.         int Diamond = 0;
  70.         int Emerald = 0;
  71.  
  72.  
  73.        
  74.  
  75.  
  76.         private void button3_Click(object sender, EventArgs e)
  77.         {
  78.             int Kredity = Convert.ToInt32(lblKredity.Text);
  79.             if(Kredity >= 5) {
  80.             lblKredity.Text = (Convert.ToInt32(lblKredity.Text) - 5).ToString();
  81.             Random Nahoda = new Random();
  82.             int NahodneCislo = Nahoda.Next(0, 101);
  83.             string[] inventar = new string[] { lblInventar0.Text, lblInventar1.Text, lblInventar2.Text, lblInventar3.Text, lblPaty.Text};
  84.                 if (NahodneCislo == 1)
  85.             {
  86.                 Emerald++;
  87.                 MessageBox.Show("Gratuluju, vyhrál jsi emerald !");
  88.                    
  89.                     return;
  90.                 }
  91.                 if ((NahodneCislo > 1) && (NahodneCislo <= 5))
  92.                 {
  93.                     Diamond++;
  94.                     MessageBox.Show("Gratuluju, vyhrál jsi diamond !");
  95.                     for(int i = 0; i >= inventar.Length; i++)
  96.                     {
  97.                         if(lblInventar[i].Text == "")
  98.                         {
  99.                             lblInventar[i].Text = Diamond + "x Diamant";
  100.                             if (Diamond > 1) { lblInventar[i].Text = Diamond + "x Diamantů"; }
  101.                         }  
  102.                     }
  103.                     return;
  104.                 }
  105.                     if ((NahodneCislo > 5) && (NahodneCislo <= 10))
  106.                     {
  107.                         Gold++;
  108.                         MessageBox.Show("Gratuluju, vyhrál jsi Gold Ingot !");
  109.                         return;
  110.                     }
  111.                     if ((NahodneCislo > 10) && (NahodneCislo <= 15))
  112.                     {
  113.                         Iron++;
  114.                         MessageBox.Show("Gratuluju, vyhrál jsi Iron ingot !");
  115.                         return;
  116.                     }
  117.                     if ((NahodneCislo > 15) && (NahodneCislo <= 25))
  118.                     {
  119.                         Sand++;
  120.                         MessageBox.Show("Gratuluju, vyhrál jsi písek !");
  121.                         return;
  122.                     }
  123.                     if ((NahodneCislo > 25) && (NahodneCislo <= 35))
  124.                     {
  125.                         Gravel++;
  126.                         MessageBox.Show("Gratuluju, vyhrál jsi štěrk !");
  127.                         return;
  128.                     }
  129.                     if ((NahodneCislo > 35) && (NahodneCislo <= 60))
  130.                     {
  131.                         Stone++;
  132.                         MessageBox.Show("Gratuluju, vyhrál jsi kámen !");
  133.                         return;
  134.                     }
  135.                     if ((NahodneCislo > 60) && (NahodneCislo <= 100))
  136.                     {
  137.                         Cobblestone++;
  138.                         MessageBox.Show("Gratuluju, vyhrál jsi ... Cobblestone ...");
  139.                         return;
  140.                     }
  141.                 }
  142.                 else { MessageBox.Show("Nemáš dostatek kreditů na hraní !");
  143.                         return; }
  144.  
  145.             }
  146.         }
  147.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement