mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Fix playlist items showing download button briefly during initial local presence checks
This commit is contained in:
@ -17,8 +17,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
{
|
||||
public class DownloadButton : BeatmapCardIconButton
|
||||
{
|
||||
public IBindable<DownloadState> State => state;
|
||||
private readonly Bindable<DownloadState> state = new Bindable<DownloadState>();
|
||||
public Bindable<DownloadState> State { get; } = new Bindable<DownloadState>();
|
||||
|
||||
private readonly APIBeatmapSet beatmapSet;
|
||||
|
||||
@ -48,14 +47,19 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
{
|
||||
base.LoadComplete();
|
||||
preferNoVideo.BindValueChanged(_ => updateState());
|
||||
state.BindValueChanged(_ => updateState(), true);
|
||||
State.BindValueChanged(_ => updateState(), true);
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
switch (state.Value)
|
||||
switch (State.Value)
|
||||
{
|
||||
case DownloadState.Unknown:
|
||||
Action = null;
|
||||
TooltipText = string.Empty;
|
||||
break;
|
||||
|
||||
case DownloadState.Downloading:
|
||||
case DownloadState.Importing:
|
||||
Action = null;
|
||||
|
@ -5,6 +5,7 @@ namespace osu.Game.Online
|
||||
{
|
||||
public enum DownloadState
|
||||
{
|
||||
Unknown,
|
||||
NotDownloaded,
|
||||
Downloading,
|
||||
Importing,
|
||||
|
@ -114,6 +114,7 @@ namespace osu.Game.Online.Rooms
|
||||
|
||||
switch (downloadTracker.State.Value)
|
||||
{
|
||||
case DownloadState.Unknown:
|
||||
case DownloadState.NotDownloaded:
|
||||
availability.Value = BeatmapAvailability.NotDownloaded();
|
||||
break;
|
||||
|
@ -561,6 +561,10 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
{
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case DownloadState.Unknown:
|
||||
// Ignore initial state to ensure the button doesn't briefly appear.
|
||||
break;
|
||||
|
||||
case DownloadState.LocallyAvailable:
|
||||
// Perform a local query of the beatmap by beatmap checksum, and reset the state if not matching.
|
||||
if (beatmapManager.QueryBeatmap(b => b.MD5Hash == beatmap.MD5Hash) == null)
|
||||
|
@ -63,8 +63,7 @@ namespace osu.Game.Screens.Play
|
||||
if (player != null)
|
||||
{
|
||||
importedScore = realm.Run(r => r.Find<ScoreInfo>(player.Score.ScoreInfo.ID)?.Detach());
|
||||
if (importedScore != null)
|
||||
state.Value = DownloadState.LocallyAvailable;
|
||||
state.Value = importedScore != null ? DownloadState.LocallyAvailable : DownloadState.NotDownloaded;
|
||||
}
|
||||
|
||||
state.BindValueChanged(state =>
|
||||
|
Reference in New Issue
Block a user