コード例 #1
0
        internal static Bitmap getSprite(int species, int form, int gender, int item, bool shiny = false)
        {
            string file;

            if (species == 0) // fix with SM release
            {
                return((Bitmap)Properties.Resources.ResourceManager.GetObject("_0"));
            }
            if (species > 802)
            {
                return((Bitmap)Properties.Resources.unknown);
            }
            {
                file = "_" + species;
                if (form > 0) // Alt Form Handling
                {
                    file = file + "_" + form;
                }
                else if (gender == 1 && (species == 592 || species == 593)) // Frillish & Jellicent
                {
                    file = file + "_" + gender;
                }
                else if (gender == 1 && (species == 521 || species == 668)) // Unfezant & Pyroar
                {
                    file = "_" + species + "f";
                }
            }

            // Redrawing logic
            Bitmap baseImage = (Bitmap)Properties.Resources.ResourceManager.GetObject(file);

            if (baseImage == null)
            {
                if (species < Main.Config.MaxSpeciesID)
                {
                    baseImage = LayerImage(
                        (Image)Properties.Resources.ResourceManager.GetObject("_" + species),
                        Properties.Resources.unknown,
                        0, 0, .5);
                }
                else
                {
                    baseImage = Properties.Resources.unknown;
                }
            }
            if (shiny)
            {
                // Add shiny star to top left of image.
                baseImage = Util.LayerImage(baseImage, Properties.Resources.rare_icon, 0, 0, 0.7);
            }
            if (item > 0)
            {
                Bitmap itemimg = (Bitmap)Properties.Resources.ResourceManager.GetObject("item_" + item) ?? Properties.Resources.helditem;
                // Redraw
                baseImage = LayerImage(baseImage, itemimg, 22 + (15 - itemimg.Width) / 2, 15 + (15 - itemimg.Height), 1);
            }
            return(baseImage);
        }
コード例 #2
0
        private void UpdateImage(PictureBox bpkx, int species, int form, int item, int gender, bool shiny)
        {
            string file = "";

            Image baseImage;

            if (!bpkx.Enabled)
            {
                bpkx.Image = (Image)null;
                return;
            }

            if (species == 0)
            {
                baseImage = (Image)Properties.Resources.ResourceManager.GetObject("_0");
            }
            else
            {
                file = "_" + species.ToString();
                if (form > 0) // Alt Form Handling
                {
                    file = file + "_" + form.ToString();
                }
                else if ((gender == 1) && (species == 521 || species == 668))   // Unfezant & Pyroar
                {
                    file = file = "_" + species.ToString() + "f";
                }
                { baseImage = (Image)Properties.Resources.ResourceManager.GetObject(file); }
            }
            if (item > 0)
            {
                // Has Item
                Image itemimg = (Image)Properties.Resources.ResourceManager.GetObject("item_" + item.ToString());
                if (itemimg == null)
                {
                    itemimg = Properties.Resources.helditem;
                }
                // Redraw
                baseImage = Util.LayerImage(baseImage, itemimg, 22 + (15 - itemimg.Width) / 2, 15 + (15 - itemimg.Height), 1);
            }
            bpkx.Image = baseImage;
        }