mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 17:52:56 +08:00
Fix feedback from realm writes causing offset slider to jump around
This commit is contained in:
parent
e0dc3a04f3
commit
daa42584f4
@ -1,6 +1,8 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@ -23,8 +25,6 @@ using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking.Statistics;
|
||||
using osuTK;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class BeatmapOffsetControl : CompositeDrawable
|
||||
@ -122,7 +122,16 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
beatmapOffsetSubscription = realm.SubscribeToPropertyChanged(
|
||||
r => r.Find<BeatmapInfo>(beatmap.Value.BeatmapInfo.ID)?.UserSettings,
|
||||
settings => settings.Offset,
|
||||
val => Current.Value = val);
|
||||
val =>
|
||||
{
|
||||
// At the point we reach here, it's not guaranteed that all realm writes have taken place (there may be some in-flight).
|
||||
// We are only aware of writes that originated from our own flow, so if we do see one that's active we can avoid handling the feedback value arriving.
|
||||
if (realmWriteTask == null)
|
||||
Current.Value = val;
|
||||
|
||||
// we can also mark any in-flight write that is managed locally as "seen" and start handling any incoming changes again.
|
||||
realmWriteTask = null;
|
||||
});
|
||||
|
||||
Current.BindValueChanged(currentChanged);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user