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.Screens;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
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));
Beatmap.SetDefault();
Dependencies.Cache(config = new OsuConfigManager(LocalStorage));
}
private OsuConfigManager config;
[SetUp]
public virtual void SetUp() => Schedule(() =>
{
@ -111,13 +116,15 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.SortMode.Value = SortMode.Artist; });
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 DateAdded", delegate { songSelect.FilterControl.SortMode.Value = SortMode.DateAdded; });
AddStep(@"Sort by BPM", delegate { songSelect.FilterControl.SortMode.Value = SortMode.BPM; });
AddStep(@"Sort by Length", delegate { songSelect.FilterControl.SortMode.Value = SortMode.Length; });
AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.SortMode.Value = SortMode.Difficulty; });
var sortMode = config.GetBindable<SortMode>(OsuSetting.SongSelectSortingMode);
AddStep(@"Sort by Artist", delegate { sortMode.Value = SortMode.Artist; });
AddStep(@"Sort by Title", delegate { sortMode.Value = SortMode.Title; });
AddStep(@"Sort by Author", delegate { sortMode.Value = SortMode.Author; });
AddStep(@"Sort by DateAdded", delegate { sortMode.Value = SortMode.DateAdded; });
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]

View File

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