mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 00:53:21 +08:00
Merge pull request #27995 from bdach/results-nrt
Apply nullability annotations to `ResultsScreen` & inheritors
This commit is contained in:
commit
310ef11eb0
@ -424,7 +424,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
scores.Add(score);
|
scores.Add(score);
|
||||||
}
|
}
|
||||||
|
|
||||||
scoresCallback?.Invoke(scores);
|
scoresCallback.Invoke(scores);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -28,8 +26,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
{
|
{
|
||||||
private readonly SortedDictionary<int, BindableLong> teamScores;
|
private readonly SortedDictionary<int, BindableLong> teamScores;
|
||||||
|
|
||||||
private Container winnerBackground;
|
private Container winnerBackground = null!;
|
||||||
private Drawable winnerText;
|
private Drawable winnerText = null!;
|
||||||
|
|
||||||
public MultiplayerTeamResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem, SortedDictionary<int, BindableLong> teamScores)
|
public MultiplayerTeamResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem, SortedDictionary<int, BindableLong> teamScores)
|
||||||
: base(score, roomId, playlistItem)
|
: base(score, roomId, playlistItem)
|
||||||
@ -41,7 +39,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -25,8 +23,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
Scheduler.AddDelayed(() => StatisticsPanel.ToggleVisibility(), 1000);
|
Scheduler.AddDelayed(() => StatisticsPanel.ToggleVisibility(), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
|
protected override APIRequest? FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
|
||||||
|
|
||||||
protected override APIRequest FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
|
protected override APIRequest? FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -25,23 +22,23 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
private readonly long roomId;
|
private readonly long roomId;
|
||||||
private readonly PlaylistItem playlistItem;
|
private readonly PlaylistItem playlistItem;
|
||||||
|
|
||||||
protected LoadingSpinner LeftSpinner { get; private set; }
|
protected LoadingSpinner LeftSpinner { get; private set; } = null!;
|
||||||
protected LoadingSpinner CentreSpinner { get; private set; }
|
protected LoadingSpinner CentreSpinner { get; private set; } = null!;
|
||||||
protected LoadingSpinner RightSpinner { get; private set; }
|
protected LoadingSpinner RightSpinner { get; private set; } = null!;
|
||||||
|
|
||||||
private MultiplayerScores higherScores;
|
private MultiplayerScores? higherScores;
|
||||||
private MultiplayerScores lowerScores;
|
private MultiplayerScores? lowerScores;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private ScoreManager scoreManager { get; set; }
|
private ScoreManager scoreManager { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; } = null!;
|
||||||
|
|
||||||
public PlaylistsResultsScreen([CanBeNull] ScoreInfo score, long roomId, PlaylistItem playlistItem)
|
public PlaylistsResultsScreen(ScoreInfo? score, long roomId, PlaylistItem playlistItem)
|
||||||
: base(score)
|
: base(score)
|
||||||
{
|
{
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
@ -123,11 +120,11 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
return userScoreReq;
|
return userScoreReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override APIRequest FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback)
|
protected override APIRequest? FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback)
|
||||||
{
|
{
|
||||||
Debug.Assert(direction == 1 || direction == -1);
|
Debug.Assert(direction == 1 || direction == -1);
|
||||||
|
|
||||||
MultiplayerScores pivot = direction == -1 ? higherScores : lowerScores;
|
MultiplayerScores? pivot = direction == -1 ? higherScores : lowerScores;
|
||||||
|
|
||||||
if (pivot?.Cursor == null)
|
if (pivot?.Cursor == null)
|
||||||
return null;
|
return null;
|
||||||
@ -147,7 +144,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
/// <param name="scoresCallback">The callback to perform with the resulting scores.</param>
|
/// <param name="scoresCallback">The callback to perform with the resulting scores.</param>
|
||||||
/// <param name="pivot">An optional score pivot to retrieve scores around. Can be null to retrieve scores from the highest score.</param>
|
/// <param name="pivot">An optional score pivot to retrieve scores around. Can be null to retrieve scores from the highest score.</param>
|
||||||
/// <returns>The indexing <see cref="APIRequest"/>.</returns>
|
/// <returns>The indexing <see cref="APIRequest"/>.</returns>
|
||||||
private APIRequest createIndexRequest(Action<IEnumerable<ScoreInfo>> scoresCallback, [CanBeNull] MultiplayerScores pivot = null)
|
private APIRequest createIndexRequest(Action<IEnumerable<ScoreInfo>> scoresCallback, MultiplayerScores? pivot = null)
|
||||||
{
|
{
|
||||||
var indexReq = pivot != null
|
var indexReq = pivot != null
|
||||||
? new IndexPlaylistScoresRequest(roomId, playlistItem.ID, pivot.Cursor, pivot.Params)
|
? new IndexPlaylistScoresRequest(roomId, playlistItem.ID, pivot.Cursor, pivot.Params)
|
||||||
@ -180,7 +177,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
/// <param name="callback">The callback to invoke with the final <see cref="ScoreInfo"/>s.</param>
|
/// <param name="callback">The callback to invoke with the final <see cref="ScoreInfo"/>s.</param>
|
||||||
/// <param name="scores">The <see cref="MultiplayerScore"/>s that were retrieved from <see cref="APIRequest"/>s.</param>
|
/// <param name="scores">The <see cref="MultiplayerScore"/>s that were retrieved from <see cref="APIRequest"/>s.</param>
|
||||||
/// <param name="pivot">An optional pivot around which the scores were retrieved.</param>
|
/// <param name="pivot">An optional pivot around which the scores were retrieved.</param>
|
||||||
private void performSuccessCallback([NotNull] Action<IEnumerable<ScoreInfo>> callback, [NotNull] List<MultiplayerScore> scores, [CanBeNull] MultiplayerScores pivot = null) => Schedule(() =>
|
private void performSuccessCallback(Action<IEnumerable<ScoreInfo>> callback, List<MultiplayerScore> scores, MultiplayerScores? pivot = null) => Schedule(() =>
|
||||||
{
|
{
|
||||||
var scoreInfos = scores.Select(s => s.CreateScoreInfo(scoreManager, rulesets, playlistItem, Beatmap.Value.BeatmapInfo)).OrderByTotalScore().ToArray();
|
var scoreInfos = scores.Select(s => s.CreateScoreInfo(scoreManager, rulesets, playlistItem, Beatmap.Value.BeatmapInfo)).OrderByTotalScore().ToArray();
|
||||||
|
|
||||||
@ -201,7 +198,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
hideLoadingSpinners(pivot);
|
hideLoadingSpinners(pivot);
|
||||||
});
|
});
|
||||||
|
|
||||||
private void hideLoadingSpinners([CanBeNull] MultiplayerScores pivot = null)
|
private void hideLoadingSpinners(MultiplayerScores? pivot = null)
|
||||||
{
|
{
|
||||||
CentreSpinner.Hide();
|
CentreSpinner.Hide();
|
||||||
|
|
||||||
@ -217,7 +214,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
/// <param name="scores">The <see cref="MultiplayerScores"/> to set positions on.</param>
|
/// <param name="scores">The <see cref="MultiplayerScores"/> to set positions on.</param>
|
||||||
/// <param name="pivot">The pivot.</param>
|
/// <param name="pivot">The pivot.</param>
|
||||||
/// <param name="increment">The amount to increment the pivot position by for each <see cref="MultiplayerScore"/> in <paramref name="scores"/>.</param>
|
/// <param name="increment">The amount to increment the pivot position by for each <see cref="MultiplayerScore"/> in <paramref name="scores"/>.</param>
|
||||||
private void setPositions([NotNull] MultiplayerScores scores, [CanBeNull] MultiplayerScores pivot, int increment)
|
private void setPositions(MultiplayerScores scores, MultiplayerScores? pivot, int increment)
|
||||||
=> setPositions(scores, pivot?.Scores[^1].Position ?? 0, increment);
|
=> setPositions(scores, pivot?.Scores[^1].Position ?? 0, increment);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -226,7 +223,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
/// <param name="scores">The <see cref="MultiplayerScores"/> to set positions on.</param>
|
/// <param name="scores">The <see cref="MultiplayerScores"/> to set positions on.</param>
|
||||||
/// <param name="pivotPosition">The pivot position.</param>
|
/// <param name="pivotPosition">The pivot position.</param>
|
||||||
/// <param name="increment">The amount to increment the pivot position by for each <see cref="MultiplayerScore"/> in <paramref name="scores"/>.</param>
|
/// <param name="increment">The amount to increment the pivot position by for each <see cref="MultiplayerScore"/> in <paramref name="scores"/>.</param>
|
||||||
private void setPositions([NotNull] MultiplayerScores scores, int pivotPosition, int increment)
|
private void setPositions(MultiplayerScores scores, int pivotPosition, int increment)
|
||||||
{
|
{
|
||||||
foreach (var s in scores.Scores)
|
foreach (var s in scores.Scores)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
@ -45,25 +42,24 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
|
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
|
||||||
|
|
||||||
public readonly Bindable<ScoreInfo> SelectedScore = new Bindable<ScoreInfo>();
|
public readonly Bindable<ScoreInfo?> SelectedScore = new Bindable<ScoreInfo?>();
|
||||||
|
|
||||||
[CanBeNull]
|
public readonly ScoreInfo? Score;
|
||||||
public readonly ScoreInfo Score;
|
|
||||||
|
|
||||||
protected ScorePanelList ScorePanelList { get; private set; }
|
protected ScorePanelList ScorePanelList { get; private set; } = null!;
|
||||||
|
|
||||||
protected VerticalScrollContainer VerticalScrollContent { get; private set; }
|
protected VerticalScrollContainer VerticalScrollContent { get; private set; } = null!;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
|
||||||
private Player player { get; set; }
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private Player? player { get; set; }
|
||||||
|
|
||||||
protected StatisticsPanel StatisticsPanel { get; private set; }
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
private Drawable bottomPanel;
|
protected StatisticsPanel StatisticsPanel { get; private set; } = null!;
|
||||||
private Container<ScorePanel> detachedPanelContainer;
|
|
||||||
|
private Drawable bottomPanel = null!;
|
||||||
|
private Container<ScorePanel> detachedPanelContainer = null!;
|
||||||
|
|
||||||
private bool lastFetchCompleted;
|
private bool lastFetchCompleted;
|
||||||
|
|
||||||
@ -84,9 +80,9 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ShowUserStatistics { get; init; }
|
public bool ShowUserStatistics { get; init; }
|
||||||
|
|
||||||
private Sample popInSample;
|
private Sample? popInSample;
|
||||||
|
|
||||||
protected ResultsScreen([CanBeNull] ScoreInfo score)
|
protected ResultsScreen(ScoreInfo? score)
|
||||||
{
|
{
|
||||||
Score = score;
|
Score = score;
|
||||||
|
|
||||||
@ -182,11 +178,11 @@ namespace osu.Game.Screens.Ranking
|
|||||||
Scheduler.AddDelayed(() => OverlayActivationMode.Value = OverlayActivation.All, shouldFlair ? AccuracyCircle.TOTAL_DURATION + 1000 : 0);
|
Scheduler.AddDelayed(() => OverlayActivationMode.Value = OverlayActivation.All, shouldFlair ? AccuracyCircle.TOTAL_DURATION + 1000 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AllowWatchingReplay)
|
if (SelectedScore.Value != null && AllowWatchingReplay)
|
||||||
{
|
{
|
||||||
buttons.Add(new ReplayDownloadButton(SelectedScore.Value)
|
buttons.Add(new ReplayDownloadButton(SelectedScore.Value)
|
||||||
{
|
{
|
||||||
Score = { BindTarget = SelectedScore },
|
Score = { BindTarget = SelectedScore! },
|
||||||
Width = 300
|
Width = 300
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -225,7 +221,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
if (lastFetchCompleted)
|
if (lastFetchCompleted)
|
||||||
{
|
{
|
||||||
APIRequest nextPageRequest = null;
|
APIRequest? nextPageRequest = null;
|
||||||
|
|
||||||
if (ScorePanelList.IsScrolledToStart)
|
if (ScorePanelList.IsScrolledToStart)
|
||||||
nextPageRequest = FetchNextPage(-1, fetchScoresCallback);
|
nextPageRequest = FetchNextPage(-1, fetchScoresCallback);
|
||||||
@ -245,7 +241,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scoresCallback">A callback which should be called when fetching is completed. Scheduling is not required.</param>
|
/// <param name="scoresCallback">A callback which should be called when fetching is completed. Scheduling is not required.</param>
|
||||||
/// <returns>An <see cref="APIRequest"/> responsible for the fetch operation. This will be queued and performed automatically.</returns>
|
/// <returns>An <see cref="APIRequest"/> responsible for the fetch operation. This will be queued and performed automatically.</returns>
|
||||||
protected virtual APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
|
protected virtual APIRequest? FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a fetch of the next page of scores. This is invoked every frame until a non-null <see cref="APIRequest"/> is returned.
|
/// Performs a fetch of the next page of scores. This is invoked every frame until a non-null <see cref="APIRequest"/> is returned.
|
||||||
@ -253,7 +249,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// <param name="direction">The fetch direction. -1 to fetch scores greater than the current start of the list, and 1 to fetch scores lower than the current end of the list.</param>
|
/// <param name="direction">The fetch direction. -1 to fetch scores greater than the current start of the list, and 1 to fetch scores lower than the current end of the list.</param>
|
||||||
/// <param name="scoresCallback">A callback which should be called when fetching is completed. Scheduling is not required.</param>
|
/// <param name="scoresCallback">A callback which should be called when fetching is completed. Scheduling is not required.</param>
|
||||||
/// <returns>An <see cref="APIRequest"/> responsible for the fetch operation. This will be queued and performed automatically.</returns>
|
/// <returns>An <see cref="APIRequest"/> responsible for the fetch operation. This will be queued and performed automatically.</returns>
|
||||||
protected virtual APIRequest FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
|
protected virtual APIRequest? FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the <see cref="Statistics.StatisticsPanel"/> to be used to display extended information about scores.
|
/// Creates the <see cref="Statistics.StatisticsPanel"/> to be used to display extended information about scores.
|
||||||
@ -327,7 +323,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
panel.Alpha = 0;
|
panel.Alpha = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScorePanel detachedPanel;
|
private ScorePanel? detachedPanel;
|
||||||
|
|
||||||
private void onStatisticsStateChanged(ValueChangedEvent<Visibility> state)
|
private void onStatisticsStateChanged(ValueChangedEvent<Visibility> state)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override APIRequest? FetchScores(Action<IEnumerable<ScoreInfo>>? scoresCallback)
|
protected override APIRequest? FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
||||||
{
|
{
|
||||||
Debug.Assert(Score != null);
|
Debug.Assert(Score != null);
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
getScoreRequest = new GetScoresRequest(Score.BeatmapInfo, Score.Ruleset);
|
getScoreRequest = new GetScoresRequest(Score.BeatmapInfo, Score.Ruleset);
|
||||||
getScoreRequest.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => !s.MatchesOnlineID(Score)).Select(s => s.ToScoreInfo(rulesets, Beatmap.Value.BeatmapInfo)));
|
getScoreRequest.Success += r => scoresCallback.Invoke(r.Scores.Where(s => !s.MatchesOnlineID(Score)).Select(s => s.ToScoreInfo(rulesets, Beatmap.Value.BeatmapInfo)));
|
||||||
return getScoreRequest;
|
return getScoreRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user