2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
|
using osu.Game.Screens.Play.HUD;
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-03-24 16:02:36 +00:00
|
|
|
|
namespace osu.Game.Tests.Visual.Gameplay
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2019-05-14 19:37:25 +00:00
|
|
|
|
public class TestSceneScoreCounter : OsuTestScene
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2019-05-14 19:37:25 +00:00
|
|
|
|
public TestSceneScoreCounter()
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
int numerator = 0, denominator = 0;
|
|
|
|
|
|
|
|
|
|
ScoreCounter score = new ScoreCounter(7)
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
TextSize = 40,
|
|
|
|
|
Margin = new MarginPadding(20),
|
|
|
|
|
};
|
|
|
|
|
Add(score);
|
|
|
|
|
|
|
|
|
|
ComboCounter comboCounter = new StandardComboCounter
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Margin = new MarginPadding(10),
|
|
|
|
|
TextSize = 40,
|
|
|
|
|
};
|
|
|
|
|
Add(comboCounter);
|
|
|
|
|
|
|
|
|
|
PercentageCounter accuracyCounter = new PercentageCounter
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Position = new Vector2(-20, 60),
|
|
|
|
|
};
|
|
|
|
|
Add(accuracyCounter);
|
|
|
|
|
|
|
|
|
|
AddStep(@"Reset all", delegate
|
|
|
|
|
{
|
|
|
|
|
score.Current.Value = 0;
|
|
|
|
|
comboCounter.Current.Value = 0;
|
|
|
|
|
numerator = denominator = 0;
|
|
|
|
|
accuracyCounter.SetFraction(0, 0);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AddStep(@"Hit! :D", delegate
|
|
|
|
|
{
|
2019-02-21 09:56:34 +00:00
|
|
|
|
score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current.Value > 0 ? comboCounter.Current.Value - 1 : 0) / 25.0);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
comboCounter.Increment();
|
|
|
|
|
numerator++;
|
|
|
|
|
denominator++;
|
|
|
|
|
accuracyCounter.SetFraction(numerator, denominator);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AddStep(@"miss...", delegate
|
|
|
|
|
{
|
|
|
|
|
comboCounter.Current.Value = 0;
|
|
|
|
|
denominator++;
|
|
|
|
|
accuracyCounter.SetFraction(numerator, denominator);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|