示例#1
0
 // Méthode permettant d'afifcher les infos des héros
 public void AfficherInfoHeros(GestionHeros gHeros)
 {
     foreach (Hero hero in gHeros.LstHeros)
     {
         txtTestes.Text += "Joueur : " + hero.CompteJoueurId + " | Héro : " + hero.Id.ToString() + " - " + hero.NomHero + "\r\n";
     }
 }
示例#2
0
        // Tests GestionItem
        private void BtnItem_Click(object sender, EventArgs e)
        {
            txtTestes.Clear();
            GestionItem  gItem = new GestionItem();
            GestionHeros ghero = new GestionHeros();

            Item item = new Item
            {
                x           = 8,
                y           = 8,
                MondeId     = 3114,
                Nom         = "Test",
                Description = "Ceci est un test"
            };

            Hero hero = ghero.LstHeros.First();

            // Création d'un item
            gItem.CréationItem(item);
            AfficherInfoItems(gItem);

            // Modification d'un item
            txtTestes.Text += "\r\nDernier item : " + item.Id + " : " + item.Nom + " - " + item.Description + " - " + item.x + ", " + item.y + " - " + item.MondeId + "\r\n\r\n";

            gItem.ModificationItem(item.Id, hero.Id, -2);
            AfficherInfoItems(gItem);

            // Suppression d'un item
            txtTestes.Text += "\r\nSuppression d\'un item : \r\n";
            txtTestes.Text += "Compte avant (même compte qu\'après, mais heroId n\'existe pas) : " + gItem.LstItems.Count() + "\r\n";
            txtTestes.Text += "Dernier item : " + gItem.LstItems.Last().Id + " - " + gItem.LstItems.Last().Nom + " - " + gItem.LstItems.Last().x.ToString() + ", " + gItem.LstItems.Last().y.ToString() + " - " + gItem.LstItems.Last().IdHero.ToString() + "\r\n";
            gItem.SuppressionItem(item, hero);
            txtTestes.Text += "Compte après (même compte, mais x,y n\'est plus présent) : " + gItem.LstItems.Count() + "\r\n";
            txtTestes.Text += "Dernier item : " + gItem.LstItems.Last().Id + " - " + gItem.LstItems.Last().Nom + " - " + gItem.LstItems.Last().x.ToString() + ", " + gItem.LstItems.Last().y.ToString() + " - " + gItem.LstItems.Last().IdHero.ToString() + "\r\n";
        }
示例#3
0
        // Tests GestionHero
        private void BtnHeros_Click(object sender, EventArgs e)
        {
            txtTestes.Clear();
            GestionHeros gHero    = new GestionHeros();
            List <Hero>  lstHeros = new List <Hero>();

            Hero hero = new Hero
            {
                x              = 8,
                y              = 8,
                MondeId        = 3114,
                NomHero        = "Test",
                Niveau         = 17,
                StatVitalite   = 18,
                CompteJoueurId = 2091
            };

            // Création d'un héro
            gHero.CréationHero(hero);
            AfficherInfoHeros(gHero);

            // Modification d'un héro
            txtTestes.Text += "\r\nModification du héro créé : \r\n";
            txtTestes.Text += "Dernier héro : " + gHero.LstHeros.Last().Id + " - " + gHero.LstHeros.Last().NomHero + "\r\n";
            gHero.ModifierHero(hero, 11, 15487, hero.x, hero.y, 18, 17, 16, 15, 3111, false);
            hero            = gHero.LstHeros.Last();
            txtTestes.Text += "Info du héro modifié : \r\n";
            txtTestes.Text += hero.Id + " - " + hero.x + " - " + hero.y + " - " + hero.MondeId + " - " + hero.Niveau + " - " + hero.Experience + " - " + hero.NomHero
                              + " - " + hero.StatVitalite + " - " + hero.StatStr + " - " + hero.StatDex + " - " + hero.StatInt + " - " + hero.EstConnecte + "\r\n";
            txtTestes.Text += "Dernier héro : " + gHero.LstHeros.Last().Id + " - " + gHero.LstHeros.Last().NomHero + "\r\n";

            // Suppression d'un héro
            txtTestes.Text += "\r\nSuppression de héro : \r\n";
            txtTestes.Text += "Compte avant : " + gHero.LstHeros.Count() + "\r\n";
            txtTestes.Text += "Dernier héro : " + gHero.LstHeros.Last().Id + " - " + gHero.LstHeros.Last().NomHero + "\r\n";
            gHero.SuppressionHero(hero);
            txtTestes.Text += "Compte après : " + gHero.LstHeros.Count() + "\r\n";
            txtTestes.Text += "Dernier héro : " + gHero.LstHeros.Last().Id + " - " + gHero.LstHeros.Last().NomHero + "\r\n";

            using (EntitiesGEDEquipe1 contexte = new EntitiesGEDEquipe1())
            {
                txtTestes.Text += "\r\nRetourner les héros pour le joueur 3093 : " + contexte.CompteJoueurs.First(x => x.Id == 3093).NomJoueur + "\r\n";

                lstHeros = gHero.RetourHerosJoueur(3093);
                if (lstHeros.Count() > 0)
                {
                    foreach (var h in lstHeros)
                    {
                        txtTestes.Text += h.Id + " - " + h.NomHero + "\r\n";
                    }
                }
                else
                {
                    txtTestes.Text += "\r\nAucun héros trouvés pour le joueur " + contexte.CompteJoueurs.First(x => x.Id == 2091).NomJoueur;
                }
            }

            // Je considère le 200 x 200 comme un multiple de la taille d'une tile (SizeTile) et de la position du héro
            // Si le héro est à la position 8, peu importe en x ou y, la marge sera de 200/monde.SizeTile (si SizeTile = 32, marge = +/- 6.25)
            // Donc dans le 200 x 200, le héros aura comme éléments se situant à 6 tuiles plus haut, plus bas, à gauche et à droite.
            // Donc entre 8-6 et 8+6, entre 2 et 14 autant en x qu'en y.
            hero            = gHero.LstHeros.First(x => x.MondeId == 3111);
            txtTestes.Text += "\r\nTous les éléments dans un rayon de 200 x 200 : \r\n" +
                              "Position du héro de base : " + hero.x + ", " + hero.y + "\r\n" +
                              "Monde de base du héro : " + hero.MondeId.ToString() + "\r\n";
            using (EntitiesGEDEquipe1 contexte = new EntitiesGEDEquipe1())
            {
                gHero.ÉlémentsRayon200x200(hero);
                txtTestes.Text += "\r\nLes héros : \r\n";
                foreach (var h in gHero.lstHero)
                {
                    txtTestes.Text += h.Id + " : " + h.NomHero + " - " + h.x + ", " + h.y + "\r\n";
                }
                txtTestes.Text += "Les monstres : \r\n";
                foreach (var h in gHero.lstMonstres)
                {
                    txtTestes.Text += h.Id + " : " + h.Nom + " - " + h.x + ", " + h.y + "\r\n";
                }
                txtTestes.Text += "Les items : \r\n";
                foreach (var h in gHero.lstItems)
                {
                    txtTestes.Text += h.Id + " : " + h.Nom + " - " + h.x + ", " + h.y + "\r\n";
                }
                txtTestes.Text += "Les objets du monde : \r\n";
                foreach (var h in gHero.lstObjmonde)
                {
                    txtTestes.Text += h.Id + " : " + h.Description + " - " + h.x + ", " + h.y + "\r\n";
                }
            }
        }