-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Utils; | ||
|
||
namespace Renako.Game.Beatmaps; | ||
|
||
/// <summary> | ||
/// Class that contain all function related to beatmap and collection of beatmaps. | ||
/// </summary> | ||
public partial class BeatmapManager : CompositeDrawable | ||
{ | ||
[Resolved] | ||
private BeatmapsCollection beatmapsCollection { get; set; } | ||
|
||
[Resolved] | ||
private WorkingBeatmap workingBeatmap { get; set; } | ||
|
||
// [BackgroundDependencyLoader] | ||
// private void load(BeatmapsCollection beatmapsCollection, WorkingBeatmap workingBeatmap) | ||
// { | ||
// this.beatmapsCollection = beatmapsCollection; | ||
// this.workingBeatmap = workingBeatmap; | ||
// } | ||
|
||
/// <summary> | ||
/// Set the working beatmap to the next beatmap in the collection. | ||
/// </summary> | ||
/// <param name="random">Whether to set the next beatmap randomly.</param> | ||
public void NextBeatmapSet(bool random = false) | ||
{ | ||
if (random) | ||
{ | ||
workingBeatmap.BeatmapSet = beatmapsCollection.BeatmapSets[RNG.Next(beatmapsCollection.BeatmapSets.Count)]; | ||
} | ||
else | ||
{ | ||
int currentBeatmapSetIndex = beatmapsCollection.BeatmapSets.IndexOf(workingBeatmap.BeatmapSet); | ||
|
||
workingBeatmap.BeatmapSet = currentBeatmapSetIndex == beatmapsCollection.BeatmapSets.Count - 1 ? beatmapsCollection.BeatmapSets[0] : beatmapsCollection.BeatmapSets[currentBeatmapSetIndex + 1]; | ||
|
||
workingBeatmap.Beatmap = beatmapsCollection.GetFirstBeatmapFromBeatmapSet(workingBeatmap.BeatmapSet); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters