Add proper masking support to the login overlay.

This commit is contained in:
Dean Herbert 2017-01-31 16:42:46 +09:00
parent 4cf2993db1
commit 3476abc38b
2 changed files with 46 additions and 18 deletions

View File

@ -18,10 +18,11 @@ namespace osu.Game.Overlays
{ {
private LoginOptions optionsSection; private LoginOptions optionsSection;
const float transition_time = 300;
public LoginOverlay() public LoginOverlay()
{ {
Width = 360; AutoSizeAxes = Axes.Both;
AutoSizeAxes = Axes.Y;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -34,31 +35,43 @@ namespace osu.Game.Overlays
Colour = Color4.Black, Colour = Color4.Black,
Alpha = 0.8f, Alpha = 0.8f,
}, },
optionsSection = new LoginOptions() new Container
{ {
Padding = new MarginPadding(10), Width = 360,
}, AutoSizeAxes = Axes.Y,
new Box { Masking = true,
Anchor = Anchor.BottomLeft, AutoSizeDuration = transition_time,
Origin = Anchor.BottomLeft, AutoSizeEasing = EasingTypes.OutQuint,
RelativeSizeAxes = Axes.X, Children = new Drawable[]
Height = 3, {
Colour = colours.Yellow, optionsSection = new LoginOptions
Alpha = 1, {
}, 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() protected override void PopIn()
{ {
optionsSection.ScaleTo(new Vector2(1, 1), 300, EasingTypes.OutExpo); optionsSection.Bounding = true;
FadeIn(200); FadeIn(transition_time, EasingTypes.OutQuint);
} }
protected override void PopOut() protected override void PopOut()
{ {
optionsSection.ScaleTo(new Vector2(1, 0), 300, EasingTypes.OutExpo); optionsSection.Bounding = false;
FadeOut(200); FadeOut(transition_time, EasingTypes.OutQuint);
} }
} }
} }

View File

@ -12,13 +12,28 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Framework.Graphics.Primitives;
namespace osu.Game.Overlays.Options.General namespace osu.Game.Overlays.Options.General
{ {
public class LoginOptions : OptionsSubsection, IOnlineComponent public class LoginOptions : OptionsSubsection, IOnlineComponent
{ {
private bool bounding = true;
protected override string Header => "Sign In"; 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)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api) private void load(APIAccess api)
{ {