mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:07:52 +08:00
Add legacy circle piece animations based on combo
This commit is contained in:
parent
2e4dc7c467
commit
5343f6922c
@ -2,13 +2,16 @@
|
|||||||
// 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 osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -18,6 +21,13 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
public class LegacyCirclePiece : CompositeDrawable, IHasAccentColour
|
public class LegacyCirclePiece : CompositeDrawable, IHasAccentColour
|
||||||
{
|
{
|
||||||
private Drawable backgroundLayer = null!;
|
private Drawable backgroundLayer = null!;
|
||||||
|
private Drawable? foregroundLayer;
|
||||||
|
|
||||||
|
private Bindable<int> currentCombo { get; } = new BindableInt();
|
||||||
|
|
||||||
|
private int animationFrame;
|
||||||
|
private int multiplier;
|
||||||
|
private double beatLength;
|
||||||
|
|
||||||
// required for editor blueprints (not sure why these circle pieces are zero size).
|
// required for editor blueprints (not sure why these circle pieces are zero size).
|
||||||
public override Quad ScreenSpaceDrawQuad => backgroundLayer.ScreenSpaceDrawQuad;
|
public override Quad ScreenSpaceDrawQuad => backgroundLayer.ScreenSpaceDrawQuad;
|
||||||
@ -27,6 +37,12 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private GameplayState? gameplayState { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBeatSyncProvider? beatSyncProvider { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource skin, DrawableHitObject drawableHitObject)
|
private void load(ISkinSource skin, DrawableHitObject drawableHitObject)
|
||||||
{
|
{
|
||||||
@ -45,7 +61,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
// backgroundLayer is guaranteed to exist due to the pre-check in TaikoLegacySkinTransformer.
|
// backgroundLayer is guaranteed to exist due to the pre-check in TaikoLegacySkinTransformer.
|
||||||
AddInternal(backgroundLayer = new LegacyKiaiFlashingDrawable(() => getDrawableFor("circle")));
|
AddInternal(backgroundLayer = new LegacyKiaiFlashingDrawable(() => getDrawableFor("circle")));
|
||||||
|
|
||||||
var foregroundLayer = getDrawableFor("circleoverlay");
|
foregroundLayer = getDrawableFor("circleoverlay");
|
||||||
if (foregroundLayer != null)
|
if (foregroundLayer != null)
|
||||||
AddInternal(foregroundLayer);
|
AddInternal(foregroundLayer);
|
||||||
|
|
||||||
@ -58,6 +74,9 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
c.Anchor = Anchor.Centre;
|
c.Anchor = Anchor.Centre;
|
||||||
c.Origin = Anchor.Centre;
|
c.Origin = Anchor.Centre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gameplayState != null)
|
||||||
|
currentCombo.BindTo(gameplayState.ScoreProcessor.Combo);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -74,6 +93,29 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
// This ensures they are scaled relative to each other but also match the expected DrawableHit size.
|
// This ensures they are scaled relative to each other but also match the expected DrawableHit size.
|
||||||
foreach (var c in InternalChildren)
|
foreach (var c in InternalChildren)
|
||||||
c.Scale = new Vector2(DrawHeight / 128);
|
c.Scale = new Vector2(DrawHeight / 128);
|
||||||
|
|
||||||
|
if (currentCombo.Value >= 150)
|
||||||
|
{
|
||||||
|
multiplier = 2;
|
||||||
|
}
|
||||||
|
else if (currentCombo.Value >= 50)
|
||||||
|
{
|
||||||
|
multiplier = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(foregroundLayer as IFramedAnimation)?.GotoFrame(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (beatSyncProvider?.ControlPoints != null)
|
||||||
|
{
|
||||||
|
beatLength = beatSyncProvider.ControlPoints.TimingPointAt(LifetimeStart).BeatLength;
|
||||||
|
|
||||||
|
animationFrame = Time.Current % ((beatLength * 2) / multiplier) >= beatLength / multiplier ? 0 : 1;
|
||||||
|
|
||||||
|
(foregroundLayer as IFramedAnimation)?.GotoFrame(animationFrame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 accentColour;
|
private Color4 accentColour;
|
||||||
|
Loading…
Reference in New Issue
Block a user