1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 18:13:09 +08:00

Store and restore the selected details tab at song select.

This commit is contained in:
Dean Herbert 2017-04-24 19:25:27 +09:00
parent e1a2f1bc7a
commit 6aa6e5eef7
2 changed files with 14 additions and 3 deletions

View File

@ -4,6 +4,7 @@
using System; using System;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Screens.Select;
namespace osu.Game.Configuration namespace osu.Game.Configuration
{ {
@ -34,6 +35,8 @@ namespace osu.Game.Configuration
Set(OsuConfig.MenuParallax, true); Set(OsuConfig.MenuParallax, true);
Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details);
Set(OsuConfig.ShowInterface, true); Set(OsuConfig.ShowInterface, true);
Set(OsuConfig.KeyOverlay, false); Set(OsuConfig.KeyOverlay, false);
//todo: implement all settings below this line (remove the Disabled set when doing so). //todo: implement all settings below this line (remove the Disabled set when doing so).
@ -316,6 +319,7 @@ namespace osu.Game.Configuration
MenuMusic, MenuMusic,
MenuVoice, MenuVoice,
MenuParallax, MenuParallax,
BeatmapDetailTab,
RawInput, RawInput,
AbsoluteToOsuWindow, AbsoluteToOsuWindow,
ConfineMouse, ConfineMouse,

View File

@ -4,10 +4,12 @@
using System; using System;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -21,15 +23,22 @@ namespace osu.Game.Screens.Select
public Action<BeatmapDetailTab, bool> OnFilter; //passed the selected tab and if mods is checked public Action<BeatmapDetailTab, bool> OnFilter; //passed the selected tab and if mods is checked
private Bindable<BeatmapDetailTab> selectedTab;
private void invokeOnFilter() private void invokeOnFilter()
{ {
OnFilter?.Invoke(tabs.Current, modsCheckbox.Current); OnFilter?.Invoke(tabs.Current, modsCheckbox.Current);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colour) private void load(OsuColour colour, OsuConfigManager config)
{ {
modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight; modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight;
selectedTab = config.GetBindable<BeatmapDetailTab>(OsuConfig.BeatmapDetailTab);
tabs.Current.BindTo(selectedTab);
tabs.Current.TriggerChange();
} }
public BeatmapDetailAreaTabControl() public BeatmapDetailAreaTabControl()
@ -62,8 +71,6 @@ namespace osu.Game.Screens.Select
tabs.Current.ValueChanged += item => invokeOnFilter(); tabs.Current.ValueChanged += item => invokeOnFilter();
modsCheckbox.Current.ValueChanged += item => invokeOnFilter(); modsCheckbox.Current.ValueChanged += item => invokeOnFilter();
tabs.Current.Value = BeatmapDetailTab.Global;
} }
} }