public void MettreAJour(double tempsInterAffichage)
        {
            try
            {
                this.Invoke((MethodInvoker) delegate
                {
                    int etatActuel = etatZoneActuelle();
                    //si la zone est réussi
                    if (etatActuel == 1)
                    {
                        //Vérifie si il reste encore des zones a jouer dans la campagne
                        if (configCampagne_.indiceZoneActuel_ < configCampagne_.quantiteZones_)
                        {
                            chargerProchaineZone();
                        }
                        else
                        {
                            //Campagne termine
                            //afficher un message de victoire: réussi ce niveau
                            var result = MessageBox.Show("Voulez vous rejouer cette campagne? ", "Félicitation! Vous avez terminé la Campagne. ", MessageBoxButtons.YesNo);
                            //si l'utilisateur décide de rejouer, on
                            if (result == DialogResult.Yes)
                            {
                                libererZoneActuel();
                                chargerZone(configCampagne_.zones_[0]);
                            }
                            else
                            {
                                this.Close();
                            }
                        }
                    }
                    //si la zone est échoué
                    else if (etatActuel == -1)
                    {
                        //Campagne termine (echec)
                        var result = MessageBox.Show("Voulez vous rejouer cette campagne? ", "Échec! Vous avez perdu. ", MessageBoxButtons.YesNo);
                        //si l'utilisateur décide de rejouer, on
                        if (result == DialogResult.Yes)
                        {
                            libererZoneActuel();
                            chargerZone(configCampagne_.zones_[0]);
                        }
                        else
                        {
                            this.Close();
                        }
                    }

                    //si la zone n'est pas terminé: continue

                    FonctionsNatives.animer(tempsInterAffichage);
                    FonctionsNatives.dessinerOpenGL();
                });
            }
            catch (Exception)
            {
            }
        }
Esempio n. 2
0
        public void MettreAJour(double tempsInterAffichage)
        {
            try
            {
                if (isActive)
                {
                    FonctionsNatives.redimensionnerFenetre(panel2.Width, panel2.Height);
                }
                this.Invoke((MethodInvoker) delegate
                {
                    //si la zone est réussi
                    if (FonctionsNatives.victoire() == 1)
                    {
                        this.DialogResult = DialogResult.OK;
                        FonctionsNatives.desactiverSon();
                        FonctionsNatives.libererOpenGL();
                        isActive = false;
                        this.Close();
                    }
                    //si la zone est échoué
                    else if (FonctionsNatives.gameOver() == 1)
                    {
                        this.DialogResult = DialogResult.No;
                        FonctionsNatives.desactiverSon();
                        FonctionsNatives.libererOpenGL();
                        isActive = false;
                        this.Close();
                    }


                    if (!pause)
                    {
                        FonctionsNatives.animer(tempsInterAffichage);
                    }
                    FonctionsNatives.dessinerOpenGL();
                });
            }
            catch (Exception)
            {
            }
        }
Esempio n. 3
0
 public void MettreAJour(double tempsInterAffichage)
 {
     try
     {
         this.Invoke((MethodInvoker) delegate
         {
             if (Program.modeEditeur != null)
             {
                 Program.modeEditeur.MettreAJour(tempsInterAffichage);
             }
             else if (partie != null)
             {
                 partie.MettreAJour(tempsInterAffichage);
             }
             else
             {
                 FonctionsNatives.animer(tempsInterAffichage);
             }
         });
     }
     catch (Exception)
     {
     }
 }
Esempio n. 4
0
        ////////////////////////////////////////////////////////////////////////
        ///
        /// @fn public void MettreAJour(double tempsInterAffichage)
        /// @brief Mise a jour du panneau OpenGL.
        /// @param[in] tempsInterAffichage : Objet duquel provient un evenement.
        /// @return Aucune.
        ///
        ////////////////////////////////////////////////////////////////////////
        public void MettreAJour(double tempsInterAffichage)
        {
            try
            {
                this.Invoke((MethodInvoker) delegate
                {
                    FonctionsNatives.refreshText(panel_GL.Size.Width, panel_GL.Size.Height);
                    if (peutAnimer)
                    {
                        FonctionsNatives.animer(tempsInterAffichage);
                        if (Program.compteurFrames == 0)
                        {
                            pointsPartie = FonctionsNatives.obtenirNombreDePointsDePartie();
                            // TODO Exemple a delete
                            StringBuilder precedentText = Points;
                            Points = new StringBuilder("Points : " + pointsPartie.ToString());
                            FonctionsNatives.updateText(precedentText, precedentText.Capacity, Points, Points.Capacity);
                            // FIN DE L'EXEMPLE
                        }
                    }
                    if (Program.compteurFrames == 0)
                    {
                        FonctionsNatives.dessinerOpenGL();
                    }
                    billesEnJeu       = FonctionsNatives.obtenirNombreBillesCourante();
                    billesPerdus      = FonctionsNatives.obtenirNombreBillesPerdus();
                    billesDisponibles = nombreBillesInit + nombreDeBillesGagnes - billesPerdus - billesEnJeu;
                    if (billesEnJeu < nombreBillesMax && (billesDisponibles > 0))
                    {
                        // Wait a certain time
                        CreerBille();
                    }
                    if (billesDisponibles == 0 && boolTemp && billesEnJeu == 0)
                    {
                        if (nbZones == 1)
                        {
                            FinCampagne(false, pointsPartie);
                        }
                        else
                        {
                            FinCampagne(false, -5);
                        }
                    }
                    if (pointsPartie >= nombreDeBillesGagnes * pointsGagnerBille + pointsGagnerBille)
                    {
                        FonctionsNatives.jouerSon(newBallSFX, newBallSFX.Length);
                        nombreDeBillesGagnes++;
                        label_nbGagnes.Text = nombreDeBillesGagnes.ToString();
                    }

                    label_nbPoints.Text = pointsPartie.ToString();
                    if (billesDisponibles >= 0)
                    {
                        label_nbBilles.Text         = billesDisponibles.ToString();
                        StringBuilder precedentText = Billes;
                        Billes = new StringBuilder("Billes : " + billesDisponibles.ToString());
                        FonctionsNatives.updateText(precedentText, precedentText.Capacity, Billes, Billes.Capacity);
                    }
                    if (pointsPartie >= pointsGagnerPartie && boolTemp && (nbZones > 1))
                    {
                        if (currentZone >= nbZones)
                        {
                            FinCampagne(true, -5);
                        }
                        else
                        {
                            ProchainePartie();
                        }
                    }
                    if (currentZoom <= 0)
                    {
                        FonctionsNatives.resetZoom();
                        currentZoom = FonctionsNatives.obtenirZoomCourant();
                    }
                });
            }
            catch (Exception)
            {
            }
        }