-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add "Synesthesia" mod for osu!catch ruleset #37011
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
Tenexxt
wants to merge
6
commits into
ppy:master
Choose a base branch
from
Tenexxt:catch-mod-synestheisia
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
6 commits
Select commit
Hold shift + click to select a range
bd4d04a
Add `CatchModSynesthesia` to mod list
Tenexxt 98c19a2
Block banana colouring
Tenexxt 3227244
Merge branch 'master' into catch-mod-synestheisia
bdach f392912
Fix indent
Tenexxt aab4421
Fix broken space (sorry) and set Droplets to always be a solid colour
Tenexxt 3fa8282
Change droplet colour to `LightGreen` as sugested and fix spacing
Tenexxt 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
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,60 @@ | ||
| // 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 osu.Game.Beatmaps; | ||
| using osu.Game.Graphics; | ||
| using osu.Game.Rulesets.Catch.Objects; | ||
| using osu.Game.Rulesets.Mods; | ||
| using osu.Game.Rulesets.Objects; | ||
| using osu.Game.Rulesets.Objects.Drawables; | ||
| using osu.Game.Screens.Edit; | ||
| using osuTK.Graphics; | ||
|
|
||
| namespace osu.Game.Rulesets.Catch.Mods | ||
| { | ||
| /// <summary> | ||
| /// Mod that colours <see cref="HitObject"/>s based on the musical division they are on | ||
| /// </summary> | ||
| public class CatchModSynesthesia : ModSynesthesia, IApplicableToBeatmap, IApplicableToDrawableHitObject | ||
| { | ||
| private readonly OsuColour colours = new OsuColour(); | ||
|
|
||
| private IBeatmap? currentBeatmap { get; set; } | ||
|
|
||
| public void ApplyToBeatmap(IBeatmap beatmap) | ||
| { | ||
| //Store a reference to the current beatmap to look up the beat divisor when notes are drawn | ||
| if (currentBeatmap != beatmap) | ||
| currentBeatmap = beatmap; | ||
| } | ||
|
|
||
| public void ApplyToDrawableHitObject(DrawableHitObject d) | ||
| { | ||
| if (currentBeatmap == null) return; | ||
|
|
||
| Color4? timingBasedColour = null; | ||
|
|
||
| d.HitObjectApplied += _ => | ||
| { | ||
| // Block bananas from getting coloured. | ||
| if (d.HitObject is not Banana) | ||
| { | ||
| timingBasedColour = BindableBeatDivisor.GetColourFor(currentBeatmap.ControlPointInfo.GetClosestBeatDivisor(d.HitObject.StartTime), colours); | ||
| } | ||
|
|
||
| // Colour droplets into a solid colour, as droplets aren't generated snapped to timeline ticks. | ||
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show fixed
Hide fixed
|
||
| if (d.HitObject is Droplet) | ||
| { | ||
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show fixed
Hide fixed
|
||
| timingBasedColour = Color4.LightGreen; | ||
| } | ||
| }; | ||
|
|
||
| // Need to set this every update to ensure it doesn't get overwritten by DrawableHitObject.OnApply() -> UpdateComboColour(). | ||
| d.OnUpdate += _ => | ||
| { | ||
| if (timingBasedColour != null) | ||
| d.AccentColour.Value = timingBasedColour.Value; | ||
| }; | ||
| } | ||
| } | ||
| } | ||
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.