mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:12:57 +08:00
Remove more dependencies
This commit is contained in:
parent
2769f6c47b
commit
8aac1f50ee
@ -5,14 +5,9 @@ using OpenTK;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose;
|
using osu.Game.Screens.Edit.Screens.Compose;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit
|
namespace osu.Game.Rulesets.Mania.Edit
|
||||||
{
|
{
|
||||||
@ -20,8 +15,6 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
{
|
{
|
||||||
public BindableBeatDivisor BeatDivisor;
|
public BindableBeatDivisor BeatDivisor;
|
||||||
|
|
||||||
public List<EditSnapLine> EditSnapLines;
|
|
||||||
|
|
||||||
public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap)
|
||||||
{
|
{
|
||||||
@ -37,60 +30,6 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
|
|
||||||
public void OnBeatSnapDivisorChange(int newDivisor)
|
public void OnBeatSnapDivisorChange(int newDivisor)
|
||||||
{
|
{
|
||||||
generateEditSnapLines(newDivisor);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateEditSnapLines(int newDivisor)
|
|
||||||
{
|
|
||||||
// Generate the edit lines
|
|
||||||
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
|
||||||
|
|
||||||
var timingPoints = Beatmap.ControlPointInfo.TimingPoints;
|
|
||||||
EditSnapLines = new List<EditSnapLine>();
|
|
||||||
|
|
||||||
// Create lines before the beginning of the first timing point
|
|
||||||
if (timingPoints.Any())
|
|
||||||
{
|
|
||||||
double step = timingPoints[0].BeatLength / newDivisor;
|
|
||||||
int index = (int)(timingPoints[0].Time / step);
|
|
||||||
index += newDivisor - index % newDivisor - 1;
|
|
||||||
for (double t = timingPoints[0].Time - step; t >= 0; t -= step, index--)
|
|
||||||
{
|
|
||||||
EditSnapLines.Add(new EditSnapLine
|
|
||||||
{
|
|
||||||
StartTime = t,
|
|
||||||
ControlPoint = timingPoints[0],
|
|
||||||
BeatDivisor = BeatDivisor,
|
|
||||||
BeatIndex = index,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < timingPoints.Count; i++)
|
|
||||||
{
|
|
||||||
TimingControlPoint point = timingPoints[i];
|
|
||||||
|
|
||||||
// Stop 1ms before the end of the timing point before the next one if any, otherwise stop at the last object's time
|
|
||||||
double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - 1 : lastObjectTime + point.BeatLength * (int)point.TimeSignature;
|
|
||||||
|
|
||||||
int index = 0;
|
|
||||||
double step = point.BeatLength / newDivisor;
|
|
||||||
for (double t = timingPoints[i].Time; t <= endTime; t += step, index++)
|
|
||||||
{
|
|
||||||
EditSnapLines.Add(new EditSnapLine
|
|
||||||
{
|
|
||||||
StartTime = t,
|
|
||||||
ControlPoint = point,
|
|
||||||
BeatDivisor = BeatDivisor,
|
|
||||||
BeatIndex = index,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var editPlayfield = (ManiaEditPlayfield)Playfield;
|
|
||||||
|
|
||||||
editPlayfield.ClearEditSnapLines();
|
|
||||||
EditSnapLines.ForEach(editPlayfield.Add);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages);
|
protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages);
|
||||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
BarLines.ForEach(Playfield.Add);
|
BarLines.ForEach(Playfield.Add);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages)
|
protected override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
Loading…
Reference in New Issue
Block a user