Skip to content

Commit

Permalink
Category text
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed May 9, 2023
1 parent 92b51f9 commit 16a2f56
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
18 changes: 12 additions & 6 deletions Assets/Script/UI/MusicLibrary/SongSelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,19 @@ public void UpdateSearch() {
.Select(i => new SongViewType(i))
.Cast<ViewType>()
.ToList();
_songs.Insert(0, new CategoryViewType());
//header = ($"ALL SONGS ", $"<#00B6F5><b>{songs.Count}</b> <#006488>{(songs.Count == 1 ? "SONG" : "SONGS")}")
_songs.Insert(0, new CategoryViewType(
"ALL SONGS",
$"<#00B6F5><b>{_songs.Count}</b> <#006488>{(_songs.Count == 1 ? "SONG" : "SONGS")}"
));

// Add recommended songs
foreach (var song in _recommendedSongs) {
_songs.Insert(0, new SongViewType(song));
}
_songs.Insert(0, new CategoryViewType());
//header = (recommendedSongs.Count == 1 ? "RECOMMENDED SONG" : "RECOMMENDED SONGS", $"<#00B6F5><b>{recommendedSongs.Count}</b> <#006488>{(recommendedSongs.Count == 1 ? "SONG" : "SONGS")}")
_songs.Insert(0, new CategoryViewType(
_recommendedSongs.Count == 1 ? "RECOMMENDED SONG" : "RECOMMENDED SONGS",
$"<#00B6F5><b>{_recommendedSongs.Count}</b> <#006488>{(_recommendedSongs.Count == 1 ? "SONG" : "SONGS")}")
);
} else {
// Split up args
var split = searchField.text.Split(';');
Expand Down Expand Up @@ -277,8 +281,10 @@ public void UpdateSearch() {

// Add header
_songs = songsOut.Select(i => new SongViewType(i)).Cast<ViewType>().ToList();
_songs.Insert(0, new CategoryViewType());
//header = (songs.Count == 1 ? "SEARCH RESULT" : "SEARCH RESULTS", $"<#00B6F5><b>{songs.Count}</b> <#006488>{(songs.Count == 1 ? "SONG" : "SONGS")}")
_songs.Insert(0, new CategoryViewType(
"SEARCH RESULTS",
$"<#00B6F5><b>{_songs.Count}</b> <#006488>{(_songs.Count == 1 ? "SONG" : "SONGS")}"
));
}

// Count songs
Expand Down
11 changes: 10 additions & 1 deletion Assets/Script/UI/MusicLibrary/ViewTypes/CategoryViewType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ namespace YARG.UI.MusicLibrary.ViewTypes {
public class CategoryViewType : ViewType {
public override BackgroundType Background => BackgroundType.Category;

public override string PrimaryText => string.Empty;
public override string PrimaryText => _primary;
public override string SideText => _side;

private string _primary;
private string _side;

public CategoryViewType(string primary, string side) {
_primary = primary;
_side = side;
}
}
}

0 comments on commit 16a2f56

Please sign in to comment.