Esempio n. 1
0
 private void addEvolutions(MonsterCard card)
 {
     foreach(PadMonsterInfo.Evolutions.Evolution evo in db.getAvailableEvolutions(card))
     {
         MonsterCard evoCard = db.FindMonsterCard(evo.EvolvesTo);
         addCardToPanel(evoCard, Evolutions);
     }
 }
Esempio n. 2
0
        private void MonsterSelectionView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (monsterSelectionView.SelectedIndices.Count > 0)
            {
                MonsterSelection = searchResults[monsterSelectionView.SelectedIndices[0]];
                this.DialogResult = DialogResult.OK;
                this.Close();
            }

            //throw new NotImplementedException();
        }
Esempio n. 3
0
 private void addCardToPanel(MonsterCard card, FlowLayoutPanel panel)
 {
     string phUrl = "https://www.padherder.com/";
     PictureBox pb = new PictureBox();
     pb.Size = new Size(64, 64);
     //Methods.UpdateFileCached(phUrl + card.Image60.HRef, card.Image60.FileName);
     //pb.BackgroundImage = Image.FromFile(card.Image60.FileName);
     setMonsterImageAsync(pb, card);
     pb.BackgroundImageLayout = ImageLayout.Center;
     //pb.BackColor = Color.Blue;
     panel.Controls.Add(pb);
 }
Esempio n. 4
0
 public async Task<System.Drawing.Image> getMonsterImage60(MonsterCard monster)
 {
     string phUrl = "https://www.padherder.com/";
     System.Diagnostics.Debug.Write("getting an image... for " + monster.Name);
     await Methods.UpdateFileCachedAsync(phUrl + monster.Image60.HRef, monster.Image60.FileName);
     System.Drawing.Image img = null;
     if (File.Exists(monster.Image60.FileName))
     {
         img = System.Drawing.Image.FromFile(monster.Image60.FileName);
     }
     return img;
 }
Esempio n. 5
0
 public List<Evolution> getAvailableEvolutions(MonsterCard card)
 {
     List<Evolution> evoList = new List<Evolution>();
     foreach(Evolution evo in card.Evolutions)
     {
         evoList.Add(evo);
         
     }
     foreach(Evolution evo in card.Evolutions)
     {
         addEvosToList(evoList, evo, card.Id);
     }
     return evoList;
 }
Esempio n. 6
0
        public MonsterSelect(MonsterDB DB)
        {
            db = DB;
            this.Width = 500;
            this.Height = 600;
            MonsterSelection = null;

            monsterSearchBox = new TextBox();
            monsterSearchBox.Left = this.Padding.Left;
            monsterSearchBox.Width = this.ClientSize.Width;       
            this.Controls.Add(monsterSearchBox);

            searchButton = new Button();
            searchButton.Top = -20;
            searchButton.Left = 0;
            this.Controls.Add(searchButton);
            this.AcceptButton = searchButton;
            searchButton.Click += SearchButton_Click;
                        
            monsterImages = new ImageList();
            monsterImages.ImageSize = new Size(60, 60);

            monsterSelectionView = new ListView();
            monsterSelectionView.Top = monsterSearchBox.Top + monsterSearchBox.Height;
            monsterSelectionView.Width = this.ClientSize.Width;
            monsterSelectionView.Height = this.ClientSize.Height - monsterSearchBox.Height;
            monsterSelectionView.SmallImageList = monsterImages;
            monsterSelectionView.View = View.Details;
            var Column1 = monsterSelectionView.Columns.Add("Monsters", monsterSelectionView.ClientSize.Width, HorizontalAlignment.Left);
            //monsterSelectionView.Columns.Add("Name",monsterSelectionView.ClientSize.Width - 62);
            monsterSelectionView.MultiSelect = false;
            monsterSelectionView.Activation = ItemActivation.OneClick;
            monsterSelectionView.ItemActivate += MonsterSelectionView_SelectedIndexChanged;
            //monsterSelectionView.SelectedIndexChanged += MonsterSelectionView_SelectedIndexChanged;
            this.Controls.Add(monsterSelectionView);
        }
Esempio n. 7
0
 async private void setMonsterImageAsync(PictureBox pictureBox, MonsterCard card)
 {
     pictureBox.BackgroundImage = await db.getMonsterImage60(card);
 }
Esempio n. 8
0
 public void AddAwakening(MonsterCard.Awaken awaken)
 {
     awokenSkills.Add(awaken);
 }
Esempio n. 9
0
        public void ParseMonsters()
        {
            using (StreamReader file = File.OpenText(MonsterListFile))
            {
                JArray monstersJS = (JArray)JToken.ReadFrom(new JsonTextReader(file));
                foreach (JObject monsterJS in monstersJS.Children())
                {
                    MonsterCard monster = new MonsterCard();
                    IList<string> keys = monsterJS.Properties().Select(p => p.Name).ToList();
                    foreach (string key in keys)
                    {
                        switch (key)
                        {
                            case "id":
                                monster.Id = (int)monsterJS.Property("id").Value;
                                break;
                            case "type":
                                monster.Type = (MonsterType)((int)monsterJS.Property("type").Value);
                                break;
                            case "type2":
                                var type2 = monsterJS["type2"];
                                if(!JsonExtensions.IsNullOrEmpty(type2))
                                {
                                    monster.Type2 = (MonsterType)((int)type2);
                                }
                                break;
                            case "type3":
                                var type3 = monsterJS["type3"];
                                if (!JsonExtensions.IsNullOrEmpty(type3))
                                {
                                    monster.Type3 = (MonsterType)((int)type3);
                                }
                                break;
                            case "team_cost":
                                monster.Cost = (int)monsterJS.Property("team_cost").Value;
                                break;
                            case "element":
                                monster.Element = (MonsterElement)((int)monsterJS.Property("element").Value);
                                break;
                            case "element2":
                                JToken element2 = monsterJS["element2"];
                                if (!JsonExtensions.IsNullOrEmpty(element2))
                                {
                                    monster.Element2 = (MonsterElement)((int)element2);
                                }
                                break;
                            case "image40_size":
                                monster.Image40.Size = (int)monsterJS.Property("image40_size").Value;
                                break;
                            case "image40_href":
                                monster.Image40.HRef = (string)monsterJS.Property("image40_href").Value;
                                break;
                            case "image60_size":
                                monster.Image60.Size = (int)monsterJS.Property("image60_size").Value;
                                break;
                            case "image60_href":
                                monster.Image60.HRef = (string)monsterJS.Property("image60_href").Value;
                                break;
                            case "name":
                                monster.Name = (string)monsterJS.Property("name").Value;
                                break;
                            case "max_level": 
                                monster.LevelMax = (int)monsterJS.Property("max_level").Value;
                                break;
                            case "rarity":
                                monster.Rarity = (int)monsterJS.Property("rarity").Value;
                                break;
                            case "hp_max":
                                monster.MaxHP = (int)monsterJS.Property("hp_max").Value;
                                break;
                            case "hp_min":
                                monster.MinHP = (int)monsterJS.Property("hp_min").Value;
                                break;
                            case "hp_scale":
                                monster.HPScale = (int)monsterJS["hp_scale"];
                                break;
                            case "atk_max":
                                monster.MaxATK = (int)monsterJS["atk_max"];
                                break;
                            case "atk_min":
                                monster.MinATK = (int)monsterJS["atk_min"];
                                break;
                            case "atk_scale":
                                monster.ATKScale = (int)monsterJS["atk_scale"];
                                break;
                            case "rcv_max":
                                monster.MaxRCV = (int)monsterJS["rcv_max"];
                                break;
                            case "rcv_min":
                                monster.MinRCV = (int)monsterJS["rcv_min"];
                                break;
                            case "rcv_scale":
                                monster.RCVScale = (int)monsterJS["rcv_scale"];
                                break;
                            case "xp_curve":
                                monster.XPCurve = (int)monsterJS["xp_curve"];
                                break;
                            case "feed_xp":
                                monster.FeedXP = (int)monsterJS["feed_xp"];
                                break;
                            case "leader_skill":
                                monster.LeaderSkill = (string)monsterJS["leader_skill"];
                                break;
                            case "active_skill":
                                monster.ActiveSkill = (string)monsterJS["active_skill"];
                                break;
                            case "version":
                                monster.Version = (int)monsterJS["version"];
                                break;
                            case "jp_only":
                                if (monsterJS["jp_only"].ToString() == "true") { monster.JpOnly = true; }
                                else monster.JpOnly = false;
                                break;
                            case "name_jp":
                                monster.JpName = monsterJS["name_jp"].ToString();
                                break;
                            case "pdx_id":
                                var pdxID = monsterJS["pdx_id"];
                                if(!JsonExtensions.IsNullOrEmpty(pdxID))
                                {
                                    pdxID = (int)pdxID;
                                }
                                break;
                            case "us_id":
                                var usID = monsterJS["us_id"];
                                if (!JsonExtensions.IsNullOrEmpty(usID))
                                {
                                    pdxID = (int)usID;
                                }
                                break;
                            case "awoken_skills":
                                string[] numbers = System.Text.RegularExpressions.Regex.Split(monsterJS.Property("awoken_skills").Value.ToString(), @"\D+");
                                if (numbers.Length > 0)
                                {
                                    foreach (string value in numbers)
                                    {
                                        if (!string.IsNullOrEmpty(value))
                                        {
                                            int awakenId = int.Parse(value);
                                            MonsterCard.Awaken aw = new MonsterCard.Awaken(awakenId);
                                            monster.AddAwakening(aw);                          
                                        }
                                    }
                                }
                                break;
                            default:
                                Debug.WriteLine(key + " " + monsterJS.Property(key).Value.ToString());
                                break;
                        }

                    }
                    MonsterCards.Add(monster);
                }
            }
        }