1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:55:35 +08:00

Update popover not to use labelled drawables

This commit is contained in:
ansel 2022-10-17 13:42:17 +03:00
parent d7e5bcbd3c
commit ffa22d8a68
2 changed files with 33 additions and 15 deletions

View File

@ -570,10 +570,7 @@ namespace osu.Game.Overlays.Comments
} }
} }
public Popover GetPopover() public Popover GetPopover() => new ReportCommentPopover(ReportComment);
{
return new ReportCommentPopover(ReportComment);
}
private class ReportToast : Toast private class ReportToast : Toast
{ {

View File

@ -8,7 +8,10 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Resources.Localisation.Web;
using osuTK; using osuTK;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments
@ -16,8 +19,8 @@ namespace osu.Game.Overlays.Comments
public class ReportCommentPopover : OsuPopover public class ReportCommentPopover : OsuPopover
{ {
private readonly Action<CommentReportReason, string> action; private readonly Action<CommentReportReason, string> action;
private LabelledEnumDropdown<CommentReportReason> reason = null!; private OsuEnumDropdown<CommentReportReason> reason = null!;
private LabelledTextBox info = null!; private OsuTextBox info = null!;
private ShakeContainer shaker = null!; private ShakeContainer shaker = null!;
public ReportCommentPopover(Action<CommentReportReason, string> action) public ReportCommentPopover(Action<CommentReportReason, string> action)
@ -36,13 +39,28 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(7), Spacing = new Vector2(7),
Children = new Drawable[] Children = new Drawable[]
{ {
reason = new LabelledEnumDropdown<CommentReportReason> new OsuSpriteText
{ {
Label = "Reason" Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Text = UsersStrings.ReportReason,
Font = OsuFont.Torus.With(size: 20),
}, },
info = new LabelledTextBox reason = new OsuEnumDropdown<CommentReportReason>
{ {
Label = "Additional info", RelativeSizeAxes = Axes.X
},
new OsuSpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Text = UsersStrings.ReportComments,
Font = OsuFont.Torus.With(size: 20),
},
info = new OsuTextBox
{
RelativeSizeAxes = Axes.X,
PlaceholderText = UsersStrings.ReportPlaceholder
}, },
new Container new Container
{ {
@ -54,10 +72,13 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Child = new RoundedButton Child = new RoundedButton
{ {
BackgroundColour = colours.Pink3, Origin = Anchor.TopCentre,
Text = "Send report", Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X, Width = 200,
Action = send BackgroundColour = colours.Red3,
Text = UsersStrings.ReportActionsSend,
Action = send,
Margin = new MarginPadding { Bottom = 5, Top = 10 },
} }
} }
} }
@ -70,7 +91,7 @@ namespace osu.Game.Overlays.Comments
string infoValue = info.Current.Value; string infoValue = info.Current.Value;
var reasonValue = reason.Current.Value; var reasonValue = reason.Current.Value;
if (reasonValue == CommentReportReason.Other && string.IsNullOrWhiteSpace(infoValue)) if (string.IsNullOrWhiteSpace(infoValue))
{ {
shaker.Shake(); shaker.Shake();
return; return;