2020-09-04 18:52:07 +00: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.
|
|
|
|
|
2024-07-04 05:23:35 +00:00
|
|
|
using System;
|
2020-09-04 18:52:07 +00:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2020-09-08 08:21:29 +00:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2020-09-04 18:52:07 +00:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2020-09-08 08:21:29 +00:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2024-06-21 16:57:14 +00:00
|
|
|
using osu.Game.Overlays;
|
2020-09-04 18:52:07 +00:00
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Collections
|
|
|
|
{
|
2020-09-07 12:08:48 +00:00
|
|
|
public partial class ManageCollectionsDialog : OsuFocusedOverlayContainer
|
2020-09-04 18:52:07 +00:00
|
|
|
{
|
|
|
|
private const double enter_duration = 500;
|
|
|
|
private const double exit_duration = 200;
|
2021-10-07 11:57:14 +00:00
|
|
|
|
2023-08-17 08:03:45 +00:00
|
|
|
protected override string PopInSampleName => @"UI/overlay-big-pop-in";
|
|
|
|
protected override string PopOutSampleName => @"UI/overlay-big-pop-out";
|
|
|
|
|
2024-07-05 05:41:50 +00:00
|
|
|
private IDisposable? duckOperation;
|
2024-07-04 05:23:35 +00:00
|
|
|
|
2024-06-21 16:57:14 +00:00
|
|
|
[Resolved]
|
|
|
|
private MusicController? musicController { get; set; }
|
|
|
|
|
2020-09-07 12:08:48 +00:00
|
|
|
public ManageCollectionsDialog()
|
2020-09-04 18:52:07 +00:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
Size = new Vector2(0.5f, 0.8f);
|
|
|
|
|
|
|
|
Masking = true;
|
|
|
|
CornerRadius = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2024-07-04 05:23:35 +00:00
|
|
|
private void load(OsuColour colours)
|
2020-09-04 18:52:07 +00:00
|
|
|
{
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
2021-12-10 05:15:00 +00:00
|
|
|
Colour = colours.GreySeaFoamDark,
|
2020-09-04 18:52:07 +00:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Child = new GridContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
2020-09-08 07:43:07 +00:00
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
2020-09-04 18:52:07 +00:00
|
|
|
},
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
2020-09-08 08:21:29 +00:00
|
|
|
new Container
|
2020-09-04 18:52:07 +00:00
|
|
|
{
|
2020-09-08 08:21:29 +00: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,
|
2021-12-10 05:15:00 +00:00
|
|
|
Colour = colours.GreySeaFoamDarker,
|
2020-09-08 08:21:29 +00:00
|
|
|
Scale = new Vector2(0.8f),
|
|
|
|
X = -10,
|
|
|
|
Action = () => State.Value = Visibility.Hidden
|
|
|
|
}
|
|
|
|
}
|
2020-09-04 18:52:07 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-12-10 05:15:00 +00:00
|
|
|
Colour = colours.GreySeaFoamDarker
|
2020-09-04 18:52:07 +00:00
|
|
|
},
|
2020-09-04 18:55:43 +00:00
|
|
|
new DrawableCollectionList
|
2020-09-04 18:52:07 +00:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2024-06-21 16:57:14 +00:00
|
|
|
}
|
2020-09-04 18:52:07 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-07-04 05:23:35 +00:00
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
{
|
|
|
|
base.Dispose(isDisposing);
|
2024-07-05 05:41:50 +00:00
|
|
|
duckOperation?.Dispose();
|
2024-07-04 05:23:35 +00:00
|
|
|
}
|
|
|
|
|
2020-09-04 18:52:07 +00:00
|
|
|
protected override void PopIn()
|
|
|
|
{
|
2024-07-05 05:41:50 +00:00
|
|
|
duckOperation = musicController?.Duck(new DuckParameters
|
|
|
|
{
|
|
|
|
DuckVolumeTo = 1,
|
2024-07-05 09:38:24 +00:00
|
|
|
DuckDuration = 100,
|
2024-07-05 05:41:50 +00:00
|
|
|
RestoreDuration = 100,
|
|
|
|
});
|
2024-06-21 16:57:14 +00:00
|
|
|
|
2020-09-04 18:52:07 +00:00
|
|
|
this.FadeIn(enter_duration, Easing.OutQuint);
|
2020-09-08 03:47:21 +00:00
|
|
|
this.ScaleTo(0.9f).Then().ScaleTo(1f, enter_duration, Easing.OutQuint);
|
2020-09-04 18:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void PopOut()
|
|
|
|
{
|
|
|
|
base.PopOut();
|
|
|
|
|
2024-07-05 05:41:50 +00:00
|
|
|
duckOperation?.Dispose();
|
2021-10-07 11:57:14 +00:00
|
|
|
|
2020-09-04 18:52:07 +00:00
|
|
|
this.FadeOut(exit_duration, Easing.OutQuint);
|
|
|
|
this.ScaleTo(0.9f, exit_duration);
|
2020-09-04 19:43:51 +00:00
|
|
|
|
|
|
|
// Ensure that textboxes commit
|
2024-05-22 13:27:53 +00:00
|
|
|
GetContainingFocusManager()?.TriggerFocusContention(this);
|
2020-09-04 18:52:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|