Beispiel #1
0
    public IEnumerator loadFeaturedPlaylists()
    {
        yield return(new WaitForSeconds(2));

        FeaturedPlaylists featuredPlaylists = spotifyManagerScript.GetFeaturedPlaylists();

        for (int i = 0; i < meshRenderers.Length; i++)
        {
            string featuredPlaylistImageURL = featuredPlaylists.Playlists.Items[i].Images[0].Url;

            GameObject meshRendererGameObject = meshRenderers[i].transform.gameObject;

            if (meshRendererGameObject.tag != "back")
            {
                PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>();

                WWW imageURLWWW = new WWW(featuredPlaylistImageURL);

                yield return(imageURLWWW);

                meshRenderers[i].material.mainTexture = imageURLWWW.texture;

                playlistScript.setPlaylistName(featuredPlaylists.Playlists.Items[i].Name);
                playlistScript.setPlaylistURI(featuredPlaylists.Playlists.Items[i].Uri);
                playlistScript.setSimplePlaylist(featuredPlaylists.Playlists.Items[i]);
                playlistScript.sprite     = ConvertWWWToSprite(imageURLWWW);
                playlistScript.ownerId    = featuredPlaylists.Playlists.Items[i].Owner.Id;
                playlistScript.playlistId = featuredPlaylists.Playlists.Items[i].Id;

                saveLoad.SaveTextureToFilePNG(ConvertWWWToTexture(imageURLWWW), "featuredPlaylist" + i + ".png");
                saveLoad.savedFeaturedPlaylists.Add(new PlaylistScriptData(playlistScript));
            }
        }
    }