Example #1
0
    private Texture LoadTexture(ResourceLoader resourceLoader, string textureName)
    {
        var resourcePath = GetTexturePath(textureName);

        resourcePath = resourcePath.Replace('\\', '/');

        if (!resourceLoader.ContainsFile(resourcePath))
        {
            return(null);
        }

        var textureNameLower = textureName.ToLower();

        if (_textureCache.ContainsKey(textureNameLower))
        {
            return(_textureCache[textureNameLower]);
        }

        using (var fs = resourceLoader.OpenFile(resourcePath))
        {
            try
            {
                var tex = VtfProvider.GetImage(fs);
                _textureCache.Add(textureNameLower, tex);
                return(tex);
            }
            catch (System.Exception e) { Debug.LogError(e); }
        }

        return(null);
    }
Example #2
0
 public override bool Exists(FileSystemPath path)
 {
     return(Res.ContainsFile(UnrootPath(path)));
 }