mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +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:
parent
fc67582c3f
commit
5831da6978
@ -295,6 +295,7 @@ namespace osu.Game
|
||||
musicController.State = Visibility.Hidden;
|
||||
chat.State = Visibility.Hidden;
|
||||
direct.State = Visibility.Hidden;
|
||||
social.State = Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Browse
|
||||
|
||||
protected abstract Color4 BackgroundColour { get; }
|
||||
protected abstract T DefaultTab { get; }
|
||||
protected virtual Drawable CreateControls() => null; //todo: naming
|
||||
protected virtual Drawable CreateSupplementaryControls() => null;
|
||||
|
||||
public BrowseFilterControl()
|
||||
{
|
||||
@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Browse
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
var controls = CreateControls();
|
||||
var controls = CreateSupplementaryControls();
|
||||
Container controlsContainer;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -17,11 +17,11 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
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 DirectSortCritera DefaultTab => DirectSortCritera.Title;
|
||||
protected override Drawable CreateControls()
|
||||
protected override Drawable CreateSupplementaryControls()
|
||||
{
|
||||
modeButtons = new FillFlowContainer<RulesetToggleButton>
|
||||
{
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user