mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Merge pull request #22599 from peppy/fix-mania-long-note-regression
Fix osu!mania long notes not displaying correctly since recent update
This commit is contained in:
@ -2,12 +2,15 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.ObjectExtensions;
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
@ -34,6 +37,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
private Drawable? lightContainer;
|
private Drawable? lightContainer;
|
||||||
|
|
||||||
private Drawable? light;
|
private Drawable? light;
|
||||||
|
private LegacyNoteBodyStyle? bodyStyle;
|
||||||
|
|
||||||
public LegacyBodyPiece()
|
public LegacyBodyPiece()
|
||||||
{
|
{
|
||||||
@ -54,9 +58,6 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
float lightScale = GetColumnSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteLightScale)?.Value
|
float lightScale = GetColumnSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteLightScale)?.Value
|
||||||
?? 1;
|
?? 1;
|
||||||
|
|
||||||
float minimumColumnWidth = GetColumnSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.MinimumColumnWidth)?.Value
|
|
||||||
?? 1;
|
|
||||||
|
|
||||||
// Create a temporary animation to retrieve the number of frames, in an effort to calculate the intended frame length.
|
// Create a temporary animation to retrieve the number of frames, in an effort to calculate the intended frame length.
|
||||||
// This animation is discarded and re-queried with the appropriate frame length afterwards.
|
// This animation is discarded and re-queried with the appropriate frame length afterwards.
|
||||||
var tmp = skin.GetAnimation(lightImage, true, false);
|
var tmp = skin.GetAnimation(lightImage, true, false);
|
||||||
@ -83,7 +84,14 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
bodySprite = skin.GetAnimation(imageName, WrapMode.ClampToEdge, WrapMode.ClampToEdge, true, true).With(d =>
|
bodyStyle = skin.GetConfig<ManiaSkinConfigurationLookup, LegacyNoteBodyStyle>(new ManiaSkinConfigurationLookup(LegacyManiaSkinConfigurationLookups.NoteBodyStyle))?.Value;
|
||||||
|
|
||||||
|
var wrapMode = bodyStyle == LegacyNoteBodyStyle.Stretch ? WrapMode.ClampToEdge : WrapMode.Repeat;
|
||||||
|
|
||||||
|
direction.BindTo(scrollingInfo.Direction);
|
||||||
|
isHitting.BindTo(holdNote.IsHitting);
|
||||||
|
|
||||||
|
bodySprite = skin.GetAnimation(imageName, wrapMode, wrapMode, true, true).With(d =>
|
||||||
{
|
{
|
||||||
if (d == null)
|
if (d == null)
|
||||||
return;
|
return;
|
||||||
@ -94,16 +102,11 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
d.Anchor = Anchor.TopCentre;
|
d.Anchor = Anchor.TopCentre;
|
||||||
d.RelativeSizeAxes = Axes.Both;
|
d.RelativeSizeAxes = Axes.Both;
|
||||||
d.Size = Vector2.One;
|
d.Size = Vector2.One;
|
||||||
d.FillMode = FillMode.Stretch;
|
|
||||||
d.Height = minimumColumnWidth / d.DrawWidth * 1.6f; // constant matching stable.
|
|
||||||
// Todo: Wrap?
|
// Todo: Wrap?
|
||||||
});
|
});
|
||||||
|
|
||||||
if (bodySprite != null)
|
if (bodySprite != null)
|
||||||
InternalChild = bodySprite;
|
InternalChild = bodySprite;
|
||||||
|
|
||||||
direction.BindTo(scrollingInfo.Direction);
|
|
||||||
isHitting.BindTo(holdNote.IsHitting);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -165,7 +168,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
if (bodySprite != null)
|
if (bodySprite != null)
|
||||||
{
|
{
|
||||||
bodySprite.Origin = Anchor.BottomCentre;
|
bodySprite.Origin = Anchor.BottomCentre;
|
||||||
bodySprite.Scale = new Vector2(1, -1);
|
bodySprite.Scale = new Vector2(bodySprite.Scale.X, Math.Abs(bodySprite.Scale.Y) * -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (light != null)
|
if (light != null)
|
||||||
@ -176,7 +179,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
if (bodySprite != null)
|
if (bodySprite != null)
|
||||||
{
|
{
|
||||||
bodySprite.Origin = Anchor.TopCentre;
|
bodySprite.Origin = Anchor.TopCentre;
|
||||||
bodySprite.Scale = Vector2.One;
|
bodySprite.Scale = new Vector2(bodySprite.Scale.X, Math.Abs(bodySprite.Scale.Y));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (light != null)
|
if (light != null)
|
||||||
@ -207,6 +210,29 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
missFadeTime.Value ??= holdNote.HoldBrokenTime;
|
missFadeTime.Value ??= holdNote.HoldBrokenTime;
|
||||||
|
|
||||||
|
// here we go...
|
||||||
|
switch (bodyStyle)
|
||||||
|
{
|
||||||
|
case LegacyNoteBodyStyle.Stretch:
|
||||||
|
// this is how lazer works by default. nothing required.
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// this is where things get fucked up.
|
||||||
|
// honestly there's three modes to handle here but they seem really pointless?
|
||||||
|
// let's wait to see if anyone actually uses them in skins.
|
||||||
|
if (bodySprite != null)
|
||||||
|
{
|
||||||
|
var sprite = bodySprite as Sprite ?? bodySprite.ChildrenOfType<Sprite>().Single();
|
||||||
|
|
||||||
|
bodySprite.FillMode = FillMode.Stretch;
|
||||||
|
// i dunno this looks about right??
|
||||||
|
bodySprite.Scale = new Vector2(1, 32800 / sprite.DrawHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -29,6 +29,8 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public Dictionary<string, string> ImageLookups = new Dictionary<string, string>();
|
public Dictionary<string, string> ImageLookups = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
public float WidthForNoteHeightScale;
|
||||||
|
|
||||||
public readonly float[] ColumnLineWidth;
|
public readonly float[] ColumnLineWidth;
|
||||||
public readonly float[] ColumnSpacing;
|
public readonly float[] ColumnSpacing;
|
||||||
public readonly float[] ColumnWidth;
|
public readonly float[] ColumnWidth;
|
||||||
@ -41,6 +43,8 @@ namespace osu.Game.Skinning
|
|||||||
public bool ShowJudgementLine = true;
|
public bool ShowJudgementLine = true;
|
||||||
public bool KeysUnderNotes;
|
public bool KeysUnderNotes;
|
||||||
|
|
||||||
|
public LegacyNoteBodyStyle? NoteBodyStyle;
|
||||||
|
|
||||||
public LegacyManiaSkinConfiguration(int keys)
|
public LegacyManiaSkinConfiguration(int keys)
|
||||||
{
|
{
|
||||||
Keys = keys;
|
Keys = keys;
|
||||||
@ -55,12 +59,6 @@ namespace osu.Game.Skinning
|
|||||||
ColumnWidth.AsSpan().Fill(DEFAULT_COLUMN_SIZE);
|
ColumnWidth.AsSpan().Fill(DEFAULT_COLUMN_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float? minimumColumnWidth;
|
public float MinimumColumnWidth => ColumnWidth.Min();
|
||||||
|
|
||||||
public float MinimumColumnWidth
|
|
||||||
{
|
|
||||||
get => minimumColumnWidth ?? ColumnWidth.Min();
|
|
||||||
set => minimumColumnWidth = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ namespace osu.Game.Skinning
|
|||||||
HoldNoteBodyImage,
|
HoldNoteBodyImage,
|
||||||
HoldNoteLightImage,
|
HoldNoteLightImage,
|
||||||
HoldNoteLightScale,
|
HoldNoteLightScale,
|
||||||
|
WidthForNoteHeightScale,
|
||||||
ExplosionImage,
|
ExplosionImage,
|
||||||
ExplosionScale,
|
ExplosionScale,
|
||||||
ColumnLineColour,
|
ColumnLineColour,
|
||||||
@ -71,5 +72,6 @@ namespace osu.Game.Skinning
|
|||||||
Hit50,
|
Hit50,
|
||||||
Hit0,
|
Hit0,
|
||||||
KeysUnderNotes,
|
KeysUnderNotes,
|
||||||
|
NoteBodyStyle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,10 +114,13 @@ namespace osu.Game.Skinning
|
|||||||
parseArrayValue(pair.Value, currentConfig.HoldNoteLightWidth);
|
parseArrayValue(pair.Value, currentConfig.HoldNoteLightWidth);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "NoteBodyStyle":
|
||||||
|
if (Enum.TryParse<LegacyNoteBodyStyle>(pair.Value, out var style))
|
||||||
|
currentConfig.NoteBodyStyle = style;
|
||||||
|
break;
|
||||||
|
|
||||||
case "WidthForNoteHeightScale":
|
case "WidthForNoteHeightScale":
|
||||||
float minWidth = float.Parse(pair.Value, CultureInfo.InvariantCulture) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR;
|
currentConfig.WidthForNoteHeightScale = (float.Parse(pair.Value, CultureInfo.InvariantCulture)) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR;
|
||||||
if (minWidth > 0)
|
|
||||||
currentConfig.MinimumColumnWidth = minWidth;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case string when pair.Key.StartsWith("Colour", StringComparison.Ordinal):
|
case string when pair.Key.StartsWith("Colour", StringComparison.Ordinal):
|
||||||
|
17
osu.Game/Skinning/LegacyNoteBodyStyle.cs
Normal file
17
osu.Game/Skinning/LegacyNoteBodyStyle.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
namespace osu.Game.Skinning
|
||||||
|
{
|
||||||
|
public enum LegacyNoteBodyStyle
|
||||||
|
{
|
||||||
|
Stretch = 0,
|
||||||
|
|
||||||
|
// listed as the default on https://osu.ppy.sh/wiki/en/Skinning/skin.ini, but is seemingly not according to the source.
|
||||||
|
// Repeat = 1,
|
||||||
|
|
||||||
|
RepeatTop = 2,
|
||||||
|
RepeatBottom = 3,
|
||||||
|
RepeatTopAndBottom = 4,
|
||||||
|
}
|
||||||
|
}
|
@ -138,6 +138,10 @@ namespace osu.Game.Skinning
|
|||||||
Debug.Assert(maniaLookup.ColumnIndex != null);
|
Debug.Assert(maniaLookup.ColumnIndex != null);
|
||||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnWidth[maniaLookup.ColumnIndex.Value]));
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnWidth[maniaLookup.ColumnIndex.Value]));
|
||||||
|
|
||||||
|
case LegacyManiaSkinConfigurationLookups.WidthForNoteHeightScale:
|
||||||
|
Debug.Assert(maniaLookup.ColumnIndex != null);
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.WidthForNoteHeightScale));
|
||||||
|
|
||||||
case LegacyManiaSkinConfigurationLookups.ColumnSpacing:
|
case LegacyManiaSkinConfigurationLookups.ColumnSpacing:
|
||||||
Debug.Assert(maniaLookup.ColumnIndex != null);
|
Debug.Assert(maniaLookup.ColumnIndex != null);
|
||||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnSpacing[maniaLookup.ColumnIndex.Value]));
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnSpacing[maniaLookup.ColumnIndex.Value]));
|
||||||
@ -185,6 +189,16 @@ namespace osu.Game.Skinning
|
|||||||
case LegacyManiaSkinConfigurationLookups.MinimumColumnWidth:
|
case LegacyManiaSkinConfigurationLookups.MinimumColumnWidth:
|
||||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.MinimumColumnWidth));
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.MinimumColumnWidth));
|
||||||
|
|
||||||
|
case LegacyManiaSkinConfigurationLookups.NoteBodyStyle:
|
||||||
|
|
||||||
|
if (existing.NoteBodyStyle != null)
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<LegacyNoteBodyStyle>(existing.NoteBodyStyle.Value));
|
||||||
|
|
||||||
|
if (GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version)?.Value < 2.5m)
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<LegacyNoteBodyStyle>(LegacyNoteBodyStyle.Stretch));
|
||||||
|
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<LegacyNoteBodyStyle>(LegacyNoteBodyStyle.RepeatBottom));
|
||||||
|
|
||||||
case LegacyManiaSkinConfigurationLookups.NoteImage:
|
case LegacyManiaSkinConfigurationLookups.NoteImage:
|
||||||
Debug.Assert(maniaLookup.ColumnIndex != null);
|
Debug.Assert(maniaLookup.ColumnIndex != null);
|
||||||
return SkinUtils.As<TValue>(getManiaImage(existing, $"NoteImage{maniaLookup.ColumnIndex}"));
|
return SkinUtils.As<TValue>(getManiaImage(existing, $"NoteImage{maniaLookup.ColumnIndex}"));
|
||||||
|
Reference in New Issue
Block a user