Beispiel #1
0
        public static AnimSheet GetSpellSheet(SpellAnimType animType, int num)
        {
            AnimSheet cacheSheet = spellCache.Get(animType.ToString() + num);

            if (cacheSheet != null)
            {
                return(cacheSheet);
            }

            if (File.Exists(Paths.EffectsPath + animType.ToString() + "-" + num + ".png"))
            {
                AnimSheet sheet = new AnimSheet();
                sheet.LoadPixelsFromFile32(Paths.EffectsPath + animType.ToString() + "-" + num + ".png");
                sheet.LoadTextureFromPixels32();
                switch (animType)
                {
                case SpellAnimType.Spell:
                    sheet.GenerateDataBuffer(1, 1);
                    break;

                case SpellAnimType.Arrow:
                    sheet.GenerateDataBuffer(8, 1);
                    break;

                case SpellAnimType.Beam:
                    sheet.GenerateDataBuffer(8, 4);
                    break;
                }
                spellCache.Add(animType.ToString() + num, sheet);
                return(sheet);
            }
            spellCache.Add(animType.ToString() + num, ErrorTexture);
            return(ErrorTexture);
        }
Beispiel #2
0
        public static AnimSheet GetSpellSheet(SpellAnimType animType, int num)
        {
            AnimSheet cacheSheet = spellCache.Get(animType.ToString() + num);
            if (cacheSheet != null) return cacheSheet;

            if (System.IO.File.Exists(Paths.EffectsPath + animType.ToString() + "-" + num + ".png")) {
                AnimSheet sheet = new AnimSheet();
                sheet.LoadPixelsFromFile32(Paths.EffectsPath + animType.ToString() + "-" + num + ".png");
                sheet.LoadTextureFromPixels32();
                switch (animType) {
                    case SpellAnimType.Spell:
                        sheet.GenerateDataBuffer(1, 1);
                        break;
                    case SpellAnimType.Arrow:
                        sheet.GenerateDataBuffer(8, 1);
                        break;
                    case SpellAnimType.Beam:
                        sheet.GenerateDataBuffer(8, 4);
                        break;
                }
                spellCache.Add(animType.ToString() + num, sheet);
                return sheet;
            }
            spellCache.Add(animType.ToString() + num, ErrorTexture);
            return ErrorTexture;
        }