mirror of
https://github.com/ppy/osu
synced 2024-12-26 00:32:52 +00:00
use null propragtor for Ruleset.Value and rulset instead of null checks
This commit is contained in:
parent
6a85f5ca8b
commit
a741d91aed
@ -18,14 +18,11 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
public string ModAcronym;
|
||||
|
||||
[Resolved]
|
||||
private LadderInfo ladderInfo { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
private void load(TextureStore textures, LadderInfo ladderInfo)
|
||||
{
|
||||
var texture = textures.Get($"mods/{ModAcronym}");
|
||||
|
||||
@ -42,12 +39,8 @@ namespace osu.Game.Tournament.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
var ruleset = rulesets.AvailableRulesets.FirstOrDefault(r => r == ladderInfo.Ruleset.Value);
|
||||
|
||||
if (ruleset == null)
|
||||
return;
|
||||
|
||||
var modIcon = ruleset.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
|
||||
var ruleset = rulesets.GetRuleset(ladderInfo.Ruleset.Value?.ID ?? 0);
|
||||
var modIcon = ruleset?.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
|
||||
|
||||
if (modIcon == null)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user