Ejemplo n.º 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);
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 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));
    }