Add option toggles and configuration for snaking in and out sliders.

This commit is contained in:
Thomas Müller 2016-12-03 13:56:19 +01:00
parent a1efd25ac1
commit c43b47da2a
3 changed files with 39 additions and 15 deletions

View File

@ -11,6 +11,8 @@ using osu.Framework.Input;
using OpenTK.Graphics.ES30;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
using osu.Game.Configuration;
using osu.Framework.Configuration;
namespace osu.Game.Modes.Osu.Objects.Drawables
{
@ -49,12 +51,24 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
};
}
private Bindable<bool> snakingIn;
private Bindable<bool> snakingOut;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
snakingIn = config.GetBindable<bool>(OsuConfig.SnakingInSliders);
snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders);
}
protected override void LoadComplete()
{
base.LoadComplete();
//force application of the state that was set before we loaded.
UpdateState(State);
body.PathWidth = 32;
}
protected override void Update()
@ -77,7 +91,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
ball.Position = slider.Curve.PositionAt(currentProgress);
double drawEndProgress = MathHelper.Clamp((Time.Current - slider.StartTime + TIME_PREEMPT) / TIME_FADEIN, 0, 1);
body.SetRange(drawStartProgress, drawEndProgress);
body.SetRange(
snakingOut ? drawStartProgress : 0,
snakingIn ? drawEndProgress : 1);
}
protected override void CheckJudgement(bool userTriggered)
@ -192,8 +208,14 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
private Path path;
private BufferedContainer container;
private double drawnProgressStart;
private double drawnProgressEnd;
public float PathWidth
{
get { return path.PathWidth; }
set { path.PathWidth = value; }
}
private double? drawnProgressStart;
private double? drawnProgressEnd;
private Slider slider;
public Body(Slider s)
@ -227,12 +249,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
path.Texture = textures.Get(@"Menu/logo");
}
protected override void LoadComplete()
{
base.LoadComplete();
path.PathWidth = 32;
}
public void SetRange(double p0, double p1)
{
if (p0 > p1)

View File

@ -9,7 +9,7 @@ using osu.Game.Screens.Play;
namespace osu.Game.Configuration
{
class OsuConfigManager : ConfigManager<OsuConfig>
public class OsuConfigManager : ConfigManager<OsuConfig>
{
protected override void InitialiseDefaults()
{
@ -129,7 +129,8 @@ namespace osu.Game.Configuration
//Set(OsuConfig.Skin, SkinManager.DEFAULT_SKIN);
Set(OsuConfig.SkinSamples, true);
Set(OsuConfig.SkipTablet, false);
Set(OsuConfig.SnakingSliders, true);
Set(OsuConfig.SnakingInSliders, true);
Set(OsuConfig.SnakingOutSliders, false);
Set(OsuConfig.Tablet, false);
Set(OsuConfig.UpdatePending, false);
Set(OsuConfig.UseSkinCursor, false);
@ -189,7 +190,7 @@ namespace osu.Game.Configuration
}
}
enum OsuConfig
public enum OsuConfig
{
// New osu:
PlayMode,
@ -303,7 +304,8 @@ namespace osu.Game.Configuration
Skin,
SkinSamples,
SkipTablet,
SnakingSliders,
SnakingInSliders,
SnakingOutSliders,
Tablet,
UpdatePending,
UserFilter,
@ -345,5 +347,6 @@ namespace osu.Game.Configuration
Ticker,
CompatibilityContext,
CanForceOptimusCompatibility,
}
}

View File

@ -18,8 +18,13 @@ namespace osu.Game.Overlays.Options.Graphics
{
new CheckBoxOption
{
LabelText = "Snaking sliders",
Bindable = config.GetBindable<bool>(OsuConfig.SnakingSliders)
LabelText = "Snaking in sliders",
Bindable = config.GetBindable<bool>(OsuConfig.SnakingInSliders)
},
new CheckBoxOption
{
LabelText = "Snaking out sliders",
Bindable = config.GetBindable<bool>(OsuConfig.SnakingOutSliders)
},
new CheckBoxOption
{