Exemplo n.º 1
0
    public void updateHoverUI(PlaylistScript playlistScript)
    {
        this.playlistScript = playlistScript;

        FullTrack track = playlistScript.getFullTrack();

        if (track != null)
        {
            TimeSpan t = TimeSpan.FromMilliseconds(playlistScript.getFullTrack().DurationMs);

            FullTrack fullTrack = playlistScript.getFullTrack();

            string answer = string.Format("{0:D2}m:{1:D2}s",
                                          t.Minutes,
                                          t.Seconds);

            textPro.SetText(playlistScript.getPlaylistName()
                            + "\n" + "Length: " + answer + "\n" + fullTrack.Artists[0].Name
                            );
        }
        else
        {
            textPro.SetText(playlistScript.getPlaylistName());
        }
    }
Exemplo n.º 2
0
    public void InitializeUI(PlaylistScript playlistScript)
    {
        this.playlistScript = playlistScript;

        if (playlistScript.gameObject.tag == "song")
        {
            artistNameProText.text += playlistScript.playlistName;
            songNameProText.text    = "";
        }
        else if (playlistScript.gameObject.tag == "artist")
        {
            artistNameProText.text += playlistScript.getPlaylistName();
            songNameProText.text    = "";
            // descriptionProText.text += ("Popularity: " + playlistScript.fullArtist.Popularity + "/n" + " Genre: " + playlistScript.fullArtist.Genres[0]);
        }
        else if (playlistScript.gameObject.tag == "playlist")
        {
            artistNameProText.text += playlistScript.getPlaylistName();
            songNameProText.text    = "";

            if (playlistScript.getSimplePlaylist() != null)
            {
                descriptionProText.text += ("Playlist Owner: " + playlistScript.getSimplePlaylist().Owner.DisplayName);
            }
        }
        else
        {
            Debug.LogError("Could not initialize Vinyl UI, tag not found");
        }
    }
Exemplo n.º 3
0
    public void HandleCollisionWithVinyl2(GameObject vinylGameObject)
    {
        Debug.Log("In HandleCollisionWithVinyl2");

        if (playlistScript.trackType == PlaylistScript.TrackType.artist)
        {
            spotifyManagerScript.Follow(FollowType.Artist, playlistScript.artistId);

            GameObject spawnedUIConfirmation = Instantiate(uiConfirmation,
                                                           gameObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.identity);

            spawnedUIConfirmation.transform.Find("Follow Confirmation Text").GetComponent <TextMeshProUGUI>().text =
                "Followed " + playlistScript.playlistName + "!";
        }

        else if (playlistScript.trackType == PlaylistScript.TrackType.track)
        {
            spotifyManagerScript.SaveTrack(playlistScript.trackId);

            GameObject spawnedUIConfirmation = Instantiate(uiConfirmation,
                                                           gameObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.identity);

            spawnedUIConfirmation.transform.Find("Follow Confirmation Text").GetComponent <TextMeshProUGUI>().text =
                "Saved " + playlistScript.getPlaylistName() + "!";
        }

        else if (playlistScript.trackType == PlaylistScript.TrackType.playlist)
        {
            spotifyManagerScript.FollowPlaylist(playlistScript.ownerId, playlistScript.playlistId);

            GameObject spawnedUIConfirmation = Instantiate(uiConfirmation,
                                                           gameObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.identity);

            spawnedUIConfirmation.transform.Find("Follow Confirmation Text").GetComponent <TextMeshProUGUI>().text =
                "Followed  " + playlistScript.getPlaylistName() + "!";
        }

        else if (playlistScript.trackType == PlaylistScript.TrackType.album)
        {
            spotifyManagerScript.SaveAlbum(playlistScript.albumId);

            GameObject spawnedUIConfirmation = Instantiate(uiConfirmation,
                                                           gameObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.identity);

            spawnedUIConfirmation.transform.Find("Follow Confirmation Text").GetComponent <TextMeshProUGUI>().text =
                "Saved " + playlistScript.getPlaylistName() + "!";
        }

        Destroy(vinylGameObject);
        Destroy(gameObject);
    }