Remove unnecessary Beatmap parameter in ManiaLegacySkinTransformer

This commit is contained in:
Dean Herbert 2022-10-04 19:49:07 +09:00
parent 5c48d8931a
commit 1a0b953846
3 changed files with 5 additions and 10 deletions

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
private readonly Column column; private readonly Column column;
[Cached] [Cached]
private readonly StageDefinition stageDefinition = new StageDefinition { Columns = 1 }; private readonly StageDefinition stageDefinition = new StageDefinition { Columns = 2 };
public ColumnTestContainer(int column, ManiaAction action, bool showColumn = false) public ColumnTestContainer(int column, ManiaAction action, bool showColumn = false)
{ {

View File

@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Mania
switch (skin) switch (skin)
{ {
case LegacySkin: case LegacySkin:
return new ManiaLegacySkinTransformer(skin, beatmap); return new ManiaLegacySkinTransformer(skin);
case ArgonSkin: case ArgonSkin:
return new ManiaArgonSkinTransformer(skin); return new ManiaArgonSkinTransformer(skin);

View File

@ -9,7 +9,6 @@ using osu.Framework.Audio.Sample;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Objects.Legacy; using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
@ -19,8 +18,6 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
{ {
public class ManiaLegacySkinTransformer : LegacySkinTransformer public class ManiaLegacySkinTransformer : LegacySkinTransformer
{ {
private readonly ManiaBeatmap beatmap;
/// <summary> /// <summary>
/// Mapping of <see cref="HitResult"/> to their corresponding /// Mapping of <see cref="HitResult"/> to their corresponding
/// <see cref="LegacyManiaSkinConfigurationLookups"/> value. /// <see cref="LegacyManiaSkinConfigurationLookups"/> value.
@ -59,15 +56,13 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
/// </summary> /// </summary>
private readonly Lazy<bool> hasKeyTexture; private readonly Lazy<bool> hasKeyTexture;
public ManiaLegacySkinTransformer(ISkin skin, IBeatmap beatmap) public ManiaLegacySkinTransformer(ISkin skin)
: base(skin) : base(skin)
{ {
this.beatmap = (ManiaBeatmap)beatmap;
isLegacySkin = new Lazy<bool>(() => GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version) != null); isLegacySkin = new Lazy<bool>(() => GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version) != null);
hasKeyTexture = new Lazy<bool>(() => hasKeyTexture = new Lazy<bool>(() =>
{ {
string keyImage = this.GetManiaSkinConfig<string>(LegacyManiaSkinConfigurationLookups.KeyImage, new StageDefinition(), 0)?.Value ?? "mania-key1"; string keyImage = this.GetManiaSkinConfig<string>(LegacyManiaSkinConfigurationLookups.KeyImage, new StageDefinition { Columns = 1 }, 0)?.Value ?? "mania-key1";
return this.GetAnimation(keyImage, true, true) != null; return this.GetAnimation(keyImage, true, true) != null;
}); });
} }
@ -149,7 +144,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
{ {
if (lookup is ManiaSkinConfigurationLookup maniaLookup) if (lookup is ManiaSkinConfigurationLookup maniaLookup)
return base.GetConfig<LegacyManiaSkinConfigurationLookup, TValue>(new LegacyManiaSkinConfigurationLookup(beatmap.TotalColumns, maniaLookup.Lookup, maniaLookup.ColumnIndex)); return base.GetConfig<LegacyManiaSkinConfigurationLookup, TValue>(new LegacyManiaSkinConfigurationLookup(maniaLookup.StageDefinition.Columns, maniaLookup.Lookup, maniaLookup.ColumnIndex));
return base.GetConfig<TLookup, TValue>(lookup); return base.GetConfig<TLookup, TValue>(lookup);
} }