public static void Init()
 {
     SpeedIcon    = Base64Sprites.LoadSpriteFromResources("SongBrowser.Assets.Speed.png");
     GraphIcon    = Base64Sprites.LoadSpriteFromResources("SongBrowser.Assets.Graph.png");
     XIcon        = Base64Sprites.LoadSpriteFromResources("SongBrowser.Assets.X.png");
     StarFullIcon = Base64Sprites.LoadSpriteFromResources("SongBrowser.Assets.StarFull.png");
     DeleteIcon   = Base64Sprites.LoadSpriteFromResources("SongBrowser.Assets.DeleteIcon.png");
     DoubleArrow  = Base64Sprites.LoadSpriteFromResources("SongBrowser.Assets.DoubleArrow.png");
     RandomIcon   = Base64Sprites.LoadSpriteFromResources("SongBrowser.Assets.RandomIcon.png");
 }
        public static void Init()
        {
            SearchIcon              = Base64Sprites.Base64ToSprite(SearchIconB64);
            PlaylistIcon            = Base64Sprites.Base64ToSprite(PlaylistIconB64);
            AddToFavoritesIcon      = Base64Sprites.Base64ToSprite(AddToFavoritesIconB64);
            RemoveFromFavoritesIcon = Base64Sprites.Base64ToSprite(RemoveFromFavoritesIconB64);
            StarFullIcon            = Base64Sprites.Base64ToSprite(StarFullB64);
            DownloadIcon            = Base64Sprites.Base64ToSprite(DownloadIconB64);
            SpeedIcon  = Base64Sprites.Base64ToSprite(SpeedIconB64);
            StarIcon   = Base64Sprites.Base64ToSprite(StarIconB64);
            GraphIcon  = Base64Sprites.Base64ToSprite(GraphIconB64);
            DeleteIcon = CustomUI.Utilities.UIUtilities.LoadSpriteFromResources("SongBrowser.Assets.DeleteIcon.png");
            XIcon      = Base64Sprites.Base64ToSprite(XIconB64);

            SortButtonStroke = Base64Sprites.Base64ToSprite(SortButtonStrokeB64);

            BeastSaberLogo = CustomUI.Utilities.UIUtilities.LoadSpriteFromResources("SongBrowser.Assets.BeastSaberLogo.png");
        }
Example #3
0
        public Playlist(JSONNode playlistNode)
        {
            string image = playlistNode["image"].Value;

            // If we cannot find an image or parse the provided one correctly, fall back to anything.
            // It will never be displayed by SongBrowser.
            if (!string.IsNullOrEmpty(image))
            {
                try
                {
                    icon = Sprites.Base64ToSprite(image.Substring(image.IndexOf(",") + 1));
                }
                catch
                {
                    Logger.Exception("Unable to convert playlist image to sprite!");
                    icon = Sprites.StarFullIcon;
                }
            }
            else
            {
                icon = Sprites.StarFullIcon;
            }
            playlistTitle    = playlistNode["playlistTitle"];
            playlistAuthor   = playlistNode["playlistAuthor"];
            customDetailUrl  = playlistNode["customDetailUrl"];
            customArchiveUrl = playlistNode["customArchiveUrl"];
            if (!string.IsNullOrEmpty(customDetailUrl))
            {
                if (!customDetailUrl.EndsWith("/"))
                {
                    customDetailUrl += "/";
                }
                Logger.Log("Found playlist with customDetailUrl! Name: " + playlistTitle + ", CustomDetailUrl: " + customDetailUrl);
            }
            if (!string.IsNullOrEmpty(customArchiveUrl) && customArchiveUrl.Contains("[KEY]"))
            {
                Logger.Log("Found playlist with customArchiveUrl! Name: " + playlistTitle + ", CustomArchiveUrl: " + customArchiveUrl);
            }

            songs = new List <PlaylistSong>();

            foreach (JSONNode node in playlistNode["songs"].AsArray)
            {
                PlaylistSong song = new PlaylistSong();
                song.key      = node["key"];
                song.songName = node["songName"];
                song.hash     = node["hash"];
                song.levelId  = node["levelId"];

                songs.Add(song);
            }

            if (playlistNode["playlistSongCount"] != null)
            {
                playlistSongCount = playlistNode["playlistSongCount"].AsInt;
            }
            if (playlistNode["fileLoc"] != null)
            {
                fileLoc = playlistNode["fileLoc"];
            }

            if (playlistNode["playlistURL"] != null)
            {
                fileLoc = playlistNode["playlistURL"];
            }
        }