-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22144 from ItsShamed/skin/argon-song-progress-cle…
…aner Add "argon" variant of song progress display
- Loading branch information
Showing
19 changed files
with
600 additions
and
115 deletions.
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
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,117 @@ | ||
// 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.Game.Configuration; | ||
using osu.Game.Graphics; | ||
using osu.Game.Rulesets.Objects; | ||
|
||
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 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.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.TrackTime = GameplayClock.CurrentTime; | ||
|
||
if (isIntro) | ||
bar.CurrentTime = 0; | ||
else | ||
bar.CurrentTime = FrameStableClock.CurrentTime; | ||
} | ||
} | ||
} |
Oops, something went wrong.