Skip to content

Commit

Permalink
Merge branch 'show-tick-results' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Dec 20, 2023
2 parents 130be4b + eb8fb80 commit 0c242fb
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public partial class DrawableSliderRepeat : DrawableOsuHitObject, ITrackSnaking

private Drawable scaleContainer;

public override bool DisplayResult => false;

public DrawableSliderRepeat()
: base(null)
{
Expand Down
5 changes: 0 additions & 5 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ public partial class DrawableSliderTail : DrawableOsuHitObject

protected DrawableSlider DrawableSlider => (DrawableSlider)ParentHitObject;

/// <summary>
/// The judgement text is provided by the <see cref="DrawableSlider"/>.
/// </summary>
public override bool DisplayResult => false;

/// <summary>
/// Whether the hit samples only play on successful hits.
/// If <c>false</c>, the hit samples will also play on misses.
Expand Down
2 changes: 0 additions & 2 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public partial class DrawableSliderTick : DrawableOsuHitObject

private const float default_tick_size = 16;

public override bool DisplayResult => false;

protected DrawableSlider DrawableSlider => (DrawableSlider)ParentHitObject;

private SkinnableDrawable scaleContainer;
Expand Down
34 changes: 16 additions & 18 deletions osu.Game.Rulesets.Osu/Skinning/Argon/ArgonJudgementPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,23 @@ protected override SpriteText CreateJudgementText() =>
/// </remarks>
public virtual void PlayAnimation()
{
switch (Result)
if (Result.IsMiss())
{
default:
JudgementText
.FadeInFromZero(300, Easing.OutQuint)
.ScaleTo(Vector2.One)
.ScaleTo(new Vector2(1.2f), 1800, Easing.OutQuint);
break;

case HitResult.Miss:
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);

this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);

this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);
break;
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);

this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);

this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);
}
else
{
JudgementText
.FadeInFromZero(300, Easing.OutQuint)
.ScaleTo(Vector2.One)
.ScaleTo(new Vector2(1.2f), 1800, Easing.OutQuint);
}

this.FadeOutFromOne(800);
Expand Down
23 changes: 19 additions & 4 deletions osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Connections;
using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
Expand Down Expand Up @@ -66,8 +65,21 @@ public OsuPlayfield()

HitPolicy = new StartTimeOrderedHitPolicy();

var hitWindows = new OsuHitWindows();
foreach (var result in Enum.GetValues<HitResult>().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r)))
foreach (var result in Enum.GetValues<HitResult>().Where(r =>
{
switch (r)
{
case HitResult.Great:
case HitResult.Ok:
case HitResult.Meh:
case HitResult.Miss:
case HitResult.LargeTickMiss:
case HitResult.IgnoreMiss:
return true;
}

return false;
}))
poolDictionary.Add(result, new DrawableJudgementPool(result, onJudgementLoaded));

AddRangeInternal(poolDictionary.Values);
Expand Down Expand Up @@ -170,7 +182,10 @@ private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
return;

DrawableOsuJudgement explosion = poolDictionary[result.Type].Get(doj => doj.Apply(result, judgedObject));
if (!poolDictionary.TryGetValue(result.Type, out var pool))
return;

DrawableOsuJudgement explosion = pool.Get(doj => doj.Apply(result, judgedObject));

judgementLayer.Add(explosion);

Expand Down
5 changes: 4 additions & 1 deletion osu.Game/Graphics/OsuColour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ public Color4 ForHitResult(HitResult result)
{
switch (result)
{
case HitResult.IgnoreMiss:
case HitResult.SmallTickMiss:
case HitResult.LargeTickMiss:
return Orange1;

case HitResult.Miss:
case HitResult.LargeTickMiss:
case HitResult.ComboBreak:
return Red;

Expand Down
16 changes: 7 additions & 9 deletions osu.Game/Rulesets/Judgements/DefaultJudgementPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@ protected override SpriteText CreateJudgementText() =>
/// </remarks>
public virtual void PlayAnimation()
{
switch (Result)
if (Result != HitResult.None && !Result.IsHit())
{
case HitResult.Miss:
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);

this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);

this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);
break;
this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);
}

this.FadeOutFromOne(800);
Expand Down
9 changes: 4 additions & 5 deletions osu.Game/Rulesets/Judgements/DrawableJudgement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,11 @@ private void runAnimation()
case HitResult.None:
break;

case HitResult.Miss:
ApplyMissAnimations();
break;

default:
ApplyHitAnimations();
if (Result.Type.IsHit())
ApplyHitAnimations();
else
ApplyMissAnimations();
break;
}

Expand Down
21 changes: 21 additions & 0 deletions osu.Game/Rulesets/Scoring/HitResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public enum HitResult
/// Indicates a large tick miss.
/// </summary>
[EnumMember(Value = "large_tick_miss")]
[Description(@"x")]
[Order(10)]
LargeTickMiss,

Expand Down Expand Up @@ -117,6 +118,7 @@ public enum HitResult
/// Indicates a miss that should be ignored for scoring purposes.
/// </summary>
[EnumMember(Value = "ignore_miss")]
[Description("x")]
[Order(13)]
IgnoreMiss,

Expand Down Expand Up @@ -267,6 +269,25 @@ public static bool IsBonus(this HitResult result)
}
}

/// <summary>
/// Whether a <see cref="HitResult"/> represents a miss of any type.
/// </summary>
public static bool IsMiss(this HitResult result)
{
switch (result)
{
case HitResult.IgnoreMiss:
case HitResult.Miss:
case HitResult.SmallTickMiss:
case HitResult.LargeTickMiss:
case HitResult.ComboBreak:
return true;

default:
return false;
}
}

/// <summary>
/// Whether a <see cref="HitResult"/> represents a successful hit.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Skinning/LegacyJudgementPieceNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public LegacyJudgementPieceNew(HitResult result, Func<Drawable> createMainDrawab
});
}

if (result != HitResult.Miss)
if (!result.IsMiss())
{
//new judgement shows old as a temporary effect
AddInternal(temporaryOldStyle = new LegacyJudgementPieceOld(result, createMainDrawable, 1.05f, true)
Expand Down
38 changes: 22 additions & 16 deletions osu.Game/Skinning/LegacyJudgementPieceOld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ public virtual void PlayAnimation()
if (animation?.FrameCount > 1 && !forceTransforms)
return;

switch (result)
if (result.IsMiss())
{
case HitResult.Miss:
bool isTick = result != HitResult.Miss;

if (isTick)
{
this.ScaleTo(0.6f);
this.ScaleTo(0.3f, 100, Easing.In);
}
else
{
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);

Expand All @@ -71,20 +79,18 @@ public virtual void PlayAnimation()
this.RotateTo(0);
this.RotateTo(rotation, fade_in_length)
.Then().RotateTo(rotation * 2, fade_out_delay + fade_out_length - fade_in_length, Easing.In);
break;

default:

this.ScaleTo(0.6f).Then()
.ScaleTo(1.1f, fade_in_length * 0.8f).Then() // t = 0.8
.Delay(fade_in_length * 0.2f) // t = 1.0
.ScaleTo(0.9f, fade_in_length * 0.2f).Then() // t = 1.2

// stable dictates scale of 0.9->1 over time 1.0 to 1.4, but we are already at 1.2.
// so we need to force the current value to be correct at 1.2 (0.95) then complete the
// second half of the transform.
.ScaleTo(0.95f).ScaleTo(finalScale, fade_in_length * 0.2f); // t = 1.4
break;
}
}
else
{
this.ScaleTo(0.6f).Then()
.ScaleTo(1.1f, fade_in_length * 0.8f).Then() // t = 0.8
.Delay(fade_in_length * 0.2f) // t = 1.0
.ScaleTo(0.9f, fade_in_length * 0.2f).Then() // t = 1.2
// stable dictates scale of 0.9->1 over time 1.0 to 1.4, but we are already at 1.2.

Check failure on line 90 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 90 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 90 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 90 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting
// so we need to force the current value to be correct at 1.2 (0.95) then complete the

Check failure on line 91 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 91 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 91 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 91 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting
// second half of the transform.

Check failure on line 92 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 92 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 92 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 92 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting
.ScaleTo(0.95f).ScaleTo(finalScale, fade_in_length * 0.2f); // t = 1.4
}
}

Expand Down
6 changes: 3 additions & 3 deletions osu.Game/Skinning/LegacySkin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,11 @@ protected override void ParseConfigurationStream(Stream stream)

private Drawable? getJudgementAnimation(HitResult result)
{
if (result.IsMiss())
return this.GetAnimation("hit0", true, false);

switch (result)
{
case HitResult.Miss:
return this.GetAnimation("hit0", true, false);

case HitResult.Meh:
return this.GetAnimation("hit50", true, false);

Expand Down

0 comments on commit 0c242fb

Please sign in to comment.