1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 17:33:02 +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.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Database;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online; using osu.Game.Online;
@ -33,7 +34,7 @@ namespace osu.Game.Screens.Play
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGame? game) private void load(OsuGame? game, Player? player, RealmAccess realm)
{ {
InternalChild = button = new DownloadButton 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 => state.BindValueChanged(state =>
{ {
switch (state.NewValue) switch (state.NewValue)