-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add "argon" variant of song progress display #22144
Merged
bdach
merged 37 commits into
ppy:master
from
ItsShamed:skin/argon-song-progress-cleaner
Jan 18, 2023
Merged
Changes from 22 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
0f1fe1d
refactor(hud/gameplay/SongProgress): Add interface to designate `Song…
ItsShamed f626519
feat(hud/gameplay): Add Argon variant of `SongProgressBar`
ItsShamed 28d2d76
refactor(hud/gameplay/SongProgressInfo): minor changes to text positi…
ItsShamed 5952cd0
feat(hud/gameplay): implement Argon song progress density graph (Segm…
ItsShamed 91cde5f
feat(hud/gameplay): implement Argon variant of `SongProgress`
ItsShamed 48deef4
test: adapt and create tests to cover new components
ItsShamed eac8e9f
test: make test not actually test anything
ItsShamed d2309fe
Merge branch 'master' into skin/argon-song-progress-cleaner
peppy 4439698
Update osu.Game/Screens/Play/HUD/ArgonSongProgress.cs
ItsShamed 65bd2e7
Merge branch 'master' into skin/argon-song-progress-cleaner
peppy b62b571
Fix `TierColours` assignment
peppy 66441d4
test: remove test for ArgonSongProgressGraph
ItsShamed d91aa34
refactor(ArgonSongProgress): reorder layering and make density graph …
ItsShamed f1989ba
quality: remove unused `Darken` bindable boolean
ItsShamed 45c5bd8
Simplify HUD test to not require casting to specific `ProgressBar` type
peppy afc12e0
Tidy up `ISongProgressBar` interface
peppy 5429979
Combine common code into `SongProgress` base class
peppy f9dd3f6
Switch test to specifically target the argon verison of the progress bar
peppy e8770b8
Remove no longer necessary interface type
peppy 742a026
Add comment mentioning why reference clock fallback logic is required
peppy 5a272b4
Merge branch 'master' into skin/argon-song-progress-cleaner
peppy 7266d8e
Move "show difficulty graph" settings back to respective implementati…
peppy 1e5dd91
Adjust `SkinnableTestScene` to give more breathing room to `RelativeS…
peppy 04c0a5d
Update `TestSceneSongProgress` to properly work with new implementation
peppy bfb7573
Prefix subclasses of `DefaultSongProgress` with `Default`
peppy 8bfd853
Fix missing comment
peppy 8030194
Use actual beatmap's hitobjects in test to better display density
peppy 5ead85f
Limit catch-up speed in test to emulate gameplay
peppy 42e9b2b
Tidy up clock logic in all `SongProgress` classes
peppy 17c35cf
Merge branch 'frame-stable-cache' into skin/argon-song-progress-cleaner
peppy f3677ab
Simplify depth change logic
peppy 01558a9
Tidy up height logic and allow hovering above bar for easier interaction
peppy 67b40dd
Adjust the seek effect to feel better
peppy 4cfb059
Merge branch 'frame-stable-cache' into skin/argon-song-progress-cleaner
peppy d4f2cd2
Fix broken test step
peppy b8b7442
Make `SongProgressInfo.ShowProgress` init-only (and remove duplicate …
bdach b62ff8d
Merge branch 'master' into skin/argon-song-progress-cleaner
bdach 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
Binary file not shown.
This file contains 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 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 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 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 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 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 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,127 @@ | ||
// 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.Collections.Generic; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Timing; | ||
using osu.Game.Configuration; | ||
using osu.Game.Graphics; | ||
using osu.Game.Rulesets.Objects; | ||
using osu.Game.Rulesets.UI; | ||
|
||
namespace osu.Game.Screens.Play.HUD | ||
{ | ||
public partial class ArgonSongProgress : SongProgress | ||
{ | ||
private readonly SongProgressInfo info; | ||
private readonly ArgonSongProgressGraph graph; | ||
private readonly ArgonSongProgressBar bar; | ||
private readonly Container graphContainer; | ||
|
||
private const float bar_height = 10; | ||
|
||
[SettingSource("Show difficulty graph", "Whether a graph displaying difficulty throughout the beatmap should be shown")] | ||
public Bindable<bool> ShowGraph { get; } = new BindableBool(true); | ||
|
||
[Resolved] | ||
private DrawableRuleset? drawableRuleset { get; set; } | ||
|
||
// Even though `FrameStabilityContainer` caches as a `GameplayClock`, we need to check it directly via `drawableRuleset` | ||
// as this calculator is not contained within the `FrameStabilityContainer` and won't see the dependency. | ||
private IClock referenceClock => drawableRuleset?.FrameStableClock ?? GameplayClock; | ||
|
||
[Resolved] | ||
private Player? player { get; set; } | ||
|
||
public ArgonSongProgress() | ||
{ | ||
Anchor = Anchor.BottomCentre; | ||
Origin = Anchor.BottomCentre; | ||
Masking = true; | ||
CornerRadius = 5; | ||
Children = new Drawable[] | ||
{ | ||
info = new SongProgressInfo | ||
{ | ||
Origin = Anchor.TopLeft, | ||
Name = "Info", | ||
Anchor = Anchor.TopLeft, | ||
RelativeSizeAxes = Axes.X, | ||
ShowProgress = false | ||
}, | ||
bar = new ArgonSongProgressBar(bar_height) | ||
{ | ||
Name = "Seek bar", | ||
Origin = Anchor.BottomLeft, | ||
Anchor = Anchor.BottomLeft, | ||
OnSeek = time => player?.Seek(time), | ||
}, | ||
graphContainer = new Container | ||
{ | ||
Anchor = Anchor.BottomLeft, | ||
Origin = Anchor.BottomLeft, | ||
Masking = true, | ||
CornerRadius = 5, | ||
Child = graph = new ArgonSongProgressGraph | ||
{ | ||
Name = "Difficulty graph", | ||
RelativeSizeAxes = Axes.Both, | ||
Blending = BlendingParameters.Additive | ||
}, | ||
RelativeSizeAxes = Axes.X, | ||
}, | ||
}; | ||
RelativeSizeAxes = Axes.X; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
info.ShowProgress = false; | ||
info.TextColour = Colour4.White; | ||
info.Font = OsuFont.Torus.With(size: 18, weight: FontWeight.Bold); | ||
} | ||
|
||
protected override void LoadComplete() | ||
{ | ||
base.LoadComplete(); | ||
|
||
Interactive.BindValueChanged(_ => bar.Interactive = Interactive.Value, true); | ||
ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true); | ||
} | ||
|
||
protected override void UpdateObjects(IEnumerable<HitObject> objects) | ||
{ | ||
graph.Objects = objects; | ||
|
||
info.StartTime = bar.StartTime = FirstHitTime; | ||
info.EndTime = bar.EndTime = LastHitTime; | ||
} | ||
|
||
private void updateGraphVisibility() | ||
{ | ||
graph.FadeTo(ShowGraph.Value ? 1 : 0, 200, Easing.In); | ||
bar.ShowBackground = !ShowGraph.Value; | ||
} | ||
|
||
protected override void Update() | ||
{ | ||
base.Update(); | ||
Height = bar.Height + bar_height + info.Height; | ||
graphContainer.Height = bar.Height; | ||
} | ||
|
||
protected override void UpdateProgress(double progress, bool isIntro) | ||
{ | ||
bar.ReferenceTime = GameplayClock.CurrentTime; | ||
|
||
if (isIntro) | ||
bar.CurrentTime = 0; | ||
else | ||
bar.CurrentTime = referenceClock.CurrentTime; | ||
} | ||
} | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine that code is now gone with further refactoring :D.