1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 19:52:55 +08:00

Make bindables private

This commit is contained in:
Dean Herbert 2019-08-27 14:31:34 +09:00
parent 69145eb83a
commit 7885c79467
2 changed files with 26 additions and 19 deletions

View File

@ -15,6 +15,7 @@ using osu.Framework.MathUtils;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
@ -79,8 +80,12 @@ namespace osu.Game.Tests.Visual.SongSelect
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
Beatmap.SetDefault(); Beatmap.SetDefault();
Dependencies.Cache(config = new OsuConfigManager(LocalStorage));
} }
private OsuConfigManager config;
[SetUp] [SetUp]
public virtual void SetUp() => Schedule(() => public virtual void SetUp() => Schedule(() =>
{ {
@ -111,13 +116,15 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.SortMode.Value = SortMode.Artist; }); var sortMode = config.GetBindable<SortMode>(OsuSetting.SongSelectSortingMode);
AddStep(@"Sort by Title", delegate { songSelect.FilterControl.SortMode.Value = SortMode.Title; });
AddStep(@"Sort by Author", delegate { songSelect.FilterControl.SortMode.Value = SortMode.Author; }); AddStep(@"Sort by Artist", delegate { sortMode.Value = SortMode.Artist; });
AddStep(@"Sort by DateAdded", delegate { songSelect.FilterControl.SortMode.Value = SortMode.DateAdded; }); AddStep(@"Sort by Title", delegate { sortMode.Value = SortMode.Title; });
AddStep(@"Sort by BPM", delegate { songSelect.FilterControl.SortMode.Value = SortMode.BPM; }); AddStep(@"Sort by Author", delegate { sortMode.Value = SortMode.Author; });
AddStep(@"Sort by Length", delegate { songSelect.FilterControl.SortMode.Value = SortMode.Length; }); AddStep(@"Sort by DateAdded", delegate { sortMode.Value = SortMode.DateAdded; });
AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.SortMode.Value = SortMode.Difficulty; }); AddStep(@"Sort by BPM", delegate { sortMode.Value = SortMode.BPM; });
AddStep(@"Sort by Length", delegate { sortMode.Value = SortMode.Length; });
AddStep(@"Sort by Difficulty", delegate { sortMode.Value = SortMode.Difficulty; });
} }
[Test] [Test]

View File

@ -29,14 +29,14 @@ namespace osu.Game.Screens.Select
private readonly TabControl<GroupMode> groupTabs; private readonly TabControl<GroupMode> groupTabs;
public Bindable<SortMode> SortMode; private Bindable<SortMode> sortMode;
public Bindable<GroupMode> GroupMode; private Bindable<GroupMode> groupMode;
public FilterCriteria CreateCriteria() => new FilterCriteria public FilterCriteria CreateCriteria() => new FilterCriteria
{ {
Group = GroupMode.Value, Group = groupMode.Value,
Sort = SortMode.Value, Sort = sortMode.Value,
SearchText = searchTextBox.Text, SearchText = searchTextBox.Text,
AllowConvertedBeatmaps = showConverted.Value, AllowConvertedBeatmaps = showConverted.Value,
Ruleset = ruleset.Value Ruleset = ruleset.Value
@ -123,8 +123,8 @@ namespace osu.Game.Screens.Select
searchTextBox.Current.ValueChanged += _ => FilterChanged?.Invoke(CreateCriteria()); searchTextBox.Current.ValueChanged += _ => FilterChanged?.Invoke(CreateCriteria());
groupTabs.PinItem(Filter.GroupMode.All); groupTabs.PinItem(GroupMode.All);
groupTabs.PinItem(Filter.GroupMode.RecentlyPlayed); groupTabs.PinItem(GroupMode.RecentlyPlayed);
} }
public void Deactivate() public void Deactivate()
@ -156,14 +156,14 @@ namespace osu.Game.Screens.Select
ruleset.BindTo(parentRuleset); ruleset.BindTo(parentRuleset);
ruleset.BindValueChanged(_ => updateCriteria()); ruleset.BindValueChanged(_ => updateCriteria());
SortMode = config.GetBindable<SortMode>(OsuSetting.SongSelectSortingMode); sortMode = config.GetBindable<SortMode>(OsuSetting.SongSelectSortingMode);
GroupMode = config.GetBindable<GroupMode>(OsuSetting.SongSelectGroupingMode); groupMode = config.GetBindable<GroupMode>(OsuSetting.SongSelectGroupingMode);
sortTabs.Current.BindTo(SortMode); sortTabs.Current.BindTo(sortMode);
groupTabs.Current.BindTo(GroupMode); groupTabs.Current.BindTo(groupMode);
GroupMode.BindValueChanged(_ => updateCriteria()); groupMode.BindValueChanged(_ => updateCriteria());
SortMode.BindValueChanged(_ => updateCriteria()); sortMode.BindValueChanged(_ => updateCriteria());
updateCriteria(); updateCriteria();
} }