From 5bce5d2057eebe74115edb5f1dbc53ceaf6e3738 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 19 Apr 2021 17:57:07 +0900 Subject: [PATCH] Update design logic --- osu.Game/Screens/Edit/Timing/RowAttribute.cs | 36 ++++------ .../RowAttributes/AttributeBubbledWord.cs | 71 ------------------- .../Timing/RowAttributes/AttributeText.cs | 32 +++++++++ .../RowAttributes/DifficultyRowAttribute.cs | 14 ++-- .../RowAttributes/EffectRowAttribute.cs | 8 +-- .../RowAttributes/SampleRowAttribute.cs | 16 ++--- .../RowAttributes/TimingRowAttribute.cs | 9 +-- 7 files changed, 62 insertions(+), 124 deletions(-) delete mode 100644 osu.Game/Screens/Edit/Timing/RowAttributes/AttributeBubbledWord.cs create mode 100644 osu.Game/Screens/Edit/Timing/RowAttributes/AttributeText.cs diff --git a/osu.Game/Screens/Edit/Timing/RowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttribute.cs index e184907751..74d43628e1 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttribute.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Edit.Timing Origin = Anchor.CentreLeft; Masking = true; - CornerRadius = 5; + CornerRadius = 3; InternalChildren = new Drawable[] { @@ -53,33 +53,25 @@ namespace osu.Game.Screens.Edit.Timing RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Right = 5 }, + Margin = new MarginPadding { Horizontal = 5 }, Spacing = new Vector2(5), Children = new Drawable[] { - new Container + new Circle { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Children = new Drawable[] - { - new Box - { - Colour = Point.GetRepresentingColour(colours), - RelativeSizeAxes = Axes.Both, - }, - new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Padding = new MarginPadding(3), - Font = OsuFont.Default.With(weight: FontWeight.SemiBold, size: 12), - Text = label, - Colour = overlayColours.Background5, - }, - }, + Colour = Point.GetRepresentingColour(colours), + RelativeSizeAxes = Axes.Y, + Size = new Vector2(4, 0.6f), + }, + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Padding = new MarginPadding(3), + Font = OsuFont.Default.With(weight: FontWeight.Bold, size: 12), + Text = label, }, }, } diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeBubbledWord.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeBubbledWord.cs deleted file mode 100644 index 7d7ad61de2..0000000000 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeBubbledWord.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Overlays; - -namespace osu.Game.Screens.Edit.Timing.RowAttributes -{ - public class AttributeBubbledWord : CompositeDrawable - { - private readonly ControlPoint controlPoint; - - private OsuSpriteText textDrawable; - - private string text; - - public string Text - { - get => text; - set - { - if (value == text) - return; - - text = value; - if (textDrawable != null) - textDrawable.Text = text; - } - } - - public AttributeBubbledWord(ControlPoint controlPoint) - { - this.controlPoint = controlPoint; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours, OverlayColourProvider overlayColours) - { - AutoSizeAxes = Axes.X; - - Anchor = Anchor.CentreLeft; - Origin = Anchor.CentreLeft; - - Height = 12; - - InternalChildren = new Drawable[] - { - new Circle - { - Colour = controlPoint.GetRepresentingColour(colours), - RelativeSizeAxes = Axes.Both, - }, - textDrawable = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Padding = new MarginPadding(6), - Font = OsuFont.Default.With(weight: FontWeight.SemiBold, size: 12), - Text = text, - Colour = overlayColours.Background5, - }, - }; - } - } -} diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeText.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeText.cs new file mode 100644 index 0000000000..d0a51f9faa --- /dev/null +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeText.cs @@ -0,0 +1,32 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Screens.Edit.Timing.RowAttributes +{ + public class AttributeText : OsuSpriteText + { + private readonly ControlPoint controlPoint; + + public AttributeText(ControlPoint controlPoint) + { + this.controlPoint = controlPoint; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Anchor = Anchor.CentreLeft; + Origin = Anchor.CentreLeft; + + Padding = new MarginPadding(6); + Font = OsuFont.Default.With(weight: FontWeight.Bold, size: 12); + Colour = controlPoint.GetRepresentingColour(colours); + } + } +} diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/DifficultyRowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/DifficultyRowAttribute.cs index 1fdd8c2708..7b553ac7ad 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/DifficultyRowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/DifficultyRowAttribute.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Edit.Timing.RowAttributes @@ -27,17 +26,14 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes { Content.AddRange(new Drawable[] { - text = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Width = 40, - Font = OsuFont.GetFont(size: EditorTable.TEXT_SIZE, weight: FontWeight.Regular), - }, new AttributeProgressBar(Point) { Current = speedMultiplier, - } + }, + text = new AttributeText(Point) + { + Width = 40, + }, }); speedMultiplier.BindValueChanged(_ => updateText(), true); diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs index e7fc57e2c9..812407d6da 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs @@ -12,8 +12,8 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes { private readonly Bindable kiaiMode; private readonly Bindable omitBarLine; - private AttributeBubbledWord kiaiModeBubble; - private AttributeBubbledWord omitBarLineBubble; + private AttributeText kiaiModeBubble; + private AttributeText omitBarLineBubble; public EffectRowAttribute(EffectControlPoint effect) : base(effect, "effect") @@ -27,8 +27,8 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes { Content.AddRange(new Drawable[] { - kiaiModeBubble = new AttributeBubbledWord(Point) { Text = "kiai" }, - omitBarLineBubble = new AttributeBubbledWord(Point) { Text = "no barline" }, + kiaiModeBubble = new AttributeText(Point) { Text = "kiai" }, + omitBarLineBubble = new AttributeText(Point) { Text = "no barline" }, }); kiaiMode.BindValueChanged(enabled => kiaiModeBubble.FadeTo(enabled.NewValue ? 1 : 0), true); diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/SampleRowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/SampleRowAttribute.cs index 066b180423..ac0797dba1 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/SampleRowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/SampleRowAttribute.cs @@ -5,14 +5,13 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Edit.Timing.RowAttributes { public class SampleRowAttribute : RowAttribute { - private AttributeBubbledWord sampleText; + private AttributeText sampleText; private OsuSpriteText volumeText; private readonly Bindable sampleBank; @@ -32,15 +31,12 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes Content.AddRange(new Drawable[] { - volumeText = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Width = 30, - Font = OsuFont.GetFont(size: EditorTable.TEXT_SIZE, weight: FontWeight.Regular), - }, + sampleText = new AttributeText(Point), progress = new AttributeProgressBar(Point), - sampleText = new AttributeBubbledWord(Point), + volumeText = new AttributeText(Point) + { + Width = 40, + }, }); volume.BindValueChanged(vol => diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs index c6e2649f8e..ab840e56a7 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs @@ -4,10 +4,8 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; -using osu.Framework.Graphics; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Timing; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Edit.Timing.RowAttributes @@ -28,12 +26,7 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes [BackgroundDependencyLoader] private void load() { - Content.Add(text = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Font = OsuFont.GetFont(size: EditorTable.TEXT_SIZE, weight: FontWeight.Regular), - }); + Content.Add(text = new AttributeText(Point)); timeSignature.BindValueChanged(_ => updateText()); beatLength.BindValueChanged(_ => updateText(), true);