mirror of
https://github.com/ppy/osu
synced 2025-01-04 13:22:08 +00:00
Move lookup to own function
This commit is contained in:
parent
c2c7ff7334
commit
a76428f965
@ -87,9 +87,7 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
// todo: this shouldn't really be duplicated here (from ManiaLegacySkinTransformer). we need to come up with a better solution.
|
// todo: this shouldn't really be duplicated here (from ManiaLegacySkinTransformer). we need to come up with a better solution.
|
||||||
hasKeyTexture = new Lazy<bool>(() => this.GetAnimation(
|
hasKeyTexture = new Lazy<bool>(() => this.GetAnimation(
|
||||||
GetConfig<LegacyManiaSkinConfigurationLookup, string>(
|
lookupForMania<string>(new LegacyManiaSkinConfigurationLookup(4, LegacyManiaSkinConfigurationLookups.KeyImage, 0))?.Value ?? "mania-key1", true, true) != null);
|
||||||
new LegacyManiaSkinConfigurationLookup(4, LegacyManiaSkinConfigurationLookups.KeyImage, 0))?.Value
|
|
||||||
?? "mania-key1", true, true) != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
@ -138,28 +136,9 @@ namespace osu.Game.Skinning
|
|||||||
if (!AllowManiaSkin)
|
if (!AllowManiaSkin)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (!maniaConfigurations.TryGetValue(maniaLookup.Keys, out var existing))
|
var result = lookupForMania<TValue>(maniaLookup);
|
||||||
maniaConfigurations[maniaLookup.Keys] = existing = new LegacyManiaSkinConfiguration(maniaLookup.Keys);
|
if (result != null)
|
||||||
|
return result;
|
||||||
switch (maniaLookup.Lookup)
|
|
||||||
{
|
|
||||||
case LegacyManiaSkinConfigurationLookups.ColumnWidth:
|
|
||||||
Debug.Assert(maniaLookup.TargetColumn != null);
|
|
||||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnWidth[maniaLookup.TargetColumn.Value]));
|
|
||||||
|
|
||||||
case LegacyManiaSkinConfigurationLookups.ColumnSpacing:
|
|
||||||
Debug.Assert(maniaLookup.TargetColumn != null);
|
|
||||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnSpacing[maniaLookup.TargetColumn.Value]));
|
|
||||||
|
|
||||||
case LegacyManiaSkinConfigurationLookups.HitPosition:
|
|
||||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.HitPosition));
|
|
||||||
|
|
||||||
case LegacyManiaSkinConfigurationLookups.LightPosition:
|
|
||||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.LightPosition));
|
|
||||||
|
|
||||||
case LegacyManiaSkinConfigurationLookups.ShowJudgementLine:
|
|
||||||
return SkinUtils.As<TValue>(new Bindable<bool>(existing.ShowJudgementLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -190,6 +169,34 @@ namespace osu.Game.Skinning
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IBindable<TValue> lookupForMania<TValue>(LegacyManiaSkinConfigurationLookup maniaLookup)
|
||||||
|
{
|
||||||
|
if (!maniaConfigurations.TryGetValue(maniaLookup.Keys, out var existing))
|
||||||
|
maniaConfigurations[maniaLookup.Keys] = existing = new LegacyManiaSkinConfiguration(maniaLookup.Keys);
|
||||||
|
|
||||||
|
switch (maniaLookup.Lookup)
|
||||||
|
{
|
||||||
|
case LegacyManiaSkinConfigurationLookups.ColumnWidth:
|
||||||
|
Debug.Assert(maniaLookup.TargetColumn != null);
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnWidth[maniaLookup.TargetColumn.Value]));
|
||||||
|
|
||||||
|
case LegacyManiaSkinConfigurationLookups.ColumnSpacing:
|
||||||
|
Debug.Assert(maniaLookup.TargetColumn != null);
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnSpacing[maniaLookup.TargetColumn.Value]));
|
||||||
|
|
||||||
|
case LegacyManiaSkinConfigurationLookups.HitPosition:
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.HitPosition));
|
||||||
|
|
||||||
|
case LegacyManiaSkinConfigurationLookups.LightPosition:
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.LightPosition));
|
||||||
|
|
||||||
|
case LegacyManiaSkinConfigurationLookups.ShowJudgementLine:
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<bool>(existing.ShowJudgementLine));
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private IBindable<Color4> getCustomColour(string lookup) => Configuration.CustomColours.TryGetValue(lookup, out var col) ? new Bindable<Color4>(col) : null;
|
private IBindable<Color4> getCustomColour(string lookup) => Configuration.CustomColours.TryGetValue(lookup, out var col) ? new Bindable<Color4>(col) : null;
|
||||||
|
|
||||||
public override Drawable GetDrawableComponent(ISkinComponent component)
|
public override Drawable GetDrawableComponent(ISkinComponent component)
|
||||||
|
Loading…
Reference in New Issue
Block a user