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

@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Direct;
using osu.Game.Overlays.Browse;
using OpenTK.Graphics;
using System;
namespace osu.Game.Overlays
{
@ -40,7 +41,9 @@ namespace osu.Game.Overlays
if (beatmapSets?.Equals(value) ?? false) return;
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; };
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();
}
@ -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));
}
private void withDisplayStyleControl(Action<DisplayStyleControl<RankStatus>> action)
{
var f = (Filter as FilterControl);
if (f != null) action.Invoke(f.DisplayStyleControl);
}
public class ResultCounts
{
public readonly int Artists;