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;
 }
 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;
 }
        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.
 }
Exemple #5
0
 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;
 }
        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 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));
        }