1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 09:02:55 +08:00

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;
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);
}
}
}

View File

@ -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)
{