mirror of
https://github.com/ppy/osu.git
synced 2026-05-17 01:03:15 +08:00
Merge taiko swell components
Per <https://github.com/ppy/osu/pull/21601/files#r1064167756>, taking a variation of the "Make all swell main pieces implement ISkinnableSwellPart" path. Should clean the interface up enough for further refactors.
This commit is contained in:
@@ -27,8 +27,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
private Vector2 baseSize;
|
||||
|
||||
private readonly SkinnableDrawable spinnerBody;
|
||||
|
||||
private readonly Container<DrawableSwellTick> ticks;
|
||||
|
||||
private double? lastPressHandleTime;
|
||||
@@ -50,24 +48,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
{
|
||||
FillMode = FillMode.Fit;
|
||||
|
||||
Content.Add(spinnerBody = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.SwellBody), _ => new DefaultSwell())
|
||||
AddInternal(ticks = new Container<DrawableSwellTick> { RelativeSizeAxes = Axes.Both });
|
||||
}
|
||||
|
||||
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.SwellBody),
|
||||
_ => new DefaultSwell
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
|
||||
AddInternal(ticks = new Container<DrawableSwellTick> { RelativeSizeAxes = Axes.Both });
|
||||
}
|
||||
|
||||
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.SwellCirclePiece),
|
||||
_ => new SwellCirclePiece
|
||||
{
|
||||
// to allow for rotation transform
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
});
|
||||
|
||||
protected override void RecreatePieces()
|
||||
{
|
||||
base.RecreatePieces();
|
||||
@@ -132,7 +123,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
int numHits = ticks.Count(r => r.IsHit);
|
||||
|
||||
(spinnerBody.Drawable as ISkinnableSwell)?.AnimateSwellProgress(this, numHits, MainPiece);
|
||||
(MainPiece.Drawable as ISkinnableSwell)?.AnimateSwellProgress(this, numHits);
|
||||
|
||||
if (numHits == HitObject.RequiredHits)
|
||||
ApplyMaxResult();
|
||||
@@ -167,7 +158,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
{
|
||||
base.UpdateStartTimeStateTransforms();
|
||||
|
||||
(spinnerBody.Drawable as ISkinnableSwell)?.AnimateSwellStart(this, MainPiece);
|
||||
(MainPiece.Drawable as ISkinnableSwell)?.AnimateSwellStart(this);
|
||||
}
|
||||
|
||||
protected override void UpdateHitStateTransforms(ArmedState state)
|
||||
@@ -187,7 +178,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
LifetimeEnd = Time.Current + clear_animation_duration;
|
||||
HandleUserInput = false;
|
||||
|
||||
(spinnerBody.Drawable as ISkinnableSwell)?.AnimateSwellCompletion(state, MainPiece);
|
||||
(MainPiece.Drawable as ISkinnableSwell)?.AnimateSwellCompletion(state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,15 @@
|
||||
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
public interface ISkinnableSwell
|
||||
{
|
||||
void AnimateSwellProgress(DrawableTaikoHitObject<Swell> swell, int numHits, SkinnableDrawable mainPiece);
|
||||
void AnimateSwellProgress(DrawableTaikoHitObject<Swell> swell, int numHits);
|
||||
|
||||
void AnimateSwellCompletion(ArmedState state, SkinnableDrawable mainPiece);
|
||||
void AnimateSwellCompletion(ArmedState state);
|
||||
|
||||
void AnimateSwellStart(DrawableTaikoHitObject<Swell> swell, SkinnableDrawable mainPiece);
|
||||
void AnimateSwellStart(DrawableTaikoHitObject<Swell> swell);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Taiko.Skinning.Default;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Skinning.Argon
|
||||
{
|
||||
public partial class ArgonSwell : DefaultSwell
|
||||
{
|
||||
protected override Drawable CreateCentreCircle()
|
||||
{
|
||||
return new ArgonSwellCirclePiece()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,8 +68,8 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon
|
||||
case TaikoSkinComponents.TaikoExplosionOk:
|
||||
return new ArgonHitExplosion(taikoComponent.Component);
|
||||
|
||||
case TaikoSkinComponents.SwellCirclePiece:
|
||||
return new ArgonSwellCirclePiece();
|
||||
case TaikoSkinComponents.SwellBody:
|
||||
return new ArgonSwell();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -11,7 +11,6 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
||||
@@ -26,6 +25,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
||||
private readonly Container bodyContainer;
|
||||
private readonly CircularContainer targetRing;
|
||||
private readonly CircularContainer expandingRing;
|
||||
private readonly Drawable centreCircle;
|
||||
|
||||
public DefaultSwell()
|
||||
{
|
||||
@@ -35,6 +35,8 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
||||
|
||||
Content.Add(bodyContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = 1,
|
||||
Children = new Drawable[]
|
||||
@@ -94,11 +96,21 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
centreCircle = CreateCentreCircle(),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected virtual Drawable CreateCentreCircle()
|
||||
{
|
||||
return new SwellCirclePiece()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
@@ -106,11 +118,11 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
||||
targetRing.BorderColour = colours.YellowDark.Opacity(0.25f);
|
||||
}
|
||||
|
||||
public void AnimateSwellProgress(DrawableTaikoHitObject<Swell> swell, int numHits, SkinnableDrawable mainPiece)
|
||||
public void AnimateSwellProgress(DrawableTaikoHitObject<Swell> swell, int numHits)
|
||||
{
|
||||
float completion = (float)numHits / swell.HitObject.RequiredHits;
|
||||
|
||||
mainPiece.Drawable.RotateTo((float)(completion * swell.HitObject.Duration / 8), 4000, Easing.OutQuint);
|
||||
centreCircle.RotateTo((float)(completion * swell.HitObject.Duration / 8), 4000, Easing.OutQuint);
|
||||
|
||||
expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, Easing.OutQuint);
|
||||
|
||||
@@ -120,16 +132,16 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
||||
.FadeTo(completion / 8, 2000, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public void AnimateSwellCompletion(ArmedState state, SkinnableDrawable mainPiece)
|
||||
public void AnimateSwellCompletion(ArmedState state)
|
||||
{
|
||||
const double transition_duration = 300;
|
||||
|
||||
bodyContainer.FadeOut(transition_duration, Easing.OutQuad);
|
||||
bodyContainer.ScaleTo(1.4f, transition_duration);
|
||||
mainPiece.FadeOut(transition_duration, Easing.OutQuad);
|
||||
centreCircle.FadeOut(transition_duration, Easing.OutQuad);
|
||||
}
|
||||
|
||||
public void AnimateSwellStart(DrawableTaikoHitObject<Swell> swell, SkinnableDrawable mainPiece)
|
||||
public void AnimateSwellStart(DrawableTaikoHitObject<Swell> swell)
|
||||
{
|
||||
if (swell.IsHit == false)
|
||||
expandingRing.FadeTo(0);
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
public partial class LegacySwell : Container, ISkinnableSwell
|
||||
{
|
||||
private Container bodyContainer = null!;
|
||||
private Sprite warning = null!;
|
||||
private Sprite spinnerCircle = null!;
|
||||
private Sprite shrinkingRing = null!;
|
||||
private Sprite clearAnimation = null!;
|
||||
@@ -40,14 +41,21 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Position = new Vector2(200f, 100f),
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
warning = new Sprite
|
||||
{
|
||||
Texture = skin.GetTexture("spinner-warning") ?? skinManager.DefaultClassicSkin.GetTexture("spinner-circle"),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Scale = skin.GetTexture("spinner-warning") != null ? Vector2.One : new Vector2(0.18f),
|
||||
},
|
||||
bodyContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Position = new Vector2(200f, 100f),
|
||||
Alpha = 0,
|
||||
|
||||
Children = new Drawable[]
|
||||
@@ -73,31 +81,31 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
Position = new Vector2(0f, 165f),
|
||||
Scale = Vector2.One,
|
||||
},
|
||||
clearAnimation = new Sprite
|
||||
{
|
||||
// File extension is included here because of a GetTexture limitation, see #21543
|
||||
Texture = skin.GetTexture("spinner-osu.png"),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Position = new Vector2(0f, -165f),
|
||||
Scale = new Vector2(0.3f),
|
||||
Alpha = 0,
|
||||
},
|
||||
}
|
||||
},
|
||||
clearAnimation = new Sprite
|
||||
{
|
||||
// File extension is included here because of a GetTexture limitation, see #21543
|
||||
Texture = skin.GetTexture("spinner-osu.png"),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Position = new Vector2(0f, -165f),
|
||||
Scale = new Vector2(0.3f),
|
||||
Alpha = 0,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
clearSample = skin.GetSample(new SampleInfo("spinner-osu"));
|
||||
}
|
||||
|
||||
public void AnimateSwellProgress(DrawableTaikoHitObject<Swell> swell, int numHits, SkinnableDrawable mainPiece)
|
||||
public void AnimateSwellProgress(DrawableTaikoHitObject<Swell> swell, int numHits)
|
||||
{
|
||||
remainingHitsCountdown.Text = $"{swell.HitObject.RequiredHits - numHits}";
|
||||
spinnerCircle.RotateTo(180f * numHits, 1000, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public void AnimateSwellCompletion(ArmedState state, SkinnableDrawable mainPiece)
|
||||
public void AnimateSwellCompletion(ArmedState state)
|
||||
{
|
||||
const double clear_transition_duration = 300;
|
||||
|
||||
@@ -118,7 +126,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
}
|
||||
}
|
||||
|
||||
public void AnimateSwellStart(DrawableTaikoHitObject<Swell> swell, SkinnableDrawable mainPiece)
|
||||
public void AnimateSwellStart(DrawableTaikoHitObject<Swell> swell)
|
||||
{
|
||||
if (swell.IsHit == false)
|
||||
{
|
||||
@@ -128,7 +136,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
|
||||
const double body_transition_duration = 100;
|
||||
|
||||
mainPiece.FadeOut(body_transition_duration);
|
||||
warning.FadeOut(body_transition_duration);
|
||||
bodyContainer.FadeIn(body_transition_duration);
|
||||
shrinkingRing.ResizeTo(0.1f, swell.HitObject.Duration);
|
||||
}
|
||||
|
||||
@@ -71,12 +71,6 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
|
||||
return null;
|
||||
|
||||
case TaikoSkinComponents.SwellCirclePiece:
|
||||
if (GetTexture("spinner-circle") != null)
|
||||
return new LegacySwellCirclePiece();
|
||||
|
||||
return null;
|
||||
|
||||
case TaikoSkinComponents.HitTarget:
|
||||
if (GetTexture("taikobigcircle") != null)
|
||||
return new TaikoLegacyHitTarget();
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace osu.Game.Rulesets.Taiko
|
||||
DrumRollBody,
|
||||
DrumRollTick,
|
||||
SwellBody,
|
||||
SwellCirclePiece,
|
||||
HitTarget,
|
||||
PlayfieldBackgroundLeft,
|
||||
PlayfieldBackgroundRight,
|
||||
|
||||
Reference in New Issue
Block a user