Example #1
0
        public static SpellSheet GetEmoteSheet(int num)
        {
            lock (spellCache)
            {
                if (spellCache.ContainsKey("Status-" + num + "-0"))
                {
                    return(spellCache["Status-" + num + "-0"]);
                }
                else
                {
                    if (System.IO.File.Exists(IO.Paths.GfxPath + "Status/Status-" + num + ".png"))
                    {
                        Surface surf = SurfaceManager.LoadSurface(IO.Paths.GfxPath + "Status/Status-" + num + ".png");
                        surf.Transparent = true;

                        int        bytesUsed = surf.Width * surf.Height * surf.BitsPerPixel / 8;
                        SpellSheet sheet     = new SpellSheet(surf, bytesUsed);
                        spellCache.Add("Status-" + num + "-0", sheet);
                        return(sheet);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
        public static SpellSheet GetSpellSheet(Enums.StationaryAnimType animType, int num, bool semiTransparent)
        {
            lock (spellCache)
            {
                if (spellCache.ContainsKey(animType.ToString() + "-" + num + "-" + semiTransparent.ToIntString()))
                {
                    return(spellCache[animType.ToString() + "-" + num + "-" + semiTransparent.ToIntString()]);
                }
                else
                {
                    if (System.IO.File.Exists(IO.Paths.GfxPath + "Spells/" + animType.ToString() + "-" + num + ".png"))
                    {
                        Surface surf;


                        if (semiTransparent)
                        {
                            surf                  = SurfaceManager.LoadSurface(IO.Paths.GfxPath + "Spells/" + animType.ToString() + "-" + num + ".png", false, true);
                            surf.Transparent      = true;
                            surf.TransparentColor = Color.Black;
                            surf.AlphaBlending    = true;
                            surf.Alpha            = 128;
                        }
                        else
                        {
                            surf             = SurfaceManager.LoadSurface(IO.Paths.GfxPath + "Spells/" + animType.ToString() + "-" + num + ".png");
                            surf.Transparent = true;
                        }
                        int        bytesUsed = surf.Width * surf.Height * surf.BitsPerPixel / 8;
                        SpellSheet sheet     = new SpellSheet(surf, bytesUsed);
                        spellCache.Add(animType.ToString() + "-" + num + "-" + semiTransparent.ToIntString(), sheet);
                        return(sheet);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
        public static SpellSheet GetSpellSheet(Enums.StationaryAnimType animType, int num, bool semiTransparent)
        {
            lock (spellCache) {
                if (spellCache.ContainsKey(animType.ToString() + "-" + num + "-" + semiTransparent.ToIntString()))
                {
                    return spellCache[animType.ToString() + "-" + num + "-" + semiTransparent.ToIntString()];
                } else {
                    if (System.IO.File.Exists(IO.Paths.GfxPath + "Spells/" + animType.ToString() + "-" + num + ".png")) {
                        Surface surf;

                        if (semiTransparent)
                        {
                            surf = SurfaceManager.LoadSurface(IO.Paths.GfxPath + "Spells/" + animType.ToString() + "-" + num + ".png", false, true);
                            surf.Transparent = true;
                            surf.TransparentColor = Color.Black;
                            surf.AlphaBlending = true;
                            surf.Alpha = 128;
                        }
                        else
                        {
                            surf = SurfaceManager.LoadSurface(IO.Paths.GfxPath + "Spells/" + animType.ToString() + "-" + num + ".png");
                            surf.Transparent = true;
                        }
                        int bytesUsed = surf.Width * surf.Height * surf.BitsPerPixel / 8;
                        SpellSheet sheet = new SpellSheet(surf, bytesUsed);
                        spellCache.Add(animType.ToString() + "-" + num + "-" + semiTransparent.ToIntString(), sheet);
                        return sheet;
                    } else {
                        return null;
                    }
                }
            }
        }
        public static SpellSheet GetEmoteSheet(int num)
        {
            lock (spellCache)
            {
                if (spellCache.ContainsKey("Status-" + num + "-0"))
                {
                    return spellCache["Status-" + num + "-0"];
                }
                else
                {
                    if (System.IO.File.Exists(IO.Paths.GfxPath + "Status/Status-" + num + ".png"))
                    {
                        Surface surf = SurfaceManager.LoadSurface(IO.Paths.GfxPath + "Status/Status-" + num + ".png");
                        surf.Transparent = true;

                        int bytesUsed = surf.Width * surf.Height * surf.BitsPerPixel / 8;
                        SpellSheet sheet = new SpellSheet(surf, bytesUsed);
                        spellCache.Add("Status-" + num + "-0", sheet);
                        return sheet;
                    }
                    else
                    {
                        return null;
                    }
                }
            }
        }