mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 21:52:54 +08:00
Merge branch 'master' into sheared-button
This commit is contained in:
commit
8880ff16c3
@ -14,6 +14,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills
|
|||||||
{
|
{
|
||||||
private const double individual_decay_base = 0.125;
|
private const double individual_decay_base = 0.125;
|
||||||
private const double overall_decay_base = 0.30;
|
private const double overall_decay_base = 0.30;
|
||||||
|
private const double release_threshold = 24;
|
||||||
|
|
||||||
protected override double SkillMultiplier => 1;
|
protected override double SkillMultiplier => 1;
|
||||||
protected override double StrainDecayBase => 1;
|
protected override double StrainDecayBase => 1;
|
||||||
@ -37,31 +38,43 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills
|
|||||||
var maniaCurrent = (ManiaDifficultyHitObject)current;
|
var maniaCurrent = (ManiaDifficultyHitObject)current;
|
||||||
double endTime = maniaCurrent.EndTime;
|
double endTime = maniaCurrent.EndTime;
|
||||||
int column = maniaCurrent.BaseObject.Column;
|
int column = maniaCurrent.BaseObject.Column;
|
||||||
|
double closestEndTime = Math.Abs(endTime - maniaCurrent.LastObject.StartTime); // Lowest value we can assume with the current information
|
||||||
|
|
||||||
double holdFactor = 1.0; // Factor to all additional strains in case something else is held
|
double holdFactor = 1.0; // Factor to all additional strains in case something else is held
|
||||||
double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly
|
double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly
|
||||||
|
bool isOverlapping = false;
|
||||||
|
|
||||||
// Fill up the holdEndTimes array
|
// Fill up the holdEndTimes array
|
||||||
for (int i = 0; i < holdEndTimes.Length; ++i)
|
for (int i = 0; i < holdEndTimes.Length; ++i)
|
||||||
{
|
{
|
||||||
// If there is at least one other overlapping end or note, then we get an addition, buuuuuut...
|
// The current note is overlapped if a previous note or end is overlapping the current note body
|
||||||
if (Precision.DefinitelyBigger(holdEndTimes[i], maniaCurrent.StartTime, 1) && Precision.DefinitelyBigger(endTime, holdEndTimes[i], 1))
|
isOverlapping |= Precision.DefinitelyBigger(holdEndTimes[i], maniaCurrent.StartTime, 1) && Precision.DefinitelyBigger(endTime, holdEndTimes[i], 1);
|
||||||
holdAddition = 1.0;
|
|
||||||
|
|
||||||
// ... this addition only is valid if there is _no_ other note with the same ending. Releasing multiple notes at the same time is just as easy as releasing 1
|
|
||||||
if (Precision.AlmostEquals(endTime, holdEndTimes[i], 1))
|
|
||||||
holdAddition = 0;
|
|
||||||
|
|
||||||
// We give a slight bonus to everything if something is held meanwhile
|
// We give a slight bonus to everything if something is held meanwhile
|
||||||
if (Precision.DefinitelyBigger(holdEndTimes[i], endTime, 1))
|
if (Precision.DefinitelyBigger(holdEndTimes[i], endTime, 1))
|
||||||
holdFactor = 1.25;
|
holdFactor = 1.25;
|
||||||
|
|
||||||
|
closestEndTime = Math.Min(closestEndTime, Math.Abs(endTime - holdEndTimes[i]));
|
||||||
|
|
||||||
// Decay individual strains
|
// Decay individual strains
|
||||||
individualStrains[i] = applyDecay(individualStrains[i], current.DeltaTime, individual_decay_base);
|
individualStrains[i] = applyDecay(individualStrains[i], current.DeltaTime, individual_decay_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
holdEndTimes[column] = endTime;
|
holdEndTimes[column] = endTime;
|
||||||
|
|
||||||
|
// The hold addition is given if there was an overlap, however it is only valid if there are no other note with a similar ending.
|
||||||
|
// Releasing multiple notes is just as easy as releasing 1. Nerfs the hold addition by half if the closest release is release_threshold away.
|
||||||
|
// holdAddition
|
||||||
|
// ^
|
||||||
|
// 1.0 + - - - - - -+-----------
|
||||||
|
// | /
|
||||||
|
// 0.5 + - - - - -/ Sigmoid Curve
|
||||||
|
// | /|
|
||||||
|
// 0.0 +--------+-+---------------> Release Difference / ms
|
||||||
|
// release_threshold
|
||||||
|
if (isOverlapping)
|
||||||
|
holdAddition = 1 / (1 + Math.Exp(0.5 * (release_threshold - closestEndTime)));
|
||||||
|
|
||||||
// Increase individual strain in own column
|
// Increase individual strain in own column
|
||||||
individualStrains[column] += 2.0 * holdFactor;
|
individualStrains[column] += 2.0 * holdFactor;
|
||||||
individualStrain = individualStrains[column];
|
individualStrain = individualStrains[column];
|
||||||
|
@ -108,7 +108,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
if (Enabled.Value)
|
if (Enabled.Value)
|
||||||
{
|
{
|
||||||
Debug.Assert(backgroundColour != null);
|
Debug.Assert(backgroundColour != null);
|
||||||
Background.FlashColour(backgroundColour.Value, 200);
|
Background.FlashColour(backgroundColour.Value.Lighten(0.4f), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnClick(e);
|
return base.OnClick(e);
|
||||||
|
@ -20,6 +20,10 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
|
|
||||||
private SettingsSlider<float> deadzoneSlider;
|
private SettingsSlider<float> deadzoneSlider;
|
||||||
|
|
||||||
|
private Bindable<float> handlerDeadzone;
|
||||||
|
|
||||||
|
private Bindable<float> localDeadzone;
|
||||||
|
|
||||||
public JoystickSettings(JoystickHandler joystickHandler)
|
public JoystickSettings(JoystickHandler joystickHandler)
|
||||||
{
|
{
|
||||||
this.joystickHandler = joystickHandler;
|
this.joystickHandler = joystickHandler;
|
||||||
@ -28,6 +32,10 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
// use local bindable to avoid changing enabled state of game host's bindable.
|
||||||
|
handlerDeadzone = joystickHandler.DeadzoneThreshold.GetBoundCopy();
|
||||||
|
localDeadzone = handlerDeadzone.GetUnboundCopy();
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
@ -40,7 +48,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
LabelText = JoystickSettingsStrings.DeadzoneThreshold,
|
LabelText = JoystickSettingsStrings.DeadzoneThreshold,
|
||||||
KeyboardStep = 0.01f,
|
KeyboardStep = 0.01f,
|
||||||
DisplayAsPercentage = true,
|
DisplayAsPercentage = true,
|
||||||
Current = joystickHandler.DeadzoneThreshold,
|
Current = localDeadzone,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -51,6 +59,17 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
|
|
||||||
enabled.BindTo(joystickHandler.Enabled);
|
enabled.BindTo(joystickHandler.Enabled);
|
||||||
enabled.BindValueChanged(e => deadzoneSlider.Current.Disabled = !e.NewValue, true);
|
enabled.BindValueChanged(e => deadzoneSlider.Current.Disabled = !e.NewValue, true);
|
||||||
|
|
||||||
|
handlerDeadzone.BindValueChanged(val =>
|
||||||
|
{
|
||||||
|
bool disabled = localDeadzone.Disabled;
|
||||||
|
|
||||||
|
localDeadzone.Disabled = false;
|
||||||
|
localDeadzone.Value = val.NewValue;
|
||||||
|
localDeadzone.Disabled = disabled;
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
localDeadzone.BindValueChanged(val => handlerDeadzone.Value = val.NewValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user