1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 10:23:03 +08:00

Implement legacy normal hit explosions

This commit is contained in:
smoogipoo 2020-04-02 14:29:16 +09:00
parent b375a02cff
commit fa3a449c3b
6 changed files with 28 additions and 1 deletions

View File

@ -8,10 +8,11 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Animations; using osu.Framework.Graphics.Animations;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Mania.Skinning namespace osu.Game.Rulesets.Mania.Skinning
{ {
public class LegacyHitExplosion : LegacyManiaElement public class LegacyHitExplosion : LegacyManiaColumnElement
{ {
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>(); private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
@ -28,6 +29,9 @@ namespace osu.Game.Rulesets.Mania.Skinning
string imageName = GetManiaSkinConfig<string>(skin, LegacyManiaSkinConfigurationLookups.ExplosionImage)?.Value string imageName = GetManiaSkinConfig<string>(skin, LegacyManiaSkinConfigurationLookups.ExplosionImage)?.Value
?? "lightingN"; ?? "lightingN";
float explosionScale = GetManiaSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.ExplosionScale)?.Value
?? 1;
InternalChild = explosion = skin.GetAnimation(imageName, true, false, startAtCurrentTime: true).With(d => InternalChild = explosion = skin.GetAnimation(imageName, true, false, startAtCurrentTime: true).With(d =>
{ {
if (d == null) if (d == null)
@ -35,6 +39,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
d.Origin = Anchor.Centre; d.Origin = Anchor.Centre;
d.Blending = BlendingParameters.Additive; d.Blending = BlendingParameters.Additive;
d.Scale = new Vector2(explosionScale);
if (!(d is TextureAnimation texAnimation)) if (!(d is TextureAnimation texAnimation))
return; return;

View File

@ -74,6 +74,9 @@ namespace osu.Game.Rulesets.Mania.Skinning
case ManiaSkinComponents.HoldNoteBody: case ManiaSkinComponents.HoldNoteBody:
return new LegacyBodyPiece(); return new LegacyBodyPiece();
case ManiaSkinComponents.HitExplosion:
return new LegacyHitExplosion();
} }
break; break;

View File

@ -22,6 +22,7 @@ namespace osu.Game.Skinning
public readonly float[] ColumnLineWidth; public readonly float[] ColumnLineWidth;
public readonly float[] ColumnSpacing; public readonly float[] ColumnSpacing;
public readonly float[] ColumnWidth; public readonly float[] ColumnWidth;
public readonly float[] ExplosionWidth;
public float HitPosition = (480 - 402) * POSITION_SCALE_FACTOR; public float HitPosition = (480 - 402) * POSITION_SCALE_FACTOR;
public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR; public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR;
@ -34,6 +35,7 @@ namespace osu.Game.Skinning
ColumnLineWidth = new float[keys + 1]; ColumnLineWidth = new float[keys + 1];
ColumnSpacing = new float[keys - 1]; ColumnSpacing = new float[keys - 1];
ColumnWidth = new float[keys]; ColumnWidth = new float[keys];
ExplosionWidth = new float[keys];
ColumnLineWidth.AsSpan().Fill(2); ColumnLineWidth.AsSpan().Fill(2);
ColumnWidth.AsSpan().Fill(DEFAULT_COLUMN_SIZE); ColumnWidth.AsSpan().Fill(DEFAULT_COLUMN_SIZE);

View File

@ -34,5 +34,7 @@ namespace osu.Game.Skinning
HoldNoteHeadImage, HoldNoteHeadImage,
HoldNoteTailImage, HoldNoteTailImage,
HoldNoteBodyImage, HoldNoteBodyImage,
ExplosionImage,
ExplosionScale
} }
} }

View File

@ -96,6 +96,10 @@ namespace osu.Game.Skinning
case "JudgementLine": case "JudgementLine":
currentConfig.ShowJudgementLine = pair.Value == "1"; currentConfig.ShowJudgementLine = pair.Value == "1";
break; break;
case "LightingNWidth":
parseArrayValue(pair.Value, currentConfig.ExplosionWidth);
break;
} }
} }
} }

View File

@ -192,6 +192,17 @@ namespace osu.Game.Skinning
case LegacyManiaSkinConfigurationLookups.ShowJudgementLine: case LegacyManiaSkinConfigurationLookups.ShowJudgementLine:
return SkinUtils.As<TValue>(new Bindable<bool>(existing.ShowJudgementLine)); return SkinUtils.As<TValue>(new Bindable<bool>(existing.ShowJudgementLine));
case LegacyManiaSkinConfigurationLookups.ExplosionScale:
Debug.Assert(maniaLookup.TargetColumn != null);
if (GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value < 2.5m)
return SkinUtils.As<TValue>(new Bindable<float>(1));
if (existing.ExplosionWidth[maniaLookup.TargetColumn.Value] != 0)
return SkinUtils.As<TValue>(new Bindable<float>(existing.ExplosionWidth[maniaLookup.TargetColumn.Value] / LegacyManiaSkinConfiguration.DEFAULT_COLUMN_SIZE));
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnWidth[maniaLookup.TargetColumn.Value] / LegacyManiaSkinConfiguration.DEFAULT_COLUMN_SIZE));
} }
return null; return null;