mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Merge pull request #17698 from Joehuu/fix-replay-button-local-being-disabled
Fix replay button being disabled when available locally but not online
This commit is contained in:
commit
eb0653fa7b
@ -150,10 +150,12 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(true)));
|
||||
|
||||
AddUntilStep("state is available", () => downloadButton.State.Value == DownloadState.LocallyAvailable);
|
||||
AddAssert("button is enabled", () => downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
||||
|
||||
AddStep("delete score", () => scoreManager.Delete(imported.Value));
|
||||
|
||||
AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
|
||||
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -87,31 +87,33 @@ namespace osu.Game.Screens.Ranking
|
||||
});
|
||||
}
|
||||
|
||||
button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable;
|
||||
updateTooltip();
|
||||
updateState();
|
||||
}, true);
|
||||
|
||||
State.BindValueChanged(state =>
|
||||
{
|
||||
button.State.Value = state.NewValue;
|
||||
updateTooltip();
|
||||
updateState();
|
||||
}, true);
|
||||
}
|
||||
|
||||
private void updateTooltip()
|
||||
private void updateState()
|
||||
{
|
||||
switch (replayAvailability)
|
||||
{
|
||||
case ReplayAvailability.Local:
|
||||
button.TooltipText = @"watch replay";
|
||||
button.Enabled.Value = true;
|
||||
break;
|
||||
|
||||
case ReplayAvailability.Online:
|
||||
button.TooltipText = @"download replay";
|
||||
button.Enabled.Value = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
button.TooltipText = @"replay unavailable";
|
||||
button.Enabled.Value = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user