1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Always display the key counter during replay/autoplay

This commit is contained in:
smoogipoo 2018-06-12 17:59:59 +09:00
parent 370e079640
commit c70c7a476b
3 changed files with 22 additions and 10 deletions

View File

@ -18,7 +18,8 @@ namespace osu.Game.Screens.Play
{
private const int duration = 100;
private Bindable<bool> showKeyCounter;
public readonly Bindable<bool> Visible = new Bindable<bool>(true);
private readonly Bindable<bool> alwaysVisible = new Bindable<bool>();
public KeyCounterCollection()
{
@ -46,9 +47,10 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
showKeyCounter = config.GetBindable<bool>(OsuSetting.KeyOverlay);
showKeyCounter.ValueChanged += keyCounterVisibility => this.FadeTo(keyCounterVisibility ? 1 : 0, duration);
showKeyCounter.TriggerChange();
config.BindWith(OsuSetting.KeyOverlay, alwaysVisible);
Visible.BindValueChanged(_ => updateVisibility());
alwaysVisible.BindValueChanged(_ => updateVisibility(), true);
}
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
@ -111,6 +113,8 @@ namespace osu.Game.Screens.Play
}
}
private void updateVisibility() => this.FadeTo(Visible.Value || alwaysVisible.Value ? 1 : 0, duration);
public override bool HandleKeyboardInput => receptor == null;
public override bool HandleMouseInput => receptor == null;

View File

@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play
protected ScoreProcessor ScoreProcessor;
protected RulesetContainer RulesetContainer;
private HUDOverlay hudOverlay;
protected HUDOverlay HudOverlay;
private FailOverlay failOverlay;
private DrawableStoryboard storyboard;
@ -170,9 +170,9 @@ namespace osu.Game.Screens.Play
OnPause = () =>
{
pauseContainer.Retries = RestartCount;
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
HudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
},
OnResume = () => hudOverlay.KeyCounter.IsCounting = true,
OnResume = () => HudOverlay.KeyCounter.IsCounting = true,
Children = new[]
{
storyboardContainer = new Container
@ -193,7 +193,7 @@ namespace osu.Game.Screens.Play
Breaks = beatmap.Breaks
},
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,
@ -228,7 +228,8 @@ namespace osu.Game.Screens.Play
}
};
hudOverlay.HoldToQuit.Action = Exit;
HudOverlay.HoldToQuit.Action = Exit;
HudOverlay.KeyCounter.Visible.Value = RulesetContainer.HasReplayLoaded;
if (ShowStoryboard)
initializeStoryboard(false);
@ -368,7 +369,7 @@ namespace osu.Game.Screens.Play
RulesetContainer?.FadeOut(fade_out_duration);
Content.FadeOut(fade_out_duration);
hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, Easing.In);
HudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, Easing.In);
Background?.FadeTo(1f, fade_out_duration);
}

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 osu.Framework.Allocation;
using osu.Game.Rulesets.Replays;
namespace osu.Game.Screens.Play
@ -14,6 +15,12 @@ namespace osu.Game.Screens.Play
Replay = replay;
}
[BackgroundDependencyLoader]
private void load()
{
HudOverlay.KeyCounter.Visible.Value = true;
}
protected override void LoadComplete()
{
base.LoadComplete();