mirror of https://github.com/ppy/osu
Rebase CancelButton to RoundedButton
This commit is contained in:
parent
25ddd20b2e
commit
a874345da0
|
@ -2,15 +2,12 @@
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments
|
namespace osu.Game.Overlays.Comments
|
||||||
|
@ -30,45 +27,22 @@ private void load()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class CancelButton : OsuHoverContainer
|
private sealed partial class CancelButton : RoundedButton
|
||||||
{
|
{
|
||||||
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
|
||||||
|
|
||||||
private readonly Box background;
|
|
||||||
|
|
||||||
public CancelButton()
|
public CancelButton()
|
||||||
: base(HoverSampleSet.Button)
|
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
Height = 25;
|
||||||
Child = new CircularContainer
|
AutoSizeAxes = Axes.X;
|
||||||
{
|
|
||||||
Masking = true,
|
|
||||||
Height = 25,
|
|
||||||
AutoSizeAxes = Axes.X,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
background = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
|
||||||
Margin = new MarginPadding { Horizontal = 20 },
|
|
||||||
Text = CommonStrings.ButtonsCancel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
protected override SpriteText CreateText() => new OsuSpriteText
|
||||||
private void load(OverlayColourProvider colourProvider)
|
|
||||||
{
|
{
|
||||||
IdleColour = colourProvider.Light4;
|
Anchor = Anchor.Centre,
|
||||||
HoverColour = colourProvider.Light3;
|
Origin = Anchor.Centre,
|
||||||
}
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||||
|
Margin = new MarginPadding { Horizontal = 20 },
|
||||||
|
Text = CommonStrings.ButtonsCancel
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue