Merge pull request #658 from Jorolf/slider-stuff

Slider tooltip and letterboxing/dim changes
This commit is contained in:
Dean Herbert 2017-04-25 20:03:59 +09:00 committed by GitHub
commit 73b8d58944
9 changed files with 49 additions and 29 deletions

View File

@ -25,7 +25,7 @@ namespace osu.Game.Configuration
Set(OsuConfig.MenuCursorSize, 1.0, 0.5f, 2); Set(OsuConfig.MenuCursorSize, 1.0, 0.5f, 2);
Set(OsuConfig.GameplayCursorSize, 1.0, 0.5f, 2); Set(OsuConfig.GameplayCursorSize, 1.0, 0.5f, 2);
Set(OsuConfig.DimLevel, 30, 0, 100); Set(OsuConfig.DimLevel, 0.3, 0, 1);
Set(OsuConfig.MouseDisableButtons, false); Set(OsuConfig.MouseDisableButtons, false);
Set(OsuConfig.MouseDisableWheel, false); Set(OsuConfig.MouseDisableWheel, false);

View File

@ -23,14 +23,14 @@ namespace osu.Game.Graphics.UserInterface
private readonly Box leftBox; private readonly Box leftBox;
private readonly Box rightBox; private readonly Box rightBox;
public string TooltipText public virtual string TooltipText
{ {
get get
{ {
var bindableDouble = CurrentNumber as BindableNumber<double>; var bindableDouble = CurrentNumber as BindableNumber<double>;
if (bindableDouble != null) if (bindableDouble != null)
{ {
if (bindableDouble.MaxValue == 1 && bindableDouble.MinValue == 0) if (bindableDouble.MaxValue == 1 && (bindableDouble.MinValue == 0 || bindableDouble.MinValue == -1))
return bindableDouble.Value.ToString(@"P0"); return bindableDouble.Value.ToString(@"P0");
return bindableDouble.Value.ToString(@"n1"); return bindableDouble.Value.ToString(@"n1");
} }

View File

@ -12,7 +12,11 @@ using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class OptionSlider<T> : FillFlowContainer where T : struct public class OptionSlider<T> : OptionSlider<T, OsuSliderBar<T>> where T: struct
{
}
public class OptionSlider<T, U> : FillFlowContainer where T : struct where U : SliderBar<T>, new()
{ {
private readonly SliderBar<T> slider; private readonly SliderBar<T> slider;
private readonly SpriteText text; private readonly SpriteText text;
@ -50,7 +54,7 @@ namespace osu.Game.Overlays.Options
{ {
Alpha = 0, Alpha = 0,
}, },
slider = new OsuSliderBar<T> slider = new U()
{ {
Margin = new MarginPadding { Top = 5, Bottom = 5 }, Margin = new MarginPadding { Top = 5, Bottom = 5 },
RelativeSizeAxes = Axes.X RelativeSizeAxes = Axes.X

View File

@ -2,7 +2,6 @@
// 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.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -18,10 +17,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OptionSlider<double> new OptionSlider<double, OffsetSlider>
{ {
LabelText = "Audio Offset", LabelText = "Audio Offset",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.AudioOffset) Bindable = config.GetBindable<double>(OsuConfig.AudioOffset)
}, },
new OsuButton new OsuButton
{ {
@ -30,5 +29,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio
} }
}; };
} }
private class OffsetSlider : OsuSliderBar<double>
{
public override string TooltipText => Current.Value.ToString(@"0ms");
}
} }
} }

View File

@ -2,7 +2,6 @@
// 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.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -18,10 +17,10 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OptionSlider<int> new OptionSlider<double>
{ {
LabelText = "Background dim", LabelText = "Background dim",
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.DimLevel) Bindable = config.GetBindable<double>(OsuConfig.DimLevel)
}, },
new OptionEnumDropdown<ProgressBarType> new OptionEnumDropdown<ProgressBarType>
{ {
@ -36,7 +35,7 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
new OptionSlider<double> new OptionSlider<double>
{ {
LabelText = "Score meter size", LabelText = "Score meter size",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.ScoreMeterScale) Bindable = config.GetBindable<double>(OsuConfig.ScoreMeterScale)
}, },
new OsuCheckbox new OsuCheckbox
{ {

View File

@ -2,9 +2,9 @@
// 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.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.Sections.Gameplay namespace osu.Game.Overlays.Options.Sections.Gameplay
{ {
@ -17,18 +17,23 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OptionSlider<double> new OptionSlider<double, StarSlider>
{ {
LabelText = "Display beatmaps from", LabelText = "Display beatmaps from",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMinimum) Bindable = config.GetBindable<double>(OsuConfig.DisplayStarsMinimum)
}, },
new OptionSlider<double> new OptionSlider<double, StarSlider>
{ {
LabelText = "up to", LabelText = "up to",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMaximum) Bindable = config.GetBindable<double>(OsuConfig.DisplayStarsMaximum)
}, },
}; };
} }
private class StarSlider : OsuSliderBar<double>
{
public override string TooltipText => Current.Value.ToString(@"0.## stars");
}
} }
} }

View File

@ -2,7 +2,6 @@
// 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.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -18,10 +17,10 @@ namespace osu.Game.Overlays.Options.Sections.Input
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OptionSlider<double> new OptionSlider<double, SensitivitySlider>
{ {
LabelText = "Sensitivity", LabelText = "Sensitivity",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MouseSpeed), Bindable = config.GetBindable<double>(OsuConfig.MouseSpeed)
}, },
new OsuCheckbox new OsuCheckbox
{ {
@ -55,5 +54,10 @@ namespace osu.Game.Overlays.Options.Sections.Input
}, },
}; };
} }
private class SensitivitySlider : OsuSliderBar<double>
{
public override string TooltipText => Current.Value.ToString(@"0.##x");
}
} }
} }

View File

@ -2,7 +2,6 @@
// 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.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -59,15 +58,15 @@ namespace osu.Game.Overlays.Options.Sections
LabelText = "Always use skin cursor", LabelText = "Always use skin cursor",
Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor) Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor)
}, },
new OptionSlider<double> new OptionSlider<double, SizeSlider>
{ {
LabelText = "Menu cursor size", LabelText = "Menu cursor size",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MenuCursorSize) Bindable = config.GetBindable<double>(OsuConfig.MenuCursorSize)
}, },
new OptionSlider<double> new OptionSlider<double, SizeSlider>
{ {
LabelText = "Gameplay cursor size", LabelText = "Gameplay cursor size",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.GameplayCursorSize) Bindable = config.GetBindable<double>(OsuConfig.GameplayCursorSize)
}, },
new OsuCheckbox new OsuCheckbox
{ {
@ -76,5 +75,10 @@ namespace osu.Game.Overlays.Options.Sections
}, },
}; };
} }
private class SizeSlider : OsuSliderBar<double>
{
public override string TooltipText => Current.Value.ToString(@"0.##x");
}
} }
} }

View File

@ -62,7 +62,7 @@ namespace osu.Game.Screens.Play
#region User Settings #region User Settings
private Bindable<int> dimLevel; private Bindable<double> dimLevel;
private Bindable<bool> mouseWheelDisabled; private Bindable<bool> mouseWheelDisabled;
private Bindable<double> userAudioOffset; private Bindable<double> userAudioOffset;
@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu) private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu)
{ {
dimLevel = config.GetBindable<int>(OsuConfig.DimLevel); dimLevel = config.GetBindable<double>(OsuConfig.DimLevel);
mouseWheelDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableWheel); mouseWheelDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableWheel);
Ruleset rulesetInstance; Ruleset rulesetInstance;
@ -316,11 +316,11 @@ namespace osu.Game.Screens.Play
base.OnEntering(last); base.OnEntering(last);
(Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, EasingTypes.OutQuint); (Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, EasingTypes.OutQuint);
Background?.FadeTo((100f - dimLevel) / 100, 1500, EasingTypes.OutQuint); Background?.FadeTo(1 - (float)dimLevel, 1500, EasingTypes.OutQuint);
Content.Alpha = 0; Content.Alpha = 0;
dimLevel.ValueChanged += newDim => Background?.FadeTo((100f - newDim) / 100, 800); dimLevel.ValueChanged += newDim => Background?.FadeTo(1 - (float)newDim, 800);
Content.ScaleTo(0.7f); Content.ScaleTo(0.7f);