mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08:00
Merge branch 'skin-components-bind-outwards-accuracy' into remove-hud-overlay-unused-pieces
This commit is contained in:
commit
04d35826a3
@ -4,9 +4,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
@ -17,33 +19,21 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||
|
||||
[Cached]
|
||||
private ScoreProcessor scoreProcessor = new ScoreProcessor();
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("Create combo counters", () => SetContents(() =>
|
||||
{
|
||||
var accuracyCounter = new SkinnableAccuracyCounter();
|
||||
|
||||
accuracyCounter.Current.Value = 1;
|
||||
|
||||
return accuracyCounter;
|
||||
}));
|
||||
AddStep("Create combo counters", () => SetContents(() => new SkinnableAccuracyCounter()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangingAccuracy()
|
||||
{
|
||||
AddStep(@"Reset all", delegate
|
||||
{
|
||||
foreach (var s in accuracyCounters)
|
||||
s.Current.Value = 1;
|
||||
});
|
||||
AddStep(@"Reset all", () => scoreProcessor.Accuracy.Value = 1);
|
||||
|
||||
AddStep(@"Hit! :D", delegate
|
||||
{
|
||||
foreach (var s in accuracyCounters)
|
||||
s.Current.Value -= 0.023f;
|
||||
});
|
||||
AddStep(@"Hit! :D", () => scoreProcessor.Accuracy.Value -= 0.23);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,11 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class DefaultAccuracyCounter : PercentageCounter, IAccuracyCounter, ISkinnableComponent
|
||||
public class DefaultAccuracyCounter : GameplayAccuracyCounter, ISkinnableComponent
|
||||
{
|
||||
private readonly Vector2 offset = new Vector2(-20, 5);
|
||||
|
||||
|
18
osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs
Normal file
18
osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs
Normal file
@ -0,0 +1,18 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public abstract class GameplayAccuracyCounter : PercentageCounter
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
Current.BindTo(scoreProcessor.Accuracy);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface providing a set of methods to update a accuracy counter.
|
||||
/// </summary>
|
||||
public interface IAccuracyCounter : IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// The current accuracy to be displayed.
|
||||
/// </summary>
|
||||
Bindable<double> Current { get; }
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class SkinnableAccuracyCounter : SkinnableDrawable, IAccuracyCounter
|
||||
public class SkinnableAccuracyCounter : SkinnableDrawable
|
||||
{
|
||||
public Bindable<double> Current { get; } = new Bindable<double>();
|
||||
|
||||
@ -15,15 +15,5 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
CentreComponent = false;
|
||||
}
|
||||
|
||||
private IAccuracyCounter skinnedCounter;
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
{
|
||||
base.SkinChanged(skin, allowFallback);
|
||||
|
||||
skinnedCounter = Drawable as IAccuracyCounter;
|
||||
skinnedCounter?.Current.BindTo(Current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,13 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyAccuracyCounter : PercentageCounter, IAccuracyCounter, ISkinnableComponent
|
||||
public class LegacyAccuracyCounter : GameplayAccuracyCounter, ISkinnableComponent
|
||||
{
|
||||
private readonly ISkin skin;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user