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 @@ private void load(OsuColour colours, OverlayColourProvider overlayColours)
Origin = Anchor.CentreLeft;
Masking = true;
CornerRadius = 5;
CornerRadius = 3;
InternalChildren = new Drawable[]
{
@ -53,33 +53,25 @@ private void load(OsuColour colours, OverlayColourProvider overlayColours)
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,
},
},
}

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.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 @@ private void load()
{
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);

View File

@ -12,8 +12,8 @@ public class EffectRowAttribute : RowAttribute
{
private readonly Bindable<bool> kiaiMode;
private readonly Bindable<bool> omitBarLine;
private AttributeBubbledWord kiaiModeBubble;
private AttributeBubbledWord omitBarLineBubble;
private AttributeText kiaiModeBubble;
private AttributeText omitBarLineBubble;
public EffectRowAttribute(EffectControlPoint effect)
: base(effect, "effect")
@ -27,8 +27,8 @@ private void load()
{
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);

View File

@ -5,14 +5,13 @@
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<string> sampleBank;
@ -32,15 +31,12 @@ private void load()
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 =>

View File

@ -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 @@ public TimingRowAttribute(TimingControlPoint timing)
[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);