mirror of
https://github.com/ppy/osu
synced 2024-12-15 03:16:17 +00:00
Cleanup.
This commit is contained in:
parent
2510a9fd32
commit
0745098783
@ -31,7 +31,8 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
AddStep("Strong Centre", () => addCentreHit(true));
|
||||
AddStep("Rim", () => addRimHit(false));
|
||||
AddStep("Strong Rim", () => addRimHit(true));
|
||||
AddStep("Add bar line", addBarLine);
|
||||
AddStep("Add bar line", () => addBarLine(false));
|
||||
AddStep("Add major bar line", () => addBarLine(true));
|
||||
|
||||
Add(new Container
|
||||
{
|
||||
@ -74,17 +75,15 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
});
|
||||
}
|
||||
|
||||
private void addBarLine()
|
||||
private void addBarLine(bool major)
|
||||
{
|
||||
bool isMajor = RNG.Next(8) == 0;
|
||||
|
||||
BarLine bl = new BarLine
|
||||
{
|
||||
StartTime = Time.Current + 1000,
|
||||
PreEmpt = 1000
|
||||
};
|
||||
|
||||
playfield.AddBarLine(isMajor ? new DrawableMajorBarLine(bl) : new DrawableBarLine(bl));
|
||||
playfield.AddBarLine(major ? new DrawableMajorBarLine(bl) : new DrawableBarLine(bl));
|
||||
}
|
||||
|
||||
private void addSwell()
|
||||
|
@ -13,6 +13,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
/// </summary>
|
||||
public class DrawableBarLine : Container
|
||||
{
|
||||
/// <summary>
|
||||
/// The width of the line tracker.
|
||||
/// </summary>
|
||||
private const float tracker_width = 2f;
|
||||
|
||||
/// <summary>
|
||||
/// Fade out time calibrated to a pre-empt of 1000ms.
|
||||
/// </summary>
|
||||
private const float base_fadeout_time = 100f;
|
||||
|
||||
/// <summary>
|
||||
/// The visual line tracker.
|
||||
/// </summary>
|
||||
@ -33,7 +43,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
RelativePositionAxes = Axes.X;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Width = 2f;
|
||||
Width = tracker_width;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
@ -41,9 +51,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
||||
EdgeSmoothness = new Vector2(0.5f, 0),
|
||||
Alpha = 0.75f
|
||||
}
|
||||
@ -58,7 +66,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
LifetimeEnd = BarLine.StartTime + BarLine.PreEmpt;
|
||||
|
||||
Delay(BarLine.StartTime - Time.Current);
|
||||
FadeOut(100 * BarLine.PreEmpt / 1000);
|
||||
FadeOut(base_fadeout_time * BarLine.PreEmpt / 1000);
|
||||
}
|
||||
|
||||
private void updateScrollPosition(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.PreEmpt));
|
||||
|
@ -10,6 +10,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableMajorBarLine : DrawableBarLine
|
||||
{
|
||||
/// <summary>
|
||||
/// The vertical offset of the triangles from the line tracker.
|
||||
/// </summary>
|
||||
private const float triangle_offfset = 10f;
|
||||
|
||||
/// <summary>
|
||||
/// The size of the triangles.
|
||||
/// </summary>
|
||||
private const float triangle_size = 20f;
|
||||
|
||||
public DrawableMajorBarLine(BarLine barLine)
|
||||
: base(barLine)
|
||||
{
|
||||
@ -17,33 +27,25 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new EquilateralTriangle
|
||||
{
|
||||
Name = "Top",
|
||||
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
Position = new Vector2(0, -10),
|
||||
Size = new Vector2(-20),
|
||||
|
||||
Position = new Vector2(0, -triangle_offfset),
|
||||
Size = new Vector2(-triangle_size),
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
},
|
||||
new EquilateralTriangle
|
||||
{
|
||||
Name = "Bottom",
|
||||
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
Position = new Vector2(0, 10),
|
||||
Size = new Vector2(20),
|
||||
|
||||
Position = new Vector2(0, triangle_offfset),
|
||||
Size = new Vector2(triangle_size),
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user