1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Rename {Snap -> BeatDivisor}Finder

This commit is contained in:
Bartłomiej Dach 2021-04-25 17:42:56 +02:00
parent afb67726f0
commit e14255f395
3 changed files with 12 additions and 12 deletions

View File

@ -48,13 +48,13 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
}
[BackgroundDependencyLoader(true)]
private void load(ManiaRulesetConfigManager rulesetConfig, SnapFinder snapFinder)
private void load(ManiaRulesetConfigManager rulesetConfig, BeatDivisorFinder beatDivisorFinder)
{
if (snapFinder != null)
if (beatDivisorFinder != null)
{
rulesetConfig?.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
HitObject.StartTimeBindable.BindValueChanged(_ => snap.Value = snapFinder.FindSnap(HitObject), true);
HitObject.StartTimeBindable.BindValueChanged(_ => snap.Value = beatDivisorFinder.FindDivisor(HitObject), true);
snap.BindValueChanged(_ => updateSnapColour(), true);
configColourCodedNotes.BindValueChanged(_ => updateSnapColour());

View File

@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Mania.UI
public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap;
[Cached]
private SnapFinder snapFinder { get; set; }
private BeatDivisorFinder beatDivisorFinder { get; set; }
public IEnumerable<BarLine> BarLines;
@ -80,7 +80,7 @@ namespace osu.Game.Rulesets.Mania.UI
: base(ruleset, beatmap, mods)
{
BarLines = new BarLineGenerator<BarLine>(Beatmap).BarLines;
snapFinder = new SnapFinder(Beatmap);
beatDivisorFinder = new BeatDivisorFinder(Beatmap);
}
[BackgroundDependencyLoader]

View File

@ -9,17 +9,17 @@ using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Objects
{
/// <summary>
/// Used to find the lowest beat divisor that a <see cref="HitObject"/> aligns to in an <see cref="IBeatmap"/>
/// Used to find the lowest beat divisor that a <see cref="HitObject"/> aligns to in an <see cref="IBeatmap"/>.
/// </summary>
public class SnapFinder
public class BeatDivisorFinder
{
private readonly IBeatmap beatmap;
/// <summary>
/// Creates a new SnapFinder instance.
/// Creates a new <see cref="BeatDivisorFinder"/> instance.
/// </summary>
/// <param name="beatmap">The beatmap to align to when evaulating.</param>
public SnapFinder(IBeatmap beatmap)
/// <param name="beatmap">The beatmap to use when calculating beat divisor alignment.</param>
public BeatDivisorFinder(IBeatmap beatmap)
{
this.beatmap = beatmap;
}
@ -27,10 +27,10 @@ namespace osu.Game.Rulesets.Objects
private static readonly int[] snaps = { 1, 2, 3, 4, 6, 8, 12, 16 };
/// <summary>
/// Finds the lowest beat divisor that the given HitObject aligns to.
/// Finds the lowest beat divisor that the given <see cref="HitObject"/> aligns to.
/// </summary>
/// <param name="hitObject">The <see cref="HitObject"/> to evaluate.</param>
public int FindSnap(HitObject hitObject)
public int FindDivisor(HitObject hitObject)
{
TimingControlPoint currentTimingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime);
double snapResult = (hitObject.StartTime - currentTimingPoint.Time) % (currentTimingPoint.BeatLength * 4);