Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.35 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 };
  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.                         string Hmm = "lblInventar[i].Text";
  98.                         if(Hmm == "")
  99.                         {
  100.                            Hmm = Diamond + "x Diamant";
  101.                             if (Diamond > 1) { Hmm = Diamond + "x Diamantů"; }
  102.                         }  
  103.                     }
  104.                     return;
  105.                 }
  106.                     if ((NahodneCislo > 5) && (NahodneCislo <= 10))
  107.                     {
  108.                         Gold++;
  109.                         MessageBox.Show("Gratuluju, vyhrál jsi Gold Ingot !");
  110.                     for (int i = 0; i >= inventar.Length; i++)
  111.                     {
  112.                         string Hmm = "lblInventar[i].Text";
  113.                         if (Hmm == "")
  114.                         {
  115.                             Hmm = Gold + "x Diamant";
  116.                             if (Gold > 1) { Hmm = Gold + "x Diamantů"; }
  117.                         }
  118.                     }
  119.                    
  120.                     return;
  121.                     }
  122.                     if ((NahodneCislo > 10) && (NahodneCislo <= 15))
  123.                     {
  124.                         Iron++;
  125.                         MessageBox.Show("Gratuluju, vyhrál jsi Iron ingot !");
  126.                     for (int i = 0; i >= inventar.Length; i++)
  127.                     {
  128.                         string Hmm = "lblInventar[i].Text";
  129.                         if (Hmm == "")
  130.                         {
  131.                             Hmm = Iron + "x Diamant";
  132.                             if (Iron > 1) { Hmm = Iron + "x Diamantů"; }
  133.                         }
  134.                     }
  135.  
  136.                     return;
  137.                     }
  138.                     if ((NahodneCislo > 15) && (NahodneCislo <= 25))
  139.                     {
  140.                         Sand++;
  141.                         MessageBox.Show("Gratuluju, vyhrál jsi písek !");
  142.                     for (int i = 0; i >= inventar.Length; i++)
  143.                     {
  144.                         string Hmm = "lblInventar[i].Text";
  145.                         if (Hmm == "")
  146.                         {
  147.                             Hmm = Sand + "x Diamant";
  148.                             if (Sand > 1) { Hmm = Sand + "x Diamantů"; }
  149.                         }
  150.                     }
  151.  
  152.                     return;
  153.                     }
  154.                     if ((NahodneCislo > 25) && (NahodneCislo <= 35))
  155.                     {
  156.                         Gravel++;
  157.                         MessageBox.Show("Gratuluju, vyhrál jsi štěrk !");
  158.                     for (int i = 0; i >= inventar.Length; i++)
  159.                     {
  160.                         string Hmm = "lblInventar[i].Text";
  161.                         if (Hmm == "")
  162.                         {
  163.                             Hmm = Gravel + "x Diamant";
  164.                             if (Gravel > 1) { Hmm = Gravel + "x Diamantů"; }
  165.                         }
  166.                     }
  167.  
  168.                     return;
  169.                     }
  170.                     if ((NahodneCislo > 35) && (NahodneCislo <= 60))
  171.                     {
  172.                         Stone++;
  173.                         MessageBox.Show("Gratuluju, vyhrál jsi kámen !");
  174.                     for (int i = 0; i >= inventar.Length; i++)
  175.                     {
  176.                         string Hmm = "lblInventar[i].Text";
  177.                         if (Hmm == "")
  178.                         {
  179.                             Hmm = Stone + "x Diamant";
  180.                             if (Stone > 1) { Hmm = Stone + "x Diamantů"; }
  181.                         }
  182.                     }
  183.  
  184.                     return;
  185.                     }
  186.                     if ((NahodneCislo > 60) && (NahodneCislo <= 100))
  187.                     {
  188.                        Cobblestone++;
  189.                     for (int i = 0; i <= inventar.Length; i++)
  190.                     {
  191.                        
  192.                         if (inventar[i] == "")
  193.                         {
  194.                             inventar[i] = Cobblestone + "x Cobble";
  195.                         }
  196.                     }
  197.                     MessageBox.Show("Gratuluju, vyhrál jsi ... Cobblestone ...");
  198.                     return;
  199.                     }
  200.                 }
  201.                 else { MessageBox.Show("Nemáš dostatek kreditů na hraní !");
  202.                         return; }
  203.  
  204.             }
  205.         }
  206.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement