mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08: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;
|
public string ModAcronym;
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private LadderInfo ladderInfo { get; set; }
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures)
|
private void load(TextureStore textures, LadderInfo ladderInfo)
|
||||||
{
|
{
|
||||||
var texture = textures.Get($"mods/{ModAcronym}");
|
var texture = textures.Get($"mods/{ModAcronym}");
|
||||||
|
|
||||||
@ -42,12 +39,8 @@ namespace osu.Game.Tournament.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var ruleset = rulesets.AvailableRulesets.FirstOrDefault(r => r == ladderInfo.Ruleset.Value);
|
var ruleset = rulesets.GetRuleset(ladderInfo.Ruleset.Value?.ID ?? 0);
|
||||||
|
var modIcon = ruleset?.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
|
||||||
if (ruleset == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var modIcon = ruleset.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
|
|
||||||
|
|
||||||
if (modIcon == null)
|
if (modIcon == null)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user