Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Catch/Mods/CatchModSynesthesia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void ApplyToDrawableHitObject(DrawableHitObject d)
// Block bananas from getting coloured.
if (d.HitObject is not Banana)
{
timingBasedColour = BindableBeatDivisor.GetColourFor(currentBeatmap.ControlPointInfo.GetClosestBeatDivisor(d.HitObject.StartTime), colours);
timingBasedColour = BindableBeatDivisor.GetDefaultColourFor(currentBeatmap.ControlPointInfo.GetClosestBeatDivisor(d.HitObject.StartTime), colours);
}

// Colour droplets into a solid colour, as droplets aren't generated snapped to timeline ticks.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions osu.Game.Rulesets.Mania.Tests/Resources/special-skin/skin.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[General]
Version: 2.5

[Colours]
SnapDefault: 255, 255, 255
Snap1: 255, 0, 0
Snap2: 0, 0, 255
Snap3: 0, 255, 0

[Mania]
Keys: 4
ColumnLineWidth: 3,1,3,1,1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
/// <summary>
/// A container to be used in a <see cref="ManiaSkinnableTestScene"/> to provide a resolvable <see cref="Column"/> dependency.
/// A container to be used in a <see cref="ManiaSkinnableTestSceneScrolling"/> to provide a resolvable <see cref="Column"/> dependency.
/// </summary>
public partial class ColumnTestContainer : Container
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
/// <summary>
/// A test scene for a mania hitobject.
/// </summary>
public abstract partial class ManiaHitObjectTestScene : ManiaSkinnableTestScene
public abstract partial class ManiaHitObjectTestScene : ManiaSkinnableTestSceneScrolling
{
[SetUp]
public void SetUp() => Schedule(() =>
Expand Down
30 changes: 0 additions & 30 deletions osu.Game.Rulesets.Mania.Tests/Skinning/ManiaSkinnableTestScene.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// 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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.UI.Scrolling.Algorithms;
using osu.Game.Tests.Visual;
using osuTK.Graphics;

Expand All @@ -20,45 +16,19 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
/// </summary>
public abstract partial class ManiaSkinnableTestScene : SkinnableTestScene
{
[Cached(Type = typeof(IScrollingInfo))]
protected readonly TestScrollingInfo ScrollingInfo = new TestScrollingInfo();

[Cached]
private readonly StageDefinition stage = new StageDefinition(4);

protected override Ruleset CreateRulesetForSkinProvider() => new ManiaRuleset();

protected ManiaSkinnableTestScene()
{
ScrollingInfo.Direction.Value = ScrollingDirection.Down;

Add(new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.SlateGray.Opacity(0.2f),
Depth = 1
});
}

[Test]
public void TestScrollingDown()
{
AddStep("change direction to down", () => ScrollingInfo.Direction.Value = ScrollingDirection.Down);
}

[Test]
public void TestScrollingUp()
{
AddStep("change direction to up", () => ScrollingInfo.Direction.Value = ScrollingDirection.Up);
}

protected class TestScrollingInfo : IScrollingInfo
{
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();

IBindable<ScrollingDirection> IScrollingInfo.Direction => Direction;
IBindable<double> IScrollingInfo.TimeRange { get; } = new Bindable<double>(5000);
IBindable<IScrollAlgorithm> IScrollingInfo.Algorithm { get; } = new Bindable<IScrollAlgorithm>(new ConstantScrollAlgorithm());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.UI.Scrolling.Algorithms;

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
/// <summary>
/// A test scene for skinnable mania components, with an <see cref="IScrollingInfo"/> provided.
/// </summary>
public abstract partial class ManiaSkinnableTestSceneScrolling : ManiaSkinnableTestScene
{
[Cached(Type = typeof(IScrollingInfo))]
protected readonly TestScrollingInfo ScrollingInfo = new TestScrollingInfo();

protected ManiaSkinnableTestSceneScrolling()
{
ScrollingInfo.Direction.Value = ScrollingDirection.Down;
}

[Test]
public void TestScrollingDown()
{
AddStep("change direction to down", () => ScrollingInfo.Direction.Value = ScrollingDirection.Down);
}

[Test]
public void TestScrollingUp()
{
AddStep("change direction to up", () => ScrollingInfo.Direction.Value = ScrollingDirection.Up);
}

protected class TestScrollingInfo : IScrollingInfo
{
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();

IBindable<ScrollingDirection> IScrollingInfo.Direction => Direction;
IBindable<double> IScrollingInfo.TimeRange { get; } = new Bindable<double>(5000);
IBindable<IScrollAlgorithm> IScrollingInfo.Algorithm { get; } = new Bindable<IScrollAlgorithm>(new ConstantScrollAlgorithm());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// 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 NUnit.Framework;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Framework.Graphics;
using osu.Framework.Bindables;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Allocation;
using osu.Framework.Timing;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using System.Linq;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
[TestFixture]
public partial class TestSceneAdjustableTimingColouring : ManiaSkinnableTestScene
{
private Bindable<bool> configTimingBasedNoteColouring = null!;
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed

private ManiaBeatmap testBeatmap = null!;

[BackgroundDependencyLoader]
private void load()
{
testBeatmap = createTestBeatmap();
SetContents(skin =>
{
var drawableRuleset = (DrawableManiaRuleset)Ruleset.Value.CreateInstance().CreateDrawableRulesetWith(testBeatmap);
drawableRuleset.Clock = new FramedClock(new ManualClock());

return drawableRuleset;
});
var config = (ManiaRulesetConfigManager)RulesetConfigs.GetConfigFor(Ruleset.Value.CreateInstance()).AsNonNull();
configTimingBasedNoteColouring = config.GetBindable<bool>(ManiaRulesetSetting.TimingBasedNoteColouring);
}

[Test]
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
public void TestColouring()
{
AddStep("disable colouring", () => configTimingBasedNoteColouring.Value = false);
AddStep("enable colouring", () => configTimingBasedNoteColouring.Value = true);
}

[Test]
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
public void TestCustomColouring()
{
AddStep("disable colouring", () => configTimingBasedNoteColouring.Value = false);
AddAssert("all notes not coloured", () => this.ChildrenOfType<DrawableNote>().All(note => note.Colour == Colour4.White));
AddStep("enable colouring", () => configTimingBasedNoteColouring.Value = true);
AddAssert("any notes coloured", () => this.ChildrenOfType<DrawableNote>().Any(note => note.Colour != Colour4.White));
AddAssert("special-skin colours correct",
() => Cell(4).ChildrenOfType<DrawableNote>().All(note =>
snapColourIsAccurate(
note.Colour,
testBeatmap.ControlPointInfo.GetClosestBeatDivisor(note.HitObject.StartTime)
)
)
);
}

private bool snapColourIsAccurate(Color4 color, int divisor)
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
{
switch (divisor)
{
case 1:
return color == new Color4(255, 0, 0, 255);

case 2:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
return color == new Color4(0, 0, 255, 255);

case 3:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
return color == new Color4(0, 255, 0, 255);

default:
return color == new Color4(255, 255, 255, 255);
}
}

private ManiaBeatmap createTestBeatmap()
{
const double beat_length = 1000;

var beatmap = new ManiaBeatmap(new StageDefinition(1))
{
HitObjects =
{
new Note { StartTime = 0 },
new Note { StartTime = beat_length / 16 },
new Note { StartTime = beat_length / 12 },
new Note { StartTime = beat_length / 8 },
new Note { StartTime = beat_length / 6 },
new Note { StartTime = beat_length / 4 },
new Note { StartTime = beat_length / 3 },
new Note { StartTime = beat_length / 2 },
new Note { StartTime = beat_length }
},
ControlPointInfo = new ControlPointInfo(),
BeatmapInfo = { Ruleset = Ruleset.Value },
};

foreach (var note in beatmap.HitObjects)
{
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
}

beatmap.ControlPointInfo.Add(0, new TimingControlPoint
{
BeatLength = beat_length
});
return beatmap;
}
}
}
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneBarLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
public partial class TestSceneBarLine : ManiaSkinnableTestScene
public partial class TestSceneBarLine : ManiaSkinnableTestSceneScrolling
{
[Test]
public void TestMinor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
public partial class TestSceneColumnBackground : ManiaSkinnableTestScene
public partial class TestSceneColumnBackground : ManiaSkinnableTestSceneScrolling
{
[BackgroundDependencyLoader]
private void load()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
public partial class TestSceneColumnHitObjectArea : ManiaSkinnableTestScene
public partial class TestSceneColumnHitObjectArea : ManiaSkinnableTestSceneScrolling
{
[BackgroundDependencyLoader]
private void load()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
public partial class TestSceneComboCounter : ManiaSkinnableTestScene
public partial class TestSceneComboCounter : ManiaSkinnableTestSceneScrolling
{
[Cached]
private ScoreProcessor scoreProcessor = new ScoreProcessor(new ManiaRuleset());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
public partial class TestSceneDrawableJudgement : ManiaSkinnableTestScene
public partial class TestSceneDrawableJudgement : ManiaSkinnableTestSceneScrolling
{
public TestSceneDrawableJudgement()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
[TestFixture]
public partial class TestSceneHitExplosion : ManiaSkinnableTestScene
public partial class TestSceneHitExplosion : ManiaSkinnableTestSceneScrolling
{
private readonly List<DrawablePool<PoolableHitExplosion>> hitExplosionPools = new List<DrawablePool<PoolableHitExplosion>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
public partial class TestScenePlayfield : ManiaSkinnableTestScene
public partial class TestScenePlayfield : ManiaSkinnableTestSceneScrolling
{
[Cached]
private ScoreProcessor scoreProcessor = new ScoreProcessor(new ManiaRuleset());
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
public partial class TestSceneStage : ManiaSkinnableTestScene
public partial class TestSceneStage : ManiaSkinnableTestSceneScrolling
{
[BackgroundDependencyLoader]
private void load()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
public partial class TestSceneStageBackground : ManiaSkinnableTestScene
public partial class TestSceneStageBackground : ManiaSkinnableTestSceneScrolling
{
[BackgroundDependencyLoader]
private void load()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
public partial class TestSceneStageForeground : ManiaSkinnableTestScene
public partial class TestSceneStageForeground : ManiaSkinnableTestSceneScrolling
{
[BackgroundDependencyLoader]
private void load()
Expand Down
Loading
Loading