MountSheet() public static method

public static MountSheet ( int mount ) : Bitmap
mount int
return System.Drawing.Bitmap
Beispiel #1
0
        /// <summary>
        /// Get the image of the current outfit
        /// </summary>
        public Image GetImage()
        {
            int  anim     = 0;
            bool noAddons = OutfiterManager.OutfitHasNoAddons(outfit);
            int  mult_y   = noAddons ? 1 : 3;
            // if there is a mount, choose the "mounted" animation, otherwise choose the "normal" animation
            int    y = (mount != 0 ? (noAddons ? 1 : 3) : 0) + (anim * mult_y);
            Bitmap outfitImage;

            // first get the outfit sheet (this contains all the different sprites for different facings/mounted/addons/etc)
            using (Bitmap outfitSheet = OutfiterManager.OutfitSheet(outfit, gender)) {
                outfitImage = GetRegion(outfitSheet, (int)facing * 2, y);
                using (Bitmap blendImage = GetRegion(outfitSheet, (int)facing * 2 + 1, y)) {
                    // colorize the outfit based on the outfits' colors
                    outfitImage = BlendPixels(outfitImage, blendImage, colors);
                    // if there are any addons selected, merge them on top of the outfit
                    for (int i = 0; i < 2; i++)
                    {
                        if (!noAddons && GetAddon(i))
                        {
                            using (Bitmap oldImage = outfitImage) {
                                // get the addon region
                                using (Bitmap addonImage = GetRegion(outfitSheet, (int)facing * 2, y + i + 1)) {
                                    // blend the addon with the colors
                                    using (Bitmap addonBlendImage = GetRegion(outfitSheet, (int)facing * 2 + 1, y + i + 1)) {
                                        // merge the addon on top of the outfit
                                        outfitImage = MergePixels(oldImage, BlendPixels(addonImage, addonBlendImage, colors));
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (mount != 0)
            {
                // if there is a mount, merge the outfit with the mount
                using (Bitmap mountSheet = OutfiterManager.MountSheet(mount)) {
                    using (Bitmap mountImage = GetRegion(mountSheet, (int)facing, 0)) {
                        Bitmap combinedImage = MergePixels(mountImage, outfitImage);
                        outfitImage.Dispose();
                        return(combinedImage);
                    }
                }
            }
            else
            {
                return(outfitImage);
            }
        }