public void LoadNewReleasesFromFile() { // saveLoad.Load(); for (int i = 0; i < meshRenderers.Length; i++) { PlaylistScriptData playlistScriptLoadedData = saveLoad.savedNewReleases[i]; PlaylistScript playlistScriptLoaded = new PlaylistScript(playlistScriptLoadedData); GameObject meshRendererGameObject = meshRenderers[i].transform.gameObject; PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>(); Sprite sprite = saveLoad.QuickLoadSpriteFromFile("newReleasesSprite" + i); meshRenderers[i].material.mainTexture = sprite.texture; playlistScript.setPlaylistName(playlistScriptLoaded.playlistName); playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI); playlistScript.artistName = playlistScriptLoaded.artistName; playlistScript.sprite = saveLoad.QuickLoadSpriteFromFile("newReleasesSprite" + i); playlistScript.albumId = playlistScriptLoaded.albumId; } }
public void LoadUserPlaylistsFromFilePNG() { if (saveLoad.savedUserPlaylists != null && saveLoad.savedUserPlaylists.Count != 0) { for (int i = 0; i < meshRenderers.Length; i++) { PlaylistScriptData playlistScriptLoadedData = saveLoad.savedUserPlaylists[i]; PlaylistScript playlistScriptLoaded = new PlaylistScript(playlistScriptLoadedData); GameObject meshRendererGameObject = meshRenderers[i].transform.gameObject; PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>(); Texture2D texture = saveLoad.LoadTextureFromFilePNG("userPlaylist" + i + ".png"); meshRenderers[i].material.mainTexture = texture; playlistScript.setPlaylistName(playlistScriptLoaded.playlistName); playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI); playlistScript.artistName = playlistScriptLoaded.artistName; playlistScript.sprite = Converter.ConvertTextureToSprite(texture); playlistScript.playlistId = playlistScriptLoaded.playlistId; playlistScript.ownerId = playlistScriptLoaded.ownerId; } } else { Debug.LogError("savedUserPlaylists is empty/null"); } }
public void LoadTopArtistsFromFilePNG() { meshRenderers = GetComponentsInChildren <MeshRenderer>(); spotifyManager = GameObject.Find("SpotifyManager"); saveLoad = spotifyManager.GetComponent <SaveLoad>(); 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>(); Texture2D texture = saveLoad.LoadTextureFromFilePNG("topArtist" + i + ".png"); meshRenderers[i].material.mainTexture = texture; playlistScript.artistId = playlistScriptLoaded.artistId; playlistScript.setPlaylistName(playlistScriptLoaded.playlistName); playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI); playlistScript.artistName = playlistScriptLoaded.artistName; playlistScript.sprite = ConvertTextureToSprite(texture); } }
public void LoadChartTracksFromFilePNG() { spotifyManager = GameObject.Find("SpotifyManager"); saveLoad = spotifyManager.GetComponent <SaveLoad>(); quads = GetChildGameObjectWithTag("song"); meshRenderers = GetMeshRenderers(quads); csvReader = spotifyManager.GetComponent <CSVReader>(); chartTracks = csvReader.chartTrackList; if (saveLoad.savedChartTracks != null && saveLoad.savedChartTracks.Count != 0) { for (int i = 0; i < meshRenderers.Length; i++) { if (chartTracks != null || chartTracks.Count != 0) { ChartTrack chartTrack = (ChartTrack)chartTracks[i + 1]; } else { Debug.LogError("chartTracks is null/empty"); } PlaylistScriptData playlistScriptLoadedData = saveLoad.savedChartTracks[i]; PlaylistScript playlistScriptLoaded = new PlaylistScript(playlistScriptLoadedData); GameObject meshRendererGameObject = meshRenderers[i].transform.gameObject; PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>(); Texture2D texture = saveLoad.LoadTextureFromFilePNG("chartTrack" + i + ".png"); meshRenderers[i].material.mainTexture = texture; playlistScript.setPlaylistName(playlistScriptLoaded.playlistName); playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI); playlistScript.artistName = playlistScriptLoaded.artistName; playlistScript.artistId = playlistScriptLoaded.artistId; playlistScript.sprite = Converter.ConvertTextureToSprite(texture); playlistScript.trackId = playlistScriptLoaded.trackId; playlistScript.audioAnalysisCustom = playlistScriptLoaded.audioAnalysisCustom; Vector3 v = popCubes[i].transform.localScale; if (playlistScriptLoaded.streams != null) { popCubes[i].transform.localScale = new Vector3(v.x, float.Parse(playlistScriptLoaded.streams) * streamsScaling, v.z); } } } else { Debug.LogError("savedChartTracks is empty/null"); } }
public void LoadTopTracksFromFile() { savedTopTracks = saveLoad.savedTopTracks; 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>(); Sprite sprite = saveLoad.QuickLoadSpriteFromFile("topTrackSprite" + i); meshRenderers[i].material.mainTexture = sprite.texture; playlistScript.setPlaylistName(playlistScriptLoaded.playlistName); playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI); playlistScript.artistName = playlistScriptLoaded.artistName; playlistScript.sprite = sprite; playlistScript.trackId = playlistScriptLoaded.trackId; playlistScript.audioAnalysisCustom = playlistScriptLoaded.audioAnalysisCustom; } }
public void LoadRecentlyPlayedFromFilePNG() { if (saveLoad.savedRecentlyPlayed != null && saveLoad.savedRecentlyPlayed.Count != 0) { for (int i = 0; i < meshRenderers.Length; i++) { PlaylistScriptData playlistScriptLoadedData = saveLoad.savedRecentlyPlayed[i]; PlaylistScript playlistScriptLoaded = new PlaylistScript(playlistScriptLoadedData); GameObject meshRendererGameObject = meshRenderers[i].transform.gameObject; PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>(); Texture2D texture = saveLoad.LoadTextureFromFilePNG("recentlyPlayed" + i + ".png"); meshRenderers[i].material.mainTexture = texture; playlistScript.setPlaylistName(playlistScriptLoaded.playlistName); playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI); playlistScript.artistName = playlistScriptLoaded.artistName; playlistScript.trackType = PlaylistScript.TrackType.track; playlistScript.sprite = Converter.ConvertTextureToSprite(texture); playlistScript.trackId = playlistScriptLoaded.trackId; playlistScript.audioAnalysisCustom = playlistScriptLoaded.audioAnalysisCustom; } } else { Debug.LogError("savedRecentlyPlayed is null/empty"); } }
public PlaylistScript(PlaylistScriptData playlistScriptData) { playlistName = playlistScriptData.playlistName; playlistURI = playlistScriptData.playlistURI; artistName = playlistScriptData.artistName; popularity = playlistScriptData.popularity; artistId = playlistScriptData.artistId; playlistId = playlistScriptData.playlistId; ownerId = playlistScriptData.ownerId; trackId = playlistScriptData.trackId; albumId = playlistScriptData.albumId; audioAnalysisCustom = playlistScriptData.audioAnalysisCustom; }
public void LoadNewReleasesFromFilePNG() { for (int i = 0; i < meshRenderers.Length; i++) { PlaylistScriptData playlistScriptLoadedData = saveLoad.savedNewReleases[i]; PlaylistScript playlistScriptLoaded = new PlaylistScript(playlistScriptLoadedData); GameObject meshRendererGameObject = meshRenderers[i].transform.gameObject; PlaylistScript playlistScript = meshRendererGameObject.GetComponent <PlaylistScript>(); Texture2D texture = saveLoad.LoadTextureFromFilePNG("newReleases" + i + ".png"); meshRenderers[i].material.mainTexture = texture; playlistScript.setPlaylistName(playlistScriptLoaded.playlistName); playlistScript.setPlaylistURI(playlistScriptLoaded.playlistURI); playlistScript.artistName = playlistScriptLoaded.artistName; playlistScript.sprite = ConvertTextureToSprite(texture); playlistScript.albumId = playlistScriptLoaded.albumId; } }