Centralise implementation of cancel button logic

This commit is contained in:
Dean Herbert 2021-05-11 11:00:57 +09:00
parent b248b2e5e3
commit 1bb3c609ae
3 changed files with 21 additions and 17 deletions

View File

@ -0,0 +1,18 @@
// 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;
namespace osu.Game.Graphics.UserInterface
{
public class DangerousTriangleButton : TriangleButton
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = colours.PinkDark;
Triangles.ColourDark = colours.PinkDarker;
Triangles.ColourLight = colours.Pink;
}
}
}

View File

@ -339,22 +339,13 @@ public CancelButton()
}
}
public class ClearButton : TriangleButton
public class ClearButton : DangerousTriangleButton
{
public ClearButton()
{
Text = "Clear";
Size = new Vector2(80, 20);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = colours.Pink;
Triangles.ColourDark = colours.PinkDark;
Triangles.ColourLight = colours.PinkLight;
}
}
public class KeyButton : Container

View File

@ -11,7 +11,6 @@
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets;
using osuTK;
using osu.Game.Graphics;
namespace osu.Game.Overlays.KeyBinding
{
@ -55,10 +54,10 @@ private void load(KeyBindingStore store)
}
}
public class ResetButton : TriangleButton
public class ResetButton : DangerousTriangleButton
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load()
{
Text = "Reset all bindings in section";
RelativeSizeAxes = Axes.X;
@ -66,10 +65,6 @@ private void load(OsuColour colours)
Height = 20;
Content.CornerRadius = 5;
BackgroundColour = colours.PinkDark;
Triangles.ColourDark = colours.PinkDarker;
Triangles.ColourLight = colours.Pink;
}
}
}