1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 04:02:57 +08:00

let NotificationOverlay move the background

This commit is contained in:
Aergwyn 2017-12-23 14:56:23 +01:00
parent 77e4a7cec2
commit 2ffc479411
2 changed files with 22 additions and 5 deletions

View File

@ -75,6 +75,8 @@ namespace osu.Game
private SettingsOverlay settings;
private float backgroundOffset;
public OsuGame(string[] args = null)
{
this.args = args;
@ -276,12 +278,27 @@ namespace osu.Game
switch (settings.State)
{
case Visibility.Hidden:
intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
backgroundOffset -= ToolbarButton.WIDTH / 2;
break;
case Visibility.Visible:
intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
backgroundOffset += ToolbarButton.WIDTH / 2;
break;
}
intro.MoveToX(backgroundOffset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
};
notificationOverlay.StateChanged += delegate
{
switch (notificationOverlay.State)
{
case Visibility.Hidden:
backgroundOffset += ToolbarButton.WIDTH / 2;
break;
case Visibility.Visible:
backgroundOffset -= ToolbarButton.WIDTH / 2;
break;
}
intro.MoveToX(backgroundOffset, NotificationOverlay.TRANSITION_LENGTH, Easing.OutQuint);
};
Cursor.State = Visibility.Hidden;

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays
public const float TRANSITION_LENGTH = 600;
public const float SIDEBAR_WIDTH = Sidebar.DEFAULT_WIDTH;
private const float sidebar_width = Sidebar.DEFAULT_WIDTH;
protected const float WIDTH = 400;
@ -102,7 +102,7 @@ namespace osu.Game.Overlays
if (showSidebar)
{
AddInternal(Sidebar = new Sidebar { Width = SIDEBAR_WIDTH });
AddInternal(Sidebar = new Sidebar { Width = sidebar_width });
SectionsContainer.SelectedSection.ValueChanged += section =>
{
@ -167,7 +167,7 @@ namespace osu.Game.Overlays
ContentContainer.MoveToX(-WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
Sidebar?.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
Sidebar?.MoveToX(-sidebar_width, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
searchTextBox.HoldFocus = false;