mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 01:27:29 +08:00
Apply second attempt at fixing long note bodies
This commit is contained in:
parent
bfbffc4a68
commit
b1d2a433f8
@ -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;
|
||||||
@ -99,9 +107,6 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
|
|
||||||
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()
|
||||||
@ -205,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, 10000 / sprite.DrawHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
Loading…
Reference in New Issue
Block a user