Implement mania note + key image configs

This commit is contained in:
smoogipoo 2020-04-06 19:04:02 +09:00
parent 707a6269b3
commit db6db861c0
3 changed files with 41 additions and 6 deletions

View File

@ -24,6 +24,8 @@ public class LegacyManiaSkinConfiguration : IHasCustomColours
public Dictionary<string, Color4> CustomColours { get; set; } = new Dictionary<string, Color4>(); public Dictionary<string, Color4> CustomColours { get; set; } = new Dictionary<string, Color4>();
public Dictionary<string, string> ImageLookups = new Dictionary<string, string>();
public readonly float[] ColumnLineWidth; public readonly float[] ColumnLineWidth;
public readonly float[] ColumnSpacing; public readonly float[] ColumnSpacing;
public readonly float[] ColumnWidth; public readonly float[] ColumnWidth;

View File

@ -71,12 +71,6 @@ private void flushPendingLines()
{ {
var pair = SplitKeyVal(line); var pair = SplitKeyVal(line);
if (pair.Key.StartsWith("Colour"))
{
HandleColours(currentConfig, line);
continue;
}
switch (pair.Key) switch (pair.Key)
{ {
case "ColumnLineWidth": case "ColumnLineWidth":
@ -106,6 +100,18 @@ private void flushPendingLines()
case "LightingNWidth": case "LightingNWidth":
parseArrayValue(pair.Value, currentConfig.ExplosionWidth); parseArrayValue(pair.Value, currentConfig.ExplosionWidth);
break; break;
case string _ when pair.Key.StartsWith("Colour"):
HandleColours(currentConfig, line);
break;
case string _ when pair.Key.StartsWith("NoteImage"):
currentConfig.ImageLookups[pair.Key] = pair.Value;
break;
case string _ when pair.Key.StartsWith("KeyImage"):
currentConfig.ImageLookups[pair.Key] = pair.Value;
break;
} }
} }
} }

View File

@ -207,6 +207,30 @@ private IBindable<TValue> lookupForMania<TValue>(LegacyManiaSkinConfigurationLoo
case LegacyManiaSkinConfigurationLookups.ColumnLineColour: case LegacyManiaSkinConfigurationLookups.ColumnLineColour:
return SkinUtils.As<TValue>(getCustomColour(existing, "ColourColumnLine")); return SkinUtils.As<TValue>(getCustomColour(existing, "ColourColumnLine"));
case LegacyManiaSkinConfigurationLookups.NoteImage:
Debug.Assert(maniaLookup.TargetColumn != null);
return SkinUtils.As<TValue>(getManiaImage(existing, $"NoteImage{maniaLookup.TargetColumn}"));
case LegacyManiaSkinConfigurationLookups.HoldNoteHeadImage:
Debug.Assert(maniaLookup.TargetColumn != null);
return SkinUtils.As<TValue>(getManiaImage(existing, $"NoteImage{maniaLookup.TargetColumn}H"));
case LegacyManiaSkinConfigurationLookups.HoldNoteTailImage:
Debug.Assert(maniaLookup.TargetColumn != null);
return SkinUtils.As<TValue>(getManiaImage(existing, $"NoteImage{maniaLookup.TargetColumn}T"));
case LegacyManiaSkinConfigurationLookups.HoldNoteBodyImage:
Debug.Assert(maniaLookup.TargetColumn != null);
return SkinUtils.As<TValue>(getManiaImage(existing, $"NoteImage{maniaLookup.TargetColumn}L"));
case LegacyManiaSkinConfigurationLookups.KeyImage:
Debug.Assert(maniaLookup.TargetColumn != null);
return SkinUtils.As<TValue>(getManiaImage(existing, $"KeyImage{maniaLookup.TargetColumn}"));
case LegacyManiaSkinConfigurationLookups.KeyImageDown:
Debug.Assert(maniaLookup.TargetColumn != null);
return SkinUtils.As<TValue>(getManiaImage(existing, $"KeyImage{maniaLookup.TargetColumn}D"));
} }
return null; return null;
@ -215,6 +239,9 @@ private IBindable<TValue> lookupForMania<TValue>(LegacyManiaSkinConfigurationLoo
private IBindable<Color4> getCustomColour(IHasCustomColours source, string lookup) private IBindable<Color4> getCustomColour(IHasCustomColours source, string lookup)
=> source.CustomColours.TryGetValue(lookup, out var col) ? new Bindable<Color4>(col) : null; => source.CustomColours.TryGetValue(lookup, out var col) ? new Bindable<Color4>(col) : null;
private IBindable<string> getManiaImage(LegacyManiaSkinConfiguration source, string lookup)
=> source.ImageLookups.TryGetValue(lookup, out var image) ? new Bindable<string>(image) : null;
public override Drawable GetDrawableComponent(ISkinComponent component) public override Drawable GetDrawableComponent(ISkinComponent component)
{ {
switch (component) switch (component)