Merge branch 'master' into display-performance-attributes

This commit is contained in:
Bartłomiej Dach
2022-01-22 14:12:57 +01:00
committed by GitHub
354 changed files with 5098 additions and 18405 deletions

View File

@ -107,7 +107,7 @@ namespace osu.Game.Screens.Ranking.Contracted
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = score.UserString,
Text = score.RealmUser.Username,
Font = OsuFont.GetFont(size: 16, weight: FontWeight.SemiBold)
},
new FillFlowContainer

View File

@ -158,7 +158,7 @@ namespace osu.Game.Screens.Ranking
trackingContainer.Show();
if (SelectedScore.Value == score)
if (SelectedScore.Value?.Equals(score) == true)
{
SelectedScore.TriggerChange();
}
@ -185,10 +185,10 @@ namespace osu.Game.Screens.Ranking
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
{
// avoid contracting panels unnecessarily when TriggerChange is fired manually.
if (score.OldValue != score.NewValue)
if (score.OldValue != null && !score.OldValue.Equals(score.NewValue))
{
// Contract the old panel.
foreach (var t in flow.Where(t => t.Panel.Score == score.OldValue))
foreach (var t in flow.Where(t => t.Panel.Score.Equals(score.OldValue)))
{
t.Panel.State = PanelState.Contracted;
t.Margin = new MarginPadding();
@ -196,7 +196,7 @@ namespace osu.Game.Screens.Ranking
}
// Find the panel corresponding to the new score.
var expandedTrackingComponent = flow.SingleOrDefault(t => t.Panel.Score == score.NewValue);
var expandedTrackingComponent = flow.SingleOrDefault(t => t.Panel.Score.Equals(score.NewValue));
expandedPanel = expandedTrackingComponent?.Panel;
if (expandedPanel == null)
@ -269,7 +269,7 @@ namespace osu.Game.Screens.Ranking
/// </summary>
/// <param name="score">The <see cref="ScoreInfo"/> to find the corresponding <see cref="ScorePanel"/> for.</param>
/// <returns>The <see cref="ScorePanel"/>.</returns>
public ScorePanel GetPanelForScore(ScoreInfo score) => flow.Single(t => t.Panel.Score == score).Panel;
public ScorePanel GetPanelForScore(ScoreInfo score) => flow.Single(t => t.Panel.Score.Equals(score)).Panel;
/// <summary>
/// Detaches a <see cref="ScorePanel"/> from its <see cref="ScorePanelTrackingContainer"/>, allowing the panel to be moved elsewhere in the hierarchy.
@ -332,13 +332,13 @@ namespace osu.Game.Screens.Ranking
{
public override IEnumerable<Drawable> FlowingChildren => applySorting(AliveInternalChildren);
public int GetPanelIndex(ScoreInfo score) => applySorting(Children).TakeWhile(s => s.Panel.Score != score).Count();
public int GetPanelIndex(ScoreInfo score) => applySorting(Children).TakeWhile(s => !s.Panel.Score.Equals(score)).Count();
[CanBeNull]
public ScoreInfo GetPreviousScore(ScoreInfo score) => applySorting(Children).TakeWhile(s => s.Panel.Score != score).LastOrDefault()?.Panel.Score;
public ScoreInfo GetPreviousScore(ScoreInfo score) => applySorting(Children).TakeWhile(s => !s.Panel.Score.Equals(score)).LastOrDefault()?.Panel.Score;
[CanBeNull]
public ScoreInfo GetNextScore(ScoreInfo score) => applySorting(Children).SkipWhile(s => s.Panel.Score != score).ElementAtOrDefault(1)?.Panel.Score;
public ScoreInfo GetNextScore(ScoreInfo score) => applySorting(Children).SkipWhile(s => !s.Panel.Score.Equals(score)).ElementAtOrDefault(1)?.Panel.Score;
private IEnumerable<ScorePanelTrackingContainer> applySorting(IEnumerable<Drawable> drawables) => drawables.OfType<ScorePanelTrackingContainer>()
.OrderByDescending(GetLayoutPosition)

View File

@ -27,7 +27,7 @@ namespace osu.Game.Screens.Ranking
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
{
if (Score.BeatmapInfo.OnlineID == null || Score.BeatmapInfo.Status <= BeatmapOnlineStatus.Pending)
if (Score.BeatmapInfo.OnlineID <= 0 || Score.BeatmapInfo.Status <= BeatmapOnlineStatus.Pending)
return null;
getScoreRequest = new GetScoresRequest(Score.BeatmapInfo, Score.Ruleset);

View File

@ -1,7 +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.
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -13,7 +12,6 @@ using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Placeholders;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osuTK;
@ -76,7 +74,7 @@ namespace osu.Game.Screens.Ranking.Statistics
if (newScore == null)
return;
if (newScore.HitEvents == null || newScore.HitEvents.Count == 0)
if (newScore.HitEvents.Count == 0)
{
content.Add(new FillFlowContainer
{
@ -104,7 +102,7 @@ namespace osu.Game.Screens.Ranking.Statistics
// Todo: The placement of this is temporary. Eventually we'll both generate the playable beatmap _and_ run through it in a background task to generate the hit events.
Task.Run(() =>
{
playableBeatmap = beatmapManager.GetWorkingBeatmap(newScore.BeatmapInfo).GetPlayableBeatmap(newScore.Ruleset, newScore.Mods ?? Array.Empty<Mod>());
playableBeatmap = beatmapManager.GetWorkingBeatmap(newScore.BeatmapInfo).GetPlayableBeatmap(newScore.Ruleset, newScore.Mods);
}, loadCancellation.Token).ContinueWith(t => Schedule(() =>
{
var rows = new FillFlowContainer
@ -142,7 +140,7 @@ namespace osu.Game.Screens.Ranking.Statistics
LoadComponentAsync(rows, d =>
{
if (Score.Value != newScore)
if (!Score.Value.Equals(newScore))
return;
spinner.Hide();