diff --git a/osu.Game.Rulesets.Mania/Objects/Barline.cs b/osu.Game.Rulesets.Mania/Objects/Barline.cs
index a9ce0559dc..9b229a8d52 100644
--- a/osu.Game.Rulesets.Mania/Objects/Barline.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Barline.cs
@@ -1,9 +1,19 @@
+using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mania.Objects
{
- public class Barline : HitObject
+ public class Barline : ManiaHitObject
{
- public bool IsMajor;
+ ///
+ /// The control point which this bar line is part of.
+ ///
+ public TimingControlPoint ControlPoint;
+
+ ///
+ /// The index of the beat which this bar line represents within the control point.
+ /// This is a "major" beat at % == 0.
+ ///
+ public int BeatIndex;
}
}
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs
index 605b9f83df..eee32a9da3 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs
@@ -1,7 +1,72 @@
+// Copyright (c) 2007-2017 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System;
+using OpenTK;
+using OpenTK.Input;
+using osu.Framework.Configuration;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Rulesets.Objects.Drawables;
+
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
- public class DrawableBarline
+ ///
+ /// Visualises a . Although this derives DrawableManiaHitObject,
+ /// this does not handle input/sound like a normal hit object.
+ ///
+ public class DrawableBarline : DrawableManiaHitObject
{
-
+ public DrawableBarline(Barline hitObject)
+ : base(hitObject, null)
+ {
+ AutoSizeAxes = Axes.Y;
+ RelativeSizeAxes = Axes.X;
+
+ Add(new Box
+ {
+ Anchor = Anchor.BottomCentre,
+ Origin = Anchor.BottomCentre,
+ RelativeSizeAxes = Axes.X,
+ Height = 1
+ });
+
+ int signatureRelativeIndex = hitObject.BeatIndex % (int)hitObject.ControlPoint.TimeSignature;
+
+ switch (signatureRelativeIndex)
+ {
+ case 0:
+ Add(new EquilateralTriangle
+ {
+ Name = "Left triangle",
+ Anchor = Anchor.BottomLeft,
+ Origin = Anchor.TopCentre,
+ Size = new Vector2(12),
+ X = -9,
+ Rotation = 90,
+ BypassAutoSizeAxes = Axes.Both
+ });
+
+ Add(new EquilateralTriangle
+ {
+ Name = "Right triangle",
+ Anchor = Anchor.BottomRight,
+ Origin = Anchor.TopCentre,
+ Size = new Vector2(12),
+ X = 9,
+ Rotation = -90,
+ BypassAutoSizeAxes = Axes.Both,
+ });
+ break;
+ case 1:
+ case 3:
+ Alpha = 0.2f;
+ break;
+ }
+ }
+
+ protected override void UpdateState(ArmedState state)
+ {
+ }
}
}
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs
deleted file mode 100644
index 607cc66012..0000000000
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace osu.Game.Rulesets.Mania.Objects.Drawables
-{
- public class DrawableMajorBarline
- {
-
- }
-}
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs
index 95b7979e43..871306b98c 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs
@@ -6,9 +6,11 @@ using System.Collections.Generic;
using System.Linq;
using OpenTK;
using OpenTK.Input;
+using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Lists;
+using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Beatmaps;
@@ -85,6 +87,33 @@ namespace osu.Game.Rulesets.Mania.UI
};
}
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ var maniaPlayfield = (ManiaPlayfield)Playfield;
+
+ double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
+
+ SortedList timingPoints = Beatmap.ControlPointInfo.TimingPoints;
+ for (int i = 0; i < timingPoints.Count; i++)
+ {
+ TimingControlPoint point = timingPoints[i];
+
+ double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - point.BeatLength : lastObjectTime + point.BeatLength * (int)point.TimeSignature;
+
+ int index = 0;
+ for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++)
+ {
+ maniaPlayfield.Add(new DrawableBarline(new Barline
+ {
+ StartTime = t,
+ ControlPoint = point,
+ BeatIndex = index
+ }));
+ }
+ }
+ }
+
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this);
protected override BeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter();
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
index ff763f87c4..dcf725e091 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
@@ -21,6 +21,7 @@ using osu.Game.Rulesets.Mania.Timing;
using osu.Framework.Input;
using osu.Framework.Graphics.Transforms;
using osu.Framework.MathUtils;
+using osu.Game.Rulesets.Mania.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.UI
{
@@ -77,27 +78,40 @@ namespace osu.Game.Rulesets.Mania.UI
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
- RelativeSizeAxes = Axes.Y,
- AutoSizeAxes = Axes.X,
+ RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new Drawable[]
{
- new Box
+ new Container
{
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black
- },
- columns = new FillFlowContainer
- {
- Name = "Columns",
+ Name = "Masked elements",
+ Anchor = Anchor.TopCentre,
+ Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
- Direction = FillDirection.Horizontal,
- Padding = new MarginPadding { Left = 1, Right = 1 },
- Spacing = new Vector2(1, 0)
+ Masking = true,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black
+ },
+ columns = new FillFlowContainer
+ {
+ Name = "Columns",
+ RelativeSizeAxes = Axes.Y,
+ AutoSizeAxes = Axes.X,
+ Direction = FillDirection.Horizontal,
+ Padding = new MarginPadding { Left = 1, Right = 1 },
+ Spacing = new Vector2(1, 0)
+ }
+ }
},
new Container
{
+ Anchor = Anchor.TopCentre,
+ Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = HIT_TARGET_POSITION },
Children = new[]
@@ -105,7 +119,10 @@ namespace osu.Game.Rulesets.Mania.UI
barlineContainer = new ControlPointContainer(timingChanges)
{
Name = "Bar lines",
- RelativeSizeAxes = Axes.Both,
+ Anchor = Anchor.TopCentre,
+ Origin = Anchor.TopCentre,
+ RelativeSizeAxes = Axes.Y
+ // Width is set in the Update method
}
}
}
@@ -190,6 +207,7 @@ namespace osu.Game.Rulesets.Mania.UI
}
public override void Add(DrawableHitObject h) => Columns.ElementAt(h.HitObject.Column).Add(h);
+ public void Add(DrawableBarline barline) => barlineContainer.Add(barline);
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
@@ -234,6 +252,13 @@ namespace osu.Game.Rulesets.Mania.UI
TransformTo(() => TimeSpan, newTimeSpan, duration, easing, new TransformTimeSpan());
}
+ protected override void Update()
+ {
+ // Due to masking differences, it is not possible to get the width of the columns container automatically
+ // While masking on effectively only the Y-axis, so we need to set the width of the bar line container manually
+ barlineContainer.Width = columns.Width;
+ }
+
private class TransformTimeSpan : Transform
{
public override double CurrentValue
diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj
index b45ce3c5df..cc5e6dd81e 100644
--- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj
+++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj
@@ -63,7 +63,6 @@
-