Skip to content

Commit

Permalink
Some mod is patching CrossfadeToDefault() and causing it to throw som…
Browse files Browse the repository at this point in the history
…e times. Cba.
  • Loading branch information
kinsi55 committed Jul 2, 2021
1 parent 73cec13 commit bfab98f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion UI/BSSFlowCoordinator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ public static void Close(bool immediately = false, bool downloadAbortConfim = tr
closeCancelSource?.Cancel();

SelectedSongView.coverLoadCancel?.Cancel();
XD.FunnyMono(SelectedSongView.songPreviewPlayer)?.CrossfadeToDefault();
try {
XD.FunnyMono(SelectedSongView.songPreviewPlayer)?.CrossfadeToDefault();
} catch(Exception ex) { }

foreach(var x in filterView.GetComponentsInChildren<ModalView>())
x.enabled = false;
Expand Down
7 changes: 5 additions & 2 deletions UI/SelectedSongView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,19 @@ internal async void SetSelectedSong(SongSearchSong song, bool selectInTableIfPos
coverLoadCancel = new CancellationTokenSource();

if(!song.CheckIsDownloadedAndLoaded()) {
XD.FunnyMono(songPreviewPlayer)?.CrossfadeToDefault();
try {
XD.FunnyMono(songPreviewPlayer)?.CrossfadeToDefault();
} catch(Exception ex) { }
coverImage.sprite = await BSSFlowCoordinator.coverLoader.LoadAsync(song.detailsSong, coverLoadCancel.Token);
} else {
var h = song.GetCustomLevelIdString();

songPreviewPlayer = XD.FunnyMono(songPreviewPlayer) ?? Resources.FindObjectsOfTypeAll<SongPreviewPlayer>().FirstOrDefault();

var preview = beatmapLevelsModel?.GetLevelPreviewForLevelId(h);
if(preview != null)
if(preview != null) try {
levelCollectionViewController?.SongPlayerCrossfadeToLevelAsync(preview);
} catch(Exception ex) { }

coverImage.sprite = await SongCore.Loader.CustomLevels.Values.First(x => x.levelID == h).GetCoverImageAsync(coverLoadCancel.Token);
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "BetterSongSearch",
"name": "BetterSongSearch",
"author": "Kinsi55",
"version": "0.2.0",
"version": "0.2.2",
"description": "Search and download songs with a lot of filtering and sorting options and without frustration!",
"gameVersion": "1.16.0",
"dependsOn": {
Expand Down

0 comments on commit bfab98f

Please sign in to comment.