mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Privatise the OsuGame beatmap, add local beatmap to OsuTestCase
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -21,17 +20,22 @@ namespace osu.Game.Overlays.Music
|
||||
private const float transition_duration = 600;
|
||||
private const float playlist_height = 510;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the order of an item in the list has changed.
|
||||
/// The second parameter indicates the new index of the item.
|
||||
/// </summary>
|
||||
public Action<BeatmapSetInfo, int> OrderChanged;
|
||||
|
||||
private GameBeatmap beatmap;
|
||||
private BeatmapManager beatmaps;
|
||||
|
||||
private FilterControl filter;
|
||||
private PlaylistList list;
|
||||
|
||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours)
|
||||
private void load(OsuColour colours, GameBeatmap beatmap, BeatmapManager beatmaps)
|
||||
{
|
||||
this.beatmap = beatmap.GetBoundCopy();
|
||||
this.beatmaps = beatmaps;
|
||||
|
||||
Children = new Drawable[]
|
||||
@ -73,13 +77,11 @@ namespace osu.Game.Overlays.Music
|
||||
},
|
||||
};
|
||||
|
||||
beatmapBacking.BindTo(game.Beatmap);
|
||||
|
||||
filter.Search.OnCommit = (sender, newText) =>
|
||||
{
|
||||
BeatmapInfo beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
||||
if (beatmap != null)
|
||||
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(beatmap);
|
||||
BeatmapInfo toSelect = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
||||
if (toSelect != null)
|
||||
beatmap.Value = beatmaps.GetWorkingBeatmap(toSelect);
|
||||
};
|
||||
}
|
||||
|
||||
@ -102,13 +104,13 @@ namespace osu.Game.Overlays.Music
|
||||
|
||||
private void itemSelected(BeatmapSetInfo set)
|
||||
{
|
||||
if (set.ID == (beatmapBacking.Value?.BeatmapSetInfo?.ID ?? -1))
|
||||
if (set.ID == (beatmap.Value?.BeatmapSetInfo?.ID ?? -1))
|
||||
{
|
||||
beatmapBacking.Value?.Track?.Seek(0);
|
||||
beatmap.Value?.Track?.Seek(0);
|
||||
return;
|
||||
}
|
||||
|
||||
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(set.Beatmaps.First());
|
||||
beatmap.Value = beatmaps.GetWorkingBeatmap(set.Beatmaps.First());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user