Example #1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Botella botella;

            if (rbCerveza.Checked)
            {
                Botella.Tipo tipo;
                Enum.TryParse <Botella.Tipo>(this.cbTipoBotella.SelectedValue.ToString(), out tipo);

                botella = new Cerveza((int)this.nudCapacidad.Value, this.txtMarca.Text, tipo, (int)this.nupContenido.Value);

                this.barra.AgregarBotella(botella);

                MessageBox.Show(botella.ToString(), "CERVEZA");
            }
            else
            {
                if (this.cbTipoBotella.Text == "Plastico")
                {
                    botella = new Agua((int)this.nudCapacidad.Value, this.txtMarca.Text, (int)this.nupContenido.Value);

                    this.barra.AgregarBotella(botella);

                    MessageBox.Show(botella.ToString(), "AGUA");
                }
                else
                {
                    MessageBox.Show(" No tenemos agua en envase de vidrio");
                }
            }
        }
Example #2
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            int     capacidadInt = (int)numCapacidad.Value;
            int     contenidoInt = (int)numContenido.Value;
            Botella botella;
            string  marca = txtMarca.Text;

            if (btnCerveza.Checked)
            {
                Botella.Tipo tipo;
                Enum.TryParse <Botella.Tipo>(cmbTipo.SelectedValue.ToString(), out tipo);
                botella = new Cerveza(capacidadInt, marca, tipo, contenidoInt);
            }
            else
            {
                botella = new Agua(capacidadInt, marca, contenidoInt);
            }
            if (botella is Agua)
            {
                barra1.AgregarBotella((Agua)botella);
            }
            else if (botella is Cerveza)
            {
                barra1.AgregarBotella((Cerveza)botella);
            }
        }
Example #3
0
        public static void Main(string[] args)
        {
            beverage PayeLate = new payeLate("Grande");
            PayeLate = new Leche(payeLate);
            PayeLate = new Espresso(payeLate);

            Console.WriteLine(payeLatte.getDescription());
            Console.WriteLine(payeLatte.getCost());

            beverage payachai = new PayaChai("Mediano");
            payachai = new Leche(PayaChai);
            payachai = new Agua(PayaChai);

            Console.WriteLine(PayaChai.getDescription());
            Console.WriteLine(PayaChai.getCost());

            beverage PayuExpress = new payuExpress("Chico");
            PayuExpress = new Espresso(payuExpress);
            PayuExpress = new Agua(payuExpress);

            Console.WriteLine(PayuExpress.getDescription());
            Console.WriteLine(PayuExpress.getCost());

            beverage payuMoca = new PayuMoca("");
            payuMoca = new Espresso(PayuMoca);
            payuMoca = new Agua(PayuMoca);
            payuMoca = new Leche(PayuMoca);

            Console.WriteLine(PayuMoca.getDescription());
            Console.WriteLine(PayuMoca.getCost());
        }
Example #4
0
        private void btnabrir_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            if (open.ShowDialog() == DialogResult.OK)
            {
                if (Path.GetExtension(open.FileName) == ".TXT")
                {
                    txtfile.Text = open.FileName;
                    try
                    {
                        using (StreamReader read = new StreamReader(open.FileName))
                        {
                            string line;
                            while ((line = read.ReadLine()) != null)
                            {
                                string[]     spt    = line.Split(';');
                                Titular      pessoa = new Titular(spt[1]);
                                ListViewItem item1  = new ListViewItem();
                                item1.Text = spt[0];
                                Conta conta;
                                if (spt[2] == "1")
                                {
                                    conta = new Energia(int.Parse(spt[0]), 0, 0, 0, pessoa);
                                    item1.SubItems.Add("Energia");
                                }
                                else
                                {
                                    conta = new Agua(int.Parse(spt[0]), 0, 0, 0, pessoa);
                                    item1.SubItems.Add("Agua");
                                }
                                Titular aux = (Titular)pessoas.Procurar(pessoa);
                                if (aux == null)
                                {
                                    pessoa.AddConta(conta);
                                    pessoas.Inserir(pessoa);
                                }
                                else
                                {
                                    aux.AddConta(conta);
                                }
                                contas.Inserir(conta);
                                listcontas.Items.Add(item1);
                                ListViewItem item = new ListViewItem();
                                item.Text = spt[1];
                                item.SubItems.Add(spt[2]);
                                listpeople.Items.Add(item);
                            }
                        }
                    }
                    catch (Exception ee)
                    {
                        MessageBox.Show(ee.Message);
                    }
                }
            }
        }
Example #5
0
    public void ExtraerAgua(Estructura build, GameAction action)
    {
        if (ComprobarAcceso(action))
        {
            return;
        }

        Agua agua = build.GetComponent <Agua>();

        action.worker.aguaTotal.TomarAgua(action.worker.aguaTotal.litrosMaximo, agua.agua);
    }
Example #6
0
 private void rellenarSobrantesAgua()
 {
     for (int i = 0; i < 10; i++)
     {
         for (int j = 0; j < 10; j++)
         {
             if (matrix[i, j] == null)
             {
                 Casilla casilla = matrix[i, j] = new Agua();
             }
         }
     }
 }
Example #7
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (rbAgua.Checked == true)
     {
         Agua a1 = new Agua(txtMarca.Text, (int)numberCapacidad.Value, (int)numberContenido.Value);
         barra1.AgregarBotella(a1);
     }
     else
     {
         Cerveza c1 = new Cerveza(txtMarca.Text, (int)numberCapacidad.Value, (int)numberContenido.Value);
         barra1.AgregarBotella(c1);
     }
 }
Example #8
0
 private void btmAgregar_Click(object sender, EventArgs e)
 {
     Enum.TryParse <Botella.Tipo>(cmbBotellaTipo.SelectedValue.ToString(), out tipo);
     if (rbAgua.Checked == true)
     {
         Botella botellaDeAgua = new Agua((int)nudCapacidad.Value, tbMarca.Text, (int)nudContenido.Value);
         barra1.AgregarBotella(botellaDeAgua);
     }
     else if (rbCerveza.Checked == true)
     {
         Botella botellaDeCerveza = new Cerveza((int)nudCapacidad.Value, tbMarca.Text, this.tipo, (int)nudContenido.Value);
         barra1.AgregarBotella(botellaDeCerveza);
     }
 }
Example #9
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Botella botella = null;

            if (rBtnAgua.Checked)
            {
                botella = new Agua((int)numUpDwCapacidad.Value, txtBoxMarca.Text, (int)numUpDwContenido.Value);
            }
            else if (rBtnCerveza.Checked)
            {
                botella = new Cerveza((int)numUpDwCapacidad.Value, txtBoxMarca.Text, (Botella.Tipo)cmbBotellaTipo.SelectedValue, (int)numUpDwContenido.Value);
            }
            this.barra1.AgregarBotella(botella);
        }
Example #10
0
 /// <summary>
 /// Agrega una botella a la barra.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Button1_Click(object sender, EventArgs e)
 {
     Botella.Tipo tipo;
     Enum.TryParse <Botella.Tipo>(cmbBotellaTipo.SelectedValue.ToString(), out tipo);
     if (BtnAgua.Checked)
     {
         Agua agua = new Agua((int)numCapacidad.Value, txtMarca.Text, (int)numContenido.Value);
         barra1.AgregarBotella(agua);
     }
     else
     {
         Cerveza cerveza = new Cerveza((int)numCapacidad.Value, txtMarca.Text, tipo, (int)numContenido.Value);
         barra1.AgregarBotella(cerveza);
     }
 }
Example #11
0
 private void btn_Agregar_Click(object sender, EventArgs e)
 {
     if (rdn_Cerveza.Checked)
     {
         Botella botellaCerveza = new Cerveza((int)num_Capacidad.Value, (int)num_Contenido.Value, txt_Marca.Text);
         this.barra.AgregarBotella(botellaCerveza);
         MessageBox.Show($"{botellaCerveza.ToString()} \nSe agregó la cerveza", "Alcohol", MessageBoxButtons.OK);
     }
     else
     {
         Botella botellaAgua = new Agua((int)num_Capacidad.Value, (int)num_Contenido.Value, txt_Marca.Text);
         barra.AgregarBotella(botellaAgua);
         MessageBox.Show($"{botellaAgua.ToString()} \nSe agregó el agua", "Awita", MessageBoxButtons.OK);
     }
 }
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (rbAgua.Checked)
     {
         Agua botellaAgua = new Agua((int)numericUpDown1.Value, txtMarca.Text, (int)numericUpDown2.Value);
         barra1.AgregarBotella(botellaAgua);
     }
     if (rbCerveza.Checked)
     {
         Botella.Tipo tipo;
         Enum.TryParse <Botella.Tipo>(cmbBotellaTipo.SelectedValue.ToString(), out tipo);
         Cerveza botellaCerveza = new Cerveza((int)numericUpDown1.Value, txtMarca.Text, tipo, (int)numericUpDown2.Value);
         barra1.AgregarBotella(botellaCerveza);
     }
 }
Example #13
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (radioButton1.Checked)
     {
         Botella.Tipo t;
         Enum.TryParse <Botella.Tipo>(comboBox1.SelectedValue.ToString(), out t);
         Botella b = new Cerveza(textBox1.Text, (int)numericUpDown1.Value, (int)numericUpDown2.Value, t);
         barra1.AgregarBotella(b);
     }
     else if (radioButton2.Checked)
     {
         Botella b = new Agua((int)numericUpDown1.Value, (int)numericUpDown2.Value, textBox1.Text);
         barra1.AgregarBotella(b);
     }
 }
Example #14
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (radioButton1.Checked)
     {
         Botella.Tipo tipo;
         Enum.TryParse <Botella.Tipo>(cmbBotellaTipo.SelectedValue.ToString(), out tipo);
         Cerveza beer = new Cerveza((int)numericUpDown1.Value, (int)numericUpDown2.Value, tipo, txtMarca.Text);
         barra.AgregarBotella(beer);
     }
     if (radioButton2.Checked)
     {
         Agua water = new Agua((int)numericUpDown1.Value, (int)numericUpDown2.Value, txtMarca.Text);
         barra.AgregarBotella(water);
     }
 }
Example #15
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     Botella.Tipo tipo;
     Enum.TryParse <Botella.Tipo>(comboTipoBotella.SelectedValue.ToString(), out tipo);
     if (radioCerveza.Checked)
     {
         int     cap = Convert.ToInt16(numericContenido.Value);
         Cerveza c   = new Cerveza(Convert.ToInt16(numericCapacidad.Value), txtMarca.Text, Convert.ToInt16(numericContenido.Value), tipo);
         barra1.AgregarBotella(c);
     }
     else
     {
         Agua a = new Agua(Convert.ToInt16(numericCapacidad.Value), txtMarca.Text, Convert.ToInt16(numericContenido.Value));
         barra1.AgregarBotella(a);
     }
 }
Example #16
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Botella botella;

            if (rdbCerbeza.Checked)
            {
                Botella.Tipo tipo;
                Enum.TryParse <Botella.Tipo>(cmbBotellaTipo.SelectedValue.ToString(), out tipo);
                botella = new Cerveza((int)numContenido.Value, textMarca.Text, (int)numContenido.Value);
            }
            else
            {
                botella = new Agua((int)numContenido.Value, textMarca.Text, (int)numContenido.Value);
            }
            this.barra.AgregarBotella(botella);
        }
Example #17
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Botella.Tipo tipo;
            Enum.TryParse <Botella.Tipo>(cmbBotellaTipo.SelectedValue.ToString(), out tipo);
            Botella botella = null;

            if (radioCerveza.Checked)
            {
                botella = new Cerveza((int)numericCapacidad.Value, txtMarca.Text, tipo, (int)numericContenido.Value);
            }
            if (radioAgua.Checked)
            {
                botella = new Agua((int)numericCapacidad.Value, txtMarca.Text, (int)numericContenido.Value);
            }
            this.barra.AgregarBotella(botella);
        }
Example #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Botella.Tipo tipo;
            Enum.TryParse <Botella.Tipo>(comboBoxBotellaTipo.SelectedValue.ToString(), out tipo);

            if (rdioBtnAgua.Checked)
            {
                Agua water = new Agua((int)this.numericUpDownCapacidad.Value, this.txtMarca.Text, (int)this.numericUpDownContenido.Value);
                this.barra1.AgregarBotella(water);
            }
            else
            {
                Cerveza beer = new Cerveza((int)this.numericUpDownCapacidad.Value, this.txtMarca.Text, (Botella.Tipo)comboBoxBotellaTipo.SelectedItem, (int)this.numericUpDownContenido.Value);
                this.barra1.AgregarBotella(beer);
            }
        }
Example #19
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     Botella.Tipo tipo;
     Enum.TryParse <Botella.Tipo>(cmbBotellaTipo.SelectedValue.ToString(), out tipo);
     if (rbBtnAgua.Checked)
     {
         Agua agua = new Agua((int)nudCapacidad.Value, txtMarca.Text, (int)nudContenido.Value);
         barra.AgregarBotella(agua);
         MessageBox.Show(agua.toString());
     }
     else if (rdBtnCerveza.Checked)
     {
         Cerveza cerveza = new Cerveza((int)nudCapacidad.Value, txtMarca.Text, tipo, (int)nudContenido.Value);
         barra.AgregarBotella(cerveza);
         MessageBox.Show(cerveza.toString());
     }
 }
Example #20
0
        private void button1_Click(object sender, EventArgs e)
        {
            string marca     = Marca.Text;
            int    capacidad = Convert.ToInt32(Capacidad.Value);
            int    contenido = Convert.ToInt32(Contenido.Value);


            if (radioButtonAgua.Checked)
            {
                Agua a = new Agua(capacidad, marca, contenido);
                barra.AgregarBotella(a);
            }

            if (radioButtonCerveza.Checked)
            {
                Cerveza c = new Cerveza(capacidad, marca, tipo, contenido);
                barra.AgregarBotella(c);
            }
        }
Example #21
0
 private void rodeaCasilladeAgua(int row, int col)
 {
     // Esquina superior izquierda
     if (row - 1 >= 0 && col - 1 >= 0 && matrix[row - 1, col - 1] == null)
     {
         matrix[row - 1, col - 1] = new Agua();
     }
     // Esquina superior derecha
     if (row - 1 >= 0 && col + 1 <= 9 && matrix[row - 1, col + 1] == null)
     {
         matrix[row - 1, col + 1] = new Agua();
     }
     // Esquina inferior izquierda
     if (row + 1 <= 9 && col - 1 >= 0 && matrix[row + 1, col - 1] == null)
     {
         matrix[row + 1, col - 1] = new Agua();
     }
     // Esquina inferior derecha
     if (row + 1 <= 9 && col + 1 <= 9 && matrix[row + 1, col + 1] == null)
     {
         matrix[row + 1, col + 1] = new Agua();
     }
     // Izquierda
     if (col - 1 >= 0 && matrix[row, col - 1] == null)
     {
         matrix[row, col - 1] = new Agua();
     }
     // Derecha
     if (row + 1 <= 9 && matrix[row + 1, col] == null)
     {
         matrix[row + 1, col] = new Agua();
     }
     // Abajo
     if (col + 1 <= 9 && matrix[row, col + 1] == null)
     {
         matrix[row, col + 1] = new Agua();
     }
     // Arriba
     if (row - 1 >= 0 && matrix[row - 1, col] == null)
     {
         matrix[row - 1, col] = new Agua();
     }
 }
Example #22
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Botella botella;

            if (radioButtonAgua.Checked)
            {
                botella = new Agua((int)numCapacidad.Value, txtBoxMarca.Text, (int)numeContenido.Value);

                barra1.AgregarBotella((Agua)botella);
            }

            if (radioButtonCerveza.Checked)
            {
                Enum.TryParse <Botella.Tipo>(cmbTipo.SelectedValue.ToString(), out tipo);
                botella = new Cerveza((int)numCapacidad.Value, txtBoxMarca.Text, tipo, (int)numeContenido.Value);

                barra1.AgregarBotella((Cerveza)botella);
            }
        }
Example #23
0
        static void Main(string[] args)
        {
            Cantina cantina;
            Cerveza c1 = new Cerveza(1000, "Honey", 500);
            Cerveza c2 = new Cerveza(2000, "IPA", Botella.Tipo.Plastico, 2050);
            Agua    a  = new Agua(500, "Los Andes", 350);
            Agua    a2 = new Agua(500, "Los Andes", 350);

            cantina = Cantina.GetCantina(3);

            if (cantina + c1)
            {
                c1.ServirMedida();
                Console.WriteLine(c1.ToString());
            }

            Console.WriteLine();

            if (cantina + c2)
            {
                c2.ServirMedida();
                Console.WriteLine(c2.ToString());
            }

            Console.WriteLine();

            if (cantina + a)
            {
                a.ServirMedida(67);
                Console.WriteLine(a.ToString());
            }

            Console.WriteLine();

            if (cantina + a2)
            {
                a2.ServirMedida();
                Console.WriteLine(a2.ToString());
            }

            Console.ReadKey();
        }
        /// <summary>
        /// Agrega botellas a la barra
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            string marca     = txtBoxMarca.Text;
            int    capacidad = (int)numCapacidad.Value;
            int    contenido = (int)numContenido.Value;

            Botella.Tipo tipo;
            Enum.TryParse <Botella.Tipo>(cmbBoxTipo.SelectedValue.ToString(), out tipo);

            if (rdBtnCerveza.Checked)
            {
                Cerveza c = new Cerveza(capacidad, contenido, marca, tipo);
                barra.AgregarBotella(c);
            }
            else if (rdBtnAgua.Checked)
            {
                Agua a = new Agua(capacidad, contenido, marca);
                barra.AgregarBotella(a);
            }
        }
Example #25
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Botella.Tipo tipo;
            Enum.TryParse <Botella.Tipo>(cmbTipo.SelectedValue.ToString(), out tipo);


            if (rBtnAgua.Checked)
            {
                Agua botellaAgua = new Agua(txtMarca.Text, (int)numCapacidad.Value, (int)numContenido.Value);
                this.barra.AgregarBotella(botellaAgua);
            }
            else if (rBtnCerveza.Checked)
            {
                Cerveza botellaCerveza = new Cerveza(txtMarca.Text, (int)numCapacidad.Value, (int)numContenido.Value, tipo);
                this.barra.AgregarBotella(botellaCerveza);
            }
            else
            {
                MessageBox.Show("seleccione tipo");
            }
        }
Example #26
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Botella.Tipo tipo;
            Enum.TryParse <Botella.Tipo>(cmbBotellaTipo.SelectedValue.ToString(), out tipo);


            if (rdbtnAgua.Checked)
            {
                Agua agua = new Agua(Convert.ToInt32(nupdoCapacidad.Value), txtbMarca.Text, Convert.ToInt32(numericUpDown2.Value));
                this.barra1.AgregarBotella(agua);
            }
            else if (rdbtnCerveza.Checked)
            {
                Cerveza cerveza = new Cerveza(Convert.ToInt32(nupdoCapacidad.Value), txtbMarca.Text, tipo, Convert.ToInt32(numericUpDown2.Value));
                this.barra1.AgregarBotella(cerveza);
            }
            else
            {
                MessageBox.Show("Seleccione cerveza o agua");
            }
        }
Example #27
0
    /// <summary>
    /// Pesca un pez
    /// </summary>
    public void Pescar(Estructura build, GameAction action)
    {
        if (ComprobarAcceso(action))
        {
            return;
        }

        Agua agua = build.GetComponent <Agua>();

        if (agua != null)
        {
            bool obtenido = agua.Pescar();
            if (obtenido)
            {
                action.worker.inventario.AddResource(RECURSOS.Pescado, 1);
                action.worker.BuscarAlmacenCercano();
            }

            action.worker.AddAction(actions.CreateAction(action, action.worker, true));
        }
    }
Example #28
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Botella botella;
            string  marca     = txtMarca.Text;
            int     capacidad = (int)numCapacidad.Value;
            int     contenido = (int)numContenido.Value;

            Botella.Tipo tipo;
            Enum.TryParse <Botella.Tipo>(cmbBotellaTipo.SelectedValue.ToString(), out tipo);

            if (rbCerveza.Checked)
            {
                botella = new Cerveza(capacidad, contenido, marca, tipo);
            }
            else
            {
                botella = new Agua(capacidad, contenido, marca);
            }


            barra1.AgregarBotella(botella);
        }
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrWhiteSpace(txtMarca.Text))
     {
         if (rbAgua.Checked)
         {
             Agua dasani = new Agua((int)nudCapacidad.Value, txtMarca.Text, (int)nudContenido.Value);
             this.barra1.AgregarBotella(dasani);
             //MessageBox.Show("Agua Agregada!", "Suceso", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             Cerveza andes = new Cerveza((int)nudCapacidad.Value, txtMarca.Text, (Botella.Tipo)cmbBotellaTipo.SelectedIndex, (int)nudContenido.Value);
             this.barra1.AgregarBotella(andes);
             //MessageBox.Show("Birrita Agregada!", "Suceso", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Hay campos vacios", "Cuidado!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Example #30
0
        static void Main(string[] args)
        {
            var agua = new Agua();

            agua.BajarTemperatura(10);
            agua.SubirTemperatura(20);
            agua.SubirTemperatura(20);
            agua.SubirTemperatura(20);
            agua.SubirTemperatura(20);
            agua.SubirTemperatura(20);
            agua.SubirTemperatura(20);
            agua.SubirTemperatura(20);
            agua.SubirTemperatura(20);
            agua.SubirTemperatura(20);
            agua.SubirTemperatura(20);
            agua.BajarTemperatura(20);
            agua.BajarTemperatura(20);
            agua.BajarTemperatura(20);
            agua.BajarTemperatura(20);
            agua.BajarTemperatura(20);
            agua.BajarTemperatura(20);
        }