mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 16:42:57 +08:00
Allow SettingsSection
s to exit without a parent SettingsPanel
This commit is contained in:
parent
ca6c292a08
commit
7258a09748
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -44,7 +45,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
public bool FilteringActive { get; set; }
|
public bool FilteringActive { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(canBeNull: true)]
|
||||||
private SettingsPanel settingsPanel { get; set; }
|
private SettingsPanel settingsPanel { get; set; }
|
||||||
|
|
||||||
protected SettingsSection()
|
protected SettingsSection()
|
||||||
@ -117,7 +118,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
selectedSection = settingsPanel.CurrentSection.GetBoundCopy();
|
selectedSection = settingsPanel?.CurrentSection.GetBoundCopy() ?? new Bindable<SettingsSection>(this);
|
||||||
selectedSection.BindValueChanged(_ => updateContentFade(), true);
|
selectedSection.BindValueChanged(_ => updateContentFade(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +139,10 @@ namespace osu.Game.Overlays.Settings
|
|||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
if (!isCurrentSection)
|
if (!isCurrentSection)
|
||||||
|
{
|
||||||
|
Debug.Assert(settingsPanel != null);
|
||||||
settingsPanel.SectionsContainer.ScrollTo(this);
|
settingsPanel.SectionsContainer.ScrollTo(this);
|
||||||
|
}
|
||||||
|
|
||||||
return base.OnClick(e);
|
return base.OnClick(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user