Exemple #1
0
 // Méthode permettant d'afifcher les infos des items
 public void AfficherInfoItems(GestionItem gItem)
 {
     foreach (Item item in gItem.LstItems)
     {
         txtTestes.Text += item.Id.ToString() + " - " + item.Nom.ToString() + "\r\n";
     }
 }
Exemple #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";
        }