2016-11-29 11:30:16 +00:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2016-11-29 12:28:43 +00:00
|
|
|
|
using osu.Framework.Configuration;
|
|
|
|
|
using osu.Game.Modes.Objects.Drawables;
|
2016-11-29 11:30:16 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Modes
|
|
|
|
|
{
|
2016-11-29 13:02:37 +00:00
|
|
|
|
public abstract class ScoreProcessor
|
2016-11-29 11:30:16 +00:00
|
|
|
|
{
|
2016-11-29 14:59:56 +00:00
|
|
|
|
public virtual Score GetScore() => new Score()
|
|
|
|
|
{
|
|
|
|
|
TotalScore = TotalScore,
|
|
|
|
|
Combo = Combo,
|
|
|
|
|
MaxCombo = HighestCombo,
|
|
|
|
|
Accuracy = Accuracy
|
|
|
|
|
};
|
2016-11-29 12:28:43 +00:00
|
|
|
|
|
2016-11-29 13:02:37 +00:00
|
|
|
|
public readonly BindableDouble TotalScore = new BindableDouble { MinValue = 0 };
|
2016-11-29 12:28:43 +00:00
|
|
|
|
|
2016-11-29 13:02:37 +00:00
|
|
|
|
public readonly BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 };
|
2016-11-29 12:28:43 +00:00
|
|
|
|
|
2016-11-29 13:02:37 +00:00
|
|
|
|
public readonly BindableInt Combo = new BindableInt();
|
2016-11-29 12:28:43 +00:00
|
|
|
|
|
2016-11-29 13:05:21 +00:00
|
|
|
|
public readonly BindableInt HighestCombo = new BindableInt();
|
2016-11-29 12:57:53 +00:00
|
|
|
|
|
2016-11-29 13:02:37 +00:00
|
|
|
|
public readonly List<JudgementInfo> Judgements = new List<JudgementInfo>();
|
2016-11-29 12:28:43 +00:00
|
|
|
|
|
2016-11-29 13:02:37 +00:00
|
|
|
|
public ScoreProcessor()
|
|
|
|
|
{
|
2016-11-29 13:05:21 +00:00
|
|
|
|
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
2016-11-29 13:02:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddJudgement(JudgementInfo judgement)
|
2016-11-29 12:28:43 +00:00
|
|
|
|
{
|
|
|
|
|
Judgements.Add(judgement);
|
2016-11-29 12:46:30 +00:00
|
|
|
|
|
2016-11-29 13:02:37 +00:00
|
|
|
|
UpdateCalculations(judgement);
|
2016-11-29 12:57:53 +00:00
|
|
|
|
|
2016-11-29 13:02:37 +00:00
|
|
|
|
judgement.ComboAtHit = (ulong)Combo.Value;
|
2016-11-29 12:28:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Update any values that potentially need post-processing on a judgement change.
|
|
|
|
|
/// </summary>
|
2016-11-29 13:02:37 +00:00
|
|
|
|
/// <param name="newJudgement">A new JudgementInfo that triggered this calculation. May be null.</param>
|
|
|
|
|
protected abstract void UpdateCalculations(JudgementInfo newJudgement);
|
2016-11-29 11:30:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|