1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-04 02:13:39 +08:00

Fix replay download button not added when no score is selected initially

This commit is contained in:
Salman Ahmed
2024-07-25 07:40:17 +03:00
Unverified
parent 0182f3d7c3
commit dad8e28446
2 changed files with 7 additions and 7 deletions
@@ -18,7 +18,7 @@ namespace osu.Game.Screens.Ranking
{
public partial class ReplayDownloadButton : CompositeDrawable, IKeyBindingHandler<GlobalAction>
{
public readonly Bindable<ScoreInfo> Score = new Bindable<ScoreInfo>();
public readonly Bindable<ScoreInfo?> Score = new Bindable<ScoreInfo?>();
protected readonly Bindable<DownloadState> State = new Bindable<DownloadState>();
@@ -44,7 +44,7 @@ namespace osu.Game.Screens.Ranking
}
}
public ReplayDownloadButton(ScoreInfo score)
public ReplayDownloadButton(ScoreInfo? score)
{
Score.Value = score;
Size = new Vector2(50, 30);
@@ -67,11 +67,11 @@ namespace osu.Game.Screens.Ranking
switch (State.Value)
{
case DownloadState.LocallyAvailable:
game?.PresentScore(Score.Value, ScorePresentType.Gameplay);
game?.PresentScore(Score.Value!, ScorePresentType.Gameplay);
break;
case DownloadState.NotDownloaded:
scoreDownloader.Download(Score.Value);
scoreDownloader.Download(Score.Value!);
break;
case DownloadState.Importing:
@@ -147,7 +147,7 @@ namespace osu.Game.Screens.Ranking
{
if (state.NewValue != DownloadState.LocallyAvailable) return;
scoreManager.Export(Score.Value);
scoreManager.Export(Score.Value!);
State.ValueChanged -= exportWhenReady;
}
+2 -2
View File
@@ -179,11 +179,11 @@ namespace osu.Game.Screens.Ranking
Scheduler.AddDelayed(() => OverlayActivationMode.Value = OverlayActivation.All, shouldFlair ? AccuracyCircle.TOTAL_DURATION + 1000 : 0);
}
if (SelectedScore.Value != null && AllowWatchingReplay)
if (AllowWatchingReplay)
{
buttons.Add(new ReplayDownloadButton(SelectedScore.Value)
{
Score = { BindTarget = SelectedScore! },
Score = { BindTarget = SelectedScore },
Width = 300
});
}