mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 00:53:31 +08:00
Remove autohide and clock related logic from Visual settings overlay
This commit is contained in:
parent
615c831069
commit
d82835107c
@ -119,13 +119,12 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
if (loaded)
|
||||
{
|
||||
PlayerSettingsOverlay.PlaybackSettings.Show();
|
||||
PlayerSettingsOverlay.Show();
|
||||
ModDisplay.FadeIn(200);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerSettingsOverlay.PlaybackSettings.Hide();
|
||||
PlayerSettingsOverlay.VisualSettings.Autohide = true;
|
||||
PlayerSettingsOverlay.Hide();
|
||||
ModDisplay.Delay(2000).FadeOut(200);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
private readonly FillFlowContainer content;
|
||||
private readonly IconButton button;
|
||||
|
||||
protected bool Expanded = true;
|
||||
private bool expanded = true;
|
||||
|
||||
private Color4 buttonActiveColour;
|
||||
|
||||
@ -82,7 +82,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
Position = new Vector2(-15, 0),
|
||||
Icon = FontAwesome.fa_bars,
|
||||
Scale = new Vector2(0.75f),
|
||||
Action = ToggleContentVisibility,
|
||||
Action = toggleContentVisibility,
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -112,13 +112,13 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
protected virtual void ToggleContentVisibility()
|
||||
private void toggleContentVisibility()
|
||||
{
|
||||
content.ClearTransforms();
|
||||
|
||||
Expanded = !Expanded;
|
||||
expanded = !expanded;
|
||||
|
||||
if (Expanded)
|
||||
if (expanded)
|
||||
content.AutoSizeAxes = Axes.Y;
|
||||
else
|
||||
{
|
||||
@ -126,7 +126,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
content.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
button.FadeColour(Expanded ? buttonActiveColour : Color4.White, 200, Easing.OutQuint);
|
||||
button.FadeColour(expanded ? buttonActiveColour : Color4.White, 200, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
// 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.Diagnostics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
@ -15,30 +12,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
protected override string Title => "Visual settings";
|
||||
|
||||
public IAdjustableClock AudioClock { get; set; }
|
||||
public FramedClock FramedClock { get; set; }
|
||||
|
||||
private bool autohide;
|
||||
|
||||
public bool Autohide
|
||||
{
|
||||
get => autohide;
|
||||
set
|
||||
{
|
||||
autohide = value;
|
||||
if (autohide && hideStopWatch == null)
|
||||
hideStopWatch = Stopwatch.StartNew();
|
||||
else if (!autohide)
|
||||
{
|
||||
this.FadeIn(50);
|
||||
hideStopWatch = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly TimeSpan hideTimeSpan = TimeSpan.FromSeconds(3);
|
||||
private Stopwatch hideStopWatch;
|
||||
|
||||
private readonly PlayerSliderBar<double> dimSliderBar;
|
||||
private readonly PlayerSliderBar<double> blurSliderBar;
|
||||
private readonly PlayerCheckbox showStoryboardToggle;
|
||||
@ -74,34 +47,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
mouseWheelDisabledToggle.Bindable = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
||||
|
||||
ToggleContentVisibility();
|
||||
}
|
||||
|
||||
protected override void ToggleContentVisibility()
|
||||
{
|
||||
base.ToggleContentVisibility();
|
||||
if (!Autohide)
|
||||
return;
|
||||
if (Expanded)
|
||||
{
|
||||
AudioClock.Stop();
|
||||
FramedClock.ProcessSourceClockFrames = false;
|
||||
hideStopWatch.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
AudioClock.Start();
|
||||
FramedClock.ProcessSourceClockFrames = true;
|
||||
hideStopWatch.Start();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (Autohide && IsPresent && hideStopWatch.Elapsed > hideTimeSpan) this.FadeOut(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user