mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:43:19 +08:00
Make song select grouping & sorting filters persistent
This commit is contained in:
parent
0a8c8906a9
commit
6bf31e8f91
@ -8,6 +8,7 @@ using osu.Framework.Platform;
|
|||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
|
||||||
namespace osu.Game.Configuration
|
namespace osu.Game.Configuration
|
||||||
{
|
{
|
||||||
@ -25,6 +26,9 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1);
|
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1);
|
||||||
Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1);
|
Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1);
|
||||||
|
|
||||||
|
Set(OsuSetting.SelectGroupingMode, GroupMode.All);
|
||||||
|
Set(OsuSetting.SelectSortingMode, SortMode.Title);
|
||||||
|
|
||||||
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
|
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
|
||||||
|
|
||||||
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
|
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
|
||||||
@ -150,6 +154,8 @@ namespace osu.Game.Configuration
|
|||||||
SaveUsername,
|
SaveUsername,
|
||||||
DisplayStarsMinimum,
|
DisplayStarsMinimum,
|
||||||
DisplayStarsMaximum,
|
DisplayStarsMaximum,
|
||||||
|
SelectGroupingMode,
|
||||||
|
SelectSortingMode,
|
||||||
RandomSelectAlgorithm,
|
RandomSelectAlgorithm,
|
||||||
ShowFpsDisplay,
|
ShowFpsDisplay,
|
||||||
ChatDisplayHeight,
|
ChatDisplayHeight,
|
||||||
|
@ -29,40 +29,14 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private readonly TabControl<GroupMode> groupTabs;
|
private readonly TabControl<GroupMode> groupTabs;
|
||||||
|
|
||||||
private SortMode sort = SortMode.Title;
|
public readonly Bindable<SortMode> SortMode = new Bindable<SortMode>(Filter.SortMode.Title);
|
||||||
|
|
||||||
public SortMode Sort
|
public readonly Bindable<GroupMode> GroupMode = new Bindable<GroupMode>(Filter.GroupMode.All);
|
||||||
{
|
|
||||||
get => sort;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (sort != value)
|
|
||||||
{
|
|
||||||
sort = value;
|
|
||||||
FilterChanged?.Invoke(CreateCriteria());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private GroupMode group = GroupMode.All;
|
|
||||||
|
|
||||||
public GroupMode Group
|
|
||||||
{
|
|
||||||
get => group;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (group != value)
|
|
||||||
{
|
|
||||||
group = value;
|
|
||||||
FilterChanged?.Invoke(CreateCriteria());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FilterCriteria CreateCriteria() => new FilterCriteria
|
public FilterCriteria CreateCriteria() => new FilterCriteria
|
||||||
{
|
{
|
||||||
Group = group,
|
Group = GroupMode.Value,
|
||||||
Sort = sort,
|
Sort = SortMode.Value,
|
||||||
SearchText = searchTextBox.Text,
|
SearchText = searchTextBox.Text,
|
||||||
AllowConvertedBeatmaps = showConverted.Value,
|
AllowConvertedBeatmaps = showConverted.Value,
|
||||||
Ruleset = ruleset.Value
|
Ruleset = ruleset.Value
|
||||||
@ -122,7 +96,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Height = 24,
|
Height = 24,
|
||||||
Width = 0.5f,
|
Width = 0.5f,
|
||||||
AutoSort = true,
|
AutoSort = true,
|
||||||
Current = { Value = GroupMode.Title }
|
Current = GroupMode
|
||||||
},
|
},
|
||||||
//spriteText = new OsuSpriteText
|
//spriteText = new OsuSpriteText
|
||||||
//{
|
//{
|
||||||
@ -141,7 +115,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Width = 0.5f,
|
Width = 0.5f,
|
||||||
Height = 24,
|
Height = 24,
|
||||||
AutoSort = true,
|
AutoSort = true,
|
||||||
Current = { Value = SortMode.Title }
|
Current = SortMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -151,10 +125,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
searchTextBox.Current.ValueChanged += _ => FilterChanged?.Invoke(CreateCriteria());
|
searchTextBox.Current.ValueChanged += _ => FilterChanged?.Invoke(CreateCriteria());
|
||||||
|
|
||||||
groupTabs.PinItem(GroupMode.All);
|
groupTabs.PinItem(Filter.GroupMode.All);
|
||||||
groupTabs.PinItem(GroupMode.RecentlyPlayed);
|
groupTabs.PinItem(Filter.GroupMode.RecentlyPlayed);
|
||||||
groupTabs.Current.ValueChanged += group => Group = group.NewValue;
|
|
||||||
sortTabs.Current.ValueChanged += sort => Sort = sort.NewValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
@ -184,7 +156,15 @@ namespace osu.Game.Screens.Select
|
|||||||
showConverted.ValueChanged += _ => updateCriteria();
|
showConverted.ValueChanged += _ => updateCriteria();
|
||||||
|
|
||||||
ruleset.BindTo(parentRuleset);
|
ruleset.BindTo(parentRuleset);
|
||||||
ruleset.BindValueChanged(_ => updateCriteria(), true);
|
ruleset.BindValueChanged(_ => updateCriteria());
|
||||||
|
|
||||||
|
config.BindWith(OsuSetting.SelectGroupingMode, GroupMode);
|
||||||
|
config.BindWith(OsuSetting.SelectSortingMode, SortMode);
|
||||||
|
|
||||||
|
GroupMode.BindValueChanged(_ => updateCriteria());
|
||||||
|
SortMode.BindValueChanged(_ => updateCriteria());
|
||||||
|
|
||||||
|
updateCriteria();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());
|
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());
|
||||||
|
Loading…
Reference in New Issue
Block a user