Use RulesetInfo instead of Ruleset in skin components lookup

This commit is contained in:
Dean Herbert 2023-02-17 15:00:57 +09:00
parent 675e5b81f3
commit 209d41ee9d
3 changed files with 7 additions and 7 deletions

View File

@ -115,7 +115,7 @@ namespace osu.Game.Screens.Play
//Needs to be initialized before skinnable drawables. //Needs to be initialized before skinnable drawables.
tally = new JudgementTally(), tally = new JudgementTally(),
mainComponents = new HUDComponentsContainer { AlwaysPresent = true, }, mainComponents = new HUDComponentsContainer { AlwaysPresent = true, },
rulesetComponents = new HUDComponentsContainer(drawableRuleset.Ruleset) { AlwaysPresent = true, }, rulesetComponents = new HUDComponentsContainer(drawableRuleset.Ruleset.RulesetInfo) { AlwaysPresent = true, },
topRightElements = new FillFlowContainer topRightElements = new FillFlowContainer
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
@ -399,7 +399,7 @@ namespace osu.Game.Screens.Play
[Resolved] [Resolved]
private OsuConfigManager config { get; set; } private OsuConfigManager config { get; set; }
public HUDComponentsContainer([CanBeNull] Ruleset ruleset = null) public HUDComponentsContainer([CanBeNull] RulesetInfo ruleset = null)
: base(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.MainHUDComponents, ruleset)) : base(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.MainHUDComponents, ruleset))
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;

View File

@ -15,11 +15,11 @@ namespace osu.Game.Skinning
/// </summary> /// </summary>
public readonly TargetArea Target; public readonly TargetArea Target;
public readonly Ruleset? Ruleset; public readonly RulesetInfo? Ruleset;
public string GetSerialisableIdentifier() => Ruleset?.ShortName ?? "global"; public string GetSerialisableIdentifier() => Ruleset?.ShortName ?? "global";
public SkinComponentsContainerLookup(TargetArea target, Ruleset? ruleset = null) public SkinComponentsContainerLookup(TargetArea target, RulesetInfo? ruleset = null)
{ {
Target = target; Target = target;
Ruleset = ruleset; Ruleset = ruleset;

View File

@ -24,13 +24,13 @@ namespace osu.Game.Skinning
[JsonProperty] [JsonProperty]
public Dictionary<string, SerialisedDrawableInfo[]> DrawableInfo { get; set; } = new Dictionary<string, SerialisedDrawableInfo[]>(); public Dictionary<string, SerialisedDrawableInfo[]> DrawableInfo { get; set; } = new Dictionary<string, SerialisedDrawableInfo[]>();
public bool TryGetDrawableInfo(Ruleset? ruleset, [NotNullWhen(true)] out SerialisedDrawableInfo[]? components) => public bool TryGetDrawableInfo(RulesetInfo? ruleset, [NotNullWhen(true)] out SerialisedDrawableInfo[]? components) =>
DrawableInfo.TryGetValue(ruleset?.ShortName ?? global_identifier, out components); DrawableInfo.TryGetValue(ruleset?.ShortName ?? global_identifier, out components);
public void Reset(Ruleset? ruleset) => public void Reset(RulesetInfo? ruleset) =>
DrawableInfo.Remove(ruleset?.ShortName ?? global_identifier); DrawableInfo.Remove(ruleset?.ShortName ?? global_identifier);
public void Update(Ruleset? ruleset, SerialisedDrawableInfo[] components) => public void Update(RulesetInfo? ruleset, SerialisedDrawableInfo[] components) =>
DrawableInfo[ruleset?.ShortName ?? global_identifier] = components; DrawableInfo[ruleset?.ShortName ?? global_identifier] = components;
} }
} }