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

Add fade in/out animations to mod settings container

This commit is contained in:
Joehu 2020-12-06 11:35:14 -08:00
parent 56699df0cf
commit 0f9b38da08
2 changed files with 15 additions and 3 deletions

View File

@ -237,7 +237,7 @@ namespace osu.Game.Overlays.Mods
{
Width = 180,
Text = "Customisation",
Action = () => ModSettingsContainer.Alpha = ModSettingsContainer.Alpha == 1 ? 0 : 1,
Action = () => ModSettingsContainer.ToggleVisibility(),
Enabled = { Value = false },
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
@ -430,7 +430,7 @@ namespace osu.Game.Overlays.Mods
DeselectTypes(selectedMod.IncompatibleMods, true);
if (selectedMod.RequiresConfiguration) ModSettingsContainer.Alpha = 1;
if (selectedMod.RequiresConfiguration) ModSettingsContainer.Show();
}
else
{

View File

@ -17,7 +17,7 @@ using osuTK.Graphics;
namespace osu.Game.Overlays.Mods
{
public class ModSettingsContainer : Container
public class ModSettingsContainer : VisibilityContainer
{
public readonly IBindable<IReadOnlyList<Mod>> SelectedMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
@ -27,6 +27,8 @@ namespace osu.Game.Overlays.Mods
private readonly FillFlowContainer<ModControlSection> modSettingsContent;
private const double transition_duration = 200;
public ModSettingsContainer()
{
Children = new Drawable[]
@ -80,5 +82,15 @@ namespace osu.Game.Overlays.Mods
protected override bool OnMouseDown(MouseDownEvent e) => true;
protected override bool OnHover(HoverEvent e) => true;
protected override void PopIn()
{
this.FadeIn(transition_duration, Easing.OutQuint);
}
protected override void PopOut()
{
this.FadeOut(transition_duration, Easing.OutQuint);
}
}
}