コード例 #1
0
ファイル: CreazioneViaggio.cs プロジェクト: MWSW/BigTycoon
        private void UpdateCosto(object sender, EventArgs e)
        {
            string nome;

            costo           = 100;
            quantitaOggetti = 0;
            if (Mittente.GetType() == typeof(Fabbrica))
            {
                Fabbrica tempFabbrica = (Fabbrica)Mittente;

                foreach (var item in tempFabbrica.SlotProdotti.DizionarioProdotti)
                {
                    nome = item.Key + "_coso";
                    var coso = (NumericUpDown)this.Controls[nome];
                    if ((int)coso.Value <= item.Value.Quantita)
                    {
                        quantitaOggetti += (int)coso.Value;
                    }
                    else
                    {
                        coso.Value = item.Value.Quantita;
                    }
                }
                foreach (var item in ListaOggetti.DizionarioMateriali)
                {
                    nome = item.Key + "_coso";
                    var coso = (NumericUpDown)this.Controls[nome];
                    coso.Value = 0;
                }
            }
            else
            {
                Industria tempIndustria = (Industria)Mittente;

                foreach (var item in tempIndustria.SlotMateriali.DizionarioMateriali)
                {
                    nome = item.Key + "_coso";
                    var coso = (NumericUpDown)this.Controls[nome];
                    if ((int)coso.Value <= item.Value.Quantita)
                    {
                        quantitaOggetti += (int)coso.Value;
                    }
                    else
                    {
                        coso.Value = item.Value.Quantita;
                    }
                }
                foreach (var item in ListaOggetti.DizionarioProdotti)
                {
                    nome = item.Key + "_coso";
                    var coso = (NumericUpDown)this.Controls[nome];
                    coso.Value = 0;
                }
            }

            nVagoni = (int)(quantitaOggetti / 10);
            costo  += nVagoni * 50;

            costo_label.Text = "Costo: " + costo.ToString() + "$";
        }
コード例 #2
0
 public void animazioneFabbricaDaFuori()
 {
     animNegFab();
     mgzz = new Fabbrica();
     this.Close();
     mgzz.ShowDialog();
 }
コード例 #3
0
ファイル: Mappa.cs プロジェクト: MWSW/BigTycoon
        /// <summary>
        /// Crea un edificio del tipo specificato alla posizione specificata e sottrae soldi.
        /// <para>0: industria, 1: fabbrica, 2: negozio; default: 0</para>
        /// </summary>
        /// <param name="x">Coordinata x</param>
        /// <param name="y">Coordinata y</param>
        /// <param name="tipo">Tipo dell'edificio</param>
        /// <param name="fenoglioIlPortafoglio">Portafoglio del giocatore che crea l'edificio</param>
        public bool AggiungiEdificio(int row, int col, int tipo, Giocatore gio)
        {
            Edificio tmp;

            switch (tipo)
            {
            default:
            case 0:
                tmp = new Industria(gio, CelleMateriali[row, col]);

                if (gio.portafogli.Soldi >= tmp.Prezzo)
                {
                    gio.portafogli.Soldi -= tmp.Prezzo;
                }
                else
                {
                    return(false);
                }

                break;

            case 1:
                tmp = new Fabbrica(gio);

                if (gio.portafogli.Soldi >= tmp.Prezzo)
                {
                    gio.portafogli.Soldi -= tmp.Prezzo;
                }
                else
                {
                    return(false);
                }

                break;

            case 2:
                tmp = new Negozio(gio);

                if (gio.portafogli.Soldi >= tmp.Prezzo)
                {
                    gio.portafogli.Soldi -= tmp.Prezzo;
                }
                else
                {
                    return(false);
                }
                break;
            }
            CelleEdifici[row, col] = tmp;

            return(true);
        }
コード例 #4
0
ファイル: Cliente.cs プロジェクト: lukemols/Negozio_di_Viola
        private void buttonAzione_Click(object sender, EventArgs e)
        {
            if (Globals.listProdottiNegozio.Count == 0 || ProdottiFiniti())
            {
                this.Close();
                fabbr = new Fabbrica();
                fabbr.ShowDialog();
            }

            else
            {
                MessageBox.Show("Vai a Cliente");
            }
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: MWSW/BigTycoon
        void AggiornaInfoGrafiche()
        {
            LordoTotale.Text         = "Lordo: " + giocatore.portafogli.Reddito + "$";
            SpeseTotali.Text         = "Spese: " + giocatore.portafogli.Spese + "$";
            GuadagnoGiornaliero.Text = "Guadagno giornaliero: " + giocatore.portafogli.Bilancio + "$";

            portafoglio_label.Text = "Portafoglio: " + giocatore.portafogli.Soldi + "$";

            immagineAzienda_label.Text = "Immagine azienda: " + giocatore.FamaAziendale + "/10";

            richiesteLavoro_label.Text = "Richieste lavoro: " + giocatore.DipendentiDisponibili;

            if (edificioSelezionato != null)
            {
                indicatoreDipendenti.Text = edificioSelezionato.Dipendenti.Quantita + "/" + edificioSelezionato.Dipendenti.MassimoDipendenti;
                indicatoreFelicita.Text   = "+" + edificioSelezionato.Dipendenti.Felicita;

                gestione_button.BackgroundImage = Properties.Resources.ingranaggio;

                if (gestioneEdificio_panel.Visible)
                {
                    stipendiPerc_label.Text = edificioSelezionato.Dipendenti.StipendiPerc + "%";

                    guadagnoEdificio.Text = "GUADAGNO " + edificioSelezionato.Bilancio + "$";
                    lordoEdificio.Text    = "LORDO " + edificioSelezionato.Reddito + "$";

                    puntiProduzione.Text = "+" + edificioSelezionato.PuntiProduzione;

                    minimoDipendenti_label.Text = "(min " + edificioSelezionato.Dipendenti.MinimoDipendenti + ")";

                    //Magazzino (GUI)
                    if (edificioSelezionato.GetType() == typeof(Industria))
                    {
                        Industria industria = (Industria)edificioSelezionato;
                        materiali_comuni.Text   = industria.SlotMateriali.GetElemento("MaterialeComune").Quantita.ToString();
                        materiali_rari.Text     = industria.SlotMateriali.GetElemento("MaterialeRaro").Quantita.ToString();
                        materiali_preziosi.Text = industria.SlotMateriali.GetElemento("MaterialePrezioso").Quantita.ToString();

                        prodotti_comuni.Text   = "--";
                        prodotti_rari.Text     = "--";
                        prodotti_preziosi.Text = "--";

                        prodotti_comuniRari.Text     = "--";
                        prodotti_comuniPreziosi.Text = "--";
                        prodotti_rariPreziosi.Text   = "--";

                        //BottoneProduzione
                        if (((Industria)edificioSelezionato).RisorsaTerreno == "MaterialeComune")
                        {
                            gestione_button.BackgroundImage = Properties.Resources.comuni;
                        }
                        else if (((Industria)edificioSelezionato).RisorsaTerreno == "MaterialeRaro")
                        {
                            gestione_button.BackgroundImage = Properties.Resources.rari;
                        }
                        else if (((Industria)edificioSelezionato).RisorsaTerreno == "MaterialePrezioso")
                        {
                            gestione_button.BackgroundImage = Properties.Resources.preziosi;
                        }
                    }
                    else if (edificioSelezionato.GetType() == typeof(Fabbrica))
                    {
                        Fabbrica fabbrica = (Fabbrica)edificioSelezionato;
                        materiali_comuni.Text   = fabbrica.SlotMateriali.GetElemento("MaterialeComune").Quantita.ToString();
                        materiali_rari.Text     = fabbrica.SlotMateriali.GetElemento("MaterialeRaro").Quantita.ToString();
                        materiali_preziosi.Text = fabbrica.SlotMateriali.GetElemento("MaterialePrezioso").Quantita.ToString();

                        prodotti_comuni.Text   = fabbrica.SlotProdotti.GetElemento("ProdottoComune").Quantita.ToString();
                        prodotti_rari.Text     = fabbrica.SlotProdotti.GetElemento("ProdottoRaro").Quantita.ToString();
                        prodotti_preziosi.Text = fabbrica.SlotProdotti.GetElemento("ProdottoPrezioso").Quantita.ToString();

                        prodotti_comuniRari.Text     = fabbrica.SlotProdotti.GetElemento("ProdottoComuneRaro").Quantita.ToString();
                        prodotti_comuniPreziosi.Text = fabbrica.SlotProdotti.GetElemento("ProdottoComunePrezioso").Quantita.ToString();
                        prodotti_rariPreziosi.Text   = fabbrica.SlotProdotti.GetElemento("ProdottoRaroPrezioso").Quantita.ToString();
                    }
                    else if (edificioSelezionato.GetType() == typeof(Negozio))
                    {
                        Negozio negozio = (Negozio)edificioSelezionato;
                        materiali_comuni.Text   = "--";
                        materiali_rari.Text     = "--";
                        materiali_preziosi.Text = "--";

                        prodotti_comuni.Text   = negozio.SlotProdotti.GetElemento("ProdottoComune").Quantita.ToString();
                        prodotti_rari.Text     = negozio.SlotProdotti.GetElemento("ProdottoRaro").Quantita.ToString();
                        prodotti_preziosi.Text = negozio.SlotProdotti.GetElemento("ProdottoPrezioso").Quantita.ToString();

                        prodotti_comuniRari.Text     = negozio.SlotProdotti.GetElemento("ProdottoComuneRaro").Quantita.ToString();
                        prodotti_comuniPreziosi.Text = negozio.SlotProdotti.GetElemento("ProdottoComunePrezioso").Quantita.ToString();
                        prodotti_rariPreziosi.Text   = negozio.SlotProdotti.GetElemento("ProdottoRaroPrezioso").Quantita.ToString();
                    }
                }
            }

            //Punti esclamativi
            for (int r = 0; r < mappa.Righe; r++)
            {
                for (int c = 0; c < mappa.Colon; c++)
                {
                    if (mappa.CelleEdifici[r, c] != null)
                    {
                        if (!mappa.CelleEdifici[r, c].EdificioAttivo)
                        {
                            attenzione[r, c].Visible = true;
                        }
                        else
                        {
                            attenzione[r, c].Visible = false;
                        }
                    }
                }
            }
        }
コード例 #6
0
        private void onClick(object sender, EventArgs e)
        {
            if (sender is Button)
            {
                if (timer1 != null)
                {
                    timer1.Stop();
                }

                if (timer2 != null)
                {
                    timer2.Stop();
                }

                this.SuspendLayout();
                textBox.Hide();
                this.ResumeLayout(false);

                switch (((Button)sender).Name)
                {
                case "negozio":

                    //if(Globals.statoGioco == 5)
                    //{
                    //  this.Close();
                    //}

//                        else
//                      {
                    this.pictureBox3.Visible = false;

                    if (!HomePage.newGame)
                    {
                        animFabNeg();
                    }

                    else
                    {
                        HomePage.newGame = false;
                    }

                    pictureBox2.Visible = false;
                    this.Close();

                    /* if(Globals.statoGioco == 0 || !Globals.visualizzaDialogo)
                     * {
                     *   ngz2 = new Negozio2();
                     *   ngz2.ShowDialog();
                     * }
                     *
                     * else
                     * {
                     *   ngz1 = new Negozio1();
                     *   ngz1.ShowDialog();
                     * }*/

                    if (Globals.visualizzaDialogo)
                    {
                        if (Globals.Livello == 6)
                        {
                            ngz3 = new Negozio3();
                            ngz3.ShowDialog();
                        }
                        else
                        {
                            ngz1 = new Negozio1();
                            ngz1.ShowDialog();
                        }
                    }

                    else
                    {
                        ngz2 = new Negozio2();
                        ngz2.ShowDialog();
                    }
                    //                    }

                    break;

                case "fabbrica":

                    this.pictureBox3.Visible = false;
                    animNegFab();
                    mgzz = new Fabbrica();
                    this.Close();
                    mgzz.ShowDialog();

                    break;

                case "cliente1":

                    this.pictureBox3.Visible = false;

                    if (Globals.statoGioco == 3)
                    {
                        //Globals.statoGioco = 2;
                        Globals.statoGioco = 5;
                        animClNeg1();
                        cl = new Cliente();
                        this.Close();
                        cl.ShowDialog();
                    }

                    break;

                case "cliente2":

                    this.pictureBox3.Visible = false;

                    if (Globals.statoGioco == 3)
                    {
                        //Globals.statoGioco = 2;
                        Globals.statoGioco = 5;
                        animClNeg2();
                        cl = new Cliente();
                        this.Close();
                        cl.ShowDialog();
                    }

                    break;

                case "cliente3":

                    this.pictureBox3.Visible = false;

                    if (Globals.statoGioco == 3)
                    {
                        //Globals.statoGioco = 2;
                        Globals.statoGioco = 5;
                        animClNeg3();
                        cl = new Cliente();
                        this.Close();
                        cl.ShowDialog();
                    }

                    break;

                case "bHome":

                    Globals.newGame = false;
                    pagIniz         = new HomePage();
                    this.Close();
                    pagIniz.ShowDialog();

                    break;

                case "bChiamaCliente":

                    Globals.statoGioco = 3;
                    Mappa mappa = new Mappa();
                    this.Close();
                    mappa.ShowDialog();
                    //animazioneClienteDaFuori();

                    break;

                case "bEsci":

                    Application.Exit();

                    break;
                }

                this.Close();
            }
        }
コード例 #7
0
ファイル: GestioneEdificio.cs プロジェクト: MWSW/BigTycoon
        private void conferma_button_Click(object sender, EventArgs e)
        {
            Fabbrica fab = null;
            Negozio  neg = null;


            //Una soluzione orrenda ma è comunque una soluzione
            if (edificio.GetType() == typeof(Fabbrica))
            {
                fab = (Fabbrica)edificio;

                switch (indice)
                {
                case 0:
                    fab.CambiaProduzione("ProdottoComune");
                    break;

                case 1:
                    fab.CambiaProduzione("ProdottoRaro");
                    break;

                case 2:
                    fab.CambiaProduzione("ProdottoPrezioso");
                    break;

                case 3:
                    fab.CambiaProduzione("ProdottoComuneRaro");
                    break;

                case 4:
                    fab.CambiaProduzione("ProdottoComunePrezioso");
                    break;

                case 5:
                    fab.CambiaProduzione("ProdottoRaroPrezioso");
                    break;
                }
            }
            else if (edificio.GetType() == typeof(Negozio))
            {
                neg = (Negozio)edificio;

                switch (indice)
                {
                case 0:
                    neg.CambiaProdottiVendita("ProdottoComune");
                    break;

                case 1:
                    neg.CambiaProdottiVendita("ProdottoRaro");
                    break;

                case 2:
                    neg.CambiaProdottiVendita("ProdottoPrezioso");
                    break;

                case 3:
                    neg.CambiaProdottiVendita("ProdottoComuneRaro");
                    break;

                case 4:
                    neg.CambiaProdottiVendita("ProdottoComunePrezioso");
                    break;

                case 5:
                    neg.CambiaProdottiVendita("ProdottoRaroPrezioso");
                    break;
                }
            }

            //Chiusura del form
            this.Close();
        }