mirror of
https://github.com/osukey/osukey.git
synced 2025-07-30 14:45:26 +09:00
move value set to constructor and make private readonly
This commit is contained in:
@ -123,14 +123,13 @@ namespace osu.Game.Tournament.Components
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(mod))
|
if (!string.IsNullOrEmpty(mod))
|
||||||
{
|
{
|
||||||
AddInternal(new TournamentModDisplay
|
AddInternal(new TournamentModDisplay(mod)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
Margin = new MarginPadding(10),
|
Margin = new MarginPadding(10),
|
||||||
Width = 60,
|
Width = 60,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
ModAcronym = mod
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,20 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
public class TournamentModDisplay : CompositeDrawable
|
public class TournamentModDisplay : CompositeDrawable
|
||||||
{
|
{
|
||||||
public string ModAcronym;
|
private readonly string modAcronym;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
|
public TournamentModDisplay(string mod)
|
||||||
|
{
|
||||||
|
modAcronym = mod;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures, LadderInfo ladderInfo)
|
private void load(TextureStore textures, LadderInfo ladderInfo)
|
||||||
{
|
{
|
||||||
var texture = textures.Get($"mods/{ModAcronym}");
|
var texture = textures.Get($"mods/{modAcronym}");
|
||||||
|
|
||||||
if (texture != null)
|
if (texture != null)
|
||||||
{
|
{
|
||||||
@ -40,7 +45,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var ruleset = rulesets.GetRuleset(ladderInfo.Ruleset.Value?.ID ?? 0);
|
var ruleset = rulesets.GetRuleset(ladderInfo.Ruleset.Value?.ID ?? 0);
|
||||||
var modIcon = ruleset?.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
|
var modIcon = ruleset?.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == modAcronym);
|
||||||
|
|
||||||
if (modIcon == null)
|
if (modIcon == null)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user