1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 06:22:56 +08:00

Restore to the last available wiki page after changing UI language

This commit is contained in:
CloneWith 2025-01-01 23:44:08 +08:00
parent 43b9e537bf
commit ae8f6967d7
No known key found for this signature in database
GPG Key ID: F4FC0D1E91D7FFD5

View File

@ -38,6 +38,8 @@ namespace osu.Game.Overlays
private bool displayUpdateRequired = true; private bool displayUpdateRequired = true;
private string lastValidPath = INDEX_PATH;
public WikiOverlay() public WikiOverlay()
: base(OverlayColourScheme.Orange, false) : base(OverlayColourScheme.Orange, false)
{ {
@ -145,12 +147,13 @@ namespace osu.Game.Overlays
private void onLangChanged(ValueChangedEvent<Language> e) private void onLangChanged(ValueChangedEvent<Language> e)
{ {
// Path unmodified, just reload the page with new language value. // Path unmodified, just reload the page with new language value.
loadPage(path.Value, e.NewValue); loadPage(path.Value == "error" ? lastValidPath : path.Value, e.NewValue);
} }
private void onSuccess(APIWikiPage response) private void onSuccess(APIWikiPage response)
{ {
wikiData.Value = response; wikiData.Value = response;
lastValidPath = response.Path;
path.Value = response.Path; path.Value = response.Path;
if (response.Layout.Equals(INDEX_PATH, StringComparison.OrdinalIgnoreCase)) if (response.Layout.Equals(INDEX_PATH, StringComparison.OrdinalIgnoreCase))