mirror of https://github.com/ppy/osu
Fix cake errors
This commit is contained in:
parent
8b01082cbb
commit
bedabc1ddf
|
@ -31,7 +31,7 @@ public abstract class ManiaPlacementBlueprintTestScene : PlacementBlueprintTestS
|
|||
private IScrollingInfo scrollingInfo;
|
||||
|
||||
[Cached]
|
||||
protected readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>();
|
||||
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
|
||||
|
||||
protected ManiaPlacementBlueprintTestScene()
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ protected ManiaPlacementBlueprintTestScene()
|
|||
private void load(RulesetConfigCache configCache)
|
||||
{
|
||||
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
|
||||
}
|
||||
|
||||
protected override SnapResult SnapForBlueprint(PlacementBlueprint blueprint)
|
||||
|
|
|
@ -18,7 +18,7 @@ public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestS
|
|||
private readonly IAdjustableClock clock = new StopwatchClock();
|
||||
|
||||
[Cached]
|
||||
protected readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>();
|
||||
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
|
||||
|
||||
protected ManiaSelectionBlueprintTestScene()
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ protected ManiaSelectionBlueprintTestScene()
|
|||
private void load(RulesetConfigCache configCache)
|
||||
{
|
||||
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
|
||||
}
|
||||
|
||||
public ManiaPlayfield Playfield => null;
|
||||
|
|
|
@ -17,7 +17,7 @@ public abstract class ManiaInputTestScene : OsuTestScene
|
|||
protected override Container<Drawable> Content => content ?? base.Content;
|
||||
|
||||
[Cached]
|
||||
protected readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>();
|
||||
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
|
||||
|
||||
protected ManiaInputTestScene(int keys)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ protected ManiaInputTestScene(int keys)
|
|||
private void load(RulesetConfigCache configCache)
|
||||
{
|
||||
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
|
||||
}
|
||||
|
||||
private class LocalInputManager : ManiaInputManager
|
||||
|
|
|
@ -26,7 +26,7 @@ public abstract class ManiaSkinnableTestScene : SkinnableTestScene
|
|||
private readonly TestScrollingInfo scrollingInfo = new TestScrollingInfo();
|
||||
|
||||
[Cached]
|
||||
protected readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>();
|
||||
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
|
||||
|
||||
protected override Ruleset CreateRulesetForSkinProvider() => new ManiaRuleset();
|
||||
|
||||
|
@ -46,7 +46,7 @@ protected ManiaSkinnableTestScene()
|
|||
private void load(RulesetConfigCache configCache)
|
||||
{
|
||||
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -31,13 +31,13 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||
public class TestSceneNotes : OsuTestScene
|
||||
{
|
||||
[Cached]
|
||||
protected readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>();
|
||||
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetConfigCache configCache)
|
||||
{
|
||||
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
|
||||
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
|
@ -64,8 +63,8 @@ protected override void LoadComplete()
|
|||
{
|
||||
HitObject.StartTimeBindable.BindValueChanged(_ => Snap = snapFinder.FindSnap(HitObject), true);
|
||||
|
||||
SnapBindable.BindValueChanged(snap => UpdateSnapColour(configColourCodedNotes.Value, snap.NewValue), true);
|
||||
configColourCodedNotes.BindValueChanged(colourCode => UpdateSnapColour(colourCode.NewValue, Snap));
|
||||
SnapBindable.BindValueChanged(snap => updateSnapColour(configColourCodedNotes.Value, snap.NewValue), true);
|
||||
configColourCodedNotes.BindValueChanged(colourCode => updateSnapColour(colourCode.NewValue, Snap));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +108,7 @@ public virtual void OnReleased(ManiaAction action)
|
|||
{
|
||||
}
|
||||
|
||||
private void UpdateSnapColour(bool colourCode, int snap)
|
||||
private void updateSnapColour(bool colourCode, int snap)
|
||||
{
|
||||
if (colourCode)
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ public class DrawableManiaRuleset : DrawableScrollingRuleset<ManiaHitObject>
|
|||
protected new ManiaRulesetConfigManager Config => (ManiaRulesetConfigManager)base.Config;
|
||||
|
||||
[Cached]
|
||||
protected readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>();
|
||||
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
|
||||
|
||||
public ScrollVisualisationMethod ScrollMethod
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ private void load()
|
|||
|
||||
Config.BindWith(ManiaRulesetSetting.ScrollTime, configTimeRange);
|
||||
|
||||
Config.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
|
||||
Config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
|
||||
}
|
||||
|
||||
protected override void AdjustScrollSpeed(int amount)
|
||||
|
|
|
@ -11,7 +11,8 @@ namespace osu.Game.Rulesets.Mania.Utils
|
|||
{
|
||||
public class SnapFinder
|
||||
{
|
||||
private ManiaBeatmap beatmap;
|
||||
private readonly ManiaBeatmap beatmap;
|
||||
|
||||
public SnapFinder(ManiaBeatmap beatmap)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
|
@ -20,42 +21,41 @@ public SnapFinder(ManiaBeatmap beatmap)
|
|||
public int FindSnap(HitObject hitObject)
|
||||
{
|
||||
TimingControlPoint currentTimingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime);
|
||||
int timeSignature = (int)currentTimingPoint.TimeSignature;
|
||||
double startTime = currentTimingPoint.Time;
|
||||
double secondsPerFourCounts = currentTimingPoint.BeatLength * 4;
|
||||
|
||||
double offset = startTime % secondsPerFourCounts;
|
||||
double snapResult = hitObject.StartTime % secondsPerFourCounts - offset;
|
||||
|
||||
if (AlmostDivisibleBy(snapResult, secondsPerFourCounts / 4.0))
|
||||
if (almostDivisibleBy(snapResult, secondsPerFourCounts / 4.0))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (AlmostDivisibleBy(snapResult, secondsPerFourCounts / 8.0))
|
||||
else if (almostDivisibleBy(snapResult, secondsPerFourCounts / 8.0))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (AlmostDivisibleBy(snapResult, secondsPerFourCounts / 12.0))
|
||||
else if (almostDivisibleBy(snapResult, secondsPerFourCounts / 12.0))
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
else if (AlmostDivisibleBy(snapResult, secondsPerFourCounts / 16.0))
|
||||
else if (almostDivisibleBy(snapResult, secondsPerFourCounts / 16.0))
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
else if (AlmostDivisibleBy(snapResult, secondsPerFourCounts / 24.0))
|
||||
else if (almostDivisibleBy(snapResult, secondsPerFourCounts / 24.0))
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
else if (AlmostDivisibleBy(snapResult, secondsPerFourCounts / 32.0))
|
||||
else if (almostDivisibleBy(snapResult, secondsPerFourCounts / 32.0))
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
else if (AlmostDivisibleBy(snapResult, secondsPerFourCounts / 48.0))
|
||||
else if (almostDivisibleBy(snapResult, secondsPerFourCounts / 48.0))
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
else if (AlmostDivisibleBy(snapResult, secondsPerFourCounts / 64.0))
|
||||
else if (almostDivisibleBy(snapResult, secondsPerFourCounts / 64.0))
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
@ -65,11 +65,12 @@ public int FindSnap(HitObject hitObject)
|
|||
}
|
||||
}
|
||||
|
||||
private const double LENIENCY_MS = 1.0;
|
||||
private static bool AlmostDivisibleBy(double dividend, double divisor)
|
||||
private const double leniency_ms = 1.0;
|
||||
|
||||
private static bool almostDivisibleBy(double dividend, double divisor)
|
||||
{
|
||||
double remainder = Math.Abs(dividend) % divisor;
|
||||
return Precision.AlmostEquals(remainder, 0, LENIENCY_MS) || Precision.AlmostEquals(remainder - divisor, 0, LENIENCY_MS);
|
||||
return Precision.AlmostEquals(remainder, 0, leniency_ms) || Precision.AlmostEquals(remainder - divisor, 0, leniency_ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue