Update design logic

This commit is contained in:
Dean Herbert
2021-04-19 17:57:07 +09:00
parent 1e6a9cec61
commit 5bce5d2057
7 changed files with 62 additions and 124 deletions

View File

@ -39,7 +39,7 @@ namespace osu.Game.Screens.Edit.Timing
Origin = Anchor.CentreLeft; Origin = Anchor.CentreLeft;
Masking = true; Masking = true;
CornerRadius = 5; CornerRadius = 3;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
@ -53,33 +53,25 @@ namespace osu.Game.Screens.Edit.Timing
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Margin = new MarginPadding { Right = 5 }, Margin = new MarginPadding { Horizontal = 5 },
Spacing = new Vector2(5), Spacing = new Vector2(5),
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new Circle
{ {
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Children = new Drawable[] Colour = Point.GetRepresentingColour(colours),
{ RelativeSizeAxes = Axes.Y,
new Box Size = new Vector2(4, 0.6f),
{ },
Colour = Point.GetRepresentingColour(colours), new OsuSpriteText
RelativeSizeAxes = Axes.Both, {
}, Anchor = Anchor.CentreLeft,
new OsuSpriteText Origin = Anchor.CentreLeft,
{ Padding = new MarginPadding(3),
Anchor = Anchor.CentreLeft, Font = OsuFont.Default.With(weight: FontWeight.Bold, size: 12),
Origin = Anchor.CentreLeft, Text = label,
Padding = new MarginPadding(3),
Font = OsuFont.Default.With(weight: FontWeight.SemiBold, size: 12),
Text = label,
Colour = overlayColours.Background5,
},
},
}, },
}, },
} }

View File

@ -1,71 +0,0 @@
// 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;
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,
},
};
}
}
}

View File

@ -0,0 +1,32 @@
// 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;
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);
}
}
}

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Edit.Timing.RowAttributes namespace osu.Game.Screens.Edit.Timing.RowAttributes
@ -27,17 +26,14 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
{ {
Content.AddRange(new Drawable[] 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) new AttributeProgressBar(Point)
{ {
Current = speedMultiplier, Current = speedMultiplier,
} },
text = new AttributeText(Point)
{
Width = 40,
},
}); });
speedMultiplier.BindValueChanged(_ => updateText(), true); speedMultiplier.BindValueChanged(_ => updateText(), true);

View File

@ -12,8 +12,8 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
{ {
private readonly Bindable<bool> kiaiMode; private readonly Bindable<bool> kiaiMode;
private readonly Bindable<bool> omitBarLine; private readonly Bindable<bool> omitBarLine;
private AttributeBubbledWord kiaiModeBubble; private AttributeText kiaiModeBubble;
private AttributeBubbledWord omitBarLineBubble; private AttributeText omitBarLineBubble;
public EffectRowAttribute(EffectControlPoint effect) public EffectRowAttribute(EffectControlPoint effect)
: base(effect, "effect") : base(effect, "effect")
@ -27,8 +27,8 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
{ {
Content.AddRange(new Drawable[] Content.AddRange(new Drawable[]
{ {
kiaiModeBubble = new AttributeBubbledWord(Point) { Text = "kiai" }, kiaiModeBubble = new AttributeText(Point) { Text = "kiai" },
omitBarLineBubble = new AttributeBubbledWord(Point) { Text = "no barline" }, omitBarLineBubble = new AttributeText(Point) { Text = "no barline" },
}); });
kiaiMode.BindValueChanged(enabled => kiaiModeBubble.FadeTo(enabled.NewValue ? 1 : 0), true); kiaiMode.BindValueChanged(enabled => kiaiModeBubble.FadeTo(enabled.NewValue ? 1 : 0), true);

View File

@ -5,14 +5,13 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Edit.Timing.RowAttributes namespace osu.Game.Screens.Edit.Timing.RowAttributes
{ {
public class SampleRowAttribute : RowAttribute public class SampleRowAttribute : RowAttribute
{ {
private AttributeBubbledWord sampleText; private AttributeText sampleText;
private OsuSpriteText volumeText; private OsuSpriteText volumeText;
private readonly Bindable<string> sampleBank; private readonly Bindable<string> sampleBank;
@ -32,15 +31,12 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
Content.AddRange(new Drawable[] Content.AddRange(new Drawable[]
{ {
volumeText = new OsuSpriteText sampleText = new AttributeText(Point),
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 30,
Font = OsuFont.GetFont(size: EditorTable.TEXT_SIZE, weight: FontWeight.Regular),
},
progress = new AttributeProgressBar(Point), progress = new AttributeProgressBar(Point),
sampleText = new AttributeBubbledWord(Point), volumeText = new AttributeText(Point)
{
Width = 40,
},
}); });
volume.BindValueChanged(vol => volume.BindValueChanged(vol =>

View File

@ -4,10 +4,8 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Edit.Timing.RowAttributes namespace osu.Game.Screens.Edit.Timing.RowAttributes
@ -28,12 +26,7 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Content.Add(text = new OsuSpriteText Content.Add(text = new AttributeText(Point));
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: EditorTable.TEXT_SIZE, weight: FontWeight.Regular),
});
timeSignature.BindValueChanged(_ => updateText()); timeSignature.BindValueChanged(_ => updateText());
beatLength.BindValueChanged(_ => updateText(), true); beatLength.BindValueChanged(_ => updateText(), true);