mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 11:23:23 +08:00
Merge pull request #658 from Jorolf/slider-stuff
Slider tooltip and letterboxing/dim changes
This commit is contained in:
commit
73b8d58944
@ -25,7 +25,7 @@ namespace osu.Game.Configuration
|
||||
|
||||
Set(OsuConfig.MenuCursorSize, 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.MouseDisableWheel, false);
|
||||
|
@ -23,14 +23,14 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private readonly Box leftBox;
|
||||
private readonly Box rightBox;
|
||||
|
||||
public string TooltipText
|
||||
public virtual string TooltipText
|
||||
{
|
||||
get
|
||||
{
|
||||
var bindableDouble = CurrentNumber as BindableNumber<double>;
|
||||
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(@"n1");
|
||||
}
|
||||
|
@ -12,7 +12,11 @@ using osu.Game.Graphics.UserInterface;
|
||||
|
||||
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 SpriteText text;
|
||||
@ -50,7 +54,7 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
Alpha = 0,
|
||||
},
|
||||
slider = new OsuSliderBar<T>
|
||||
slider = new U()
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||
RelativeSizeAxes = Axes.X
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -18,10 +17,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OptionSlider<double>
|
||||
new OptionSlider<double, OffsetSlider>
|
||||
{
|
||||
LabelText = "Audio Offset",
|
||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.AudioOffset)
|
||||
Bindable = config.GetBindable<double>(OsuConfig.AudioOffset)
|
||||
},
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -18,10 +17,10 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OptionSlider<int>
|
||||
new OptionSlider<double>
|
||||
{
|
||||
LabelText = "Background dim",
|
||||
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.DimLevel)
|
||||
Bindable = config.GetBindable<double>(OsuConfig.DimLevel)
|
||||
},
|
||||
new OptionEnumDropdown<ProgressBarType>
|
||||
{
|
||||
@ -36,7 +35,7 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
|
||||
new OptionSlider<double>
|
||||
{
|
||||
LabelText = "Score meter size",
|
||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.ScoreMeterScale)
|
||||
Bindable = config.GetBindable<double>(OsuConfig.ScoreMeterScale)
|
||||
},
|
||||
new OsuCheckbox
|
||||
{
|
||||
|
@ -2,9 +2,9 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Gameplay
|
||||
{
|
||||
@ -17,18 +17,23 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OptionSlider<double>
|
||||
new OptionSlider<double, StarSlider>
|
||||
{
|
||||
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",
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -18,10 +17,10 @@ namespace osu.Game.Overlays.Options.Sections.Input
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OptionSlider<double>
|
||||
new OptionSlider<double, SensitivitySlider>
|
||||
{
|
||||
LabelText = "Sensitivity",
|
||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MouseSpeed),
|
||||
Bindable = config.GetBindable<double>(OsuConfig.MouseSpeed)
|
||||
},
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
@ -59,15 +58,15 @@ namespace osu.Game.Overlays.Options.Sections
|
||||
LabelText = "Always use skin cursor",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor)
|
||||
},
|
||||
new OptionSlider<double>
|
||||
new OptionSlider<double, SizeSlider>
|
||||
{
|
||||
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",
|
||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.GameplayCursorSize)
|
||||
Bindable = config.GetBindable<double>(OsuConfig.GameplayCursorSize)
|
||||
},
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
#region User Settings
|
||||
|
||||
private Bindable<int> dimLevel;
|
||||
private Bindable<double> dimLevel;
|
||||
private Bindable<bool> mouseWheelDisabled;
|
||||
private Bindable<double> userAudioOffset;
|
||||
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
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);
|
||||
|
||||
Ruleset rulesetInstance;
|
||||
@ -316,11 +316,11 @@ namespace osu.Game.Screens.Play
|
||||
base.OnEntering(last);
|
||||
|
||||
(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;
|
||||
|
||||
dimLevel.ValueChanged += newDim => Background?.FadeTo((100f - newDim) / 100, 800);
|
||||
dimLevel.ValueChanged += newDim => Background?.FadeTo(1 - (float)newDim, 800);
|
||||
|
||||
Content.ScaleTo(0.7f);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user