mirror of
https://github.com/ppy/osu
synced 2025-01-22 05:43:14 +00:00
Merge pull request #1735 from Aergwyn/add-nofitication-overlay-push-bg
Let NotificationOverlay move the background
This commit is contained in:
commit
45e4c09cb8
@ -37,7 +37,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
private MusicController musicController;
|
private MusicController musicController;
|
||||||
|
|
||||||
private NotificationOverlay notificationOverlay;
|
private NotificationOverlay notifications;
|
||||||
|
|
||||||
private DialogOverlay dialogOverlay;
|
private DialogOverlay dialogOverlay;
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
if (s.Beatmap == null)
|
if (s.Beatmap == null)
|
||||||
{
|
{
|
||||||
notificationOverlay.Post(new SimpleNotification
|
notifications.Post(new SimpleNotification
|
||||||
{
|
{
|
||||||
Text = @"Tried to load a score for a beatmap we don't have!",
|
Text = @"Tried to load a score for a beatmap we don't have!",
|
||||||
Icon = FontAwesome.fa_life_saver,
|
Icon = FontAwesome.fa_life_saver,
|
||||||
@ -154,7 +154,7 @@ namespace osu.Game
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
// hook up notifications to components.
|
// hook up notifications to components.
|
||||||
BeatmapManager.PostNotification = n => notificationOverlay?.Post(n);
|
BeatmapManager.PostNotification = n => notifications?.Post(n);
|
||||||
BeatmapManager.GetStableStorage = GetStorageForStableInstall;
|
BeatmapManager.GetStableStorage = GetStorageForStableInstall;
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
@ -207,7 +207,7 @@ namespace osu.Game
|
|||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
}, overlayContent.Add);
|
}, overlayContent.Add);
|
||||||
|
|
||||||
loadComponentSingleFile(notificationOverlay = new NotificationOverlay
|
loadComponentSingleFile(notifications = new NotificationOverlay
|
||||||
{
|
{
|
||||||
GetToolbarHeight = () => ToolbarOffset,
|
GetToolbarHeight = () => ToolbarOffset,
|
||||||
Depth = -4,
|
Depth = -4,
|
||||||
@ -224,7 +224,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
if (entry.Level < LogLevel.Important) return;
|
if (entry.Level < LogLevel.Important) return;
|
||||||
|
|
||||||
notificationOverlay.Post(new SimpleNotification
|
notifications.Post(new SimpleNotification
|
||||||
{
|
{
|
||||||
Text = $@"{entry.Level}: {entry.Message}"
|
Text = $@"{entry.Level}: {entry.Message}"
|
||||||
});
|
});
|
||||||
@ -237,7 +237,7 @@ namespace osu.Game
|
|||||||
dependencies.Cache(userProfile);
|
dependencies.Cache(userProfile);
|
||||||
dependencies.Cache(musicController);
|
dependencies.Cache(musicController);
|
||||||
dependencies.Cache(beatmapSetOverlay);
|
dependencies.Cache(beatmapSetOverlay);
|
||||||
dependencies.Cache(notificationOverlay);
|
dependencies.Cache(notifications);
|
||||||
dependencies.Cache(dialogOverlay);
|
dependencies.Cache(dialogOverlay);
|
||||||
|
|
||||||
// ensure only one of these overlays are open at once.
|
// ensure only one of these overlays are open at once.
|
||||||
@ -272,19 +272,21 @@ namespace osu.Game
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.StateChanged += delegate
|
Action<Visibility> stateChanged = delegate
|
||||||
{
|
{
|
||||||
switch (settings.State)
|
float offset = 0;
|
||||||
{
|
|
||||||
case Visibility.Hidden:
|
if (settings.State == Visibility.Visible)
|
||||||
intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
|
offset += ToolbarButton.WIDTH / 2;
|
||||||
break;
|
if (notifications.State == Visibility.Visible)
|
||||||
case Visibility.Visible:
|
offset -= ToolbarButton.WIDTH / 2;
|
||||||
intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
|
|
||||||
break;
|
intro.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
settings.StateChanged += stateChanged;
|
||||||
|
notifications.StateChanged += stateChanged;
|
||||||
|
|
||||||
Cursor.State = Visibility.Hidden;
|
Cursor.State = Visibility.Hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +354,7 @@ namespace osu.Game
|
|||||||
direct.State = Visibility.Hidden;
|
direct.State = Visibility.Hidden;
|
||||||
social.State = Visibility.Hidden;
|
social.State = Visibility.Hidden;
|
||||||
userProfile.State = Visibility.Hidden;
|
userProfile.State = Visibility.Hidden;
|
||||||
notificationOverlay.State = Visibility.Hidden;
|
notifications.State = Visibility.Hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenChanged(Screen newScreen)
|
private void screenChanged(Screen newScreen)
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public const float TRANSITION_LENGTH = 600;
|
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;
|
protected const float WIDTH = 400;
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (showSidebar)
|
if (showSidebar)
|
||||||
{
|
{
|
||||||
AddInternal(Sidebar = new Sidebar { Width = SIDEBAR_WIDTH });
|
AddInternal(Sidebar = new Sidebar { Width = sidebar_width });
|
||||||
|
|
||||||
SectionsContainer.SelectedSection.ValueChanged += section =>
|
SectionsContainer.SelectedSection.ValueChanged += section =>
|
||||||
{
|
{
|
||||||
@ -167,7 +167,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
ContentContainer.MoveToX(-WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
|
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);
|
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
|
|
||||||
searchTextBox.HoldFocus = false;
|
searchTextBox.HoldFocus = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user