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

View File

@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play
protected ScoreProcessor ScoreProcessor; protected ScoreProcessor ScoreProcessor;
protected RulesetContainer RulesetContainer; protected RulesetContainer RulesetContainer;
private HUDOverlay hudOverlay; protected HUDOverlay HudOverlay;
private FailOverlay failOverlay; private FailOverlay failOverlay;
private DrawableStoryboard storyboard; private DrawableStoryboard storyboard;
@ -170,9 +170,9 @@ namespace osu.Game.Screens.Play
OnPause = () => OnPause = () =>
{ {
pauseContainer.Retries = RestartCount; 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[] Children = new[]
{ {
storyboardContainer = new Container storyboardContainer = new Container
@ -193,7 +193,7 @@ namespace osu.Game.Screens.Play
Breaks = beatmap.Breaks Breaks = beatmap.Breaks
}, },
RulesetContainer.Cursor?.CreateProxy() ?? new Container(), 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 Clock = Clock, // hud overlay doesn't want to use the audio clock directly
ProcessCustomClock = false, 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) if (ShowStoryboard)
initializeStoryboard(false); initializeStoryboard(false);
@ -368,7 +369,7 @@ namespace osu.Game.Screens.Play
RulesetContainer?.FadeOut(fade_out_duration); RulesetContainer?.FadeOut(fade_out_duration);
Content.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); Background?.FadeTo(1f, fade_out_duration);
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Replays;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
@ -14,6 +15,12 @@ namespace osu.Game.Screens.Play
Replay = replay; Replay = replay;
} }
[BackgroundDependencyLoader]
private void load()
{
HudOverlay.KeyCounter.Visible.Value = true;
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();