mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:33:22 +08:00
Use TryGetValue
wherever possible
Rider says so.
This commit is contained in:
parent
479ff7eb41
commit
c844d65a81
@ -164,10 +164,10 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
||||
|
||||
private Drawable getResult(HitResult result)
|
||||
{
|
||||
if (!hit_result_mapping.ContainsKey(result))
|
||||
if (!hit_result_mapping.TryGetValue(result, out var value))
|
||||
return null;
|
||||
|
||||
string filename = this.GetManiaSkinConfig<string>(hit_result_mapping[result])?.Value
|
||||
string filename = this.GetManiaSkinConfig<string>(value)?.Value
|
||||
?? default_hit_result_skin_filenames[result];
|
||||
|
||||
var animation = this.GetAnimation(filename, true, true, frameLength: 1000 / 20d);
|
||||
|
@ -120,10 +120,9 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
|
||||
public void RemoveChannel(Channel channel)
|
||||
{
|
||||
if (!channelMap.ContainsKey(channel))
|
||||
if (!channelMap.TryGetValue(channel, out var item))
|
||||
return;
|
||||
|
||||
ChannelListItem item = channelMap[channel];
|
||||
FillFlowContainer<ChannelListItem> flow = getFlowForChannel(channel);
|
||||
|
||||
channelMap.Remove(channel);
|
||||
@ -134,10 +133,10 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
|
||||
public ChannelListItem GetItem(Channel channel)
|
||||
{
|
||||
if (!channelMap.ContainsKey(channel))
|
||||
if (!channelMap.TryGetValue(channel, out var item))
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
||||
return channelMap[channel];
|
||||
return item;
|
||||
}
|
||||
|
||||
public void ScrollChannelIntoView(Channel channel) => scroll.ScrollIntoView(GetItem(channel));
|
||||
|
@ -78,12 +78,12 @@ namespace osu.Game.Tests.Visual.Spectator
|
||||
/// <param name="state">The spectator state to end play with.</param>
|
||||
public void SendEndPlay(int userId, SpectatedUserState state = SpectatedUserState.Quit)
|
||||
{
|
||||
if (!userBeatmapDictionary.ContainsKey(userId))
|
||||
if (!userBeatmapDictionary.TryGetValue(userId, out int value))
|
||||
return;
|
||||
|
||||
((ISpectatorClient)this).UserFinishedPlaying(userId, new SpectatorState
|
||||
{
|
||||
BeatmapID = userBeatmapDictionary[userId],
|
||||
BeatmapID = value,
|
||||
RulesetID = 0,
|
||||
Mods = userModsDictionary[userId],
|
||||
State = state
|
||||
|
Loading…
Reference in New Issue
Block a user