1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:28:00 +08:00

Resolve addressed issues

+ Stopped using testing methods in non-testing classes
+ Resolve Player and add OnSeek event
+ Take bindings away from BarHitErrorMeter
+ Add support for ColourHitErrorMeter
This commit is contained in:
sh0ckR6 2021-09-17 16:19:41 -04:00
parent bde092f816
commit b2b3108afa
No known key found for this signature in database
GPG Key ID: 701938030071AF85
5 changed files with 26 additions and 30 deletions

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

View File

@ -10,10 +10,7 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osuTK;
@ -21,7 +18,7 @@ using osuTK.Graphics;
namespace osu.Game.Screens.Play.HUD.HitErrorMeters
{
public class BarHitErrorMeter : HitErrorMeter, IKeyBindingHandler<GlobalAction>
public class BarHitErrorMeter : HitErrorMeter
{
private const int arrow_move_duration = 400;
@ -144,10 +141,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
arrow.Alpha = 0;
arrow.Delay(200).FadeInFromZero(600);
var progressBar = Parent.ChildrenOfType<SongProgress>().FirstOrDefault();
if (progressBar != null)
progressBar.Bar.OnSeek += _ => handleSeek();
}
private void createColourBars(OsuColour colours)
@ -287,26 +280,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
}
}
private void handleSeek()
{
judgementsContainer.Clear(true);
}
public bool OnPressed(GlobalAction action)
{
switch (action)
{
case GlobalAction.SeekReplayBackward:
case GlobalAction.SeekReplayForward:
handleSeek();
return false;
}
return false;
}
public void OnReleased(GlobalAction action)
{
}
public override void Clear() => judgementsContainer.Clear(true);
}
}

View File

@ -33,6 +33,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
judgementsFlow.Push(GetColourForHitResult(judgement.Type));
}
public override void Clear() => judgementsFlow.Clear(true);
private class JudgementFlow : FillFlowContainer<HitErrorCircle>
{
private const int max_available_judgements = 20;

View File

@ -22,6 +22,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
[Resolved]
private OsuColour colours { get; set; }
[Resolved(canBeNull: true)]
private Player player { get; set; }
public bool UsesFixedAnchor { get; set; }
[BackgroundDependencyLoader(true)]
@ -34,6 +37,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
{
base.LoadComplete();
if (player != null)
player.OnSeek += Clear;
processor.NewJudgement += OnNewJudgement;
}
@ -67,6 +73,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
}
}
public abstract void Clear();
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);

View File

@ -69,6 +69,8 @@ namespace osu.Game.Screens.Play
public Action RestartRequested;
public Action OnSeek;
public bool HasFailed { get; private set; }
private Bindable<bool> mouseWheelDisabled;
@ -584,7 +586,11 @@ namespace osu.Game.Screens.Play
/// Seek to a specific time in gameplay.
/// </summary>
/// <param name="time">The destination time to seek to.</param>
public void Seek(double time) => GameplayClockContainer.Seek(time);
public void Seek(double time)
{
GameplayClockContainer.Seek(time);
OnSeek.Invoke();
}
private ScheduledDelegate frameStablePlaybackResetDelegate;