mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
@ -17,33 +19,21 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private ScoreProcessor scoreProcessor = new ScoreProcessor();
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetUpSteps()
|
public void SetUpSteps()
|
||||||
{
|
{
|
||||||
AddStep("Create combo counters", () => SetContents(() =>
|
AddStep("Create combo counters", () => SetContents(() => new SkinnableAccuracyCounter()));
|
||||||
{
|
|
||||||
var accuracyCounter = new SkinnableAccuracyCounter();
|
|
||||||
|
|
||||||
accuracyCounter.Current.Value = 1;
|
|
||||||
|
|
||||||
return accuracyCounter;
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestChangingAccuracy()
|
public void TestChangingAccuracy()
|
||||||
{
|
{
|
||||||
AddStep(@"Reset all", delegate
|
AddStep(@"Reset all", () => scoreProcessor.Accuracy.Value = 1);
|
||||||
{
|
|
||||||
foreach (var s in accuracyCounters)
|
|
||||||
s.Current.Value = 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep(@"Hit! :D", delegate
|
AddStep(@"Hit! :D", () => scoreProcessor.Accuracy.Value -= 0.23);
|
||||||
{
|
|
||||||
foreach (var s in accuracyCounters)
|
|
||||||
s.Current.Value -= 0.023f;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,11 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD
|
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);
|
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
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
public class SkinnableAccuracyCounter : SkinnableDrawable, IAccuracyCounter
|
public class SkinnableAccuracyCounter : SkinnableDrawable
|
||||||
{
|
{
|
||||||
public Bindable<double> Current { get; } = new Bindable<double>();
|
public Bindable<double> Current { get; } = new Bindable<double>();
|
||||||
|
|
||||||
@ -15,15 +15,5 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
CentreComponent = false;
|
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.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
public class LegacyAccuracyCounter : PercentageCounter, IAccuracyCounter, ISkinnableComponent
|
public class LegacyAccuracyCounter : GameplayAccuracyCounter, ISkinnableComponent
|
||||||
{
|
{
|
||||||
private readonly ISkin skin;
|
private readonly ISkin skin;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user