Skip to content

Commit

Permalink
Added artist name clicking back
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed May 9, 2023
1 parent 9826116 commit 92b51f9
Show file tree
Hide file tree
Showing 8 changed files with 361 additions and 103 deletions.
300 changes: 256 additions & 44 deletions Assets/Art/Fonts/Barlow/Barlow-Bold.asset

Large diffs are not rendered by default.

69 changes: 12 additions & 57 deletions Assets/Prefabs/UI/MusicLibrary/MusicLibrary.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
Expand Down Expand Up @@ -1266,8 +1266,8 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: YARG.UI.MusicLibrary.SelectedSongView, Assembly-CSharp
- m_Target: {fileID: 4030813026385655377}
m_TargetAssemblyTypeName: YARG.UI.MusicLibrary.Sidebar, Assembly-CSharp
m_MethodName: SearchFilter
m_Mode: 5
m_Arguments:
Expand Down Expand Up @@ -1428,7 +1428,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
Expand Down Expand Up @@ -1459,8 +1459,8 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: YARG.UI.MusicLibrary.SelectedSongView, Assembly-CSharp
- m_Target: {fileID: 4030813026385655377}
m_TargetAssemblyTypeName: YARG.UI.MusicLibrary.Sidebar, Assembly-CSharp
m_MethodName: SearchFilter
m_Mode: 5
m_Arguments:
Expand Down Expand Up @@ -1870,7 +1870,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
Expand Down Expand Up @@ -1901,8 +1901,8 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: YARG.UI.MusicLibrary.SelectedSongView, Assembly-CSharp
- m_Target: {fileID: 4030813026385655377}
m_TargetAssemblyTypeName: YARG.UI.MusicLibrary.Sidebar, Assembly-CSharp
m_MethodName: SearchFilter
m_Mode: 5
m_Arguments:
Expand Down Expand Up @@ -3090,7 +3090,6 @@ GameObject:
- component: {fileID: 4030813026215709993}
- component: {fileID: 4030813026215709995}
- component: {fileID: 4030813026215709992}
- component: {fileID: 4030813026215709994}
m_Layer: 5
m_Name: Length
m_TagString: Untagged
Expand Down Expand Up @@ -3216,50 +3215,6 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &4030813026215709994
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4030813026215709998}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 4030813026215709992}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &4030813026216348289
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -4549,7 +4504,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
Expand Down Expand Up @@ -4580,8 +4535,8 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: YARG.UI.MusicLibrary.SelectedSongView, Assembly-CSharp
- m_Target: {fileID: 4030813026385655377}
m_TargetAssemblyTypeName: YARG.UI.MusicLibrary.Sidebar, Assembly-CSharp
m_MethodName: SearchFilter
m_Mode: 5
m_Arguments:
Expand Down
57 changes: 57 additions & 0 deletions Assets/Prefabs/UI/MusicLibrary/SongView.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ GameObject:
- component: {fileID: 7351933036123520269}
- component: {fileID: 7006697502306556741}
- component: {fileID: 7664445044345806523}
- component: {fileID: 7595498556028577441}
m_Layer: 5
m_Name: Secondary
m_TagString: Untagged
Expand Down Expand Up @@ -474,6 +475,62 @@ MonoBehaviour:
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &7595498556028577441
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4454172983210282838}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 7006697502306556741}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 6622513572522471069}
m_TargetAssemblyTypeName: YARG.UI.MusicLibrary.SongView, Assembly-CSharp
m_MethodName: SecondaryTextClick
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &4505452236614856762
GameObject:
m_ObjectHideFlags: 0
Expand Down
2 changes: 0 additions & 2 deletions Assets/Script/Song/Scanning/SongScanThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ private void ScanSubDirectory(string cacheFolder, string subDir, ICollection<Son

// Iterate through the files in this current directory to look for CON files
foreach (var file in Directory.EnumerateFiles(subDir)) {
Debug.Log($"Scanning file {file}");

// for each file found, read first 4 bytes and check for "CON " or "LIVE"
using var fs = new FileStream(file, FileMode.Open, FileAccess.Read);
using var br = new BinaryReader(fs);
Expand Down
19 changes: 19 additions & 0 deletions Assets/Script/UI/MusicLibrary/Sidebar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,24 @@ public void PlaySong() {
MainMenu.Instance.chosenSong = songViewType.SongEntry;
MainMenu.Instance.ShowPreSong();
}

public void SearchFilter(string type) {
var viewType = SongSelection.Instance.Songs[SongSelection.Instance.SelectedIndex];
if (viewType is not SongViewType songViewType) {
return;
}

var songEntry = songViewType.SongEntry;

string value = type switch {
"source" => songEntry.Source,
"album" => songEntry.Album,
"year" => songEntry.Year,
"charter" => songEntry.Charter,
"genre" => songEntry.Genre,
_ => throw new Exception("Unreachable")
};
SongSelection.Instance.searchField.text = $"{type}:{value}";
}
}
}
7 changes: 7 additions & 0 deletions Assets/Script/UI/MusicLibrary/SongView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,12 @@ private void SetBackground(ViewType.BackgroundType type, bool selected) {
break;
}
}

public void SecondaryTextClick() {
int realIndex = SongSelection.Instance.SelectedIndex + _relativeSongIndex;
var viewType = SongSelection.Instance.Songs[realIndex];

viewType.SecondaryTextClick();
}
}
}
6 changes: 6 additions & 0 deletions Assets/Script/UI/MusicLibrary/ViewTypes/SongViewType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ public override Sprite IconSprite {
public SongViewType(SongEntry songEntry) {
SongEntry = songEntry;
}

public override void SecondaryTextClick() {
base.SecondaryTextClick();

SongSelection.Instance.searchField.text = $"artist:{SongEntry.Artist}";
}
}
}
4 changes: 4 additions & 0 deletions Assets/Script/UI/MusicLibrary/ViewTypes/ViewType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ public enum BackgroundType {
public virtual string SideText => string.Empty;

public virtual Sprite IconSprite => null;

public virtual void SecondaryTextClick() {

}
}
}

0 comments on commit 92b51f9

Please sign in to comment.