Exemplo n.º 1
0
 private void TraiterEvtChat(string[] infosEvt)
 {
     this.EvenementCourant = new Chat()
     {
         Nom = infosEvt[3], Message = infosEvt[4]
     };
 }
Exemplo n.º 2
0
        private void TraiterEvtFinDonne(string[] infosEvt)
        {
            FinDonne evt = new FinDonne();

            // Liste des gagnants
            string[] gagnants = infosEvt[3].Split(',');
            evt.JoueursGagnants = new List <JoueurStat>();
            foreach (string gagnant in gagnants)
            {
                evt.JoueursGagnants.Add(new JoueurStat()
                {
                    Nom = gagnant
                });
            }

            // Combinaison gagnante
            string[] infosComb = infosEvt[4].Split(':');
            if (infosComb.Length == 1)
            {
                evt.CombinaisonGagnante = null;
            }
            else
            {
                evt.CombinaisonGagnante = new Combinaison(
                    (TypeCombinaison)Enum.Parse(typeof(TypeCombinaison), infosComb[0]),
                    ParserChaineEnListeCartes(infosComb[1], ',')
                    );
            }

            evt.Pot = int.Parse(infosEvt[5]);

            this.EvenementCourant = evt;
        }
Exemplo n.º 3
0
 private void TraiterEvtRiver(string[] infosEvt)
 {
     this.EvenementCourant = new River()
     {
         Carte = ParserChaineEnCarte(infosEvt[3]),
         Pot   = int.Parse(infosEvt[4])
     };
 }
Exemplo n.º 4
0
 /// <summary>
 /// Lecture
 /// </summary>
 /// <param name="evt"></param>
 void TraiterEvenement(EvenementJeu evt)
 {
     if (evt != null)
     {
         Type typeEvt = evt.GetType();
         logClient.Debug(" Traitement evenement de type : " + typeEvt.Name);
         if (typeEvt == typeof(NouvellePartie))
         {
             TraiterEvtNouvellePartie(evt as NouvellePartie);
         }
         else if (typeEvt == typeof(NouvelleDonne))
         {
             TraiterEvtNouvelleDonne(evt as NouvelleDonne);
         }
         else if (typeEvt == typeof(AugmentationBlinds))
         {
             TraiterEvtAugmentationBlinds(evt as AugmentationBlinds);
         }
         else if (typeEvt == typeof(Chat))
         {
             TraiterEvtChat(evt as Chat);
         }
         else if (typeEvt == typeof(ActionJoueurStat))
         {
             TraiterEvtActionJoueur(evt as ActionJoueurStat);
         }
         else if (typeEvt == typeof(Flop))
         {
             TraiterEvtFlop(evt as Flop);
         }
         else if (typeEvt == typeof(Turn))
         {
             TraiterEvtTurn(evt as Turn);
         }
         else if (typeEvt == typeof(River))
         {
             TraiterEvtRiver(evt as River);
         }
         else if (typeEvt == typeof(FinDonne))
         {
             TraiterEvtFinDonne(evt as FinDonne);
         }
         else if (typeEvt == typeof(FinPartie))
         {
             TraiterEvtFinPartie(evt as FinPartie);
         }
         else
         {
             logClient.Debug("======== Evenement non reconnu");
         }
     }
     else
     {
         logClient.Debug("******* Erreur lors de la lecture d'un evenement : L'evenement est null");
     }
 }
Exemplo n.º 5
0
 private void TraiterEvtActionJoueur(string[] infosEvt, TypeActionJoueur typeAction)
 {
     this.EvenementCourant = new ActionJoueurStat()
     {
         TypeAction = typeAction,
         Nom        = infosEvt[3],
         Mise       = int.Parse(infosEvt[4]),
         Tapis      = int.Parse(infosEvt[5])
     };
 }
Exemplo n.º 6
0
 private void TraiterEvtFlop(string[] infosEvt)
 {
     string[] flop = infosEvt[3].Split(',');
     this.EvenementCourant = new Flop()
     {
         Carte1 = ParserChaineEnCarte(flop[0]),
         Carte2 = ParserChaineEnCarte(flop[1]),
         Carte3 = ParserChaineEnCarte(flop[2]),
         Pot    = int.Parse(infosEvt[4])
     };
 }
Exemplo n.º 7
0
        private void TraiterEvtNouvelleDonne(string[] infosEvt)
        {
            NouvelleDonne nelleDonne = new NouvelleDonne();
            int           numDonne   = int.Parse(infosEvt[1]);

            nelleDonne.NumeroDonne = numDonne;

            // Lecture des infos dans le fichier des donnes
            string[] infosJoueurs = LireExtraitFichierDonne(_posDonne[numDonne], _posDonne[numDonne + 1]).Split(new char[2] {
                '\r', '\n'
            }, StringSplitOptions.RemoveEmptyEntries);
            List <JoueurStat> listeJoueurs = new List <JoueurStat>();

            for (int i = 0; i < infosJoueurs.Length; i++)
            {
                string[] detJoueurs = infosJoueurs[i].Split(';');
                listeJoueurs.Add(new JoueurStat()
                {
                    Nom    = detJoueurs[2],
                    Carte1 = ParserChaineEnCarte(detJoueurs[3]),
                    Carte2 = ParserChaineEnCarte(detJoueurs[4]),
                    Tapis  = int.Parse(detJoueurs[5])
                });
            }
            string[] infosDealer = infosEvt[3].Split(',');
            nelleDonne.Dealer      = infosDealer[0];
            nelleDonne.PetiteBlind = infosDealer[1];
            nelleDonne.GrosseBlind = infosDealer[2];


            nelleDonne.InfosBlind = new Blind();
            string[] infosBlind = infosEvt[4].Split(',');
            nelleDonne.InfosBlind.MontantPetiteBlind = int.Parse(infosBlind[0]);
            nelleDonne.InfosBlind.MontantGrosseBlind = int.Parse(infosBlind[1]);
            infosBlind = infosEvt[5].Split(',');
            nelleDonne.InfosBlind.MontantProchainePetiteBlind = int.Parse(infosBlind[0]);
            nelleDonne.InfosBlind.MontantProchaineGrosseBlind = int.Parse(infosBlind[1]);

            nelleDonne.ListeJoueurs = listeJoueurs;

            this.EvenementCourant = nelleDonne;

            if (ChangementDonne != null)
            {
                ChangementDonne(this, new ChangementDonneEventArgs()
                {
                    NumeroDonne = numDonne
                });
            }
        }
Exemplo n.º 8
0
        private void TraiterEvtAugmentationBlinds(string[] infosEvt)
        {
            string[] blindsActuelles         = infosEvt[3].Split(',');
            string[] prochainesBlinds        = infosEvt[4].Split(',');
            int      delaiAugmentationBlinds = int.Parse(infosEvt[5]);

            this.EvenementCourant = new AugmentationBlinds()
            {
                MontantPetiteBlind          = int.Parse(blindsActuelles[0]),
                MontantGrosseBlind          = int.Parse(blindsActuelles[1]),
                MontantProchainePetiteBlind = int.Parse(prochainesBlinds[0]),
                MontantProchaineGrosseBlind = int.Parse(prochainesBlinds[1]),
                DelaiAugmentationBlinds     = new TimeSpan(0, delaiAugmentationBlinds, 0)
            };
        }
Exemplo n.º 9
0
        private void TraiterEvtFinPartie(string[] infosEvt)
        {
            FinPartie evt = new FinPartie();

            evt.ListeJoueurs = new List <JoueurStat>();
            int pos = 1;

            foreach (string joueur in infosEvt[3].Split(','))
            {
                evt.ListeJoueurs.Add(new JoueurStat()
                {
                    PositionElimination = pos++, Nom = joueur
                });
            }

            this.EvenementCourant = evt;
        }
Exemplo n.º 10
0
        private void TraiterEvtNouvellePartie(string[] infosEvt)
        {
            List <JoueurStat> resListe = new List <JoueurStat>();

            string[] listeJoueurs = infosEvt[3].Split(',');
            string[] potJoueurs   = infosEvt[4].Split(',');
            for (int i = 0; i < listeJoueurs.Length; i++)
            {
                resListe.Add(new JoueurStat()
                {
                    Nom = listeJoueurs[i], Tapis = int.Parse(potJoueurs[i]), Carte1 = null, Carte2 = null, PositionElimination = 0
                });
            }
            NouvellePartie nellePartie = new NouvellePartie();

            nellePartie.ListeJoueurs = resListe;
            this.EvenementCourant    = nellePartie;
        }
Exemplo n.º 11
0
 private void ModifierDateEvt(string date, EvenementJeu evt)
 {
     evt.DateEvenement = DateTime.Parse(date);
 }