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