Пример #1
0
        public List <SpriteFile> GetAllSpriteFiles(SpriteType type)
        {
            if (!_fallbackSpriteProvider.IsDefaultsPopulated)
            {
                return(new List <SpriteFile>());
            }
            var dict = new Dictionary <SpriteType, Dictionary <int, SpriteFile> >();

            foreach (var i in _fallbackSpriteProvider.GetAllSpriteFiles(type))
            {
                if (!dict.TryGetValue(i.Type, out Dictionary <int, SpriteFile> subDict))
                {
                    subDict      = new Dictionary <int, SpriteFile>();
                    dict[i.Type] = subDict;
                }
                subDict[i.Id] = i;
            }
            string overrideFolder = Path.Combine(_mod.FolderPath, GraphicsInfoResource.Get(type).PngFolder);

            if (Directory.Exists(overrideFolder))
            {
                foreach (var i in Directory.GetFiles(overrideFolder)
                         .Select(i => new SpriteFile(type: type, id: int.Parse(Path.GetFileNameWithoutExtension(i)), file: i, isOverride: true)))
                {
                    dict[i.Type][i.Id] = i;
                }
            }
            return(dict.Values.SelectMany(i => i.Values).ToList());
        }
Пример #2
0
        public List <SpriteFile> GetAllSpriteFiles(SpriteType type)
        {
            string dir = Path.Combine(_defaultDataFolder, GraphicsInfoResource.Get(type).PngFolder);

            if (!Directory.Exists(dir))
            {
                return(new List <SpriteFile>());
            }
            return(Directory.GetFiles(dir)
                   .Select(i => new SpriteFile(type, int.Parse(Path.GetFileNameWithoutExtension(i)), i, isOverride: false))
                   .ToList());
        }
Пример #3
0
 private SpriteFile GetSpriteFilePathWithoutFallback(SpriteType type, int id)
 {
     return(new SpriteFile(type, id, Path.Combine(_mod.FolderPath, GraphicsInfoResource.GetRelativeSpritePath(type, id)), true));
 }
Пример #4
0
 public SpriteFile GetSpriteFile(SpriteType type, int id)
 {
     return(new SpriteFile(type, id, Path.Combine(_defaultDataFolder, GraphicsInfoResource.GetRelativeSpritePath(type, id)), false));
 }