mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 13:07:24 +08:00
54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
|
//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;
|
|||
|
using osu.Framework.Graphics;
|
|||
|
using osu.Framework.Graphics.Containers;
|
|||
|
using osu.Game.Beatmaps.Objects;
|
|||
|
using osu.Game.Graphics.UserInterface;
|
|||
|
|
|||
|
namespace osu.Game.GameModes.Play
|
|||
|
{
|
|||
|
public abstract class ScoreOverlay : Container
|
|||
|
{
|
|||
|
public KeyCounterCollection KeyCounter;
|
|||
|
public ComboCounter ComboCounter;
|
|||
|
public ScoreCounter ScoreCounter;
|
|||
|
public PercentageCounter AccuracyCounter;
|
|||
|
|
|||
|
protected abstract KeyCounterCollection CreateKeyCounter();
|
|||
|
protected abstract ComboCounter CreateComboCounter();
|
|||
|
protected abstract PercentageCounter CreateAccuracyCounter();
|
|||
|
protected abstract ScoreCounter CreateScoreCounter();
|
|||
|
|
|||
|
public virtual void OnHit(HitObject h)
|
|||
|
{
|
|||
|
ComboCounter?.Increment();
|
|||
|
ScoreCounter?.Increment(300);
|
|||
|
AccuracyCounter?.Set(Math.Min(1, AccuracyCounter.Count + 0.01f));
|
|||
|
}
|
|||
|
|
|||
|
public virtual void OnMiss(HitObject h)
|
|||
|
{
|
|||
|
ComboCounter?.Roll();
|
|||
|
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
|
|||
|
}
|
|||
|
|
|||
|
public ScoreOverlay()
|
|||
|
{
|
|||
|
RelativeSizeAxes = Axes.Both;
|
|||
|
|
|||
|
Children = new Drawable[] {
|
|||
|
KeyCounter = CreateKeyCounter(),
|
|||
|
ComboCounter = CreateComboCounter(),
|
|||
|
ScoreCounter = CreateScoreCounter(),
|
|||
|
AccuracyCounter = CreateAccuracyCounter(),
|
|||
|
};
|
|||
|
}
|
|||
|
}
|
|||
|
}
|