1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 08:13:31 +08:00

Autohide social when entering a screen that doesn't allow overlays, fix potential nullrefs in DirectOverlay, CreateControls -> CreateSupplementaryControls

This commit is contained in:
DrabWeb 2017-05-26 02:32:01 -03:00
parent fc67582c3f
commit 5831da6978
4 changed files with 16 additions and 6 deletions

View File

@ -295,6 +295,7 @@ namespace osu.Game
musicController.State = Visibility.Hidden; musicController.State = Visibility.Hidden;
chat.State = Visibility.Hidden; chat.State = Visibility.Hidden;
direct.State = Visibility.Hidden; direct.State = Visibility.Hidden;
social.State = Visibility.Hidden;
} }
else else
{ {

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Browse
protected abstract Color4 BackgroundColour { get; } protected abstract Color4 BackgroundColour { get; }
protected abstract T DefaultTab { get; } protected abstract T DefaultTab { get; }
protected virtual Drawable CreateControls() => null; //todo: naming protected virtual Drawable CreateSupplementaryControls() => null;
public BrowseFilterControl() public BrowseFilterControl()
{ {
@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Browse
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
var controls = CreateControls(); var controls = CreateSupplementaryControls();
Container controlsContainer; Container controlsContainer;
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -17,11 +17,11 @@ namespace osu.Game.Overlays.Direct
{ {
private FillFlowContainer<RulesetToggleButton> modeButtons; private FillFlowContainer<RulesetToggleButton> modeButtons;
public readonly DisplayStyleControl<RankStatus> DisplayStyleControl; //todo: naming public readonly DisplayStyleControl<RankStatus> DisplayStyleControl;
protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552"); protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552");
protected override DirectSortCritera DefaultTab => DirectSortCritera.Title; protected override DirectSortCritera DefaultTab => DirectSortCritera.Title;
protected override Drawable CreateControls() protected override Drawable CreateSupplementaryControls()
{ {
modeButtons = new FillFlowContainer<RulesetToggleButton> modeButtons = new FillFlowContainer<RulesetToggleButton>
{ {

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Direct; using osu.Game.Overlays.Direct;
using osu.Game.Overlays.Browse; using osu.Game.Overlays.Browse;
using OpenTK.Graphics; using OpenTK.Graphics;
using System;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -40,7 +41,9 @@ namespace osu.Game.Overlays
if (beatmapSets?.Equals(value) ?? false) return; if (beatmapSets?.Equals(value) ?? false) return;
beatmapSets = value; beatmapSets = value;
recreatePanels((Filter as FilterControl).DisplayStyleControl.DisplayStyle.Value); //todo: potential nullref var s = PanelDisplayStyle.Grid;
withDisplayStyleControl(c => s = c.DisplayStyle.Value);
recreatePanels(s);
} }
} }
@ -100,7 +103,7 @@ namespace osu.Game.Overlays
Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; };
Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; };
(Filter as FilterControl).DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; //todo: potential nullref withDisplayStyleControl(c => c.DisplayStyle.ValueChanged += recreatePanels);
updateResultCounts(); updateResultCounts();
} }
@ -132,6 +135,12 @@ namespace osu.Game.Overlays
panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b));
} }
private void withDisplayStyleControl(Action<DisplayStyleControl<RankStatus>> action)
{
var f = (Filter as FilterControl);
if (f != null) action.Invoke(f.DisplayStyleControl);
}
public class ResultCounts public class ResultCounts
{ {
public readonly int Artists; public readonly int Artists;