From 3476abc38bff61b14132bd723e09e8ffefa5d87e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jan 2017 16:42:46 +0900 Subject: [PATCH] Add proper masking support to the login overlay. --- osu.Game/Overlays/LoginOverlay.cs | 47 ++++++++++++------- .../Overlays/Options/General/LoginOptions.cs | 17 ++++++- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index 5b69c85eb4..9a4a6e8895 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -18,10 +18,11 @@ namespace osu.Game.Overlays { private LoginOptions optionsSection; + const float transition_time = 300; + public LoginOverlay() { - Width = 360; - AutoSizeAxes = Axes.Y; + AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader] @@ -34,31 +35,43 @@ namespace osu.Game.Overlays Colour = Color4.Black, Alpha = 0.8f, }, - optionsSection = new LoginOptions() + new Container { - Padding = new MarginPadding(10), - }, - new Box { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = 3, - Colour = colours.Yellow, - Alpha = 1, - }, + Width = 360, + AutoSizeAxes = Axes.Y, + Masking = true, + AutoSizeDuration = transition_time, + AutoSizeEasing = EasingTypes.OutQuint, + Children = new Drawable[] + { + optionsSection = new LoginOptions + { + Padding = new MarginPadding(10), + }, + new Box + { + RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Height = 3, + Colour = colours.Yellow, + Alpha = 1, + }, + } + } }; } protected override void PopIn() { - optionsSection.ScaleTo(new Vector2(1, 1), 300, EasingTypes.OutExpo); - FadeIn(200); + optionsSection.Bounding = true; + FadeIn(transition_time, EasingTypes.OutQuint); } protected override void PopOut() { - optionsSection.ScaleTo(new Vector2(1, 0), 300, EasingTypes.OutExpo); - FadeOut(200); + optionsSection.Bounding = false; + FadeOut(transition_time, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index 48a310f060..a47e775cd7 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -12,13 +12,28 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Configuration; - +using osu.Framework.Graphics.Primitives; + namespace osu.Game.Overlays.Options.General { public class LoginOptions : OptionsSubsection, IOnlineComponent { + private bool bounding = true; + protected override string Header => "Sign In"; + public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty; + + public bool Bounding + { + get { return bounding; } + set + { + bounding = value; + Invalidate(Invalidation.SizeInParentSpace); + } + } + [BackgroundDependencyLoader(permitNulls: true)] private void load(APIAccess api) {