Example #1
0
        public Servomoteur(Carte carte, int id, ServoBaudrate baudrate)
        {
            this.carte = carte;
            this.id = id;
            this.baudrate = baudrate;

            connexion = Connexions.ConnexionParCarte[carte];

            connexion.NouvelleTrameRecue += new ConnexionUDP.ReceptionDelegate(connexion_NouvelleTrame);
        }
 public void addCarte(Carte c)
 {
     try
     {
         using (StreamWriter swFisier = new StreamWriter(NumeFisier, true))
         {
             swFisier.WriteLine(c.afisare());
         }
     }
     catch (IOException eIO)
     {
         throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
     }
     catch (Exception eGen)
     {
         throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
     }
 }
Example #3
0
 public void remove(Carte carte)
 {
     conn = new DB().getConn();
     try
     {
         string query = "delete * from carte where id = " + carte.Id;
         cmd = new NpgsqlCommand(query, conn);
         cmd.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         throw new Exception("Erreur dans CarteDao=>remove " + e.Message);
     }
     finally
     {
         conn.Close();
     }
 }
Example #4
0
    /// <summary>
    /// Mélange les Cartes de la pioche et de la défausse
    /// </summary>
    public void MelangerPioche()
    {
        // On ajoute la défausse à la pioche, puis on la supprime
        pioche.AddRange(defausse);
        defausse.Clear();

        System.Random rng = new System.Random();
        int           n   = pioche.Count;

        while (n > 1)
        {
            n--;
            int   index = rng.Next(n + 1);
            Carte carte = pioche[index];
            pioche[index] = pioche[n];
            pioche[n]     = carte;
        }
    }
Example #5
0
 public Test1()
 {
     carte = new Carte()
     {
         Id    = new Text("238s0r-3d3"),
         Nr    = new ISSN("384-9ff4-5g"),
         titlu = new Text("Aventurile lui Tom Sawyer"),
         autor = new Text("Mark Twain"),
         an    = new Text("1876"),
         gent  = Gen_tip.Liric,
         genc  = Gen_continut.Aventură
     };
     magistrala = new MagistralaEvenimente();
     magistrala.InregistreazaProcesatoareStandard();
     mockProcesatorAdaugare = new Mock <ProcesatorEveniment>();
     magistrala.InregistreazaProcesator(TipEveniment.AdaugareCarte, mockProcesatorAdaugare.Object);
     magistrala.InchideInregistrarea();
 }
        public ActionResult DescarcaCartile()
        {
            List <CarteEntity> listaDb    = _repo.CitesteCartile();
            List <Carte>       listaCarti = new List <Carte>();

            foreach (CarteEntity entity in listaDb)
            {
                Carte model = Map(entity);
                listaCarti.Add(model);
            }

            string serializat = JsonConvert.SerializeObject(listaCarti);

            byte[] bytes = Encoding.UTF8.GetBytes(serializat);
            return(File(bytes, "application/json", "listaCarti.json"));
            //FileStream myFile = System.IO.File.Open();
            //return File(myFile, "application/octet-stream", "myfile.someextention");
        }
Example #7
0
        private void AfiseazaLista()
        {
            lstCarti.Items.Clear();
            Cititor cititor = adminCititori.GetCititorByIndex(Int32.Parse(lblID.Text));

            if (cititor.NrCarti == 0)
            {
                this.Close();
            }
            for (int i = 0; i < cititor.NrCarti; i++)
            {
                Carte carte = adminCarti.GetCarteByIndex(cititor.imprumutID[i]);
                if (carte != null)
                {
                    lstCarti.Items.Add(carte.NumeComplet);
                }
            }
        }
Example #8
0
    public void determineRoundWinner()
    {
        Carte better = _pile.getElem(0);
        int   win    = _fp;

        for (int i = 1; i < 4; i++)
        {
            Carte carte = _pile.getElem(i);
            if (carte.isBetter(better))
            {
                better = carte;
                win    = (_fp + i) % 4;
            }
        }
        _fp = win;
        givePoints();
        announceRoundWinner(better);
    }
Example #9
0
 //------------------------------------------------------------------------
 //Dublura found == true /not found == false / Add Book
 static public bool CheckDublura(Carte current)
 {
     if (Lists.Lib.Count <= 0)
     {
         return(false);
     }
     else
     {
         foreach (Carte book in Lists.Lib)
         {
             if (string.Equals(current.Autor, book.Autor) && string.Equals(current.Titlu, book.Titlu))
             {
                 return(true);
             }
         }
         return(false);
     }
 }
Example #10
0
    private void GenerateGrid()
    {
        if (genericGround == null)
        {
            return;
        }

        if (GameManage.DonnerInstance.Carte == null)
        {
            return;
        }

        x = (int)GameManage.DonnerInstance.Carte.Xmax;
        y = (int)GameManage.DonnerInstance.Carte.Ymax;

        int origineX = -((x) / 2);
        int origineY = -((y) / 2);

        if (solGenerique == null)
        {
            solGenerique = new PoolObjects();
            solGenerique.SetGameObject       = genericGround;
            solGenerique.SetParentGameObject = this.transform;
        }


        Carte carte = GameManage.DonnerInstance.Carte;

        for (int i = 0; i < x; i++)
        {
            for (int j = 0; j < y; j++)
            {
                if (carte.DonnerCellule(i, j) != null &&
                    carte.DonnerCellule(i, j).EstOccupe)
                {
                    int ht = carte.DonnerCellule(i, j).Hauteur;
                    for (int a = 0; a <= ht; a++)
                    {
                        solGenerique.CreerObject(new Vector3(origineX + i * h, a, origineY + j * w), Quaternion.identity);
                    }
                }
            }
        }
    }
Example #11
0
 public bool isBetter(Carte better)
 {
     if (isTrap)
     {
         if (!better.getTrap())
         {
             return(true);
         }
         return(value > better.getValue());
     }
     else
     {
         if (better.getCouleur() != couleur)
         {
             return(false);
         }
         return(value > better.getValue());
     }
 }
Example #12
0
 public bool GenerateCards()
 {
     allCards        = new List <Carte>();
     allCardsDisplay = new List <CardReader>();
     foreach (CellData item in chestTiles)
     {
         CellData[] nearbyCells = new CellData[9];
         nearbyCells = GetAdjCells(item);
         for (int i = 0; i < nearbyCells.Length; i++)
         {
             //PENSER A CHANGER QUAND ON AURA REMIS EN UN SEUL GO;
             Carte newCarte = new Carte(nearbyCells[i], i);
             allCards.Add(newCarte);
             //allCardsDisplay.Add(newCarte.ingameDisplay.GetComponentInChildren<CardReader>());
         }
     }
     ready = true;
     return(allCards.Count > 0);
 }
Example #13
0
        public LiaisonDataCheck(Connexion connexion, Carte carte, bool bloquant)
        {
            Reponses = new Dictionary<int, List<ReponseLiaison>>();
            for (int i = 0; i < 255; i++ )
                Reponses.Add(i, new List<ReponseLiaison>());

            Connexion = connexion;
            Carte = carte;
            Bloquant = bloquant;

            NombreMessagesTotal = 0;
            NombreMessagesCorrects = 0;
            NombreMessagesPerdusEmission = 0;
            NombreMessagesCorrompusEmission = 0;
            NombreMessagesPerdusReception = 0;
            NombreMessagesCorrompusReception = 0;
            IDTestEmissionActuel = 255;
            IDTestReceptionActuel = 0;
        }
Example #14
0
 public static bool is_in_autre_inoshikacho_combinaison(Carte carte)
 {
     if (carte is Animal)
     {
         if (((Animal)carte).NomAnimal == NomAnimal.Cerf)
         {
             return(true);
         }
         else if (((Animal)carte).NomAnimal == NomAnimal.Sanglier)
         {
             return(true);
         }
         else if (((Animal)carte).NomAnimal == NomAnimal.Papillon)
         {
             return(true);
         }
     }
     return(false);
 }
Example #15
0
        private void mtAdauga_Click(object sender, EventArgs e)
        {
            CodEroare validare = Validare();

            if (validare == CodEroare.CORECT)

            {
                Carte c = new Carte(mtxtTitlu.Text, mtxtAutor.Text, mtxtEditura.Text, Convert.ToInt32(dudNrExemplare.Text));
                c.Limba = GetSelectedLimba();
                c.Gen   = new List <string>();
                c.Gen.AddRange(genuriSelectate);
                adminCarti.AddCarte(c);
                this.Close();
            }
            else
            {
                MarcheazaControaleCuDateIncorecte(validare);
            }
        }
Example #16
0
        public unsafe Carte PlayCard(Deck pile, askcontrat askcard)
        {
            askcard.deck = fillDeck(askcard.deck);
            Header h = new Header();

            h.id_command = 3;
            bool     ok       = false;
            responce responce = new responce();

            while (!ok)
            {
                write <Header>(h);
                write <askcontrat>(askcard);
                responce = read <responce>();
                Carte carte = deck.getElem(responce.value);
                ok = isGoodMove(carte, pile);
            }
            return(deck.PutCard(responce.value));
        }
Example #17
0
 // Runner tous les tests.
 void Test()
 {
     // On detruit d'abord tous les fichiers dans le dossier.
     DeleteFilesTestFolder();
     foreach (GameObject Carte in Cards)
     {
         Carte        compCarte     = Carte.GetComponent <Carte>();
         StreamWriter writer        = new StreamWriter(folder + "/" + compCarte.Name + ".txt", true);
         List <Effet> allEffets     = compCarte.AllEffets;
         string       effetToString = compCarte.AllEffetsStringToDisplay;
         int          i             = 1;
         foreach (Effet e in allEffets)
         {
             TestUneCarte(e, compCarte, writer, effetToString, i);
             i++;
         }
         writer.Close();
     }
 }
Example #18
0
    private Carte IA_V3_choose_best_card_to_play(List <Carte_IA_v3> paires)
    {
        paires.Sort(delegate(Carte_IA_v3 a, Carte_IA_v3 b)
        {
            double score_a = a.val;
            double score_b = b.val;

            if (score_a > score_b)
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        });
        IA.carte_defosse = paires[0].defosse.carte;
        return(paires[0].main.carte);
    }
Example #19
0
    private Carte IA_V4_choose_best_card_to_play(List <Carte_IA_v4> paires)
    {
        paires.Sort(delegate(Carte_IA_v4 a, Carte_IA_v4 b)
        {
            double score_a = a.get_valeur_paire();
            double score_b = b.get_valeur_paire();

            if (score_a > score_b)
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        });
        IA.carte_defosse = paires[0].defosse.carte;
        return(paires[0].main.carte);
    }
Example #20
0
        public void ConfigurerAventurierTest()
        {
            var filePath    = @"C:\Projects\CarteAuTresor\CarteAuTresorUnitTest\EntreCarteTest.txt";
            var fileManager = new FileManager(filePath);

            fileManager.FileReader();

            var carte = Carte.CreerCarteAuTresor(fileManager);

            carte.ConfigurerCarteAuTresor();
            carte.ConfigurerAventurier(fileManager);

            carte.CarteAuTresor[1, 1].Aventurier.Should().NotBeNull();
            carte.CarteAuTresor[1, 1].Aventurier.Nom.Should().Be("Indiana");
            carte.CarteAuTresor[1, 1].Aventurier.Orientation.Should().Be(Orientation.Sud);
            carte.CarteAuTresor[1, 1].Aventurier.Sequence.Should().Be("AADADA");
            carte.CarteAuTresor[1, 1].Aventurier.NombreTour.Should().Be(6);
            carte.CarteAuTresor[1, 1].Aventurier.NombreTresor.Should().Be(0);
        }
Example #21
0
 public void insert(Carte carte)
 {
     conn = new DB().getConn();
     try
     {
         string query = "insert into cartes (id,libelle,valeur) values (nextval('seq_carte')," + carte.Libelle + ","
                        + carte.Valeur + ")";
         cmd = new NpgsqlCommand(query, conn);
         cmd.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         throw new Exception("Erreur dans CarteDao=>insert" + e.Message);
     }
     finally
     {
         conn.Close();
     }
 }
Example #22
0
        static void Main(string[] args)
        {
            //configurare infrastructura
            MagistralaComenzi.Instanta.Value.InregistreazaProcesatoareStandard();
            MagistralaEvenimente.Instanta.Value.InregistreazaProcesatoareStandard();
            MagistralaEvenimente.Instanta.Value.InchideInregistrarea();

            var carte = new Carte(new Text("1-a"), new ISSN("12"), new Text("titlu1"), new Text("a1"), new Text("1980"), Gen_tip.Epic, Gen_continut.Aventură, new Utilizator());

            //var cmdAdauga = new ComandaAdaugare();
            //cmdAdauga.carte = carte;
            //MagistralaComenzi.Instanta.Value.Trimite(cmdAdauga);
            //var cmdCauta = new ComandaCautare();
            //cmdCauta.carte = carte;
            //MagistralaComenzi.Instanta.Value.Trimite(cmdCauta);
            //var cmdImprumut = new ComandaImprumutare();
            //MagistralaComenzi.Instanta.Value.Trimite(cmdImprumut);
            Console.ReadLine();
        }
Example #23
0
        // Add card
        public ActionResult InsertCard(int carte, int employe, int quantite, string date)
        {
            //instanciation des services
            distribCarteService      = new DistributionCarteService();
            empStockService          = new EmployeStockService();
            empService               = new EmployeService();
            carteService             = new CarteService();
            employeStockHistoService = new EmployeStockHistoService();

            //instanciation objet depuis argument
            Carte      c        = new Carte(carte);
            Employe    emp      = new Employe(employe);
            DateTime   dateTime = DateTime.Parse(date);
            EmployeVue employee = empService.findById(employe);
            Carte      cartee   = carteService.findById(carte);

            //instanciation distribution carte
            DistributionCarte carteDist = new DistributionCarte(c, emp, quantite, dateTime);

            //Recherche du stock de l'employe actuelle
            EmployeStockVue empStockActu = new EmployeStockVue();

            empStockActu.Carte = cartee.Libelle;
            empStockActu.Nom   = employee.Nom;
            List <EmployeStockVue> listEmpStockActu = empStockService.search(empStockActu);

            //insertion de la distribution
            distribCarteService.insert(carteDist);

            //mise a jour du stock du coursier
            int stock = listEmpStockActu[0].Stock + quantite;

            empStockService.update(new EmployeStock(employe, stock, carte));

            //insertion du nouveau stock du coursier
            employeStockHistoService.insert(new EmployeStockHisto(employe, quantite, carte));

            //Recherche liste carte distribue
            List <DistributionCarteVue> listCarteDistr = distribCarteService.getAll();

            ViewBag.ListCarteDistr = listCarteDistr;
            return(View());
        }
Example #24
0
    public void SendDeckHasChange(Carte drop, Carte get)
    {
        m_MyActionPhase = m_Action.Wait;

        m_Canvas.UpdateInterface(m_MyActionPhase, hand);
        Debug.Log("A player have draw");
        byte evCode = 3;                                             // Custom Event 1: Used as "MoveUnitsToTargetPosition" event

        object[] content = new object[] { drop.cardId, get.cardId }; // Array contains the target position and the IDs of the selected units

        RaiseEventOptions raiseEventOptions = new RaiseEventOptions();

        //raiseEventOptions.CachingOption = EventCaching.AddToRoomCacheGlobal;
        raiseEventOptions.Receivers = ReceiverGroup.Others;
        SendOptions sendOptions = new SendOptions();

        sendOptions.DeliveryMode = DeliveryMode.Reliable;
        PhotonNetwork.RaiseEvent(evCode, content, raiseEventOptions, sendOptions);
    }
Example #25
0
        static Carte PiochezCarte(ref Pioche pioche)
        {
            Carte cartepiocher = new Carte();
            bool  carteValide  = false;
            int   alea         = 0;

            while (carteValide == false)
            {
                alea = generateurNb.Next(0, 52);
                if (pioche.tabpioche[alea].carteUtiliser == false)
                {
                    cartepiocher = pioche.tabpioche[alea];
                    pioche.tabpioche[alea].carteUtiliser = true;
                    cartepiocher.carteUtiliser           = true;
                    carteValide = true;
                }
            }
            return(cartepiocher);
        }
Example #26
0
        static void Main(string[] args)
        {
            Joueur joueur1     = new Joueur("joe", 3);
            Joueur joueur2     = new Joueur("ordi", 3);
            Carte  carteCentre = new Carte((Sorte)generateurNb.Next(1, 5), generateurNb.Next(1, 14));
            int    nbJoueur    = 0;
            int    nb          = 0;
            int    choix       = 0;
            int    temp        = 0;

            //            NbJoueur(out nbJoueur);


            //Afficher les cartes du joueur 1

            Console.WriteLine("Carte 1 : " + joueur1.tabCarte[0].valeurCarte + " - " + joueur1.tabCarte[0].sorteCarte);
            Console.WriteLine("Carte 2 : " + joueur1.tabCarte[1].valeurCarte + " - " + joueur1.tabCarte[1].sorteCarte);
            Console.WriteLine("Carte 3 : " + joueur1.tabCarte[2].valeurCarte + " - " + joueur1.tabCarte[2].sorteCarte);

            //Afficher la carte du centre
            Console.WriteLine("Carte Centre : " + carteCentre.valeurCarte + " - " + carteCentre.sorteCarte);

            //Afficher les options du joueur
            AfficherMenu();
            choix = Convert.ToInt32(Console.ReadLine());

            if (choix == 1)
            {
                Console.WriteLine("Saisir la carte a enlever : ");
                temp = Convert.ToInt16(Console.ReadLine());
                new Carte((Sorte)generateurNb.Next(1, 5), generateurNb.Next(1, 14));
                joueur1 : Console.WriteLine("Nouvelle Carte : " + joueur1.tabCarte[choix - 1].valeurCarte + " - " + joueur1.tabCarte[choix - 1].sorteCarte);
            }
            else if (choix == 2)
            {
                Console.WriteLine("Saisir la carte a enlever : ");
                temp = Convert.ToInt16(Console.ReadLine());
                joueur1 : Console.WriteLine("Nouvelle carte : " + carteCentre.valeurCarte + " - " + carteCentre.sorteCarte);
            }

            Console.ReadKey();
        }
        public void TestAjoutCarteEnTrop()
        {
            Terrain curPose = new Terrain(2);

            Assert.AreEqual(curPose.Count, 0, "Création de Terrain NOK");
            Carte maCarte1 = new Carte("Carte1", TypeCarte.Instantanee, 1, 1, 12);
            bool  AjoutOK  = curPose.ajouterCarte(maCarte1);
            Carte maCarte2 = new Carte("Carte2", TypeCarte.Instantanee, 1, 1, 7);

            AjoutOK = curPose.ajouterCarte(maCarte2);
            Assert.AreEqual(true, AjoutOK, "Ajout Carte autorise NOK sur retour ajouterCarte");
            Assert.AreEqual(2, curPose.Count, "Ajout de 2 Cartes NOK");
            Assert.AreEqual(maCarte2, curPose[2], "Ajout 2éme carte pas à la bonne position ");
            Assert.AreEqual(maCarte1, curPose.prochaineCarte, "Prochaine Carte NOK avec 2 éléements ");
            Carte maCarte3 = new Carte("Carte3", TypeCarte.Instantanee, 1, 1, 7);

            AjoutOK = curPose.ajouterCarte(maCarte3);
            Assert.AreEqual(false, AjoutOK, "Ajout Carte Interdite NOK sur retour ajouterCarte");
            Assert.AreEqual(2, curPose.Count, "Ajout de 2 Cartes NOK sur Count");
        }
Example #28
0
 private void SetupAnnotations()
 {
     foreach (var wifiHotspot in ViewModel.ValidHotspots)
     {
         var position = new Position(wifiHotspot.Coordinates.Latitude, wifiHotspot.Coordinates.Longitude);
         var pin      = new Pin
         {
             Type     = PinType.Place,
             Position = position,
             Label    = wifiHotspot.Name,
             Address  = wifiHotspot.Address.Street
         };
         if (!Carte.Pins.Any())
         {
             Carte.MoveToRegion(
                 MapSpan.FromCenterAndRadius(position, Distance.FromMiles(2)));
         }
         Carte.Pins.Add(pin);
     }
 }
Example #29
0
        /// <summary>
        /// Charge et retourne une carte.
        /// </summary>
        /// <param name="cheminCarte">Le chemin du fichier de sauvegarde de la carte.</param>
        /// <returns>La carte chargée. (null si erreur)</returns>
        public static Carte ChargerCarteMonde(string cheminCarte)
        {
            try
            {
                StreamReader sr = new StreamReader(cheminCarte);

                List <string> lignes = new List <string>();

                while (!sr.EndOfStream)
                {
                    lignes.Add(sr.ReadLine());
                }

                return(Carte.ChargerDonneesSauvegarde(lignes.ToArray()));
            }
            catch
            {
                return(null);
            }
        }
 public void AdaugaCarte(Carte book)
 {
     try
     {
         //instructiunea 'using' va apela la final swFisierText.Close();
         //al doilea parametru setat la 'true' al constructorului StreamWriter indica modul 'append' de deschidere al fisierului
         using (StreamWriter swFisierText = new StreamWriter(NumeFisier, true))
         {
             swFisierText.WriteLine(book.Info);
         }
     }
     catch (IOException eIO)
     {
         throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
     }
     catch (Exception eGen)
     {
         throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
     }
 }
Example #31
0
        public void AjouterMenuTest()
        {
            Carte c1 = new Carte(1, "special");

            Menu m1 = new Menu(1, "soir");
            Menu m2 = new Menu(2, "apres-midi");
            Menu m3 = new Menu(3, "matin");


            // System.Diagnostics.Debug.WriteLine(c1.LesMenus);


            c1.AjouterMenu(m1);
            c1.AjouterMenu(m2);
            c1.AjouterMenu(m3);

            Assert.AreEqual("soir", c1.LesMenus[0].NomMenu);
            Assert.AreEqual("apres-midi", c1.LesMenus[1].NomMenu);
            Assert.AreEqual("matin", c1.LesMenus[2].NomMenu);
        }
Example #32
0
        /// <summary>
        /// Fonction qui va chercher en BD les exemplaires selon la requête voulue
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        private static List <Exemplaire> RetrieveExemplaires(string query)
        {
            List <Exemplaire> lstResultat = new List <Exemplaire>();
            Carte             laCarte     = null;
            DataSet           dsResultat;
            DataTable         dtResultat;

            ConnectionBD = new MySqlConnexion();

            dsResultat = ConnectionBD.Query(query);
            dtResultat = dsResultat.Tables[0];

            foreach (DataRow dr in dtResultat.Rows)
            {
                laCarte = MySqlCarteService.RetrieveById((int)dr["idCarte"]);
                lstResultat.Add(new Exemplaire(laCarte, (int)dr["quantite"], (int)dr["idExemplaire"]));
            }

            return(lstResultat);
        }
Example #33
0
        void Robot_ConnexionChange(Carte carte, bool connecte)
        {
            IndicateurConnexion selectLed = null;
            switch (carte)
            {
                case Carte.RecMove:
                    selectLed = ledRecMove;
                    break;
                case Carte.Balise:
                    selectLed = ledBalise;
                    break;
                case Carte.RecIO:
                    selectLed = ledRecIO;
                    break;
            }

            this.Invoke(new EventHandler(delegate
            {
                SetLed(selectLed, connecte);
            }));
        }
Example #34
0
        public RobotReel(IDRobot idRobot, Carte carte)
        {
            AngleTotalParcouru = 0;
            DistanceTotaleParcourue = 0;
            Carte = carte;
            IDRobot = idRobot;
            ServomoteursConnectes = new List<byte>();
            CapteurActive = new Dictionary<CapteurOnOffID, bool>();

            foreach (FonctionIO fonction in Enum.GetValues(typeof(FonctionIO)))
                SemaphoresIO.Add(fonction, new Semaphore(0, int.MaxValue));

            foreach (FonctionMove fonction in Enum.GetValues(typeof(FonctionMove)))
                SemaphoresMove.Add(fonction, new Semaphore(0, int.MaxValue));

            foreach (CapteurOnOffID fonction in Enum.GetValues(typeof(CapteurOnOffID)))
            {
                SemaphoresCapteurs.Add(fonction, new Semaphore(0, int.MaxValue));
                CapteurActive.Add(fonction, false);
            }
        }
Example #35
0
    /**
     * Constructeur de la classe Partie
     * nomPartie Le nom de la partie
     * c La carte associee a la partie
     * joueurs Les joueurs deja initialises associes a leurs numeros respectifs
     * nbTours Le nombre de tour a realiser ou restant a la partie
     * joueurCourant Le joueur courant
     */
    public Partie(string nomPartie, Carte c, List<Joueur> joueurs, int nbTours)
    {
        this._carte = c;
        this._joueurs = joueurs;
        this._toursRestants = nbTours;
        this._nomPartie = nomPartie;

        // Selection de la premiere unite courante
        this._uniteCourante = this._joueurs[0].Peuple.Unites[0];

        // Mise a zero du compteur de joueurs
        this._cptTourJoueurs = 0;

        // Calcul des points de joueurs
        this.recalculerPoints();
        NBMAXJOUEURS = joueurs.Count;
        this._nbJoueursRestants = joueurs.Count;
        this.initUnites();
        this._carte.GrilleUnites = new Dictionary<Coordonnee,List<Unite>>();
        this.miseAJourGilleUnite();
        this.recalculerPoints();
    }
Example #36
0
        public MoteurParticule(YellokillerGame game, SpriteBatch spriteBatch, Carte carte, Heros heros1, Heros heros2, List<Statue> _statue)
        {
            this.game = game;
            this.spriteBatch = spriteBatch;

            hadoken_heros1 = new ExplosionParticleSystem(game, 1, heros1, carte, 50);
            game.Components.Add(hadoken_heros1);

            ball1 = new BallParticleSystem(game, 1, heros1, carte);
            game.Components.Add(ball1);

            foreach (Statue statue in _statue)
            {
                explosion_statue = new Statue_Explosion(game, 20, carte, statue, statue.Distance_Statue_Mur(carte));
                game.Components.Add(explosion_statue);
            }

            fume_hadoken = new ExplosionSmokeParticleSystem(game, 2);
            game.Components.Add(fume_hadoken);

            fumigene1 = new Fumigene(game, 9, heros1, carte);
            game.Components.Add(fumigene1);

            fume = new SmokePlumeParticleSystem(game, 9);
            game.Components.Add(fume);

            try
            {
                hadoken_heros2 = new ExplosionParticleSystem(game, 1, heros2, carte, 50);
                game.Components.Add(hadoken_heros2);
                ball2 = new BallParticleSystem(game, 1, heros2, carte);
                fumigene2 = new Fumigene(game, 9, heros2, carte);
                game.Components.Add(fumigene2);
                game.Components.Add(ball2);
            }
            catch (NullReferenceException)
            { }
        }
Example #37
0
 public Prise GetPrise(Carte vire, int tour)
 {
     throw new System.NotImplementedException();
 }
Example #38
0
        public static Trame EnvoyerUart(Carte carte, Trame trame)
        {
            byte[] tab = new byte[3 + trame.Length];
            tab[0] = (byte)carte;
            tab[1] = (byte)FonctionMove.EnvoiUart;
            tab[2] = (byte)trame.Length;
            for (int i = 0; i < trame.Length; i++)
                tab[3 + i] = trame[i];

            Trame retour = new Trame(tab);
            return retour;
        }
Example #39
0
 public static Trame ServoDemandeConfigAlarmeShutdown(ServomoteurID servo, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[4];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.DemandeConfigAlarmeShutdown;
     tab[3] = (byte)servo;
     return new Trame(tab);
 }
Example #40
0
 public static Trame ServoDemandeCoupleActuel(ServomoteurID servo, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[4];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.DemandeCoupleCourant;
     tab[3] = (byte)servo;
     return new Trame(tab);
 }
Example #41
0
        // Fonctionnalités                  ======================================================================================================
        // Nouveau tag détecté et validé (on est en droit de le poser et il est seul sur la table)
        public void onTag()
        {
            //On récupère la carte correspondante
            _card = CarteAssoc.AssocTagCarte[_tag].getCarte();

            //On détecte le type de la carte
            _typeCard = Carte.TypeCarte.CARD;
            if (_card is HTMLTagCarte) _typeCard = Carte.TypeCarte.HTML_TAG_CARD;
            else if (_card is HTMLAttributeCarte) _typeCard = Carte.TypeCarte.HTML_ATTRIB_CARD;
            else if (_card is AddonCarte) _typeCard = Carte.TypeCarte.ADDON_CARD;
            else if (_card is AttaqueCarte) _typeCard = Carte.TypeCarte.ATTACK_CARD;

            //On détermine le layout à afficher
            if ((_typeCard == Carte.TypeCarte.HTML_TAG_CARD && ((HTMLTagCarte)_card).getTagtype() == HTML_classes.HtmlTag.HTMLTagType.OPENTAG) && !HTML_classes.HtmlElement.singleTags.Exists(v => v == ((HTMLTagCarte)_card).getTag()) || _typeCard == Carte.TypeCarte.HTML_ATTRIB_CARD)
                _hasTextEdit = true;
            if (_typeCard == Carte.TypeCarte.ATTACK_CARD)
                _hasPlayerSelector = true;
            if (_tag == (int)TagCorrespondance.ATTRIB_SRC)
                _hasImageSelector = true;

            _card.onPlay();
        }
Example #42
0
 // Constructeurs                    ======================================================================================================
 // Paramètres : t tag
 //              delegate de construction
 //              d uri du fichier de description
 //              k mot-clé de la carte
 public CarteAssoc(int t, Carte carte, string d, string k)
 {
     tag = t;
     descriptionFilename = d;
     keyword = k;
     card = carte;
 }
Example #43
0
 public static Trame ServoEnvoiConfigEcho(ServomoteurID servo, char val, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[5];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiConfigEcho;
     tab[3] = (byte)servo;
     tab[4] = (byte)val;
     return new Trame(tab);
 }
Example #44
0
 public static void Boss_Esquive_Shuriken(Heros heros, Boss boss, List<Shuriken> shuriken, Carte carte, Rectangle camera)
 {
     foreach (Shuriken _shuriken in shuriken)
     {
         if (boss.VaEnHaut && boss.VaEnBas && boss.VaADroite && boss.VaAGauche)
         {
             if (_shuriken.Direction == Vector2.UnitX && boss.Regarde_Gauche && Math.Abs(boss.X - _shuriken.X) < 4 && boss.Y == _shuriken.Y)
             // si le shuriken va a droite , le shuriken est a moins de 4 cases du boss et que le shuriken
             // et le boss sont sur la meme position en Y alors :
             {
                 if (boss.Y + 1 < Taille_Map.HAUTEUR_MAP && carte.Cases[boss.Y + 1, boss.X].EstFranchissable)
                 // si le boss n est pas tout en bas de la map ou coller vers le bas a une texture non franchissable :
                 {
                     boss.positionDesiree.Y += 28; // il descend
                     boss.VaEnBas = false;
                     break; // Jpense que c'est inutile, mais on sait jamais
                 }
                 // si il est colle a une texture non franchissable :
                 else if (boss.Y - 1 >= 0 && carte.Cases[boss.Y - 1, boss.X].EstFranchissable)
                 {
                     boss.positionDesiree.Y -= 28; // il monte
                     boss.VaEnHaut = false;
                     break;
                 }
             }
             else if (_shuriken.Direction == Vector2.UnitY && boss.Regarde_Haut && Math.Abs(boss.Y - _shuriken.Y) < 4 && boss.X == _shuriken.X)
             // si le shuriken va en bas, le shuriken est a moins de 7 cases du boss et que le shuriken
             // et le boss sont sur la meme position en X alors :
             {
                 if (boss.X + 1 < Taille_Map.LARGEUR_MAP && carte.Cases[boss.Y, boss.X + 1].EstFranchissable)
                 {
                     boss.positionDesiree.X += 28; // il va a droite
                     boss.VaADroite = false;
                     break;
                 }
                 // si il est colle a une texture non franchissable :
                 else if (boss.X - 1 >= 0 && carte.Cases[boss.Y, boss.X - 1].EstFranchissable)
                 {
                     boss.positionDesiree.X -= 28; // il va a gauche
                     boss.VaAGauche = false;
                     break;
                 }
             }
             else if (_shuriken.Direction == -Vector2.UnitX && boss.Regarde_Droite && Math.Abs(boss.X - _shuriken.X) < 4 && boss.Y == _shuriken.Y)
             // si le shuriken va a droite , le shuriken est a moins de 7 cases du boss et que le shuriken
             // et le boss sont sur la meme position en Y alors :
             {
                 if (boss.Y + 1 < Taille_Map.HAUTEUR_MAP && carte.Cases[boss.Y + 1, boss.X].EstFranchissable)
                 // si le boss n est pas tout en bas de la map ou coller vers le bas a une texture non franchissable :
                 {
                     boss.positionDesiree.Y -= 28; // il descend
                     boss.VaEnHaut = false;
                     break; // Jpense que c'est inutile, mais on sait jamais
                 }
                 // si il est colle a une texture non franchissable :
                 else if (boss.Y - 1 >= 0 && carte.Cases[boss.Y - 1, boss.X].EstFranchissable)
                 {
                     boss.positionDesiree.Y += 28; // il monte
                     boss.VaEnBas = false;
                     break;
                 }
             }
             else if (_shuriken.Direction == -Vector2.UnitY && boss.Regarde_Bas && Math.Abs(boss.Y - _shuriken.Y) < 4 && boss.X == _shuriken.X)
             // si le shuriken va en bas, le shuriken est a moins de 7 cases du boss et que le shuriken
             // et le boss sont sur la meme position en X alors :
             {
                 if (boss.X + 1 < Taille_Map.LARGEUR_MAP && carte.Cases[boss.Y, boss.X + 1].EstFranchissable)
                 {
                     boss.positionDesiree.X -= 28; // il va a droite
                     boss.VaAGauche = false;
                     break;
                 }
                 // si il est colle a une texture non franchissable :
                 else if (boss.X - 1 >= 0 && carte.Cases[boss.Y, boss.X - 1].EstFranchissable)
                 {
                     boss.positionDesiree.X += 28; // il va a gauche
                     boss.VaADroite = false;
                     break;
                 }
             }
         }
     }
 }
Example #45
0
 public static Trame ServoEnvoiBaudrate(ServomoteurID servo, ServoBaudrate baud, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[5];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiBaudrate;
     tab[3] = (byte)servo;
     tab[4] = (byte)baud;
     return new Trame(tab);
 }
Example #46
0
 public static Trame ServoEnvoiComplianceParams(ServomoteurID servo, byte CCWSlope, byte CCWMargin, byte CWMargin, byte CWSlope, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[8];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiComplianceParams;
     tab[3] = (byte)servo;
     tab[4] = CCWSlope;
     tab[5] = CCWMargin;
     tab[6] = CWMargin;
     tab[7] = CWSlope;
     return new Trame(tab);
 }
Example #47
0
 public static Trame ServoEnvoiLed(ServomoteurID servo, bool allume, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[5];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiLed;
     tab[3] = (byte)servo;
     tab[4] = (byte)(allume ? 1 : 0);
     return new Trame(tab);
 }
Example #48
0
 public static Trame ServoEnvoiId(ServomoteurID servo, char nouvelId, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[5];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiId;
     tab[3] = (byte)servo;
     tab[4] = (byte)nouvelId;
     return new Trame(tab);
 }
Example #49
0
        public static Trame Debug(Carte carte, int numDebug)
        {
            byte[] tab = new byte[3];
            tab[0] = (byte)carte;
            switch(carte)
            {
                case Carte.RecIO:
                    tab[1] = (byte)FonctionIO.Debug;
                    break;
                case Carte.RecMove:
                    tab[1] = (byte)FonctionMove.Debug;
                    break;
            }
            tab[2] = (byte)numDebug;

            return new Trame(tab);
        }
Example #50
0
 public static Trame ServoReset(ServomoteurID servo, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[4];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.Reset;
     tab[3] = (byte)servo;
     return new Trame(tab);
 }
Example #51
0
 public static Trame ServoEnvoiPositionMinimum(ServomoteurID servo, int position, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[6];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiPositionMinimum;
     tab[3] = (byte)servo;
     tab[4] = ByteDivide(position, true);
     tab[5] = ByteDivide(position, false);
     return new Trame(tab);
 }
Example #52
0
 public static Trame ServoEnvoiConfigAlarmeShutdown(ServomoteurID servo, bool inputVoltage, bool angleLimit, bool overheating, bool range, bool checksum, bool overload, bool instruction, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[11];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiConfigAlarmeShutdown;
     tab[3] = (byte)servo;
     tab[4] = (byte)(inputVoltage ? 1 : 0);
     tab[5] = (byte)(angleLimit ? 1 : 0);
     tab[6] = (byte)(overheating ? 1 : 0);
     tab[7] = (byte)(range ? 1 : 0);
     tab[8] = (byte)(checksum ? 1 : 0);
     tab[9] = (byte)(overload ? 1 : 0);
     tab[10] = (byte)(instruction ? 1 : 0);
     return new Trame(tab);
 }
Example #53
0
 public void EnvoyerUart(Carte carte, Trame trame)
 {
     Trame trameUart = TrameFactory.EnvoyerUart(carte, trame);
     Connexions.ConnexionParCarte[carte].SendMessage(trameUart);
 }
Example #54
0
 public static Trame ServoEnvoiTemperatureMax(ServomoteurID servo, int temperature, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[5];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiTemperatureMax;
     tab[3] = (byte)servo;
     tab[4] = (byte)temperature;
     return new Trame(tab);
 }
Example #55
0
 public static Trame ServoEnvoiTensionMin(ServomoteurID servo, double tension, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[5];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiTensionMin;
     tab[3] = (byte)servo;
     tab[4] = (byte)(tension * 10);
     return new Trame(tab);
 }
Example #56
0
 public static Trame ServoEnvoiVitesseMax(ServomoteurID servo, int vitesse, Carte carte = Carte.RecIO)
 {
     byte[] tab = new byte[6];
     tab[0] = (byte)carte;
     tab[1] = (byte)FonctionIO.CommandeServo;
     tab[2] = (byte)FonctionServo.EnvoiVitesseMax;
     tab[3] = (byte)servo;
     tab[4] = ByteDivide(vitesse, true);
     tab[5] = ByteDivide(vitesse, false);
     return new Trame(tab);
 }
Example #57
0
        public static Trame DemandeValeursAnalogiques(Carte carte)
        {
            byte[] tab = new byte[2];
            tab[0] = (byte)carte;
            tab[1] = (byte)FonctionIO.DemandeValeursAnalogiques;

            Trame retour = new Trame(tab);
            return retour;
        }
Example #58
0
        private Prise GetPrise(Carte vire)
        {
            for (int i = 0; i < 4; i++)
            {
                Joueur j = GetJoueurSuivant(_donneur);
                Prise p = j.GetPrise(vire, 1);
                if (p != null) return p;
            }

            for (int i = 0; i < 4; i++)
            {
                Joueur j = GetJoueurSuivant(_donneur);
                Prise p = j.GetPrise(vire, 2);
                if (p != null) return p;
            }

            return null;
        }