1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 14:37:30 +08:00
osu-lazer/osu.Game/Collections/ManageCollectionsDialog.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

140 lines
5.2 KiB
C#
Raw Normal View History

2020-09-05 02:52:07 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Audio;
2020-09-05 02:52:07 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
2020-09-08 16:21:29 +08:00
using osu.Framework.Graphics.Sprites;
2020-09-05 02:52:07 +08:00
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
2020-09-08 16:21:29 +08:00
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
2020-09-05 02:52:07 +08:00
using osuTK;
namespace osu.Game.Collections
{
2020-09-07 20:08:48 +08:00
public partial class ManageCollectionsDialog : OsuFocusedOverlayContainer
2020-09-05 02:52:07 +08:00
{
private const double enter_duration = 500;
private const double exit_duration = 200;
2021-10-07 19:57:14 +08:00
protected override string PopInSampleName => @"UI/overlay-big-pop-in";
protected override string PopOutSampleName => @"UI/overlay-big-pop-out";
[Resolved]
private MusicController? musicController { get; set; }
2020-09-07 20:08:48 +08:00
public ManageCollectionsDialog()
2020-09-05 02:52:07 +08:00
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
Size = new Vector2(0.5f, 0.8f);
Masking = true;
CornerRadius = 10;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio)
2020-09-05 02:52:07 +08:00
{
Children = new Drawable[]
{
new Box
{
Colour = colours.GreySeaFoamDark,
2020-09-05 02:52:07 +08:00
RelativeSizeAxes = Axes.Both,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
2020-09-05 02:52:07 +08:00
},
Content = new[]
{
new Drawable[]
{
2020-09-08 16:21:29 +08:00
new Container
2020-09-05 02:52:07 +08:00
{
2020-09-08 16:21:29 +08:00
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Manage collections",
Font = OsuFont.GetFont(size: 30),
Padding = new MarginPadding { Vertical = 10 },
},
new IconButton
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Icon = FontAwesome.Solid.Times,
Colour = colours.GreySeaFoamDarker,
2020-09-08 16:21:29 +08:00
Scale = new Vector2(0.8f),
X = -10,
Action = () => State.Value = Visibility.Hidden
}
}
2020-09-05 02:52:07 +08:00
}
},
new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeaFoamDarker
2020-09-05 02:52:07 +08:00
},
2020-09-05 02:55:43 +08:00
new DrawableCollectionList
2020-09-05 02:52:07 +08:00
{
RelativeSizeAxes = Axes.Both,
}
}
}
},
}
}
}
2020-09-05 02:52:07 +08:00
};
}
protected override void PopIn()
{
musicController?.Duck(100, 1f);
2020-09-05 02:52:07 +08:00
this.FadeIn(enter_duration, Easing.OutQuint);
this.ScaleTo(0.9f).Then().ScaleTo(1f, enter_duration, Easing.OutQuint);
2020-09-05 02:52:07 +08:00
}
protected override void PopOut()
{
base.PopOut();
musicController?.Unduck(100);
2021-10-07 19:57:14 +08:00
2020-09-05 02:52:07 +08:00
this.FadeOut(exit_duration, Easing.OutQuint);
this.ScaleTo(0.9f, exit_duration);
2020-09-05 03:43:51 +08:00
// Ensure that textboxes commit
GetContainingFocusManager()?.TriggerFocusContention(this);
2020-09-05 02:52:07 +08:00
}
}
}