1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Merge pull request #4130 from peppy/fix-key-counter

Fix key counter not counting
This commit is contained in:
Dean Herbert 2019-01-23 18:38:02 +09:00 committed by GitHub
commit f6fbb77ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 22 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.ComponentModel;
using System.Linq;
using osu.Game.Rulesets;
@ -23,11 +24,17 @@ namespace osu.Game.Tests.Visual
};
}
protected override bool ContinueCondition(Player player) => base.ContinueCondition(player) && ((ScoreAccessiblePlayer)player).ScoreProcessor.TotalScore > 0;
protected override void AddCheckSteps(Func<Player> player)
{
base.AddCheckSteps(player);
AddUntilStep(() => ((ScoreAccessiblePlayer)player()).ScoreProcessor.TotalScore > 0, "score above zero");
AddUntilStep(() => ((ScoreAccessiblePlayer)player()).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys");
}
private class ScoreAccessiblePlayer : Player
{
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
public new HUDOverlay HUDOverlay => base.HUDOverlay;
}
}
}

View File

@ -250,14 +250,14 @@ namespace osu.Game.Rulesets.UI
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
KeyBindingInputManager.Children = new Drawable[]
KeyBindingInputManager.AddRange(new Drawable[]
{
content = new Container
{
RelativeSizeAxes = Axes.Both,
},
Playfield
};
});
if (Cursor != null)
KeyBindingInputManager.Add(Cursor);

View File

@ -27,14 +27,6 @@ namespace osu.Game.Rulesets.UI
public abstract class RulesetInputManager<T> : PassThroughInputManager, ICanAttachKeyCounter, IHasReplayHandler
where T : struct
{
public class RulesetKeyBindingContainer : DatabasedKeyBindingContainer<T>
{
public RulesetKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
: base(ruleset, variant, unique)
{
}
}
protected override InputState CreateInitialState()
{
var state = base.CreateInitialState();
@ -251,6 +243,14 @@ namespace osu.Game.Rulesets.UI
protected virtual RulesetKeyBindingContainer CreateKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
=> new RulesetKeyBindingContainer(ruleset, variant, unique);
public class RulesetKeyBindingContainer : DatabasedKeyBindingContainer<T>
{
public RulesetKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
: base(ruleset, variant, unique)
{
}
}
}
/// <summary>

View File

@ -46,17 +46,21 @@ namespace osu.Game.Screens.Play
Children = new Drawable[]
{
visibilityContainer = new Container {
visibilityContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[] {
new Container {
Children = new Drawable[]
{
new Container
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Y = 30,
AutoSizeAxes = Axes.Both,
AutoSizeDuration = 200,
AutoSizeEasing = Easing.Out,
Children = new Drawable[] {
Children = new Drawable[]
{
AccuracyCounter = CreateAccuracyCounter(),
ScoreCounter = CreateScoreCounter(),
ComboCounter = CreateComboCounter(),

View File

@ -83,7 +83,7 @@ namespace osu.Game.Screens.Play
protected ScoreProcessor ScoreProcessor;
protected RulesetContainer RulesetContainer;
private HUDOverlay hudOverlay;
protected HUDOverlay HUDOverlay;
private FailOverlay failOverlay;
private DrawableStoryboard storyboard;
@ -200,7 +200,7 @@ namespace osu.Game.Screens.Play
{
Child = RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
},
hudOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
{
Clock = Clock, // hud overlay doesn't want to use the audio clock directly
ProcessCustomClock = false,
@ -233,8 +233,8 @@ namespace osu.Game.Screens.Play
}
};
hudOverlay.HoldToQuit.Action = performUserRequestedExit;
hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
HUDOverlay.HoldToQuit.Action = performUserRequestedExit;
HUDOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused);

View File

@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual
{
Player p = null;
AddStep(ruleset.RulesetInfo.Name, () => p = loadPlayerFor(ruleset));
AddUntilStep(() => ContinueCondition(p));
AddCheckSteps(() => p);
}
else
{
@ -52,7 +52,7 @@ namespace osu.Game.Tests.Visual
{
Player p = null;
AddStep(r.Name, () => p = loadPlayerFor(r));
AddUntilStep(() => ContinueCondition(p));
AddCheckSteps(() => p);
AddUntilStep(() =>
{
@ -79,7 +79,10 @@ namespace osu.Game.Tests.Visual
}
}
protected virtual bool ContinueCondition(Player player) => player.IsLoaded;
protected virtual void AddCheckSteps(Func<Player> player)
{
AddUntilStep(() => player().IsLoaded, "player loaded");
}
protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo);