Exemplo n.º 1
0
        private void SaveDeck(bool isStructureOrStartingDeck)
        {
            List <int> main  = new List <int>();
            List <int> extra = new List <int>();

            foreach (PlayerCard pcard in cards)
            {
                CardInfos card = CardManager.GetCard(pcard.Id);
                if (card.GetCardTypes().Contains(CardType.Synchro) || card.GetCardTypes().Contains(CardType.Xyz) || card.GetCardTypes().Contains(CardType.Fusion) || card.GetCardTypes().Contains(CardType.Link))
                {
                    if (!extra.Contains(card.Id))
                    {
                        extra.Add(card.Id);
                    }
                }
                else
                {
                    if (!main.Contains(card.Id))
                    {
                        main.Add(card.Id);
                    }
                }
            }

            string deck = "#created by purchase " + _infos.PurchaseTag;

            deck += Environment.NewLine + "#main";
            foreach (int id in main)
            {
                deck += Environment.NewLine + id.ToString();
            }
            deck += Environment.NewLine + "#extra";
            foreach (int id in extra)
            {
                deck += Environment.NewLine + id.ToString();
            }
            deck += Environment.NewLine + "!side";

            if (isStructureOrStartingDeck)
            {
                File.WriteAllText(System.IO.Path.Combine(FormExecution.path, "BattleCityAlpha", "deck", _infos.Name + ".ydk"), deck);
            }
            else
            {
                File.WriteAllText(System.IO.Path.Combine(FormExecution.path, "BattleCityAlpha", "deck", "new_cards.ydk"), deck);
            }
        }
Exemplo n.º 2
0
        public void SetCard(CardInfos card)
        {
            tb_cardname.Text = card.Name;
            CardType[] typeArray = card.GetCardTypes();
            string     level     = "";
            string     atkdef    = "";
            string     attribute = "";

            if (typeArray.Contains(CardType.Magie) || typeArray.Contains(CardType.Piège))
            {
            }
            else
            {
                if (!typeArray.Contains(CardType.Link))
                {
                    if (typeArray.Contains(CardType.Pendule))
                    {
                        level = string.Format("◊{0}    {1}◊", card.LScale, card.RScale);
                    }
                    else
                    {
                        level = card.Level + "★";
                    }

                    atkdef = string.Format("{0}/{1}", card.Atk, card.Def);
                }
                else
                {
                    LinkMarker[] markers = card.GetLinkMarkers();
                    atkdef = card.Atk + "/LINK-" + markers.Count();

                    level = GetStringLinksMarkers(markers);
                }
                attribute = string.Format("{0}|{1}", card.GetRace(), card.GetAttribute());
            }
            tb_cardlevel.Text     = level;
            tb_cardatkdef.Text    = atkdef;
            tb_cardattribute.Text = attribute;
            tb_cardtype.Text      = card.GetCardType();
            tb_carddesc.Text      = card.Description;

            img_card.Source = FormExecution.AssetsManager.GetPics(new string[] { "BattleCityAlpha", "pics", card.Id + ".jpg" });
        }
        private void SetCard(CardInfos card)
        {
            tb_cardname.Text = card.Name;
            CardType[] typeArray = card.GetCardTypes();
            string     level     = "";
            string     atkdef    = "";
            string     attribute = "";

            if (typeArray.Contains(CardType.Magie) || typeArray.Contains(CardType.Piège))
            {
            }
            else
            {
                if (!typeArray.Contains(CardType.Link))
                {
                    if (typeArray.Contains(CardType.Pendule))
                    {
                        level = string.Format("◊{0}    {1}◊", card.LScale, card.RScale);
                    }
                    else
                    {
                        level = card.Level + "★";
                    }

                    atkdef = string.Format("{0}/{1}", card.Atk, card.Def);
                }
                else
                {
                    LinkMarker[] markers = card.GetLinkMarkers();
                    atkdef = card.Atk + "/LINK-" + markers.Count();

                    level = GetStringLinksMarkers(markers);
                }
                attribute = string.Format("{0}|{1}", card.GetRace(), card.GetAttribute());
            }
            tb_cardlevel.Text     = level;
            tb_cardatkdef.Text    = atkdef;
            tb_cardattribute.Text = attribute;
            tb_cardtype.Text      = card.GetCardType();
            tb_carddesc.Text      = card.Description;
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
        public bool CheckCard(CardInfos infos)
        {
            if (cb_cardtype1.SelectedIndex != 0)
            {
                if (!infos.GetCardTypes().Contains((CardType)cb_cardtype1.SelectedItem))
                {
                    return(false);
                }
            }
            if (cb_cardtype2.SelectedIndex != 0)
            {
                if (!infos.GetCardTypes().Contains((CardType)cb_cardtype2.SelectedItem))
                {
                    return(false);
                }
            }
            if (cb_cardattribute.SelectedIndex != 0)
            {
                if (infos.Attribute != ((int)(CardAttribute)cb_cardattribute.SelectedItem))
                {
                    return(false);
                }
            }
            if (cb_cardrace.SelectedIndex != 0)
            {
                if (infos.Race != ((int)(CardRace)cb_cardrace.SelectedItem))
                {
                    return(false);
                }
            }
            if (cb_setnames.SelectedIndex != 0)
            {
                if (!infos.GetSetName().Contains(cb_setnames.SelectedItem.ToString()))
                {
                    return(false);
                }
            }
            if (tb_level.Text != string.Empty)
            {
                if (infos.Level != Convert.ToInt32(tb_level.Text))
                {
                    return(false);
                }
            }
            if (tb_attack.Text != string.Empty)
            {
                if (infos.Atk != Convert.ToInt32(tb_attack.Text))
                {
                    return(false);
                }
            }
            if (tb_defence.Text != string.Empty)
            {
                if (infos.Def != Convert.ToInt32(tb_defence.Text))
                {
                    return(false);
                }
            }
            if (tb_name.Text != string.Empty)
            {
                if (!infos.Name.ToUpper().Contains(tb_name.Text.ToUpper()))
                {
                    return(false);
                }
            }

            return(true);
        }
        private bool LoadCard(int cardid)
        {
            DataGridViewRow datarow = null;
            DataGridViewRow textrow = null;
            foreach (DataGridViewRow row in cdbdata.Rows)
            {
                if (row.Cells["id"].Value == null) continue;
                if (row.Cells["id"].Value.ToString() == cardid.ToString())
                {
                    datarow = row;
                }
            }
            foreach (DataGridViewRow row in cdbenglishtext.Rows)
            {
                if (row.Cells["id"].Value == null) continue;
                if (row.Cells["id"].Value.ToString() == cardid.ToString())
                {
                    textrow = row;
                }
            }

            if (datarow == null && textrow == null)
            {
                MessageBox.Show("Card not found.");
                return false;
            }

            CardInfos info = new CardInfos(datarow, textrow);
            CardID.Text = info.Id.ToString();
            Alias.Text = info.AliasId.ToString();
            for (int i = 0; i < Formats.Count;i++ )
            {
                if (Formats[i] == info.Ot)
                {
                    CardFormats.SelectedIndex = i;
                    break;
                }
            }
            Level.SelectedIndex = info.Level - 1;
            for (int i = 0; i < CardRaces.Count; i++)
            {
                if (CardRaces[i] == info.Race)
                {
                    Race.SelectedIndex = i;
                    break;
                }
            }
            for (int i = 0; i < CardAttributes.Count; i++)
            {
                if (CardAttributes[i] == info.Attribute)
                {
                    CardAttribute.SelectedIndex = i;
                    break;
                }
            }
            ATK.Text = info.Atk.ToString();
            DEF.Text = info.Def.ToString();
            CardName.Text = info.Name;
            CardDescription.Text = info.Description;
            foreach (string effect in info.EffectStrings)
                EffectList.Items.Add(effect);
            SetCardTypes(info.GetCardTypes());

            int index = this.SetCodes.IndexOf(info.SetCode & 0xffff);
            this.SetCodeLst.SelectedIndex = index;
            index = this.SetCodes.IndexOf(info.SetCode >> 0x10);
            this.OtherSetCodeLst.SelectedIndex = index;

            SetCategoryCheckBoxs(info.Category);

            LoadedCard = info.Id;

            return true;
        }