1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Make sub panel back button inherit osu button

This commit is contained in:
Joehu 2019-12-08 10:51:25 -08:00
parent 5cf35869e9
commit 9974fff5cc

View File

@ -3,14 +3,14 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Screens.Ranking;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -34,21 +34,21 @@ namespace osu.Game.Overlays
protected override bool DimMainContent => false; // dimming is handled by main overlay protected override bool DimMainContent => false; // dimming is handled by main overlay
private class BackButton : OsuClickableContainer private class BackButton : OsuButton
{ {
private AspectContainer aspect;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Size = new Vector2(Sidebar.DEFAULT_WIDTH); Size = new Vector2(Sidebar.DEFAULT_WIDTH);
Children = new Drawable[]
BackgroundColour = Color4.Black;
AddRange(new Drawable[]
{ {
aspect = new AspectContainer new Container
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteIcon new SpriteIcon
@ -69,19 +69,7 @@ namespace osu.Game.Overlays
}, },
} }
} }
}; });
}
protected override bool OnMouseDown(MouseDownEvent e)
{
aspect.ScaleTo(0.75f, 2000, Easing.OutQuint);
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
{
aspect.ScaleTo(1, 1000, Easing.OutElastic);
return base.OnMouseUp(e);
} }
} }
} }