diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 64958139da..97c9dbb2e0 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -23,6 +23,7 @@ using osu.Game.Screens; using osu.Game.Screens.Menu; using OpenTK; using System.Linq; +using osu.Framework.Graphics.Primitives; namespace osu.Game { @@ -168,6 +169,9 @@ namespace osu.Game { switch (args.Key) { + case Key.T: + Toolbar.ToggleVisibility(); + return true; case Key.O: options.ToggleVisibility(); return true; @@ -223,6 +227,14 @@ namespace osu.Game return base.OnExiting(); } + protected override void UpdateAfterChildren() + { + base.UpdateAfterChildren(); + + if (modeStack.ChildGameMode != null) + modeStack.ChildGameMode.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight }; + } + private void modeAdded(GameMode newMode) { newMode.ModePushed += modeAdded; diff --git a/osu.Game/Overlays/Options/Sidebar.cs b/osu.Game/Overlays/Options/Sidebar.cs index b0762f3fd5..57865b84a7 100644 --- a/osu.Game/Overlays/Options/Sidebar.cs +++ b/osu.Game/Overlays/Options/Sidebar.cs @@ -11,13 +11,14 @@ using osu.Framework.Graphics.Transformations; using osu.Framework.Input; using osu.Framework.Threading; using osu.Game.Graphics; +using osu.Game.Overlays.Toolbar; namespace osu.Game.Overlays.Options { public class Sidebar : Container { private FlowContainer content; - internal const int DEFAULT_WIDTH = 60; + internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH; internal const int EXPANDED_WIDTH = 200; protected override Container Content => content; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 0640741ef0..1b6abb475c 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -8,25 +8,23 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; -using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Modes; -using osu.Game.Online.API; using OpenTK; -using OpenTK.Graphics; namespace osu.Game.Overlays.Toolbar { public class Toolbar : OverlayContainer { - public const float HEIGHT = 50; + public const float HEIGHT = 40; public Action OnHome; public Action OnPlayModeChange; private ToolbarModeSelector modeSelector; + private ToolbarUserArea userArea; - private const int transition_time = 250; + private const int transition_time = 500; private const float alpha_hovering = 0.8f; private const float alpha_normal = 0.6f; @@ -70,7 +68,7 @@ namespace osu.Game.Overlays.Toolbar { Icon = FontAwesome.fa_search }, - new ToolbarUserArea(), + userArea = new ToolbarUserArea(), new ToolbarButton { Icon = FontAwesome.fa_bars @@ -130,13 +128,15 @@ namespace osu.Game.Overlays.Toolbar protected override void PopIn() { MoveToY(0, transition_time, EasingTypes.OutQuint); - FadeIn(transition_time, EasingTypes.OutQuint); + FadeIn(transition_time / 2, EasingTypes.OutQuint); } protected override void PopOut() { - MoveToY(-DrawSize.Y, transition_time, EasingTypes.InQuint); - FadeOut(transition_time, EasingTypes.InQuint); + userArea?.LoginOverlay.Hide(); + + MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint); + FadeOut(transition_time); } class PassThroughFlowContainer : FlowContainer diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 919818dd54..160e4460d9 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -21,6 +21,8 @@ namespace osu.Game.Overlays.Toolbar { public class ToolbarButton : Container { + public const float WIDTH = Toolbar.HEIGHT * 1.4f; + public FontAwesome Icon { get { return DrawableIcon.Icon; } @@ -66,6 +68,9 @@ namespace osu.Game.Overlays.Toolbar public ToolbarButton() { + Width = WIDTH; + RelativeSizeAxes = Axes.Y; + Children = new Drawable[] { HoverBackground = new Box @@ -80,7 +85,7 @@ namespace osu.Game.Overlays.Toolbar Direction = FlowDirection.HorizontalOnly, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Padding = new MarginPadding { Left = 20, Right = 20 }, + Padding = new MarginPadding { Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2 }, Spacing = new Vector2(5), RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, @@ -121,9 +126,6 @@ namespace osu.Game.Overlays.Toolbar } } }; - - RelativeSizeAxes = Axes.Y; - AutoSizeAxes = Axes.X; } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs index 580e53bf6b..1955ef5c1c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Toolbar { class ToolbarUserArea : Container { - private LoginOverlay loginOverlay; + public LoginOverlay LoginOverlay; private ToolbarUserButton button; public override RectangleF BoundingBox => button.BoundingBox; @@ -25,9 +25,9 @@ namespace osu.Game.Overlays.Toolbar Children = new Drawable[] { button = new ToolbarUserButton { - Action = toggle, + Action = () => LoginOverlay.ToggleVisibility(), }, - loginOverlay = new LoginOverlay + LoginOverlay = new LoginOverlay { BypassAutoSizeAxes = Axes.Both, Position = new Vector2(0, 1), @@ -37,10 +37,5 @@ namespace osu.Game.Overlays.Toolbar } }; } - - private void toggle() - { - loginOverlay.ToggleVisibility(); - } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 60d0eaacda..921c2d26df 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -20,6 +20,8 @@ namespace osu.Game.Overlays.Toolbar public ToolbarUserButton() { + AutoSizeAxes = Axes.X; + DrawableText.Font = @"Exo2.0-MediumItalic"; Add(new OpaqueBackground { Depth = 1 }); diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 67802ab2f3..a76cdbe99b 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -14,6 +14,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; using osu.Game.Graphics; +using osu.Game.Overlays.Toolbar; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; @@ -33,6 +34,8 @@ namespace osu.Game.Screens.Menu private AudioSample sampleOsuClick; + private Toolbar toolbar; + private FlowContainerWithOrigin buttonFlow; //todo: make these non-internal somehow. @@ -117,9 +120,10 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load(AudioManager audio, OsuGame game) { sampleOsuClick = audio.Sample.Get(@"Menu/menuhit"); + toolbar = game.Toolbar; } protected override void LoadComplete() @@ -150,7 +154,7 @@ namespace osu.Game.Screens.Menu return true; } - + return false; } @@ -215,6 +219,8 @@ namespace osu.Game.Screens.Menu switch (state) { case MenuState.Initial: + toolbar?.Hide(); + buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out); buttonArea.FadeOut(300); @@ -239,9 +245,10 @@ namespace osu.Game.Screens.Menu buttonArea.FadeIn(300); if (lastState == MenuState.Initial) - //todo: this propagates to invisible children and causes delays later down the track (on first MenuState.Play) buttonArea.Delay(150, true); + Scheduler.AddDelayed(() => toolbar?.Show(), 150); + foreach (Button b in buttonsTopLevel) b.State = ButtonState.Expanded; diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 9a715c17be..f672a3998b 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -1,20 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.GameModes; using osu.Framework.GameModes.Testing; using osu.Framework.Graphics; using osu.Framework.Graphics.Transformations; using osu.Game.Graphics.Containers; -using osu.Game.Modes; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; using osu.Game.Screens.Direct; -using osu.Game.Screens.Edit; using osu.Game.Screens.Multiplayer; -using osu.Game.Screens.Play; using OpenTK; using osu.Game.Screens.Select; @@ -25,7 +21,7 @@ namespace osu.Game.Screens.Menu private ButtonSystem buttons; public override string Name => @"Main Menu"; - internal override bool ShowOverlays => true; + internal override bool ShowOverlays => buttons.State != MenuState.Initial; private BackgroundMode background; @@ -42,7 +38,7 @@ namespace osu.Game.Screens.Menu ParallaxAmount = 0.01f, Children = new Drawable[] { - buttons = new ButtonSystem() + buttons = new ButtonSystem { OnChart = delegate { Push(new ChartListing()); }, OnDirect = delegate { Push(new OnlineListing()); }, @@ -63,11 +59,11 @@ namespace osu.Game.Screens.Menu background.Preload(game); buttons.OnSettings = game.ToggleOptions; + } protected override void OnEntering(GameMode last) { - base.OnEntering(last); buttons.FadeInFromZero(500); } diff --git a/osu.Game/Screens/OsuGameMode.cs b/osu.Game/Screens/OsuGameMode.cs index b2646f4dea..3134640a60 100644 --- a/osu.Game/Screens/OsuGameMode.cs +++ b/osu.Game/Screens/OsuGameMode.cs @@ -24,8 +24,6 @@ namespace osu.Game.Screens protected new OsuGameBase Game => base.Game as OsuGameBase; - protected float ToolbarPadding => ShowOverlays ? (Game as OsuGame)?.Toolbar.DrawHeight ?? 0 : 0; - private bool boundToBeatmap; private Bindable beatmap; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 7152523b45..c3f0eb9b6d 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -27,14 +27,12 @@ namespace osu.Game.Screens.Select public FilterControl() { - AutoSizeAxes = Axes.Y; - Children = new Drawable[] { new Box { Colour = Color4.Black, - Alpha = 0.6f, + Alpha = 0.8f, RelativeSizeAxes = Axes.Both, }, new FlowContainer diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index ccc0732984..e206c5d5fa 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -11,15 +11,12 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.GameModes; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Modes; using osu.Game.Screens.Backgrounds; using OpenTK; -using OpenTK.Graphics; using osu.Game.Screens.Play; using osu.Framework; using osu.Framework.Audio.Sample; @@ -29,8 +26,8 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics; using osu.Framework.Input; using OpenTK.Input; -using osu.Game.Graphics; using System.Collections.Generic; +using osu.Framework.Graphics.Containers; using osu.Framework.Threading; namespace osu.Game.Screens.Select @@ -45,7 +42,6 @@ namespace osu.Game.Screens.Select private TrackManager trackManager; private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225); - private static readonly Vector2 wedged_container_start_position = new Vector2(0, 50); private BeatmapInfoWedge beatmapInfoWedge; private static readonly Vector2 background_blur = new Vector2(20); @@ -53,39 +49,11 @@ namespace osu.Game.Screens.Select private AudioSample sampleChangeDifficulty; private AudioSample sampleChangeBeatmap; - + private List beatmapGroups; private Footer footer; - class WedgeBackground : Container - { - public WedgeBackground() - { - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Size = new Vector2(1, 0.5f), - Colour = Color4.Black.Opacity(0.5f), - Shear = new Vector2(0.15f, 0), - EdgeSmoothness = new Vector2(2, 0), - }, - new Box - { - RelativeSizeAxes = Axes.Both, - RelativePositionAxes = Axes.Y, - Size = new Vector2(1, -0.5f), - Position = new Vector2(0, 1), - Colour = Color4.Black.Opacity(0.5f), - Shear = new Vector2(-0.15f, 0), - EdgeSmoothness = new Vector2(2, 0), - }, - }; - } - } - Player player; FilterControl filter; @@ -117,20 +85,25 @@ namespace osu.Game.Screens.Select OsuGame osuGame, OsuColour colours) { const float carousel_width = 640; - const float bottom_tool_height = 50; + const float filter_height = 100; + beatmapGroups = new List(); Children = new Drawable[] { new ParallaxContainer { + Padding = new MarginPadding { Top = filter_height }, ParallaxAmount = 0.005f, RelativeSizeAxes = Axes.Both, - Children = new [] + Children = new[] { new WedgeBackground { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Right = carousel_width * 0.76f }, + Padding = new MarginPadding + { + Right = carousel_width * 0.76f + }, }, } }, @@ -143,18 +116,21 @@ namespace osu.Game.Screens.Select }, filter = new FilterControl { - Position = wedged_container_start_position, RelativeSizeAxes = Axes.X, + Height = filter_height, FilterChanged = filterChanged, Exit = Exit, }, beatmapInfoWedge = new BeatmapInfoWedge { Alpha = 0, - Position = wedged_container_start_position, Size = wedged_container_size, RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Top = 20, Right = 20, }, + Margin = new MarginPadding + { + Top = 20, + Right = 20, + }, }, footer = new Footer() { @@ -236,9 +212,9 @@ namespace osu.Game.Screens.Select Content.FadeInFromZero(250); - beatmapInfoWedge.MoveToX(wedged_container_start_position.X - 50); - beatmapInfoWedge.MoveToX(wedged_container_start_position.X, 800, EasingTypes.OutQuint); - + beatmapInfoWedge.MoveToX(-50); + beatmapInfoWedge.MoveToX(0, 800, EasingTypes.OutQuint); + filter.Activate(); } @@ -262,19 +238,19 @@ namespace osu.Game.Screens.Select Content.ScaleTo(1.1f, 250, EasingTypes.InSine); Content.FadeOut(250); - + filter.Deactivate(); base.OnSuspending(next); } protected override bool OnExiting(GameMode next) { - beatmapInfoWedge.MoveTo(wedged_container_start_position + new Vector2(-100, 50), 800, EasingTypes.InQuint); + beatmapInfoWedge.MoveToX(-100, 800, EasingTypes.InQuint); beatmapInfoWedge.RotateTo(10, 800, EasingTypes.InQuint); Content.FadeOut(100); - filter.Deactivate(); + filter.Deactivate(); return base.OnExiting(next); } diff --git a/osu.Game/Screens/Select/WedgeBackground.cs b/osu.Game/Screens/Select/WedgeBackground.cs new file mode 100644 index 0000000000..901fa21c92 --- /dev/null +++ b/osu.Game/Screens/Select/WedgeBackground.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Screens.Select +{ + public class WedgeBackground : Container + { + public WedgeBackground() + { + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1, 0.5f), + Colour = Color4.Black.Opacity(0.5f), + Shear = new Vector2(0.15f, 0), + EdgeSmoothness = new Vector2(2, 0), + }, + new Box + { + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Y, + Size = new Vector2(1, -0.5f), + Position = new Vector2(0, 1), + Colour = Color4.Black.Opacity(0.5f), + Shear = new Vector2(-0.15f, 0), + EdgeSmoothness = new Vector2(2, 0), + }, + }; + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1b1c851128..3f610bed42 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -188,6 +188,7 @@ +