Exemple #1
0
        private void btnDifficle_Click(object sender, EventArgs e)
        {
            ControleurJeu j = new ControleurJeu();

            /* On devrait mettre un nombre de tour faible en paramètre du controleur */
            j.lancerJeu(this);
        }
        /**
         * Donne une tache au personnage selectionné
         */
        public void donnerTachePerso()
        {
            List <Fonctionnalites> listeTache = new List <Fonctionnalites>();

            //arrayliste des taches que le personnage va effectuer

            foreach (Fonctionnalites f in listfonctionnalite)
            {
                //MessageBox.Show(cboFonctionnalite1.Text);

                if (f.getNom() + " (" + f.getNvConnaissNecces() + ")" == cboFonctionnalite1.Text)  // dans une cboFonctionnale on a "nom (NvConnaissNecces)"
                {
                    listeTache.Add(f);
                }
                if (f.getNom() + " (" + f.getNvConnaissNecces() + ")" == cboFonctionnalite2.Text)
                {
                    listeTache.Add(f);
                }
                if (cboFonctionnalite3.Visible != false)  //si le crunch est activé alors ajouter une tache en plus
                {
                    if (f.getNom() + " (" + f.getNvConnaissNecces() + ")" == cboFonctionnalite3.Text)
                    {
                        listeTache.Add(f);
                    }
                }
            }

            ControleurJeu.tache(this.perso, listeTache);
        }
Exemple #3
0
        /**
         * Lance la méthode init du controleurJeu
         */
        private void btnCommencer_Click(object sender, EventArgs e)
        {
            ControleurJeu j = new ControleurJeu();

            j.init();
            j.lancerJeu(this);
        }
        /**
         * Verifie si les fonctionnalités de recherche sont terminées pour effectuer les fonctionnalites de conception
         */
        public bool estRealisable()
        {
            bool res = true;

            if (getType() == "Concevoir")
            {
                foreach (Fonctionnalites f1 in ControleurJeu.getListeFonctionnalite())
                {
                    if (!(f1.getStatus()) && f1.getType() == "Spécification")
                    {
                        res = false;
                    }
                }
            }
            if (getType() == "Développer")
            {
                foreach (Fonctionnalites f2 in ControleurJeu.getListeFonctionnalite())
                {
                    if (!(f2.getStatus()) && f2.getType() == "Concevoir")
                    {
                        res = false;
                    }
                }
            }
            if (getType() == "Recette")
            {
                foreach (Fonctionnalites f3 in ControleurJeu.getListeFonctionnalite())
                {
                    if (!(f3.getStatus()) && f3.getType() == "Développer")
                    {
                        res = false;
                    }
                }
            }

            if (getType() == "Livraison")
            {
                foreach (Fonctionnalites f3 in ControleurJeu.getListeFonctionnalite())
                {
                    if (!(f3.getStatus()) && f3.getType() == "Recette")
                    {
                        res = false;
                    }
                }
            }
            return(res);
        }
Exemple #5
0
        /**
         * Lance une instance du controleur jeu
         */
        private void btnDifficile_Click(object sender, EventArgs e)
        {
            ControleurJeu j = new ControleurJeu();

            j.lancerJeu2(this);
        }
        /**
         * Initialisation des UC_Personnages
         */
        public void initialisationUCPerso(Personnage p, Image img)
        {
            this.perso             = p;
            this.pictureBox1.Image = img;

            ArrayList qualite     = p.getQualite();
            ArrayList defaut      = p.getDefaut();
            ArrayList pointFort   = p.getPointFort();
            ArrayList pointFaible = p.getPointFaible();


            this.setPrenom(perso.getPrenom());
            this.setConnaissance(perso.getConnaissances());
            this.setStress(perso.getStress());
            this.setFatigue(perso.getFatigue());
            this.setAffinite(perso.getAffinite());
            this.setDeteste(perso.getDeteste());
            this.cboFonctionnalite1.Visible = true;
            this.cboFonctionnalite2.Visible = true;
            lblAction1.Visible         = true;
            btnSupprimerTache1.Visible = true;
            btnSupprimerTache2.Visible = true;

            listfonctionnalite = ControleurJeu.getListeFonctionnalite(); //remet à jour la liste de fonctionnalité

            if (this.perso.getFatigue() == 100)
            {
                this.Enabled = false;
            }
            else
            {
                if (perso.estDisponible() == false && perso.getMalade() == true)
                {
                    this.Enabled   = false;
                    this.BackColor = Color.Violet;
                    perso.setMalade(false);
                    perso.setDisponible(true);
                    this.cboFonctionnalite1.Visible = false;
                    this.btnSupprimerTache1.Visible = false;
                    this.cboFonctionnalite2.Visible = false;
                    this.btnSupprimerTache2.Visible = false;
                    this.lblPrenom.Text             = "Absent";

                    frmReunionPopUp frm = new frmReunionPopUp();
                    frm.messagePopUp(perso.getPrenom());
                    frm.Show();
                }

                else if (perso.estDisponible() == false && perso.getMalade() == false)
                {
                    this.BackColor = Color.SpringGreen;
                    perso.setDisponible(true);
                }
                else
                {
                    this.Enabled   = true;
                    this.BackColor = Color.AliceBlue;
                }
            }
            if (this.perso.getStress() == 100)
            {
                //this.setProductivite();
                this.Enabled = false;
            }
            copiFonc();


            lblAction1.Visible = true;
            this.reunion       = false;
        }
Exemple #7
0
        /**
         * Affiche le menu des réunions
         */
        private void btnReunion_Click(object sender, EventArgs e)
        {
            frmReunion reunion = new frmReunion();

            if (reunion.ShowDialog() == DialogResult.OK)
            {
                reunion.remettreCompteurAZero();
            }
            lblIntro.Visible = false;


            btnTourSuivant.Visible = true;
            btnRepos.Visible       = true;
            btnCrunch.Visible      = true;
            timerRepos.Enabled     = false;
            foreach (Reunion r in ControleurJeu.getListeReunion())
            {
                if (r.getStatut())       //active les effets des achievements débloqués lors de la réunion
                {
                    btnReunion.Enabled = false;

                    if (r.getThemeReunion() == "Faire connaissance")
                    {
                        foreach (Object o in Controls)
                        {
                            if (o is Panel)
                            {
                                Panel p = (Panel)o;
                                foreach (Object c in p.Controls)
                                {
                                    if (c is UC_Personnage)
                                    {
                                        UC_Personnage up = (UC_Personnage)c;

                                        up.rendrePrenomsVisible();
                                    }
                                }
                            }
                        }
                    }
                    if (r.getThemeReunion() == "Évaluer le potentiel du groupe")
                    {
                        foreach (Object o in Controls)
                        {
                            if (o is Panel)
                            {
                                Panel p = (Panel)o;
                                foreach (Object c in p.Controls)
                                {
                                    if (c is UC_Personnage)
                                    {
                                        UC_Personnage up = (UC_Personnage)c;

                                        up.rendreAttributsVisible();
                                    }
                                }
                            }
                        }
                    }
                    if (r.getThemeReunion() == "Analyse des affinités de chacun")
                    {
                        foreach (Object o in Controls)
                        {
                            if (o is Panel)
                            {
                                Panel p = (Panel)o;
                                foreach (Object c in p.Controls)
                                {
                                    if (c is UC_Personnage)
                                    {
                                        UC_Personnage up = (UC_Personnage)c;

                                        up.rendreAffinitesVisible();
                                    }
                                }
                            }
                        }
                    }
                    if (r.getThemeReunion() == "Révèle les qualités et les défauts")
                    {
                        uC_Personnage1.afficherQualiteDefaut();
                        uC_Personnage2.afficherQualiteDefaut();
                        uC_Personnage3.afficherQualiteDefaut();
                        uC_Personnage4.afficherQualiteDefaut();
                    }
                    if (r.getThemeReunion() == "Analyse de la demande du client et de ses besoins + Définir un cahier des charges")
                    {
                        lstTache.Visible    = true;
                        btnVider.Visible    = true;
                        lblLstTache.Visible = true;
                        frmReunionPopUp popup = new frmReunionPopUp();
                        popup.messagePopUp("formation");
                        popup.ShowDialog();
                    }
                    if (r.getThemeReunion() == "Mettre en commun le travail et l'avancement de chacun")
                    {
                        lblTacheReal.Visible        = true;
                        pnlProgressBarTache.Visible = true;
                    }
                    uC_Personnage1.rendreInvisibleTacheMatin();
                    uC_Personnage2.rendreInvisibleTacheMatin();
                    uC_Personnage3.rendreInvisibleTacheMatin();
                    uC_Personnage4.rendreInvisibleTacheMatin();
                }
                //verifie si toutes les réunions ont été faites si c'est le cas alors on rend invisible le bouton Réunion
                Boolean etatReunion = true;
                foreach (Reunion re in ControleurJeu.getListeReunion())
                {
                    if (re.getStatut() == false)
                    {
                        etatReunion = false;
                    }
                }
                if (etatReunion)
                {
                    btnReunion.Visible = false;
                }
            }
        }
Exemple #8
0
        /**
         * Met les personnages définis dans le frmRepos au repos. Leur fatigue et leur stress sont divisés par deux.
         */
        private void btnRepos_Click(object sender, EventArgs e)
        {
            frmRepos     repos = new frmRepos(listPersonnage, this);
            DialogResult dr    = new DialogResult();



            dr = repos.ShowDialog();
            if (crunchBool == true)
            {
                foreach (Object o in Controls)
                {
                    if (o is Panel)
                    {
                        Panel p = (Panel)o;
                        foreach (Object c in p.Controls)
                        {
                            if (c is UC_Personnage)
                            {
                                UC_Personnage up = (UC_Personnage)c;
                                up.crunchDesactive();
                                crunchBool = false;
                            }
                        }
                    }
                }
            }


            /* if (nbTour >= nbTourMax)
             * {
             *   viderCBO();
             *
             *   ControleurJeu.arreterJeu(rtbListeF.Text);
             *
             *   this.Close();
             * }
             */
            if (dr == DialogResult.OK)
            {
                if (listRepos.Count() != 0)
                {
                    btnRepos.Enabled = false;
                }

                ArrayList listPerso = ControleurJeu.getListePersonnage();

                Personnage p1 = (Personnage)listPerso[0];
                Personnage p2 = (Personnage)listPerso[1];
                Personnage p3 = (Personnage)listPerso[2];
                Personnage p4 = (Personnage)listPerso[3];

                //mise a jour des persos apres avoir effectue les taches


                //On met a jour les uC concernés
                foreach (Personnage perso in listRepos)
                {
                    if (uC_Personnage1.getPersonnage() == perso)
                    {
                        initUC(uC_Personnage1, perso);
                        uC_Personnage1.rendreCBO1Visible();
                    }
                    else if (uC_Personnage2.getPersonnage() == perso)
                    {
                        initUC(uC_Personnage2, perso);
                        uC_Personnage2.rendreCBO1Visible();
                    }
                    else if (uC_Personnage3.getPersonnage() == perso)
                    {
                        initUC(uC_Personnage3, perso);
                        uC_Personnage3.rendreCBO1Visible();
                    }
                    else if (uC_Personnage4.getPersonnage() == perso)
                    {
                        initUC(uC_Personnage4, perso);
                        uC_Personnage4.rendreCBO1Visible();
                    }
                    else
                    {
                        MessageBox.Show("PERSONNE NE DOIT SE REPOSER, TROP DE TRAVAIL");
                    }
                }
                listRepos.Clear();
            }
        }
Exemple #9
0
        /**
         * Assignation des personnages aux User_Controls, affichage de tous les labels et des progress bar
         * qui sont générés dynamiquement.
         */
        public frmJeu(Personnage p1, Personnage p2, Personnage p3, Personnage p4, int tourmax)
        {
            InitializeComponent();

            nbTourMax = tourmax;
            int screenWidth  = Screen.PrimaryScreen.Bounds.Width;
            int screenHeight = Screen.PrimaryScreen.Bounds.Height;

            this.Size = new Size(screenWidth, screenHeight);


            lblTacheReal.Size        = new Size(((screenWidth - lblTacheReal.Location.X) - lblTacheReal.Size.Width) + lblTacheReal.Size.Width, lblTacheReal.Size.Height - 5);
            pnlProgressBarTache.Size = new Size(((screenWidth - pnlProgressBarTache.Location.X) - pnlProgressBarTache.Size.Width) + pnlProgressBarTache.Size.Width, pnlProgressBarTache.Size.Height - 5);
            panel2.Size = new Size(screenWidth, panel2.Height);


            foreach (Fonctionnalites f in ControleurJeu.getListeFonctionnalite())
            {
                if (f.getPaDepense() < f.getPaNecess() && f.getStatus() == false)
                {
                    lstTache.Items.Add(f.getNom() + " (" + f.getNvConnaissNecces() + ")");
                }
            }
            lstTache.AllowDrop       = true;
            uC_Personnage1.AllowDrop = true;
            uC_Personnage2.AllowDrop = true;
            uC_Personnage3.AllowDrop = true;
            uC_Personnage4.AllowDrop = true;

            this.Refresh();

            listPersonnage.Clear();
            crunchBool = false;


            ArrayList listPerso = ControleurJeu.getListePersonnage();

            listPersonnage.Add(p1);
            listPersonnage.Add(p2);
            listPersonnage.Add(p3);
            listPersonnage.Add(p4);


            initUC(uC_Personnage1, p1);
            initUC(uC_Personnage2, p2);
            initUC(uC_Personnage3, p3);
            initUC(uC_Personnage4, p4);

            foreach (Object o in Controls)
            {
                if (o is UC_Personnage)
                {
                    UC_Personnage uC_Perso = new UC_Personnage();
                    uC_Perso.Enabled = true;
                }
            }

            ArrayList       listTache  = ControleurJeu.getListeFonctionnalite();
            int             posBas     = 5;
            Fonctionnalites fPrecedent = null;

            //Initialisation ProgressBar pour chaque tache
            for (int i = 0; i <= listTache.Count - 1; i++)
            {
                Bunifu.Framework.UI.BunifuProgressBar progressBar = new Bunifu.Framework.UI.BunifuProgressBar();
                Label           l = new Label();
                Fonctionnalites f = (Fonctionnalites)listTache[i];

                if (f.getNom() != "Formation")
                {
                    if (fPrecedent == null || f.getType() != fPrecedent.getType())
                    {
                        posBas += 25;
                        Label lblaffichageType = new Label();
                        lblaffichageType.Text     = f.getType();
                        lblaffichageType.Location = new System.Drawing.Point(0, posBas);
                        lblaffichageType.Font     = new System.Drawing.Font("Cooper Black", 19F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                        lblaffichageType.Size     = new System.Drawing.Size(200, 45);
                        lblaffichageType.Tag      = 10; //permet d'identifier les labels titres
                        posBas += 50;
                        pnlProgressBarTache.Controls.Add(lblaffichageType);
                    }

                    fPrecedent = f;     //remet à jour la fonctionnalités précédente

                    l.Font      = new System.Drawing.Font("Cooper Black", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    l.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    l.BackColor = pnlProgressBarTache.BackColor;
                    l.Location  = new System.Drawing.Point(0, posBas);
                    l.Size      = new System.Drawing.Size(220, 20);
                    l.Text      = f.getNom();
                    if (f.getType() == "Spécification")
                    {
                        l.ForeColor = Color.DarkRed;
                    }
                    if (f.getType() == "Concevoir")
                    {
                        l.ForeColor = Color.Green;
                    }
                    if (f.getType() == "Développer")
                    {
                        l.ForeColor = Color.Purple;
                    }
                    if (f.getType() == "Recette")
                    {
                        l.ForeColor = Color.DarkGray;
                    }
                    if (f.getType() == "Livraison")
                    {
                        l.ForeColor = Color.Maroon;
                    }


                    progressBar.BackColor     = System.Drawing.Color.Silver;
                    progressBar.BorderRadius  = 5;
                    progressBar.ProgressColor = System.Drawing.Color.Teal;
                    progressBar.Size          = new System.Drawing.Size(pnlProgressBarTache.Width - 200, 20);
                    progressBar.Location      = new System.Drawing.Point(l.Location.X + 200, l.Location.Y);
                    progressBar.Tag           = i;
                    progressBar.Value         = 0;

                    pnlProgressBarTache.Controls.Add(progressBar);
                    pnlProgressBarTache.Controls.Add(l);
                    posBas += 25;
                }
            }
        }
Exemple #10
0
        /**
         * Tour suivant : Calcul des attributs des personnages et mise à jour des User_Controls.
         * Vérification si le crunch est activé ou non, random qui détermine si un personnage
         * tombe malade.
         */
        private void btnTourSuivant_Click(object sender, EventArgs e)
        {
            uC_Personnage1.arreterClignotant();
            uC_Personnage2.arreterClignotant();
            uC_Personnage3.arreterClignotant();
            uC_Personnage4.arreterClignotant();


            lblTour.Visible    = true;
            btnReunion.Enabled = true;

            btnRepos.Enabled = true;
            if (crunchBool == true)
            {
                foreach (Object o in Controls)
                {
                    if (o is Panel)
                    {
                        Panel p = (Panel)o;
                        foreach (Object c in p.Controls)
                        {
                            if (c is UC_Personnage)
                            {
                                UC_Personnage up = (UC_Personnage)c;
                                up.Enabled = true;
                                up.crunchDesactive();
                                crunchBool = false;
                            }
                        }
                    }
                }
            }


            // FIN SI DEADLINE OU TOUTES LES FONCTIONS SONT FINIES
            // A REVOIR ( VERIFIER SI LE POURCENTAGE DU PROJET == 100 --> FIN )
            if ((nbTour >= nbTourMax) || ((ControleurJeu.verifierTacheTermine())))
            {
                if (ControleurJeu.verifierTacheTermine())
                {
                    ControleurJeu.arreterJeu(rtbListeF.Text, 0);

                    this.Close();
                }
                ControleurJeu.arreterJeu(rtbListeF.Text);

                this.Close();
            }

            // Pre remplissage de toutes les taches pour le tour actuel pour chaque perso
            foreach (Object o in Controls)
            {
                if (o is Panel)
                {
                    Panel p = (Panel)o;

                    foreach (Object c in p.Controls)
                    {
                        if (c is UC_Personnage)
                        {
                            UC_Personnage up = (UC_Personnage)c;

                            up.remplirListeAffinite();
                        }
                    }
                }
            }



            //modification des taches des user controls
            foreach (Object o in Controls)
            {
                if (o is Panel)
                {
                    Panel p = (Panel)o;

                    foreach (Object c in p.Controls)
                    {
                        if (c is UC_Personnage)
                        {
                            UC_Personnage up = (UC_Personnage)c;

                            up.donnerTachePerso();
                        }
                    }
                }
            }

            foreach (Object o in Controls)
            {
                if (o is Panel)
                {
                    Panel p = (Panel)o;

                    foreach (Object c in p.Controls)
                    {
                        if (c is UC_Personnage)
                        {
                            UC_Personnage up = (UC_Personnage)c;

                            up.viderListeAffinite();
                        }
                    }
                }
            }



            try
            {
                // REMPLISSAGE DEUXIEME "CONSOLE"
                rtbListeF.Text += "\nJournée " + nbTour.ToString() + ":\n";
                rtbListeF.Text += s;

                s = "";


                // MISE A ZERO DES COMBOBOX POUR NE PLUS AVOIR LES ANCIENS CHOIX
                foreach (Object o in Controls)
                {
                    if (o is Panel)
                    {
                        Panel p = (Panel)o;

                        foreach (Object c in p.Controls)
                        {
                            if (c is UC_Personnage)
                            {
                                UC_Personnage up = (UC_Personnage)c;
                                up.cleanCBO();
                            }
                        }
                    }
                }

                ControleurJeu.nouveauTour();



                this.augmenterNbTour();   //incremente nb de tour
                lblTour.Text = "Tour : " + nbTour.ToString() + " / " + nbTourMax.ToString();

                ArrayList listPerso = ControleurJeu.getListePersonnage();

                Personnage p1 = (Personnage)listPerso[0];
                Personnage p2 = (Personnage)listPerso[1];
                Personnage p3 = (Personnage)listPerso[2];
                Personnage p4 = (Personnage)listPerso[3];

                //mise a jour des persos apres avoir effectue les taches
                initUC(uC_Personnage1, p1);
                initUC(uC_Personnage2, p2);
                initUC(uC_Personnage3, p3);
                initUC(uC_Personnage4, p4);

                List <UC_Personnage> listUC = new List <UC_Personnage>();
                listUC.Add(uC_Personnage1);
                listUC.Add(uC_Personnage2);
                listUC.Add(uC_Personnage3);
                listUC.Add(uC_Personnage4);

                uC_Personnage1.cleanCBO();
                uC_Personnage2.cleanCBO();
                uC_Personnage3.cleanCBO();
                uC_Personnage4.cleanCBO();

                Random rnd  = new Random();
                int    alea = rnd.Next(20);
                if (alea <= 3)
                {
                    UC_Personnage u = listUC[alea];
                    u.getPersonnage().setMalade(true);
                    u.getPersonnage().setDisponible(false);
                }


                // FIN SI DEADLINE OU TOUTES LES FONCTIONS SONT FINIES
                // A REVOIR ( VERIFIER SI LE POURCENTAGE DU PROJET == 100 --> FIN )
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Selectionnez Action");
            }


            //Mettre à jour la liste des tâches à effectuer, c'est-à-dire que l'on vérifie si la tâche est complété ou non. Si c'est le cas alors on l'enlève de la liste
            lstTache.Items.Clear();
            foreach (Fonctionnalites f in ControleurJeu.getListeFonctionnalite())
            {
                if (f.getPaDepense() < f.getPaNecess() && f.getStatus() == false)
                {
                    lstTache.Items.Add(f.getNom() + " (" + f.getNvConnaissNecces() + ")");
                }
            }



            //Actualiser les progressBars pour chaque tache
            ArrayList listFonctionnalite = ControleurJeu.getListeFonctionnalite();

            for (int i = 0; i <= listFonctionnalite.Count - 1; i++)
            {
                foreach (Object o in Controls)
                {
                    if (o is Panel)
                    {
                        Panel p = (Panel)o;
                        foreach (Object ob in p.Controls)
                        {
                            if (ob is Bunifu.Framework.UI.BunifuProgressBar)
                            {
                                Bunifu.Framework.UI.BunifuProgressBar pb = (Bunifu.Framework.UI.BunifuProgressBar)ob;
                                if ((int)pb.Tag == i)
                                {
                                    Fonctionnalites f = (Fonctionnalites)listFonctionnalite[i];
                                    foreach (Fonctionnalites ft in ControleurJeu.getListeFonctionnalite())
                                    {
                                        if (f.getNom() == ft.getNom())
                                        {
                                            float val1 = (float)ft.getPaDepense();
                                            float val2 = (float)ft.getPaNecess();
                                            float res  = (val1 / val2) * 100;
                                            if (res >= 100)
                                            {
                                                res = 100;
                                            }
                                            pb.Value = (int)res;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }