Ejemplo n.º 1
0
 private void CreateSprites()
 {
     // Create a sprite object for each champion loaded
     foreach (var textureEntry in LoadedChampionTextures)
     {
         var key = textureEntry.Key;
         ChampionSprites[textureEntry.Key] = new Sprite(() => LoadedChampionTextures[key]());
     }
 }
Ejemplo n.º 2
0
        private void LoadChampionImages()
        {
            // Load the unknown champ icon
            string unknownTextureKey;

            MasterMind.TextureLoader.Load(TransformToMinimapIcon(Resources.UnknownChamp), out unknownTextureKey);

            // Load the current champions
            if (Directory.Exists(ChampionImagesFolderPath))
            {
                foreach (var champion in EntityManager.Heroes.Enemies.Select(o => o.Hero).Where(champion => !LoadedChampionTextures.ContainsKey(champion)))
                {
                    var championName = champion.ToString();

                    // Check if file for champ exists
                    var filePath = Path.Combine(ChampionImagesFolderPath, championName + ChampSquareMinimapSuffix);
                    if (!File.Exists(filePath))
                    {
                        // Use unknown champ image
                        LoadedChampionTextures.Add(champion, () => MasterMind.TextureLoader[unknownTextureKey]);
                        continue;
                    }

                    // Load local image
                    Bitmap champIcon;
                    try
                    {
                        using (var bmpTemp = new Bitmap(filePath))
                        {
                            champIcon = new Bitmap(bmpTemp);
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.Error("[MasterMind] Failed to load champion image from file!");
                        Logger.Error(e.ToString());
                        File.Delete(filePath);

                        // Use unknown champ image
                        LoadedChampionTextures.Add(champion, () => MasterMind.TextureLoader[unknownTextureKey]);
                        continue;
                    }

                    MasterMind.TextureLoader.Load(ChampSquarePrefix + championName, champIcon);
                    LoadedChampionTextures.Add(champion, () => MasterMind.TextureLoader[ChampSquarePrefix + championName]);
                }
            }
            else
            {
                // No champion images exist, use unknown image
                foreach (var champion in EntityManager.Heroes.Enemies.Select(o => o.Hero).Where(champion => !LoadedChampionTextures.ContainsKey(champion)))
                {
                    LoadedChampionTextures.Add(champion, () => MasterMind.TextureLoader[unknownTextureKey]);
                }
            }
        }
Ejemplo n.º 3
0
        private void ReplaceChampionImage(Champion champion, Bitmap minimapIcon)
        {
            // Replace images in sync
            Core.DelayAction(() =>
            {
                if (LoadedChampionTextures.ContainsKey(champion))
                {
                    // Unload the current texture
                    MasterMind.TextureLoader.Unload(ChampSquarePrefix + champion);

                    // Load the new texture
                    MasterMind.TextureLoader.Load(ChampSquarePrefix + champion, minimapIcon);

                    // Replace the texture
                    LoadedChampionTextures[champion] = () => MasterMind.TextureLoader[ChampSquarePrefix + champion];
                }
            }, 0);
        }