Skip to content

Commit

Permalink
Add shortcut to control beatmap for now
Browse files Browse the repository at this point in the history
  • Loading branch information
HelloYeew committed Feb 3, 2025
1 parent a8db5f5 commit bcd1944
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Renako.Game/Beatmaps/BeatmapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,16 @@ public void NextBeatmapSet(bool random = false)
workingBeatmap.Beatmap = beatmapsCollection.GetFirstBeatmapFromBeatmapSet(workingBeatmap.BeatmapSet);
}
}

/// <summary>
/// Set the working beatmap to the previous beatmap in the collection.
/// </summary>
public void PreviousBeatmapSet()
{
int currentBeatmapSetIndex = beatmapsCollection.BeatmapSets.IndexOf(workingBeatmap.BeatmapSet);

workingBeatmap.BeatmapSet = currentBeatmapSetIndex == 0 ? beatmapsCollection.BeatmapSets[beatmapsCollection.BeatmapSets.Count - 1] : beatmapsCollection.BeatmapSets[currentBeatmapSetIndex - 1];

workingBeatmap.Beatmap = beatmapsCollection.GetFirstBeatmapFromBeatmapSet(workingBeatmap.BeatmapSet);
}
}
17 changes: 13 additions & 4 deletions Renako.Game/RenakoGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Framework.Threading;
using osuTK.Input;
using Renako.Game.Beatmaps;
using Renako.Game.Configurations;
using Renako.Game.Database;
Expand Down Expand Up @@ -121,11 +122,19 @@ private void refreshBeatmapCollection()

protected override bool OnKeyDown(KeyDownEvent e)
{
// TODO: Add notification for refresh
if (e.Key == osuTK.Input.Key.F5)
switch (e.Key)
{
refreshBeatmapCollection();
return true;
case Key.F5:
refreshBeatmapCollection();
return true;

case Key.F6:
BeatmapManager.PreviousBeatmapSet();
return true;

case Key.F7:
BeatmapManager.NextBeatmapSet();
return true;
}

return base.OnKeyDown(e);
Expand Down

0 comments on commit bcd1944

Please sign in to comment.