示例#1
0
    static TextureProvider GetProviderForPath(string path, TextureDataSource source)
    {
        TextureProvider provider;

        if (!providers.TryGetValue(path, out provider))
        {
            switch (source)
            {
            case TextureDataSource.WWW:
                provider = new TextureProviderWWW(path);
                break;

            case TextureDataSource.Resources:
                provider = new TextureProviderResources(path);
                break;

            case TextureDataSource.StreamingAssets:
                provider = new TextureProviderStream(path);
                break;
            }

            providers.Add(path, provider);
        }

        return(provider);
    }
示例#2
0
    public static void LoadTextureAsync(string path, TextureDataSource source, TextureFormat format, bool mipmaps, System.Action <Texture2D> action)
    {
        TextureProvider provider = GetProviderForPath(path, source);

        provider.LoadAsync(path, format, mipmaps, action);
    }
示例#3
0
    public static Texture2D LoadTexture(string path, TextureDataSource source, TextureFormat format, bool mipmaps)
    {
        TextureProvider provider = GetProviderForPath(path, source);

        return(provider.Load(path, format, mipmaps));
    }