mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Remove autohide and clock related logic from Visual settings overlay
This commit is contained in:
@ -119,13 +119,12 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
if (loaded)
|
if (loaded)
|
||||||
{
|
{
|
||||||
PlayerSettingsOverlay.PlaybackSettings.Show();
|
PlayerSettingsOverlay.Show();
|
||||||
ModDisplay.FadeIn(200);
|
ModDisplay.FadeIn(200);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PlayerSettingsOverlay.PlaybackSettings.Hide();
|
PlayerSettingsOverlay.Hide();
|
||||||
PlayerSettingsOverlay.VisualSettings.Autohide = true;
|
|
||||||
ModDisplay.Delay(2000).FadeOut(200);
|
ModDisplay.Delay(2000).FadeOut(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
private readonly FillFlowContainer content;
|
private readonly FillFlowContainer content;
|
||||||
private readonly IconButton button;
|
private readonly IconButton button;
|
||||||
|
|
||||||
protected bool Expanded = true;
|
private bool expanded = true;
|
||||||
|
|
||||||
private Color4 buttonActiveColour;
|
private Color4 buttonActiveColour;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
Position = new Vector2(-15, 0),
|
Position = new Vector2(-15, 0),
|
||||||
Icon = FontAwesome.fa_bars,
|
Icon = FontAwesome.fa_bars,
|
||||||
Scale = new Vector2(0.75f),
|
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 override Container<Drawable> Content => content;
|
||||||
|
|
||||||
protected virtual void ToggleContentVisibility()
|
private void toggleContentVisibility()
|
||||||
{
|
{
|
||||||
content.ClearTransforms();
|
content.ClearTransforms();
|
||||||
|
|
||||||
Expanded = !Expanded;
|
expanded = !expanded;
|
||||||
|
|
||||||
if (Expanded)
|
if (expanded)
|
||||||
content.AutoSizeAxes = Axes.Y;
|
content.AutoSizeAxes = Axes.Y;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -126,7 +126,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
content.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
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>.
|
// 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 System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
@ -15,30 +12,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
{
|
{
|
||||||
protected override string Title => "Visual settings";
|
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> dimSliderBar;
|
||||||
private readonly PlayerSliderBar<double> blurSliderBar;
|
private readonly PlayerSliderBar<double> blurSliderBar;
|
||||||
private readonly PlayerCheckbox showStoryboardToggle;
|
private readonly PlayerCheckbox showStoryboardToggle;
|
||||||
@ -74,34 +47,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||||
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
mouseWheelDisabledToggle.Bindable = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user