1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00

Check whether score is already imported and show correct state for save button

This commit is contained in:
Dean Herbert 2022-07-15 20:45:37 +09:00
parent 21433d4ecb
commit d325c534ab

View File

@ -8,6 +8,7 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Database;
using osu.Game.Scoring;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online;
@ -33,7 +34,7 @@ namespace osu.Game.Screens.Play
}
[BackgroundDependencyLoader]
private void load(OsuGame? game)
private void load(OsuGame? game, Player? player, RealmAccess realm)
{
InternalChild = button = new DownloadButton
{
@ -60,6 +61,13 @@ namespace osu.Game.Screens.Play
}
};
if (player != null)
{
score = realm.Run(r => r.Find<ScoreInfo>(player.Score.ScoreInfo.ID)?.Detach());
if (score != null)
state.Value = DownloadState.LocallyAvailable;
}
state.BindValueChanged(state =>
{
switch (state.NewValue)