Exemplo n.º 1
0
        public void onRequestReceived(MessageApi.Message msg)
        {
            Console.WriteLine( " :: " + "Requete recu de type : " + msg.sujetMsg.ToString() + " id : " + msg.id);

            if (msg.sujetMsg == Message.MessageSujet.RequeteRejoindrePartie)
            {
                handleRejoindrePartie((RequeteRejoindrePartie)msg);
            }
            else if (msg.sujetMsg == Message.MessageSujet.RequeteValeurDe)
            {
                ReponseDe rep = (ReponseDe)(msg.creerReponse(Message.MessageSujet.ReponseDe));
                rep.valeurDe = connManager.valeurDe;
                msg.repondre();
            }
            else if (msg.sujetMsg == Message.MessageSujet.RequeteTerminerTour)
            {
                msg.creerReponse(Message.MessageSujet.ReponseOk);
                msg.repondre();
                connManager.tourSuivant();
            }
            else if (msg.sujetMsg == Message.MessageSujet.RequeteConstructionColonie)
            {
                msg.creerReponse(Message.MessageSujet.ReponseOk);
                msg.repondre();

                connManager.onColonieConstruite(((RequetePosition)msg).position, joueur);
            }
            else if (msg.sujetMsg == Message.MessageSujet.RequeteConstructionRoute)
            {
                msg.creerReponse(Message.MessageSujet.ReponseOk);
                msg.repondre();

                connManager.onRouteConstruite(((RequetePosition)msg).position, joueur);
            }
            else if (msg.sujetMsg == Message.MessageSujet.RequeteConstructionVille)
            {
                msg.creerReponse(Message.MessageSujet.ReponseOk);
                msg.repondre();

                connManager.onVilleConstruite(((RequetePosition)msg).position, joueur);
            }
            else if( msg.sujetMsg == Message.MessageSujet.RequeteResGenere )
            {
                ReponseRes rep = (ReponseRes)msg.creerReponse(Message.MessageSujet.ReponseRes);
                rep.res = connManager.getResPourJoueur(joueur);
                msg.repondre();
            }
        }
        public void onRequestReceived(MessageApi.Message msg)
        {
            Console.WriteLine(nom + " :: " + "Requete recu de type : " + msg.sujetMsg.ToString() + " id : " + msg.id);

            msg.creerReponse(Message.MessageSujet.ReponseOk);
            msg.repondre();
        }