1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

make mania skin elements use new method

This commit is contained in:
mcendu 2020-03-31 17:32:05 +08:00
parent c0f8c1dc28
commit 71fc240aee
No known key found for this signature in database
GPG Key ID: FBCD5D45163D6364
6 changed files with 12 additions and 20 deletions

View File

@ -35,8 +35,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource skin, IScrollingInfo scrollingInfo, DrawableHitObject drawableObject) private void load(ISkinSource skin, IScrollingInfo scrollingInfo, DrawableHitObject drawableObject)
{ {
string imageName = skin.GetConfig<LegacyManiaSkinConfigurationLookup, string>( string imageName = GetManiaSkinConfig<string>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteBodyImage)?.Value
new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.HoldNoteBodyImage, column.Index))?.Value
?? $"mania-note{FallbackColumnIndex}L"; ?? $"mania-note{FallbackColumnIndex}L";
sprite = skin.GetAnimation(imageName, true, true).With(d => sprite = skin.GetAnimation(imageName, true, true).With(d =>

View File

@ -31,15 +31,12 @@ namespace osu.Game.Rulesets.Mania.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource skin, IScrollingInfo scrollingInfo) private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
{ {
string lightImage = skin.GetConfig<LegacyManiaSkinConfigurationLookup, string>( string lightImage = GetManiaSkinConfig<string>(skin, LegacyManiaSkinConfigurationLookups.LightImage, 0)?.Value
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.LightImage, 0))?.Value
?? "mania-stage-light"; ?? "mania-stage-light";
float leftLineWidth = skin.GetConfig<LegacyManiaSkinConfigurationLookup, float>( float leftLineWidth = GetManiaSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.LeftLineWidth)
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.LeftLineWidth, Column.Index))
?.Value ?? 1; ?.Value ?? 1;
float rightLineWidth = skin.GetConfig<LegacyManiaSkinConfigurationLookup, float>( float rightLineWidth = GetManiaSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.RightLineWidth)
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.RightLineWidth, Column.Index))
?.Value ?? 1; ?.Value ?? 1;
bool hasLeftLine = leftLineWidth > 0; bool hasLeftLine = leftLineWidth > 0;

View File

@ -28,12 +28,10 @@ namespace osu.Game.Rulesets.Mania.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource skin, IScrollingInfo scrollingInfo) private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
{ {
string targetImage = skin.GetConfig<LegacyManiaSkinConfigurationLookup, string>( string targetImage = GetManiaSkinConfig<string>(skin, LegacyManiaSkinConfigurationLookups.HitTargetImage)?.Value
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.HitTargetImage))?.Value
?? "mania-stage-hint"; ?? "mania-stage-hint";
bool showJudgementLine = skin.GetConfig<LegacyManiaSkinConfigurationLookup, bool>( bool showJudgementLine = GetManiaSkinConfig<bool>(skin, LegacyManiaSkinConfigurationLookups.ShowJudgementLine)?.Value
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.ShowJudgementLine))?.Value
?? true; ?? true;
InternalChild = directionContainer = new Container InternalChild = directionContainer = new Container

View File

@ -36,12 +36,10 @@ namespace osu.Game.Rulesets.Mania.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource skin, IScrollingInfo scrollingInfo) private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
{ {
string upImage = skin.GetConfig<LegacyManiaSkinConfigurationLookup, string>( string upImage = GetManiaSkinConfig<string>(skin, LegacyManiaSkinConfigurationLookups.KeyImage)?.Value
new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.KeyImage, column.Index))?.Value
?? $"mania-key{FallbackColumnIndex}"; ?? $"mania-key{FallbackColumnIndex}";
string downImage = skin.GetConfig<LegacyManiaSkinConfigurationLookup, string>( string downImage = GetManiaSkinConfig<string>(skin, LegacyManiaSkinConfigurationLookups.KeyImageDown)?.Value
new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.KeyImageDown, column.Index))?.Value
?? $"mania-key{FallbackColumnIndex}D"; ?? $"mania-key{FallbackColumnIndex}D";
InternalChild = directionContainer = new Container InternalChild = directionContainer = new Container

View File

@ -45,8 +45,9 @@ namespace osu.Game.Rulesets.Mania.Skinning
/// </summary> /// </summary>
/// <param name="skin">The skin from which configuration is retrieved.</param> /// <param name="skin">The skin from which configuration is retrieved.</param>
/// <param name="lookup">The value to retrieve.</param> /// <param name="lookup">The value to retrieve.</param>
protected IBindable<T> GetManiaSkinConfig<T>(ISkin skin, LegacyManiaSkinConfigurationLookups lookup) /// <param name="index">The index of the column to which the entry applies.</param>
protected IBindable<T> GetManiaSkinConfig<T>(ISkin skin, LegacyManiaSkinConfigurationLookups lookup, int? index = null)
=> skin.GetConfig<LegacyManiaSkinConfigurationLookup, T>( => skin.GetConfig<LegacyManiaSkinConfigurationLookup, T>(
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, lookup, Column.Index)); new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, lookup, index ?? Column.Index));
} }
} }

View File

@ -83,8 +83,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
break; break;
} }
string noteImage = skin.GetConfig<LegacyManiaSkinConfigurationLookup, string>( string noteImage = GetManiaSkinConfig<string>(skin, lookup)?.Value
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, lookup, Column.Index))?.Value
?? $"mania-note{FallbackColumnIndex}{suffix}"; ?? $"mania-note{FallbackColumnIndex}{suffix}";
return skin.GetTexture(noteImage); return skin.GetTexture(noteImage);