mirror of
https://github.com/ppy/osu.git
synced 2025-02-12 16:42:55 +08:00
Fix average button not correctly becoming disabled where it previously would
This commit is contained in:
parent
28a59f4e29
commit
721b2dfbba
@ -138,15 +138,15 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
ReferenceScore.BindValueChanged(scoreChanged, true);
|
ReferenceScore.BindValueChanged(scoreChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the last play graph is relative to the offset at the point of the last play, so we need to factor that out for some usages.
|
||||||
|
private double adjustmentSinceLastPlay => lastPlayBeatmapOffset - Current.Value;
|
||||||
|
|
||||||
private void currentChanged(ValueChangedEvent<double> offset)
|
private void currentChanged(ValueChangedEvent<double> offset)
|
||||||
{
|
{
|
||||||
Scheduler.AddOnce(updateOffset);
|
Scheduler.AddOnce(updateOffset);
|
||||||
|
|
||||||
void updateOffset()
|
void updateOffset()
|
||||||
{
|
{
|
||||||
// the last play graph is relative to the offset at the point of the last play, so we need to factor that out.
|
|
||||||
double adjustmentSinceLastPlay = lastPlayBeatmapOffset - Current.Value;
|
|
||||||
|
|
||||||
// Negative is applied here because the play graph is considering a hit offset, not track (as we currently use for clocks).
|
// Negative is applied here because the play graph is considering a hit offset, not track (as we currently use for clocks).
|
||||||
lastPlayGraph?.UpdateOffset(-adjustmentSinceLastPlay);
|
lastPlayGraph?.UpdateOffset(-adjustmentSinceLastPlay);
|
||||||
|
|
||||||
@ -157,11 +157,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useAverageButton != null)
|
|
||||||
{
|
|
||||||
useAverageButton.Enabled.Value = !Precision.AlmostEquals(lastPlayAverage, adjustmentSinceLastPlay, Current.Precision / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
realmWriteTask = realm.WriteAsync(r =>
|
realmWriteTask = realm.WriteAsync(r =>
|
||||||
{
|
{
|
||||||
var setInfo = r.Find<BeatmapSetInfo>(beatmap.Value.BeatmapSetInfo.ID);
|
var setInfo = r.Find<BeatmapSetInfo>(beatmap.Value.BeatmapSetInfo.ID);
|
||||||
@ -255,7 +250,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
Current.Value = lastPlayBeatmapOffset - lastPlayAverage;
|
Current.Value = lastPlayBeatmapOffset - lastPlayAverage;
|
||||||
lastAppliedScore.Value = ReferenceScore.Value;
|
lastAppliedScore.Value = ReferenceScore.Value;
|
||||||
},
|
},
|
||||||
Enabled = { Value = !Precision.AlmostEquals(lastPlayAverage, 0, Current.Precision / 2) }
|
|
||||||
},
|
},
|
||||||
globalOffsetText = new LinkFlowContainer
|
globalOffsetText = new LinkFlowContainer
|
||||||
{
|
{
|
||||||
@ -285,9 +279,12 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
|
bool allow = allowOffsetAdjust;
|
||||||
|
|
||||||
if (useAverageButton != null)
|
if (useAverageButton != null)
|
||||||
useAverageButton.Enabled.Value = allowOffsetAdjust;
|
useAverageButton.Enabled.Value = allow && !Precision.AlmostEquals(lastPlayAverage, adjustmentSinceLastPlay, Current.Precision / 2);
|
||||||
Current.Disabled = !allowOffsetAdjust;
|
|
||||||
|
Current.Disabled = !allow;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool allowOffsetAdjust
|
private bool allowOffsetAdjust
|
||||||
|
Loading…
Reference in New Issue
Block a user