Beispiel #1
0
        private void AfficherFaibleCategorie()
        {
            ECodeCouleur Code   = ListeJoueur.GetJoueur().GetLowestCategorie();
            string       NomCat = "";

            switch (Code)
            {
            case ECodeCouleur.B:
                NomCat = "Bleu";
                break;

            case ECodeCouleur.J:
                NomCat = "Jaune";
                break;

            case ECodeCouleur.R:
                NomCat = "Rouge";
                break;

            case ECodeCouleur.V:
                NomCat = "Vert";
                break;
            }
            LB_FaibleCat.Text = NomCat;
        }
Beispiel #2
0
        private void JouerTour()
        {
            Roulette.Tourner();
            CouleurCat = Roulette.GetCouleur();

            if (CouleurCat == ECodeCouleur.BL)
            {
                // On permet au joueur de choisir sa couleur
                Choix_Categorie m = new Choix_Categorie();
                m.ShowDialog();
            }

            AfficherQuestion Form = new AfficherQuestion(ref conn, CouleurCat);

            Form.ShowDialog();

            if (!Form.BienRepondu)
            {
                LB_Reponse.ForeColor = Color.Red;
                LB_Reponse.Text      = "Mauvaise réponse !";
                ListeJoueur.NextTour();
                AfficherNom();
            }
            else
            {
                LB_Reponse.ForeColor = Color.Green;
                LB_Reponse.Text      = "Bonne réponse !";

                AddScore(CouleurCat);
                AfficherScore();
                AfficherFaibleCategorie();
            }
        }
        private void ChangerCouleur()
        {
            int   index   = Randomize();
            Color Couleur = CodeCouleur.ElementAt(index).Value;

            CouleurChoisie = CodeCouleur.ElementAt(index).Key;
            BackColor      = Couleur;
        }
        public AfficherQuestion(ref OracleConnection Connection, ECodeCouleur Categorie)
        {
            InitializeComponent();
            conn = Connection;
            Categorie = Form1.CouleurCat;
            GetQuestion();
            GetReponses();

        }
Beispiel #5
0
        public ECodeCouleur GetLowestCategorie()
        {
            ECodeCouleur PlusFaible = ECodeCouleur.B; // Valeur de base qui sera changé par l'actuelle plus faible catégorie

            foreach (var Code in Score)
            {
                if (Code.Value < Score[PlusFaible])
                {
                    PlusFaible = Code.Key;
                }
            }

            return(PlusFaible);
        }
Beispiel #6
0
        private void AddScore(ECodeCouleur Code)
        {
            // Faudrait un trigger au lieu de ça !!
            if (ListeJoueur.AddScoreToRoundPlayer(Code))
            {
                OracleCommand commandAfficherScore = new OracleCommand("TRIVIA", conn);
                commandAfficherScore.CommandType = CommandType.StoredProcedure;
                commandAfficherScore.CommandText = "TRIVIA.AfficherScore";

                OracleParameter returnValue = new OracleParameter("return", OracleDbType.RefCursor);
                returnValue.Direction = ParameterDirection.ReturnValue;
                commandAfficherScore.Parameters.Add(returnValue);

                OracleParameter param = new OracleParameter("pAlias", OracleDbType.Varchar2);
                param.Direction = ParameterDirection.Input;
                param.Value     = ListeJoueur.GetJoueur().GetAlias();
                commandAfficherScore.Parameters.Add(param);

                OracleDataReader Reader = commandAfficherScore.ExecuteReader();
                while (Reader.Read())
                {
                    if (Reader.GetString(2) == Code.ToString())
                    {
                        return; // La catégorie est déjà gagnée
                    }
                }

                OracleCommand command = new OracleCommand("TRIVIA", conn);
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "TRIVIA.CreerScore";

                OracleParameter paramCat = new OracleParameter("pCodeCategorie", OracleDbType.Char);
                paramCat.Direction = ParameterDirection.Input;
                paramCat.Value     = Code.ToString().ElementAt(0);
                command.Parameters.Add(paramCat);

                OracleParameter paramAlias = new OracleParameter("pAlias", OracleDbType.Varchar2);
                paramAlias.Direction = ParameterDirection.Input;
                paramAlias.Value     = ListeJoueur.GetJoueur().GetAlias();
                command.Parameters.Add(paramAlias);

                command.ExecuteNonQuery();
            }
        }
Beispiel #7
0
        /// <summary>
        /// Ajoute un point à une catégorie
        /// </summary>
        /// <param name="Code">Code de couleur de la catégorie</param>
        public bool AddScoreToRoundPlayer(ECodeCouleur Code)
        {
            Liste.ElementAt(IndexPlyAyantTour).Score[Code]++;

            return(Liste.ElementAt(IndexPlyAyantTour).Score[Code] >= 5);
        }