mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 06:42:56 +08:00
Turn on nullability in ParticipantPanel
This commit is contained in:
parent
222a50c457
commit
21bf7ee448
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using MessagePack;
|
using MessagePack;
|
||||||
@ -48,7 +49,7 @@ namespace osu.Game.Online.API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mod ToMod(Ruleset ruleset)
|
public Mod ToMod([NotNull] Ruleset ruleset)
|
||||||
{
|
{
|
||||||
Mod resultMod = ruleset.CreateModFromAcronym(Acronym);
|
Mod resultMod = ruleset.CreateModFromAcronym(Acronym);
|
||||||
|
|
||||||
|
@ -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.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -35,18 +33,18 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
|||||||
public readonly MultiplayerRoomUser User;
|
public readonly MultiplayerRoomUser User;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IRulesetStore rulesets { get; set; }
|
private IRulesetStore rulesets { get; set; } = null!;
|
||||||
|
|
||||||
private SpriteIcon crown;
|
private SpriteIcon crown = null!;
|
||||||
|
|
||||||
private OsuSpriteText userRankText;
|
private OsuSpriteText userRankText = null!;
|
||||||
private ModDisplay userModsDisplay;
|
private ModDisplay userModsDisplay = null!;
|
||||||
private StateDisplay userStateDisplay;
|
private StateDisplay userStateDisplay = null!;
|
||||||
|
|
||||||
private IconButton kickButton;
|
private IconButton kickButton = null!;
|
||||||
|
|
||||||
public ParticipantPanel(MultiplayerRoomUser user)
|
public ParticipantPanel(MultiplayerRoomUser user)
|
||||||
{
|
{
|
||||||
@ -135,7 +133,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
|
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
|
||||||
Text = user?.Username
|
Text = user?.Username ?? string.Empty
|
||||||
},
|
},
|
||||||
userRankText = new OsuSpriteText
|
userRankText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
@ -188,7 +186,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
|||||||
const double fade_time = 50;
|
const double fade_time = 50;
|
||||||
|
|
||||||
var currentItem = Playlist.GetCurrentItem();
|
var currentItem = Playlist.GetCurrentItem();
|
||||||
var ruleset = currentItem != null ? rulesets.GetRuleset(currentItem.RulesetID)?.CreateInstance() : null;
|
Ruleset? ruleset = currentItem != null ? rulesets.GetRuleset(currentItem.RulesetID)?.CreateInstance() : null;
|
||||||
|
|
||||||
int? currentModeRank = ruleset != null ? User.User?.RulesetsStatistics?.GetValueOrDefault(ruleset.ShortName)?.GlobalRank : null;
|
int? currentModeRank = ruleset != null ? User.User?.RulesetsStatistics?.GetValueOrDefault(ruleset.ShortName)?.GlobalRank : null;
|
||||||
userRankText.Text = currentModeRank != null ? $"#{currentModeRank.Value:N0}" : string.Empty;
|
userRankText.Text = currentModeRank != null ? $"#{currentModeRank.Value:N0}" : string.Empty;
|
||||||
@ -208,7 +206,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
|||||||
Schedule(() => userModsDisplay.Current.Value = User.Mods.Select(m => m.ToMod(ruleset)).ToList());
|
Schedule(() => userModsDisplay.Current.Value = User.Mods.Select(m => m.ToMod(ruleset)).ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuItem[] ContextMenuItems
|
public MenuItem[]? ContextMenuItems
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user