2020-02-12 01:47:51 +08: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.
|
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2020-02-12 01:47:51 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2022-11-03 16:47:29 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2022-01-28 12:53:48 +08:00
|
|
|
|
using osu.Game.Resources.Localisation.Web;
|
2020-02-12 01:47:51 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Comments
|
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public abstract partial class CancellableCommentEditor : CommentEditor
|
2020-02-12 01:47:51 +08:00
|
|
|
|
{
|
|
|
|
|
public Action OnCancel;
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
ButtonsContainer.Add(new CancelButton
|
|
|
|
|
{
|
2020-02-12 05:57:06 +08:00
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
2020-02-12 01:47:51 +08:00
|
|
|
|
Action = () => OnCancel?.Invoke()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 13:32:20 +08:00
|
|
|
|
private partial class CancelButton : OsuHoverContainer
|
2020-02-12 01:47:51 +08:00
|
|
|
|
{
|
|
|
|
|
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
|
|
|
|
|
|
|
|
|
private readonly Box background;
|
|
|
|
|
|
|
|
|
|
public CancelButton()
|
2022-11-03 16:47:29 +08:00
|
|
|
|
: base(HoverSampleSet.Button)
|
2020-02-12 01:47:51 +08:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
Child = new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
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 },
|
2022-01-28 12:53:48 +08:00
|
|
|
|
Text = CommonStrings.ButtonsCancel
|
2020-02-12 01:47:51 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
|
|
|
|
{
|
2020-02-12 18:28:49 +08:00
|
|
|
|
IdleColour = colourProvider.Light4;
|
|
|
|
|
HoverColour = colourProvider.Light3;
|
2020-02-12 01:47:51 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|