mirror of
https://github.com/osukey/osukey.git
synced 2025-05-08 23:27:38 +09:00
Fade display out during rewind (as the value displayed is no longer valid)
This commit is contained in:
parent
81a13566bc
commit
676df55a0e
@ -25,7 +25,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set => current.Current = value;
|
set => current.Current = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHasText displayedCountSpriteText;
|
private IHasText displayedCountText;
|
||||||
|
|
||||||
|
public Drawable DrawableCount { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If true, the roll-up duration will be proportional to change in value.
|
/// If true, the roll-up duration will be proportional to change in value.
|
||||||
@ -72,16 +74,16 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
displayedCountSpriteText = CreateText();
|
displayedCountText = CreateText();
|
||||||
|
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
Child = (Drawable)displayedCountSpriteText;
|
Child = DrawableCount = (Drawable)displayedCountText;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateDisplay()
|
protected void UpdateDisplay()
|
||||||
{
|
{
|
||||||
if (displayedCountSpriteText != null)
|
if (displayedCountText != null)
|
||||||
displayedCountSpriteText.Text = FormatCount(DisplayedCount);
|
displayedCountText.Text = FormatCount(DisplayedCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -18,6 +18,11 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<JudgementResult> NewJudgement;
|
public event Action<JudgementResult> NewJudgement;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when a judgement is reverted, usually due to rewinding gameplay.
|
||||||
|
/// </summary>
|
||||||
|
public event Action<JudgementResult> JudgementReverted;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum number of hits that can be judged.
|
/// The maximum number of hits that can be judged.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -71,6 +76,8 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
JudgedHits--;
|
JudgedHits--;
|
||||||
|
|
||||||
RevertResultInternal(result);
|
RevertResultInternal(result);
|
||||||
|
|
||||||
|
JudgementReverted?.Invoke(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -42,6 +42,9 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private GameplayState gameplayState { get; set; }
|
private GameplayState gameplayState { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private GameplayClock gameplayClock { get; set; }
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private TimedDifficultyAttributes[] timedAttributes;
|
private TimedDifficultyAttributes[] timedAttributes;
|
||||||
|
|
||||||
@ -70,7 +73,24 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
if (scoreProcessor != null)
|
if (scoreProcessor != null)
|
||||||
|
{
|
||||||
scoreProcessor.NewJudgement += onNewJudgement;
|
scoreProcessor.NewJudgement += onNewJudgement;
|
||||||
|
scoreProcessor.JudgementReverted += onJudgementReverted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isValid;
|
||||||
|
|
||||||
|
protected bool IsValid
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == isValid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
isValid = value;
|
||||||
|
DrawableCount.FadeTo(isValid ? 1 : 0.3f, 1000, Easing.OutQuint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onNewJudgement(JudgementResult judgement)
|
private void onNewJudgement(JudgementResult judgement)
|
||||||
@ -86,6 +106,12 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
var calculator = gameplayState.Ruleset.CreatePerformanceCalculator(timedAttributes[attribIndex].Attributes, gameplayState.Score.ScoreInfo);
|
var calculator = gameplayState.Ruleset.CreatePerformanceCalculator(timedAttributes[attribIndex].Attributes, gameplayState.Score.ScoreInfo);
|
||||||
|
|
||||||
Current.Value = (int)Math.Round(calculator?.Calculate() ?? 0, MidpointRounding.AwayFromZero);
|
Current.Value = (int)Math.Round(calculator?.Calculate() ?? 0, MidpointRounding.AwayFromZero);
|
||||||
|
IsValid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onJudgementReverted(JudgementResult obj)
|
||||||
|
{
|
||||||
|
IsValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override LocalisableString FormatCount(int count) => count.ToString(@"D");
|
protected override LocalisableString FormatCount(int count) => count.ToString(@"D");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user