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); } } } }