Skip to content

Commit

Permalink
Merge pull request #26 from Loloppe/master
Browse files Browse the repository at this point in the history
1.37.5
  • Loading branch information
kinsi55 authored Sep 30, 2024
2 parents 746ee31 + 3233957 commit 59bea98
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ obj/*
HarmonyPatches/RemoveSplashscreen.cs
HarmonyPatchHelper.cs
Screenshots/SocialPreview.jpg
/.vs
9 changes: 9 additions & 0 deletions BetterSongSearch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
<Reference Include="BeatmapCore">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatmapCore.dll</HintPath>
</Reference>
<Reference Include="BeatSaber.ViewSystem" Publicize="true">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.ViewSystem.dll</HintPath>
</Reference>
<Reference Include="BeatSaberPlaylistsLib">
<HintPath>$(BeatSaberDir)\Libs\BeatSaberPlaylistsLib.dll</HintPath>
</Reference>
Expand All @@ -106,6 +109,9 @@
<Reference Include="HMUI" Publicize="true">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\HMUI.dll</HintPath>
</Reference>
<Reference Include="Interactable">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Interactable.dll</HintPath>
</Reference>
<Reference Include="IPA.Loader">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
</Reference>
Expand All @@ -119,6 +125,9 @@
<Reference Include="Oculus.VR">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Oculus.VR.dll</HintPath>
</Reference>
<Reference Include="SegmentedControl">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\SegmentedControl.dll</HintPath>
</Reference>
<Reference Include="SongCore">
<HintPath>$(BeatSaberDir)\Plugins\SongCore.dll</HintPath>
</Reference>
Expand Down
25 changes: 25 additions & 0 deletions BetterSongSearch.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35222.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterSongSearch", "BetterSongSearch.csproj", "{AC39B7E1-394D-4964-A575-9BE792B5C637}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AC39B7E1-394D-4964-A575-9BE792B5C637}.Debug|x64.ActiveCfg = Debug|x64
{AC39B7E1-394D-4964-A575-9BE792B5C637}.Debug|x64.Build.0 = Debug|x64
{AC39B7E1-394D-4964-A575-9BE792B5C637}.Release|x64.ActiveCfg = Release|x64
{AC39B7E1-394D-4964-A575-9BE792B5C637}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FFDDFC11-9646-47E4-B711-3DBB17F9689B}
EndGlobalSection
EndGlobal
11 changes: 5 additions & 6 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,17 @@ public void Init(IPALogger logger, Config conf) {
Log = logger;
Log.Info("BetterSongSearch initialized.");
Settings.cfgInstance = PluginConfig.Instance = conf.Generated<PluginConfig>();

UI.Manager.Init();

SharedCoroutineStarter.Init();

new Harmony("Kinsi55.BeatSaber.BetterSongSearch").PatchAll(Assembly.GetExecutingAssembly());
}

[OnStart]
public void OnApplicationStart() {
BeatSaberMarkupLanguage.Util.MainMenuAwaiter.MainMenuInitializing += MainMenuInit;
}


public void MainMenuInit() {
UI.Manager.Init();
SharedCoroutineStarter.Init();
}

[OnExit]
Expand Down
2 changes: 1 addition & 1 deletion UI/CustomLists/DownloadList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static CustomDownloadListTableCell GetCell(TableView tableView) {
tableCell.interactable = true;

tableCell.reuseIdentifier = ReuseIdentifier;
BSMLParser.instance.Parse(
BSMLParser.Instance.Parse(
Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "BetterSongSearch.UI.CustomLists.DownloadListCell.bsml"),
tableCell.gameObject, tableCell
);
Expand Down
2 changes: 1 addition & 1 deletion UI/CustomLists/SongList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static CustomSongListTableCell GetCell(TableView tableView) {
tableCell.interactable = true;

tableCell.reuseIdentifier = ReuseIdentifier;
BSMLParser.instance.Parse(
BSMLParser.Instance.Parse(
Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "BetterSongSearch.UI.CustomLists.SongListCell.bsml"),
tableCell.gameObject, tableCell
);
Expand Down
4 changes: 2 additions & 2 deletions UI/DownloadHistoryView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace BetterSongSearch.UI {
class DownloadHistoryView : BSMLAutomaticViewController, TableView.IDataSource {
[UIComponent("scrollBarContainer")] private VerticalLayoutGroup _scrollBarContainer = null;
[UIComponent("downloadList")] CustomListTableData downloadHistoryData = null;
TableView downloadHistoryTable => downloadHistoryData?.tableView;
TableView downloadHistoryTable => downloadHistoryData?.TableView;
public readonly List<DownloadHistoryEntry> downloadList = new List<DownloadHistoryEntry>();
DownloadHistoryEntry[] downloadListSorted = null;

Expand Down Expand Up @@ -156,7 +156,7 @@ void Parsed() {
BSMLStuff.GetScrollbarForTable(downloadHistoryData.gameObject, _scrollBarContainer.transform);
}

public float CellSize() => 8.05f;
public float CellSize(int idx) => 8.05f;
public int NumberOfCells() => downloadList?.Count ?? 0;

public TableCell CellForIdx(TableView tableView, int idx) => DownloadListTableData.GetCell(tableView).PopulateWithSongData(downloadListSorted[idx]);
Expand Down
6 changes: 3 additions & 3 deletions UI/FilterView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ static List<DateTime> BuildList() {

[UIAction("#post-parse")]
void Parsed() {
currentFilter.hideOlderThanSlider.slider.maxValue = hideOlderThanOptions.Count - 1;
currentFilter.hideOlderThanSlider.Slider.maxValue = hideOlderThanOptions.Count - 1;

((RectTransform)gameObject.transform).offsetMax = new Vector2(20, 22);

StartCoroutine(BSMLStuff.MergeSliders(gameObject));

// I hate BSML some times
var m = GetComponentsInChildren<DropDownListSetting>()
.Where(x => x.associatedValue.MemberName == "mods")
.Where(x => x.AssociatedValue.MemberName == "mods")
.First()
.GetComponent<DropdownWithTableView>()
._modalView;
Expand Down Expand Up @@ -87,7 +87,7 @@ internal void SetFilter(FilterOptions filter = null) {
* Seems like there is SOMETHING broken with how input changes are handled, something to do
* with nested coroutines or whatever. I have no idea. For now I spent enough time trying to fix this
*/
currentFilter.hideOlderThanSlider.onChange.Invoke(currentFilter.hideOlderThanSlider.Value);
currentFilter.hideOlderThanSlider.OnChange.Invoke(currentFilter.hideOlderThanSlider.Value);
}

BSMLParserParams presetsViewParams = null;
Expand Down
2 changes: 1 addition & 1 deletion UI/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace BetterSongSearch.UI {
static class Manager {
public static void Init() {
MenuButtons.instance.RegisterButton(new MenuButton("Better Song Search", "Search songs, but better", ShowFlow, true));
MenuButtons.Instance.RegisterButton(new MenuButton("Better Song Search", "Search songs, but better", ShowFlow, true));
}

internal static FlowCoordinator _parentFlow { get; private set; }
Expand Down
4 changes: 2 additions & 2 deletions UI/SongListController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void Awake() {
[UIAction("SelectSong")] void _SelectSong(TableView _, int row) => selectedSongView.SetSelectedSong(searchedSongsList[row]);

[UIComponent("songList")] public CustomListTableData songListData = null;
public TableView songList => songListData?.tableView;
public TableView songList => songListData?.TableView;
[UIComponent("searchBoxContainer")] private VerticalLayoutGroup _searchBoxContainer = null;
[UIComponent("scrollBarContainer")] private VerticalLayoutGroup _scrollBarContainer = null;

Expand Down Expand Up @@ -166,7 +166,7 @@ void Parsed() {
Task.Run(_UpdateSearchedSongsList);
}

public float CellSize() => PluginConfig.Instance.smallerFontSize ? 11.66f : 14f;
public float CellSize(int idx) => PluginConfig.Instance.smallerFontSize ? 11.66f : 14f;
public int NumberOfCells() => searchedSongsList?.Count ?? 0;
public TableCell CellForIdx(TableView tableView, int idx) => SongListTableData.GetCell(tableView).PopulateWithSongData(searchedSongsList[idx]);

Expand Down
2 changes: 1 addition & 1 deletion UI/Views/SplitViews/PlaylistCreation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PlaylistCreation {

[UIAction("#post-parse")]
void Parsed() {
playlistName.modalKeyboard.modalView._animateParentCanvas = false;
playlistName.ModalKeyboard.ModalView._animateParentCanvas = false;
}

internal static string nameToUseOnNextOpen = "h";
Expand Down
10 changes: 5 additions & 5 deletions UI/Views/SplitViews/Presets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public void Refresh(bool selected, bool highlighted) {
void Parsed() {
FilterPresets.Init();

BSMLStuff.GetScrollbarForTable(presetList.tableView.gameObject, _presetScrollbarContainer.transform);
BSMLStuff.GetScrollbarForTable(presetList.TableView.gameObject, _presetScrollbarContainer.transform);

// BSML / HMUI my beloved
newPresetName.modalKeyboard.modalView._animateParentCanvas = false;
newPresetName.ModalKeyboard.ModalView._animateParentCanvas = false;
}


Expand All @@ -47,9 +47,9 @@ void Parsed() {
[UIComponent("newPresetName")] readonly StringSetting newPresetName = null;
[UIComponent("presetScrollbarContainer")] readonly VerticalLayoutGroup _presetScrollbarContainer = null;
internal void ReloadPresets() {
presetList.data = FilterPresets.presets.Select(x => new FilterPresetRow(x.Key)).ToList<object>();
presetList.tableView.ReloadData();
presetList.tableView.ClearSelection();
presetList.Data = FilterPresets.presets.Select(x => new FilterPresetRow(x.Key)).ToList<object>();
presetList.TableView.ReloadData();
presetList.TableView.ClearSelection();

loadButton.interactable = false;
deleteButton.interactable = false;
Expand Down
2 changes: 1 addition & 1 deletion Util/BSMLStuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static BSMLParserParams InitSplitView(ref BSMLParserParams pparams, GameO
if(viewName == null)
viewName = host.GetType().Name;

return pparams = BSMLParser.instance.Parse(Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), $"BetterSongSearch.UI.Views.SplitViews.{viewName}.bsml"), targetGameObject, host);
return pparams = BSMLParser.Instance.Parse(Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), $"BetterSongSearch.UI.Views.SplitViews.{viewName}.bsml"), targetGameObject, host);
}

static GameObject scrollBar = null;
Expand Down
11 changes: 6 additions & 5 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"id": "BetterSongSearch",
"name": "BetterSongSearch",
"author": "Kinsi55",
"version": "0.7.87",
"version": "0.7.88",
"description": "Search and download songs with a lot of filtering and sorting options and without frustration!",
"gameVersion": "1.34.5",
"gameVersion": "1.37.4",
"dependsOn": {
"BSIPA": "^4.0.5",
"BeatSaberMarkupLanguage": "^1.5.3",
"BSIPA": "^4.3.5",
"BeatSaberMarkupLanguage": "^1.12.0",
"BS Utils": "^1.14.1",
"SongDetailsCache": "^1.2.2",
"SongCore": "^3.3.1"
"SongCore": "^3.14.13"
}
}

0 comments on commit 59bea98

Please sign in to comment.