Combine Judgement.HitResults into one.

This commit is contained in:
Dean Herbert
2017-09-05 19:44:59 +09:00
committed by smoogipooo
parent d69b8d7784
commit 84c22df3f5
46 changed files with 265 additions and 467 deletions

View File

@ -34,15 +34,13 @@ namespace osu.Game.Rulesets.Judgements
AutoSizeAxes = Axes.Both;
string resultString = judgement.Result == HitResult.Hit ? judgement.ResultString : judgement.Result.GetDescription();
Children = new[]
{
JudgementText = new OsuSpriteText
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Text = resultString.ToUpper(),
Text = judgement.Result.GetDescription().ToUpper(),
Font = @"Venera",
TextSize = 16
}
@ -68,6 +66,8 @@ namespace osu.Game.Rulesets.Judgements
switch (Judgement.Result)
{
case HitResult.None:
break;
case HitResult.Miss:
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Judgements
this.Delay(600).FadeOut(200);
break;
case HitResult.Hit:
default:
this.ScaleTo(0.9f);
this.ScaleTo(1, 500, Easing.OutElastic);

View File

@ -5,13 +5,20 @@ using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Judgements
{
public abstract class Judgement
public class Judgement
{
/// <summary>
/// Whether this judgement is the result of a hit or a miss.
/// </summary>
public HitResult Result;
/// <summary>
/// The maximum <see cref="HitResult"/> that can be achieved.
/// </summary>
public virtual HitResult MaxResult => HitResult.Perfect;
public bool IsHit => Result > HitResult.Miss;
/// <summary>
/// The offset at which this judgement occurred.
/// </summary>
@ -20,13 +27,20 @@ namespace osu.Game.Rulesets.Judgements
public virtual bool AffectsCombo => true;
/// <summary>
/// The string representation for the result achieved.
/// The numeric representation for the result achieved.
/// </summary>
public abstract string ResultString { get; }
public int NumericResult => NumericResultFor(Result);
/// <summary>
/// The string representation for the max result achievable.
/// The numeric representation for the maximum achievable result.
/// </summary>
public abstract string MaxResultString { get; }
public int MaxNumericResult => NumericResultFor(MaxResult);
/// <summary>
/// Convert a <see cref="HitResult"/> to a numeric score representation.
/// </summary>
/// <param name="result">The value to convert.</param>
/// <returns>The number.</returns>
protected virtual int NumericResultFor(HitResult result) => result > HitResult.Miss ? 1 : 0;
}
}

View File

@ -178,10 +178,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
channel.Volume.Value = sample.Volume;
Samples.Add(channel);
}
//we may be setting a custom judgement in test cases or what not.
if (Judgement == null)
Judgement = CreateJudgement();
}
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects;
@ -196,7 +192,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
nestedHitObjects.Add(h);
}
protected abstract TJudgement CreateJudgement();
protected abstract void UpdateState(ArmedState state);
}
}

View File

@ -10,17 +10,34 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <summary>
/// Indicates that the object has not been judged yet.
/// </summary>
[Description("")]
[Description(@"")]
None,
/// <summary>
/// Indicates that the object has been judged as a miss.
/// </summary>
[Description(@"Miss")]
Miss,
[Description(@"Meh")]
Meh,
/// <summary>
/// Indicates that the object has been judged as a hit.
/// Optional judgement.
/// </summary>
[Description(@"Hit")]
Hit,
[Description(@"OK")]
Ok,
[Description(@"Good")]
Good,
[Description(@"Great")]
Great,
/// <summary>
/// Optional judgement.
/// </summary>
[Description(@"Perfect")]
Perfect,
}
}
}

View File

@ -1,9 +1,11 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Objects
@ -30,6 +32,10 @@ namespace osu.Game.Rulesets.Objects
/// </summary>
public SampleInfoList Samples = new SampleInfoList();
public virtual IEnumerable<Judgement> CreateJudgements() => new[] { new Judgement() };
public readonly List<HitObject> Children = new List<HitObject>();
/// <summary>
/// Applies default values to this HitObject.
/// </summary>

View File

@ -181,10 +181,12 @@ namespace osu.Game.Rulesets.Scoring
{
switch (judgement.Result)
{
case HitResult.None:
break;
case HitResult.Miss:
Combo.Value = 0;
break;
case HitResult.Hit:
default:
Combo.Value++;
break;
}