예제 #1
0
        public CardForm(Card C, string U)
        {
            InitializeComponent();
            EraseButton.Visible = false;
            Card1 = C;
            User = U;
            CheckCard();
                string n = Directory.GetCurrentDirectory().ToString() +  C.getZdjecie();
                this.Text = C.getNazwa();
            try
            {
                pictureBox1.BackgroundImage = Image.FromFile(n);
            }
            catch(Exception ex)
            {

            }
                
                if (posiadane.Count == 0) 
                {
                    infoLabel.Text = "Nie posiadasz jeszcze tej karty";
                    EraseButton.Visible = false;
                }
                else
                {
                    infoLabel.Text = "Posiadasz " + posiadane.Count + " takich kard";
                    EraseButton.Visible = true;

                }
            
        }
예제 #2
0
 private bool compare(Card A, Card B)
 {
     if (A.getNazwa() != null)
     {
         if (A.getNazwa() != B.getNazwa()) return false;
     } 
     if (A.getRzadkosc() != null)
     {
         if (A.getRzadkosc() != B.getRzadkosc()) return false;
     }
     if (A.getKolor() != null)
     {
         if (A.getKolor() != B.getKolor()) return false;
     }
     if (A.getTyp() != null)
     {
         if (A.getTyp() != B.getTyp()) return false;
     }
     if (A.getMana() != -1)
     {
         if (A.getMana() != B.getMana()) return false;
     }
     if (A.getAtak() != -1)
     {
         if (A.getAtak() != B.getAtak()) return false;
     }
     if (A.getObrona() != -1)
     {
         if (A.getObrona() != B.getObrona()) return false;
     }
     return true; 
 }
예제 #3
0
 // Odczyta numer talii
 private void ReadSingleRowForDecks(IDataRecord record, List<Card> List)
 {
     Card A = new Card(int.Parse(record[0].ToString()), record[1].ToString(), record[2].ToString(), record[3].ToString(), record[4].ToString(), int.Parse(record[5].ToString()), record[6].ToString(), record[7].ToString(), record[8].ToString(), record[9].ToString(), int.Parse(record[10].ToString()));
     List.Add(A);
 }
예제 #4
0
        private void search(string name, string type, string rarity, string color, int mana, int atack, int defence, List<Card> list, ListView listView)
        {
            Card C = new Card();
            List<Card> temp = new List<Card>();

            if (name != "") C.setNazwa(name);
            if (type != "") C.setTyp(type);
            if (rarity != "") C.setRzadkosc(rarity);
            if (color != "") C.setKolor(color);
            if (mana >= -1) C.setMana(mana);
            if (atack >= -1) C.setAtak(atack);
            if (defence >= -1) C.setObrona(defence);
 
            for(int i=0; i< list.Count; i++)
            {
                if(compare(C,list.ElementAt(i)) == true)
                {
                    temp.Add(list.ElementAt(i));
                }
            }

            addToViewList(temp, listView,0);
        }