mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Add a setting to toggle showing converted beatmaps
This commit is contained in:
@ -15,6 +15,7 @@ using osu.Game.Screens.Select.Filter;
|
||||
using Container = osu.Framework.Graphics.Containers.Container;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
@ -60,6 +61,7 @@ namespace osu.Game.Screens.Select
|
||||
Group = group,
|
||||
Sort = sort,
|
||||
SearchText = searchTextBox.Text,
|
||||
AllowConvertedBeatmaps = showConverted,
|
||||
Ruleset = ruleset
|
||||
};
|
||||
|
||||
@ -163,17 +165,24 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private Bindable<bool> showConverted;
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuColour colours, OsuGame osu)
|
||||
private void load(OsuColour colours, OsuGame osu, OsuConfigManager config)
|
||||
{
|
||||
sortTabs.AccentColour = colours.GreenLight;
|
||||
|
||||
showConverted = config.GetBindable<bool>(OsuSetting.ShowConvertedBeatmaps);
|
||||
showConverted.ValueChanged += val => updateCriteria();
|
||||
|
||||
if (osu != null)
|
||||
ruleset.BindTo(osu.Ruleset);
|
||||
ruleset.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria());
|
||||
ruleset.ValueChanged += val => updateCriteria();
|
||||
ruleset.TriggerChange();
|
||||
}
|
||||
|
||||
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||
|
||||
protected override bool OnMouseMove(InputState state) => true;
|
||||
@ -182,4 +191,4 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
protected override bool OnDragStart(InputState state) => true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace osu.Game.Screens.Select
|
||||
public SortMode Sort;
|
||||
public string SearchText;
|
||||
public RulesetInfo Ruleset;
|
||||
public bool AllowConvertedBeatmaps;
|
||||
|
||||
public void Filter(List<BeatmapGroup> groups)
|
||||
{
|
||||
@ -23,7 +24,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
var set = g.BeatmapSet;
|
||||
|
||||
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetID == (Ruleset?.ID ?? 0));
|
||||
bool hasCurrentMode = AllowConvertedBeatmaps || set.Beatmaps.Any(bm => bm.RulesetID == (Ruleset?.ID ?? 0));
|
||||
|
||||
bool match = hasCurrentMode;
|
||||
|
||||
|
Reference in New Issue
Block a user