mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 19:12:56 +08:00
Add static memory of last applied offset score
I don't really like adding this new session static, but we don't have a better place to put this.
This commit is contained in:
parent
2d3595f768
commit
2a28c5f4de
@ -29,6 +29,7 @@ namespace osu.Game.Configuration
|
|||||||
SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
||||||
SetDefault(Static.TouchInputActive, RuntimeInfo.IsMobile);
|
SetDefault(Static.TouchInputActive, RuntimeInfo.IsMobile);
|
||||||
SetDefault<ScoreInfo>(Static.LastLocalUserScore, null);
|
SetDefault<ScoreInfo>(Static.LastLocalUserScore, null);
|
||||||
|
SetDefault<ScoreInfo>(Static.LastAppliedOffsetScore, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -81,6 +82,11 @@ namespace osu.Game.Configuration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
LastLocalUserScore,
|
LastLocalUserScore,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stores the local user's last score which was used to apply an offset.
|
||||||
|
/// </summary>
|
||||||
|
LastAppliedOffsetScore,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the intro animation for the daily challenge screen has been played once.
|
/// Whether the intro animation for the daily challenge screen has been played once.
|
||||||
/// This is reset when a new challenge is up.
|
/// This is reset when a new challenge is up.
|
||||||
|
@ -15,6 +15,7 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -36,6 +37,8 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
{
|
{
|
||||||
public Bindable<ScoreInfo?> ReferenceScore { get; } = new Bindable<ScoreInfo?>();
|
public Bindable<ScoreInfo?> ReferenceScore { get; } = new Bindable<ScoreInfo?>();
|
||||||
|
|
||||||
|
private Bindable<ScoreInfo?> lastAppliedScore { get; } = new Bindable<ScoreInfo?>();
|
||||||
|
|
||||||
public BindableDouble Current { get; } = new BindableDouble
|
public BindableDouble Current { get; } = new BindableDouble
|
||||||
{
|
{
|
||||||
MinValue = -50,
|
MinValue = -50,
|
||||||
@ -100,6 +103,12 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(SessionStatics statics)
|
||||||
|
{
|
||||||
|
statics.BindWith(Static.LastAppliedOffsetScore, lastAppliedScore);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -176,6 +185,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
if (score.NewValue == null)
|
if (score.NewValue == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (score.NewValue.Equals(lastAppliedScore.Value))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!score.NewValue.BeatmapInfo.AsNonNull().Equals(beatmap.Value.BeatmapInfo))
|
if (!score.NewValue.BeatmapInfo.AsNonNull().Equals(beatmap.Value.BeatmapInfo))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -230,7 +242,11 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
useAverageButton = new SettingsButton
|
useAverageButton = new SettingsButton
|
||||||
{
|
{
|
||||||
Text = BeatmapOffsetControlStrings.CalibrateUsingLastPlay,
|
Text = BeatmapOffsetControlStrings.CalibrateUsingLastPlay,
|
||||||
Action = () => Current.Value = lastPlayBeatmapOffset - lastPlayAverage,
|
Action = () =>
|
||||||
|
{
|
||||||
|
Current.Value = lastPlayBeatmapOffset - lastPlayAverage;
|
||||||
|
lastAppliedScore.Value = ReferenceScore.Value;
|
||||||
|
},
|
||||||
Enabled = { Value = !Precision.AlmostEquals(lastPlayAverage, 0, Current.Precision / 2) }
|
Enabled = { Value = !Precision.AlmostEquals(lastPlayAverage, 0, Current.Precision / 2) }
|
||||||
},
|
},
|
||||||
globalOffsetText = new LinkFlowContainer
|
globalOffsetText = new LinkFlowContainer
|
||||||
|
Loading…
Reference in New Issue
Block a user