mirror of
https://github.com/ppy/osu.git
synced 2024-09-21 18:07:23 +08:00
Initial implementation
This commit is contained in:
parent
81130eacd1
commit
f534c4aada
@ -134,6 +134,8 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.Shift, InputKey.F2 }, GlobalAction.SelectPreviousRandom),
|
||||
new KeyBinding(InputKey.F3, GlobalAction.ToggleBeatmapOptions),
|
||||
new KeyBinding(InputKey.BackSpace, GlobalAction.DeselectAllMods),
|
||||
new KeyBinding(InputKey.PageUp, GlobalAction.IncreaseSpeed), // Not working with minus and other keys....
|
||||
new KeyBinding(InputKey.PageDown, GlobalAction.DecreaseSpeed),
|
||||
};
|
||||
|
||||
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
|
||||
@ -364,5 +366,11 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorToggleRotateControl))]
|
||||
EditorToggleRotateControl,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.IncreaseSpeed))]
|
||||
IncreaseSpeed,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.DecreaseSpeed))]
|
||||
DecreaseSpeed,
|
||||
}
|
||||
}
|
||||
|
@ -349,6 +349,16 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString EditorToggleRotateControl => new TranslatableString(getKey(@"editor_toggle_rotate_control"), @"Toggle rotate control");
|
||||
|
||||
/// <summary>
|
||||
/// "Increase Speed"
|
||||
/// </summary>
|
||||
public static LocalisableString IncreaseSpeed => new TranslatableString(getKey(@"increase_speed"), @"Increase Speed");
|
||||
|
||||
/// <summary>
|
||||
/// "Decrease Speed"
|
||||
/// </summary>
|
||||
public static LocalisableString DecreaseSpeed => new TranslatableString(getKey(@"decrease_speed"), @"Decrease Speed");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
@ -755,7 +755,95 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void IncreaseSpeed()
|
||||
{
|
||||
// find way of grabbing all types of ModSpeedAdjust
|
||||
var rateAdjustStates = ModSelect.AllAvailableMods.Where(pair => pair.Mod.Acronym == "DT" || pair.Mod.Acronym == "NC" || pair.Mod.Acronym == "HT" || pair.Mod.Acronym == "DC");
|
||||
var stateDoubleTime = ModSelect.AllAvailableMods.First(pair => pair.Mod.Acronym == "DT");
|
||||
bool oneActive = false;
|
||||
double newRate = 1.05d;
|
||||
foreach (var state in rateAdjustStates)
|
||||
{
|
||||
ModRateAdjust mod = (ModRateAdjust)state.Mod;
|
||||
if (state.Active.Value)
|
||||
{
|
||||
oneActive = true;
|
||||
newRate = mod.SpeedChange.Value + 0.05d;
|
||||
if (mod.Acronym == "DT" || mod.Acronym == "NC")
|
||||
{
|
||||
mod.SpeedChange.Value = newRate;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newRate == 1.0d)
|
||||
{
|
||||
state.Active.Value = false;
|
||||
}
|
||||
if (newRate > 1d)
|
||||
{
|
||||
state.Active.Value = false;
|
||||
stateDoubleTime.Active.Value = true;
|
||||
((ModDoubleTime)stateDoubleTime.Mod).SpeedChange.Value = newRate;
|
||||
return;
|
||||
}
|
||||
if (newRate < 1d)
|
||||
{
|
||||
mod.SpeedChange.Value = newRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!oneActive)
|
||||
{
|
||||
stateDoubleTime.Active.Value = true;
|
||||
((ModDoubleTime)stateDoubleTime.Mod).SpeedChange.Value = newRate;
|
||||
}
|
||||
}
|
||||
public void DecreaseSpeed()
|
||||
{
|
||||
var rateAdjustStates = ModSelect.AllAvailableMods.Where(pair => pair.Mod.Acronym == "DT" || pair.Mod.Acronym == "NC" || pair.Mod.Acronym == "HT" || pair.Mod.Acronym == "DC");
|
||||
var stateHalfTime = ModSelect.AllAvailableMods.First(pair => pair.Mod.Acronym == "HT");
|
||||
bool oneActive = false;
|
||||
double newRate = 0.95d;
|
||||
foreach (var state in rateAdjustStates)
|
||||
{
|
||||
ModRateAdjust mod = (ModRateAdjust)state.Mod;
|
||||
if (state.Active.Value)
|
||||
{
|
||||
oneActive = true;
|
||||
newRate = mod.SpeedChange.Value - 0.05d;
|
||||
if (mod.Acronym == "HT" || mod.Acronym == "DC")
|
||||
{
|
||||
mod.SpeedChange.Value = newRate;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newRate == 1.0d)
|
||||
{
|
||||
state.Active.Value = false;
|
||||
}
|
||||
if (newRate < 1d)
|
||||
{
|
||||
state.Active.Value = false;
|
||||
stateHalfTime.Active.Value = true;
|
||||
((ModHalfTime)stateHalfTime.Mod).SpeedChange.Value = newRate;
|
||||
return;
|
||||
}
|
||||
if (newRate > 1d)
|
||||
{
|
||||
mod.SpeedChange.Value = newRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!oneActive)
|
||||
{
|
||||
stateHalfTime.Active.Value = true;
|
||||
((ModHalfTime)stateHalfTime.Mod).SpeedChange.Value = newRate;
|
||||
}
|
||||
}
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
@ -955,12 +1043,17 @@ namespace osu.Game.Screens.Select
|
||||
return false;
|
||||
|
||||
if (!this.IsCurrentScreen()) return false;
|
||||
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.Select:
|
||||
FinaliseSelection();
|
||||
return true;
|
||||
case GlobalAction.IncreaseSpeed:
|
||||
IncreaseSpeed();
|
||||
return true;
|
||||
case GlobalAction.DecreaseSpeed:
|
||||
DecreaseSpeed();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user