Пример #1
0
        private void DeckList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!CardList.ContainsKey(DeckList.SelectedItem.ToString()))
            {
                CardName.Text    = "";
                CardID.Text      = "";
                CardDetails.Text = "";
                return;
            }
            CardInfos card = CardList[DeckList.SelectedItem.ToString()];

            if (card == null)
            {
                return;
            }
            CardName.Text = card.Name;
            CardID.Text   = card.Id.ToString(CultureInfo.InvariantCulture);

            CardDetails.Text  = "";
            CardDetails.Text += card.GetCardTypes() + " ";

            if (card.HasType(CardType.Monster))
            {
                string level = string.Empty;
                for (int i = 0; i < card.Level; i++)
                {
                    level = level + "*";
                }
                CardDetails.Text += card.GetCardRace() + Environment.NewLine +
                                    (card.HasType(CardType.Xyz) ? "Rank " : "Level ") + card.Level + " " +
                                    "[" + level + "] " + ((card.Atk == -2) ? "?" :
                                                          card.Atk.ToString(CultureInfo.InvariantCulture)) + "/" + ((card.Def == -2) ? "?" : card.Def.ToString(CultureInfo.InvariantCulture)) + Environment.NewLine;
            }
            else
            {
                CardDetails.Text += Environment.NewLine;
            }

            CardDetails.Text += card.Description;
        }