예제 #1
0
        private void btnViewMap_Click(object sender, EventArgs e)
        {
            Image iDefaultBackground = GameResourceManager.LoadResource_FullName("EK_SW.KWRendered.png");

            frmImagePreview test = new frmImagePreview();

            test.BackgroundImageLayout = ImageLayout.Stretch;
            test.BackgroundImage       = iDefaultBackground;
            test.ClientSize            = new System.Drawing.Size(iDefaultBackground.Width, iDefaultBackground.Height);
            test.FormBorderStyle       = System.Windows.Forms.FormBorderStyle.None;
            test.Padding     = new Padding(0);
            test.PreviewType = frmImagePreview.PreviewTypes.Other;
            test.Text        = "EK Unleashed :: Kingdom War Reference Map";
            test.Icon        = (Icon)this.Icon.Clone();
            test.Show();
        }
예제 #2
0
        public void PopupRunePreviewWindow(int rune_id, int rune_level, Point popup_location)
        {
            JObject rune = Game.GetRuneByID(rune_id);
            if (rune == null)
                return;

            Image iDefaultBackground = GameResourceManager.LoadResource_RuneBlank();
            iDefaultBackground = Utils.ImageResizer(iDefaultBackground, 291, 410);

            frmImagePreview preview = new frmImagePreview();
            preview.BackgroundImageLayout = ImageLayout.Stretch;
            preview.BackgroundImage = iDefaultBackground;
            preview.ClientSize = new System.Drawing.Size(iDefaultBackground.Width, iDefaultBackground.Height);
            preview.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

            if (rune_level >= 4) rune_level = 4;
            if (rune_level <= 0) rune_level = 0;

            preview.Text = "EK Unleashed :: " + rune["RuneName"].ToString() + ((rune_level > 0) ? " at level " + rune_level.ToString() : "");

            preview.StartPosition = FormStartPosition.Manual;
            preview.Location = popup_location;

            preview.Icon = (Icon)this.Icon.Clone();

            System.Windows.Forms.PictureBox pb = new PictureBox();
            pb.Location = new Point(0, 0);
            pb.BorderStyle = BorderStyle.None;
            try
            {
                pb.Image = GameResourceManager.GenerateRuneImage(rune_id, rune_level, rune["RuneName"].ToString().Trim(), Utils.CInt(rune["Property"]), Utils.CInt(rune["Color"]), Game.GetSkillByID(Utils.CInt(rune["LockSkill" + (rune_level + 1).ToString()])), rune["Condition"].ToString(), rune["SkillTimes"].ToString());
                pb.Size = new System.Drawing.Size(pb.Image.Width, pb.Image.Height);
            }
            catch { }
            //pb.SizeMode = PictureBoxSizeMode.AutoSize;
            pb.Padding = new System.Windows.Forms.Padding(0);
            pb.MouseDown += new MouseEventHandler(preview.parent_MouseDown);
            pb.MouseUp += new MouseEventHandler(preview.parent_MouseUp);
            pb.MouseMove += new MouseEventHandler(preview.parent_MouseMove);
            preview.Controls.Add(pb);

            try { preview.ClientSize = new Size(pb.Image.Width, pb.Image.Height + 2); } catch { }
            try { preview.Size = new System.Drawing.Size(pb.Image.Width, pb.Image.Height); } catch { }

            preview.IsExpanded = true;
            preview.PreviewType = frmImagePreview.PreviewTypes.Rune;

            preview.Show();
        }
예제 #3
0
        public void PopupCardPreviewWindow(int card_id, int card_level, Point popup_location, string card_name = "", int element = 0, int stars = 0, int cost = 0, int wait = 0, List<JObject> skills = null, List<int> attack_progression = null, List<int> hp_progression = null, Image iBaseImage = null, int evolved_times = 0, int skill_evolved = 0)
        {
            if (element == 0)
            {
                try
                {
                    JObject card = Game.GetCardByID(card_id);
                    if (card == null)
                        return;

                    card_name = card["CardName"].ToString();
                    element = Utils.CInt(card["Race"]);
                    stars = Utils.CInt(card["Color"]);
                    cost = Utils.CInt(card["Cost"]);
                    wait = Utils.CInt(card["Wait"]);
                    skills = new List<JObject>();
                    try
                    {
                        JObject skill = Game.GetSkillByID(Utils.CInt(card["Skill"]));
                        if (skill == null)
                            skill = JObject.Parse("{ \"empty\": \"1\" }");
                        skills.Add(skill);
                    }
                    catch
                    {
                        skills.Add(JObject.Parse("{ \"empty\": \"1\" }"));
                    }
                    try
                    {
                        JObject skill = Game.GetSkillByID(Utils.CInt(card["LockSkill1"]));
                        if (skill == null)
                            skill = JObject.Parse("{ \"empty\": \"1\" }");
                        skills.Add(skill);
                    }
                    catch
                    {
                        skills.Add(JObject.Parse("{ \"empty\": \"1\" }"));
                    }
                    try
                    {
                        string[] sub_skills = Utils.SubStringsDups(card["LockSkill2"].ToString(), "_");

                        foreach (string sub_skill in sub_skills)
                        {
                            JObject skill = Game.GetSkillByID(Utils.CInt(sub_skill));
                            if (skill == null)
                                skill = JObject.Parse("{ \"empty\": \"1\" }");
                            skills.Add(skill);
                        }
                    }
                    catch
                    {
                        skills.Add(JObject.Parse("{ \"empty\": \"1\" }"));
                    }
                    attack_progression = new List<int>();
                    foreach (var attack in card["AttackArray"])
                        attack_progression.Add(Utils.CInt(attack.ToString()));
                    hp_progression = new List<int>();
                    foreach (var attack in card["HpArray"])
                        hp_progression.Add(Utils.CInt(attack.ToString()));
                }
                catch (Exception ex)
                {
                    Utils.Chatter(Errors.GetAllErrorDetails(ex));
                    return;
                }
            }

            if (skill_evolved != 0)
            {
                try
                {
                    JObject skill = Game.GetSkillByID(skill_evolved);
                    if (skill != null)
                        skills.Add(skill);
                }
                catch { }
            }

            Image iDefaultBackground = GameResourceManager.LoadResource_CardBlank();
            if (iDefaultBackground == null)
            {
                Utils.DebugLogger("Card image is empty!");
                return;
            }
            iDefaultBackground = Utils.ImageResizer(iDefaultBackground, 289, 435);

            frmImagePreview preview = new frmImagePreview();
            preview.BackgroundImageLayout = ImageLayout.Stretch;
            preview.BackgroundImage = iDefaultBackground;
            preview.ClientSize = new System.Drawing.Size(iDefaultBackground.Width, iDefaultBackground.Height);
            //preview.MouseClick += new MouseEventHandler((sender, e) => { if (!preview.IsDragging) preview.Close(); });
            preview.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            preview.Padding = new Padding(0);
            //preview.AllowTransparency = true;
            //preview.StartPosition = FormStartPosition.CenterParent;

            if (card_level >= 15) card_level = 15;
            if (card_level <= 0) card_level = 0;

            if (element == 100)
            {
                card_level = 10;
                preview.Text = "EK Unleashed :: " + card_name;
            }
            else
            {
                preview.Text = "EK Unleashed :: " + card_name + ((card_level > 0) ? " at level " + card_level.ToString() : "");
            }

            preview.StartPosition = FormStartPosition.Manual;
            preview.Location = popup_location;

            preview.Icon = (Icon)this.Icon.Clone();

            System.Windows.Forms.PictureBox pb = new PictureBox();
            pb.Location = new Point(0, 0);
            pb.BorderStyle = BorderStyle.None;

            try
            {
                if ((Utils.CInt(card_id) == 0) && (iBaseImage != null))
                    pb.Image = GameResourceManager.GenerateFakeCardImage(iBaseImage, card_level, card_name, element, stars, cost, wait, skills, attack_progression, hp_progression);
                else
                    pb.Image = GameResourceManager.GenerateCardImage(card_id, card_level, card_name, element, stars, cost, wait, skills, attack_progression, hp_progression, null, evolved_times);

                pb.Size = new System.Drawing.Size(pb.Image.Width, pb.Image.Height);
            }
            catch { }
            //pb.SizeMode = PictureBoxSizeMode.AutoSize;
            pb.Padding = new Padding(0);
            //pb.MouseClick += new MouseEventHandler((sender, e) => { if (!preview.IsDragging) preview.Close(); });
            pb.MouseDown += new MouseEventHandler(preview.parent_MouseDown);
            pb.MouseUp += new MouseEventHandler(preview.parent_MouseUp);
            pb.MouseMove += new MouseEventHandler(preview.parent_MouseMove);
            preview.Controls.Add(pb);

            try { preview.ClientSize = new Size(pb.Image.Width, pb.Image.Height + 2); } catch { }
            try { preview.Size = new System.Drawing.Size(pb.Image.Width, pb.Image.Height); } catch { }

            preview.IsExpanded = true;
            preview.PreviewType = frmImagePreview.PreviewTypes.Card;

            preview.Show();
        }
예제 #4
0
        private void btnViewMap_Click(object sender, EventArgs e)
        {
            Image iDefaultBackground = GameResourceManager.LoadResource_FullName("EK_SW.KWRendered.png");

            frmImagePreview test = new frmImagePreview();
            test.BackgroundImageLayout = ImageLayout.Stretch;
            test.BackgroundImage = iDefaultBackground;
            test.ClientSize = new System.Drawing.Size(iDefaultBackground.Width, iDefaultBackground.Height);
            test.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            test.Padding = new Padding(0);
            test.PreviewType = frmImagePreview.PreviewTypes.Other;
            test.Text = "EK Unleashed :: Kingdom War Reference Map";
            test.Icon = (Icon)this.Icon.Clone();
            test.Show();
        }