Add DangerousButton for use in popup dialogs

This commit is contained in:
Dean Herbert
2022-03-21 16:06:32 +09:00
parent 31570d3114
commit b42081dd9b
3 changed files with 73 additions and 9 deletions

View File

@ -45,8 +45,9 @@ namespace osu.Game.Graphics.UserInterface
}
}
protected readonly Container ColourContainer;
private readonly Container backgroundContainer;
private readonly Container colourContainer;
private readonly Container glowContainer;
private readonly Box leftGlow;
private readonly Box centerGlow;
@ -113,7 +114,7 @@ namespace osu.Game.Graphics.UserInterface
Masking = true,
Children = new Drawable[]
{
colourContainer = new Container
ColourContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
@ -182,7 +183,7 @@ namespace osu.Game.Graphics.UserInterface
{
buttonColour = value;
updateGlow();
colourContainer.Colour = value;
ColourContainer.Colour = value;
}
}
@ -230,11 +231,11 @@ namespace osu.Game.Graphics.UserInterface
Alpha = 0.05f
};
colourContainer.Add(flash);
ColourContainer.Add(flash);
flash.FadeOutFromOne(100).Expire();
clickAnimating = true;
colourContainer.ResizeWidthTo(colourContainer.Width * 1.05f, 100, Easing.OutQuint)
ColourContainer.ResizeWidthTo(ColourContainer.Width * 1.05f, 100, Easing.OutQuint)
.OnComplete(_ =>
{
clickAnimating = false;
@ -246,14 +247,14 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnMouseDown(MouseDownEvent e)
{
colourContainer.ResizeWidthTo(hover_width * 0.98f, click_duration * 4, Easing.OutQuad);
ColourContainer.ResizeWidthTo(hover_width * 0.98f, click_duration * 4, Easing.OutQuad);
return base.OnMouseDown(e);
}
protected override void OnMouseUp(MouseUpEvent e)
{
if (State == SelectionState.Selected)
colourContainer.ResizeWidthTo(hover_width, click_duration, Easing.In);
ColourContainer.ResizeWidthTo(hover_width, click_duration, Easing.In);
base.OnMouseUp(e);
}
@ -279,12 +280,12 @@ namespace osu.Game.Graphics.UserInterface
if (newState == SelectionState.Selected)
{
spriteText.TransformSpacingTo(hoverSpacing, hover_duration, Easing.OutElastic);
colourContainer.ResizeWidthTo(hover_width, hover_duration, Easing.OutElastic);
ColourContainer.ResizeWidthTo(hover_width, hover_duration, Easing.OutElastic);
glowContainer.FadeIn(hover_duration, Easing.OutQuint);
}
else
{
colourContainer.ResizeWidthTo(idle_width, hover_duration, Easing.OutElastic);
ColourContainer.ResizeWidthTo(idle_width, hover_duration, Easing.OutElastic);
spriteText.TransformSpacingTo(Vector2.Zero, hover_duration, Easing.OutElastic);
glowContainer.FadeOut(hover_duration, Easing.OutQuint);
}