private static Bitmap GetBitmap(Cache.CacheType cacheType, string name, IconGenerator.IconType type, int size, Color borderColor, float borderWidth, out Cache cache) { SetIconGeneratorSettings(type, size, borderColor, borderWidth); cache = CreateCache(cacheType, name); if (BitmapCache.ContainsKey(cache)) { return(BitmapCache[cache]); //Bitmap has been created already, return it. } //Bitmap has been created yet, so lets create it and cache it. return(BitmapCache[cache] = IconGenerator.GetIcon(name)); // All done, returning sprite. }
public static Sprite GetSpellSprite(string spellName, IconGenerator.IconType type, int size, Color borderColor, float borderWidth) { Cache cache; return GetSprite(Cache.CacheType.Spell, spellName, type, size, borderColor, borderWidth, out cache); }
public static Bitmap GetSpellBitmap(SpellDataInst spell, IconGenerator.IconType type, int size, Color borderColor, float borderWidth) { Cache cache; return GetBitmap(Cache.CacheType.Spell, spell.Name, type, size, borderColor, borderWidth, out cache); }
public static Sprite GetChampionSprite(AIHeroClient hero, IconGenerator.IconType type, int size, Color borderColor, float borderWidth) { Cache cache; return GetSprite(Cache.CacheType.Champion, hero.ChampionName, type, size, borderColor, borderWidth, out cache); }
public static Bitmap GetChampionBitmap(string hero, IconGenerator.IconType type, int size, Color borderColor, float borderWidth) { Cache cache; return GetBitmap(Cache.CacheType.Champion, hero, type, size, borderColor, borderWidth, out cache); }
public Cache(CacheType cacheType, string name, IconGenerator.IconType type, int size, Color borderColor, float borderWidth) { Type = cacheType; Name = name; IconType = type; Size = size; BorderColor = borderColor; BorderWidth = borderWidth; }
static IconManager() { IconGenerator = new IconGenerator(IconGenerator.IconType.Circle, 32, 32, IconGenerator.DefaultGoldColor, 2); BitmapCache = new Dictionary<Cache, Bitmap>(); SpriteCache = new Dictionary<Cache, Sprite>(); }
private static void SetIconGeneratorSettings(IconGenerator.IconType type, int size, Color borderColor, float borderWidth) { IconGenerator.Type = type; IconGenerator.Width = size; IconGenerator.Height = size; IconGenerator.BorderColor = borderColor; IconGenerator.BorderWidth = borderWidth; }
private static Sprite GetSprite(Cache.CacheType cacheType, string name, IconGenerator.IconType type, int size, Color borderColor, float borderWidth, out Cache cache) { var bitmap = GetBitmap(cacheType, name, type, size, borderColor, borderWidth, out cache); if (SpriteCache.ContainsKey(cache)) return SpriteCache[cache]; return SpriteCache[cache] = new Sprite(TextureLoader.BitmapToTexture(bitmap)); // All done, returning sprite. }
private static Bitmap GetBitmap(Cache.CacheType cacheType, string name, IconGenerator.IconType type, int size, Color borderColor, float borderWidth, out Cache cache) { SetIconGeneratorSettings(type, size, borderColor, borderWidth); cache = CreateCache(cacheType, name); if (BitmapCache.ContainsKey(cache)) return BitmapCache[cache]; //Bitmap has been created already, return it. //Bitmap has been created yet, so lets create it and cache it. return BitmapCache[cache] = IconGenerator.GetIcon(name); // All done, returning sprite. }
static IconManager() { IconGenerator = new IconGenerator(IconGenerator.IconType.Circle, 32, 32, IconGenerator.DefaultGoldColor, 2); BitmapCache = new Dictionary <Cache, Bitmap>(); SpriteCache = new Dictionary <Cache, Sprite>(); }