public void LoadTopArtistsFromFile()
    {
        //   saveLoad.Load();

        for (int i = 0; i < meshRenderers.Length; i++)
        {
            PlaylistScriptData playlistScriptLoadedData = saveLoad.savedTopArtists[i];

            PlaylistScript playlistScriptLoaded = new PlaylistScript(playlistScriptLoadedData);

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

            PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>();

            Sprite sprite = saveLoad.QuickLoadSpriteFromFile("topArtistSprite" + i);

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

            playlistScript.setPlaylistName(playlistScriptLoaded.playlistName);
            playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI);
            playlistScript.artistName = playlistScriptLoaded.artistName;
            playlistScript.sprite     = saveLoad.QuickLoadSpriteFromFile("topArtistSprite" + i);
        }
    }
Beispiel #2
0
    public void LoadTopTracksFromFilePNG()
    {
        for (int i = 0; i < meshRenderers.Length; i++)
        {
            PlaylistScriptData playlistScriptLoadedData = saveLoad.savedTopTracks[i];

            PlaylistScript playlistScriptLoaded = new PlaylistScript(playlistScriptLoadedData);

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

            PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>();

            Texture2D texture = saveLoad.LoadTextureFromFilePNG("topTrack" + i + ".png");

            meshRenderers[i].material.mainTexture = texture;

            playlistScript.setPlaylistName(playlistScriptLoaded.playlistName);
            playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI);
            playlistScript.artistName          = playlistScriptLoaded.artistName;
            playlistScript.sprite              = ConvertTextureToSprite(texture);
            playlistScript.trackId             = playlistScriptLoaded.trackId;
            playlistScript.audioAnalysisCustom = playlistScriptLoaded.audioAnalysisCustom;
        }
    }
Beispiel #3
0
    public void LoadFeaturedPlaylistFromFilePNG()
    {
        for (int i = 0; i < meshRenderers.Length; i++)
        {
            PlaylistScriptData playlistScriptLoadedData = saveLoad.savedFeaturedPlaylists[i];

            PlaylistScript playlistScriptLoaded = new PlaylistScript(playlistScriptLoadedData);

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

            PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>();

            Texture2D texture = saveLoad.LoadTextureFromFilePNG("featuredPlaylist" + i + ".png");

            meshRenderers[i].material.mainTexture = texture;

            playlistScript.setPlaylistName(playlistScriptLoaded.playlistName);
            playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI);
            playlistScript.artistName = playlistScriptLoaded.artistName;
            playlistScript.sprite     = ConvertTextureToSprite(texture);
            playlistScript.playlistId = playlistScriptLoaded.playlistId;
            playlistScript.ownerId    = playlistScriptLoaded.ownerId;
        }
    }
    public IEnumerator LoadUserRecommendationsWithTrack(List <string> ids)
    {
        Recommendations recommendations = spotifyManagerScript.GetRecommendationsWithTrack(ids);

        for (int i = 0; i < meshRenderers.Length; i++)
        {
            FullTrack fullTrack = spotifyManagerScript.GetTrack(recommendations.Tracks[i].Id);

            string recommendationsImageURL = fullTrack.Album.Images[0].Url;

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

            PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>();

            WWW imageURLWWW = new WWW(recommendationsImageURL);

            yield return(imageURLWWW);

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

            playlistScript.setPlaylistName(fullTrack.Name);
            playlistScript.setPlaylistURI(fullTrack.Uri);
        }
    }
Beispiel #5
0
    public IEnumerator LoadUserPlaylists()
    {
        yield return(new WaitForSeconds(2));

        Paging <SimplePlaylist> usersPlaylists = spotifyManagerScript.GetUsersPlayists();

        if (usersPlaylists == null)
        {
            Debug.LogError("usersPlaylists is null");
        }
        else
        {
            for (int i = 0; i < meshRenderers.Length; i++)
            {
                string userPlaylistImageURL = usersPlaylists.Items[i].Images[0].Url;

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

                PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>();

                WWW imageURLWWW = new WWW(userPlaylistImageURL);

                yield return(imageURLWWW);

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

                playlistScript.setPlaylistName(usersPlaylists.Items[i].Name);
                playlistScript.setPlaylistURI(usersPlaylists.Items[i].Uri);
                playlistScript.sprite     = ConvertWWWToSprite(imageURLWWW);
                playlistScript.ownerId    = usersPlaylists.Items[i].Owner.Id;
                playlistScript.playlistId = usersPlaylists.Items[i].Id;
                saveLoad.SaveTextureToFilePNG(Converter.ConvertWWWToTexture(imageURLWWW), "userPlaylist" + i + ".png");
                saveLoad.savedUserPlaylists.Add(new PlaylistScriptData(playlistScript));
            }
        }
    }