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 @@ public class ColumnTestContainer : Container
private readonly Column column;
[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)
{

View File

@ -68,7 +68,7 @@ public class ManiaRuleset : Ruleset, ILegacyRuleset
switch (skin)
{
case LegacySkin:
return new ManiaLegacySkinTransformer(skin, beatmap);
return new ManiaLegacySkinTransformer(skin);
case ArgonSkin:
return new ManiaArgonSkinTransformer(skin);

View File

@ -9,7 +9,6 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Rulesets.Scoring;
@ -19,8 +18,6 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
{
public class ManiaLegacySkinTransformer : LegacySkinTransformer
{
private readonly ManiaBeatmap beatmap;
/// <summary>
/// Mapping of <see cref="HitResult"/> to their corresponding
/// <see cref="LegacyManiaSkinConfigurationLookups"/> value.
@ -59,15 +56,13 @@ private static readonly IReadOnlyDictionary<HitResult, string> default_hit_resul
/// </summary>
private readonly Lazy<bool> hasKeyTexture;
public ManiaLegacySkinTransformer(ISkin skin, IBeatmap beatmap)
public ManiaLegacySkinTransformer(ISkin skin)
: base(skin)
{
this.beatmap = (ManiaBeatmap)beatmap;
isLegacySkin = new Lazy<bool>(() => GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version) != null);
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;
});
}
@ -149,7 +144,7 @@ public override ISample GetSample(ISampleInfo sampleInfo)
public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
{
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);
}