Merge branch 'master' into profile

This commit is contained in:
Huo Yaoyuan
2017-07-14 22:52:19 +08:00
53 changed files with 1305 additions and 379 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using OpenTK.Graphics;
using osu.Framework.Allocation;
@ -35,6 +36,8 @@ namespace osu.Game.Overlays
private SearchTextBox searchTextBox;
private Func<float> getToolbarHeight;
public SettingsOverlay()
{
RelativeSizeAxes = Axes.Y;
@ -93,7 +96,11 @@ namespace osu.Game.Overlays
new SidebarButton
{
Section = section,
Action = sectionsContainer.ScrollToTop
Action = s =>
{
sectionsContainer.ScrollTo(s);
sidebar.State = ExpandedState.Contracted;
},
}
).ToArray()
}
@ -111,7 +118,7 @@ namespace osu.Game.Overlays
searchTextBox.Current.ValueChanged += newValue => sectionsContainer.SearchContainer.SearchTerm = newValue;
sectionsContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
getToolbarHeight = () => game?.ToolbarOffset ?? 0;
}
protected override void PopIn()
@ -148,6 +155,14 @@ namespace osu.Game.Overlays
base.OnFocus(state);
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
sectionsContainer.Margin = new MarginPadding { Left = sidebar.DrawWidth };
sectionsContainer.Padding = new MarginPadding { Top = getToolbarHeight() };
}
private class SettingsSectionsContainer : SectionsContainer<SettingsSection>
{
public SearchContainer<SettingsSection> SearchContainer;