mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 11:02:54 +08:00
Make bar lines work again.
This commit is contained in:
parent
1f56848442
commit
de35ea22b1
@ -9,6 +9,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Rulesets.Mania.Timing;
|
using osu.Game.Rulesets.Mania.Timing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Mods
|
namespace osu.Game.Rulesets.Mania.Mods
|
||||||
{
|
{
|
||||||
@ -34,9 +35,9 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
hitObjectTimingChanges[maniaObject.Column].Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
|
hitObjectTimingChanges[maniaObject.Column].Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (BarLine barLine in hitRenderer.BarLines)
|
foreach (DrawableBarLine barLine in hitRenderer.BarLines)
|
||||||
{
|
{
|
||||||
var controlPoint = hitRenderer.CreateControlPointAt(barLine.StartTime);
|
var controlPoint = hitRenderer.CreateControlPointAt(barLine.HitObject.StartTime);
|
||||||
controlPoint.TimingPoint.BeatLength = 1000;
|
controlPoint.TimingPoint.BeatLength = 1000;
|
||||||
|
|
||||||
barlineTimingChanges.Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
|
barlineTimingChanges.Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
|
||||||
|
@ -6,7 +6,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
@ -36,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int PreferredColumns;
|
public int PreferredColumns;
|
||||||
|
|
||||||
public readonly List<BarLine> BarLines = new List<BarLine>();
|
public IEnumerable<DrawableBarLine> BarLines;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Per-column timing changes.
|
/// Per-column timing changes.
|
||||||
@ -58,9 +60,12 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
for (int i = 0; i < PreferredColumns; i++)
|
for (int i = 0; i < PreferredColumns; i++)
|
||||||
hitObjectTimingChanges[i] = new List<SpeedAdjustmentContainer>();
|
hitObjectTimingChanges[i] = new List<SpeedAdjustmentContainer>();
|
||||||
|
|
||||||
// Generate the bar line list
|
// Generate the bar lines
|
||||||
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
||||||
|
|
||||||
SortedList<TimingControlPoint> timingPoints = Beatmap.ControlPointInfo.TimingPoints;
|
SortedList<TimingControlPoint> timingPoints = Beatmap.ControlPointInfo.TimingPoints;
|
||||||
|
var barLines = new List<DrawableBarLine>();
|
||||||
|
|
||||||
for (int i = 0; i < timingPoints.Count; i++)
|
for (int i = 0; i < timingPoints.Count; i++)
|
||||||
{
|
{
|
||||||
TimingControlPoint point = timingPoints[i];
|
TimingControlPoint point = timingPoints[i];
|
||||||
@ -71,15 +76,17 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++)
|
for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++)
|
||||||
{
|
{
|
||||||
BarLines.Add(new BarLine
|
barLines.Add(new DrawableBarLine(new BarLine
|
||||||
{
|
{
|
||||||
StartTime = t,
|
StartTime = t,
|
||||||
ControlPoint = point,
|
ControlPoint = point,
|
||||||
BeatIndex = index
|
BeatIndex = index
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BarLines = barLines;
|
||||||
|
|
||||||
// Generate speed adjustments from mods first
|
// Generate speed adjustments from mods first
|
||||||
bool useDefaultSpeedAdjustments = true;
|
bool useDefaultSpeedAdjustments = true;
|
||||||
|
|
||||||
@ -97,6 +104,16 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
generateDefaultSpeedAdjustments();
|
generateDefaultSpeedAdjustments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
var maniaPlayfield = Playfield as ManiaPlayfield;
|
||||||
|
if (maniaPlayfield == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BarLines.ForEach(maniaPlayfield.Add);
|
||||||
|
}
|
||||||
|
|
||||||
private void generateDefaultSpeedAdjustments()
|
private void generateDefaultSpeedAdjustments()
|
||||||
{
|
{
|
||||||
defaultControlPoints.ForEach(c =>
|
defaultControlPoints.ForEach(c =>
|
||||||
|
@ -127,7 +127,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
Name = "Bar lines",
|
Name = "Bar lines",
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.Y
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
VisibleTimeRange = visibleTimeRange
|
||||||
// Width is set in the Update method
|
// Width is set in the Update method
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user