-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add adjustable rhythm-based colouring to osu!mania #38495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
prplnorangesoda
wants to merge
4
commits into
ppy:master
Choose a base branch
from
prplnorangesoda:beatsnap-colours
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
bb2fba0
add adjustable rhythm-based colouring to mania
prplnorangesoda 550e682
fix: update snap colouring when skin changes
prplnorangesoda 39e705e
fix: snap colouring works with triangles skin
prplnorangesoda 09d868e
code quality fixes
prplnorangesoda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+2.69 KB
osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania-note1@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.69 KB
osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania-noteS@2x.png
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
6
osu.Game.Rulesets.Mania.Tests/Resources/special-skin/skin.ini
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
osu.Game.Rulesets.Mania.Tests/Skinning/ManiaSkinnableTestSceneScrolling.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()); | ||
| } | ||
| } | ||
| } |
121 changes: 121 additions & 0 deletions
121
osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneAdjustableTimingColouring.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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!; | ||
|
|
||
| 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] | ||
|
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] | ||
|
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) | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| { | ||
| switch (divisor) | ||
| { | ||
| case 1: | ||
| return color == new Color4(255, 0, 0, 255); | ||
|
|
||
| case 2: | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| return color == new Color4(0, 0, 255, 255); | ||
|
|
||
| case 3: | ||
|
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; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.