From 6aa6e5eef7b85911c017f0d91e0b4591e8078e9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 19:25:27 +0900 Subject: [PATCH] Store and restore the selected details tab at song select. --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++++ .../Screens/Select/BeatmapDetailAreaTabControl.cs | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index d47ed48e99..de3acf7a71 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Configuration; using osu.Framework.Platform; +using osu.Game.Screens.Select; namespace osu.Game.Configuration { @@ -34,6 +35,8 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuParallax, true); + Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details); + Set(OsuConfig.ShowInterface, true); Set(OsuConfig.KeyOverlay, false); //todo: implement all settings below this line (remove the Disabled set when doing so). @@ -316,6 +319,7 @@ namespace osu.Game.Configuration MenuMusic, MenuVoice, MenuParallax, + BeatmapDetailTab, RawInput, AbsoluteToOsuWindow, ConfineMouse, diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 48a46f0b90..51ec6f7707 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -4,10 +4,12 @@ using System; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -21,15 +23,22 @@ namespace osu.Game.Screens.Select public Action OnFilter; //passed the selected tab and if mods is checked + private Bindable selectedTab; + private void invokeOnFilter() { OnFilter?.Invoke(tabs.Current, modsCheckbox.Current); } [BackgroundDependencyLoader] - private void load(OsuColour colour) + private void load(OsuColour colour, OsuConfigManager config) { modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight; + + selectedTab = config.GetBindable(OsuConfig.BeatmapDetailTab); + + tabs.Current.BindTo(selectedTab); + tabs.Current.TriggerChange(); } public BeatmapDetailAreaTabControl() @@ -62,8 +71,6 @@ namespace osu.Game.Screens.Select tabs.Current.ValueChanged += item => invokeOnFilter(); modsCheckbox.Current.ValueChanged += item => invokeOnFilter(); - - tabs.Current.Value = BeatmapDetailTab.Global; } }