Enable NRT while we're here

This commit is contained in:
Dan Balasescu 2024-08-13 16:08:06 +09:00
parent ca91726190
commit 3f02869bcc
No known key found for this signature in database
1 changed files with 16 additions and 24 deletions

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Linq;
using System.Threading;
@ -25,32 +23,35 @@ public partial class WikiOverlay : OnlineOverlay<WikiHeader>
public string CurrentPath => path.Value;
private readonly Bindable<string> path = new Bindable<string>(INDEX_PATH);
private readonly Bindable<APIWikiPage> wikiData = new Bindable<APIWikiPage>();
private readonly Bindable<APIWikiPage?> wikiData = new Bindable<APIWikiPage?>();
private readonly IBindable<Language> language = new Bindable<Language>();
[Resolved]
private IAPIProvider api { get; set; }
private IAPIProvider api { get; set; } = null!;
private GetWikiRequest request;
[Resolved]
private OsuGameBase game { get; set; } = null!;
private CancellationTokenSource cancellationToken;
private GetWikiRequest? request;
private CancellationTokenSource? cancellationToken;
private WikiArticlePage? articlePage;
private bool displayUpdateRequired = true;
private WikiArticlePage articlePage;
private Bindable<Language> language;
public WikiOverlay()
: base(OverlayColourScheme.Orange, false)
{
}
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
protected override void LoadComplete()
{
// Fetch current language on load for translated pages (if possible)
language = game.CurrentLanguage.GetBoundCopy();
base.LoadComplete();
path.BindValueChanged(onPathChanged);
wikiData.BindTo(Header.WikiPageData);
language.BindTo(game.CurrentLanguage);
language.BindValueChanged(onLangChanged);
}
public void ShowPage(string pagePath = INDEX_PATH)
@ -65,15 +66,6 @@ public void ShowPage(string pagePath = INDEX_PATH)
ShowParentPage = showParentPage,
};
protected override void LoadComplete()
{
base.LoadComplete();
path.BindValueChanged(onPathChanged);
language.BindValueChanged(onLangChanged);
wikiData.BindTo(Header.WikiPageData);
}
protected override void PopIn()
{
base.PopIn();