Skip to content

Commit 7490bca

Browse files
authored
Merge pull request #31746 from mcendu/taiko-legacy-spinner
Add legacy taiko swell (spinner)
2 parents ee6dcbd + d87a775 commit 7490bca

File tree

8 files changed

+426
-111
lines changed

8 files changed

+426
-111
lines changed

osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableSwell.cs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public void TestHits()
2020
{
2121
Anchor = Anchor.Centre,
2222
Origin = Anchor.Centre,
23+
Scale = new osuTK.Vector2(0.5f),
2324
}));
2425
}
2526

osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs

+10-109
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@
66
using System;
77
using System.Linq;
88
using JetBrains.Annotations;
9-
using osu.Framework.Allocation;
10-
using osu.Framework.Extensions.Color4Extensions;
119
using osu.Framework.Graphics;
1210
using osu.Framework.Graphics.Containers;
13-
using osu.Game.Graphics;
1411
using osu.Game.Rulesets.Objects.Drawables;
15-
using osuTK.Graphics;
16-
using osu.Framework.Graphics.Shapes;
1712
using osu.Framework.Input.Events;
1813
using osu.Game.Rulesets.Objects;
1914
using osu.Game.Rulesets.Taiko.Skinning.Default;
@@ -25,11 +20,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
2520
{
2621
public partial class DrawableSwell : DrawableTaikoHitObject<Swell>
2722
{
28-
private const float target_ring_thick_border = 1.4f;
29-
private const float target_ring_thin_border = 1f;
30-
private const float target_ring_scale = 5f;
31-
private const float inner_ring_alpha = 0.65f;
32-
3323
/// <summary>
3424
/// Offset away from the start time of the swell at which the ring starts appearing.
3525
/// </summary>
@@ -38,9 +28,6 @@ public partial class DrawableSwell : DrawableTaikoHitObject<Swell>
3828
private Vector2 baseSize;
3929

4030
private readonly Container<DrawableSwellTick> ticks;
41-
private readonly Container bodyContainer;
42-
private readonly CircularContainer targetRing;
43-
private readonly CircularContainer expandingRing;
4431

4532
private double? lastPressHandleTime;
4633

@@ -51,6 +38,8 @@ public partial class DrawableSwell : DrawableTaikoHitObject<Swell>
5138
/// </summary>
5239
public bool MustAlternate { get; internal set; } = true;
5340

41+
public event Action<int> UpdateHitProgress;
42+
5443
public DrawableSwell()
5544
: this(null)
5645
{
@@ -61,87 +50,15 @@ public DrawableSwell([CanBeNull] Swell swell)
6150
{
6251
FillMode = FillMode.Fit;
6352

64-
Content.Add(bodyContainer = new Container
65-
{
66-
RelativeSizeAxes = Axes.Both,
67-
Depth = 1,
68-
Children = new Drawable[]
69-
{
70-
expandingRing = new CircularContainer
71-
{
72-
Name = "Expanding ring",
73-
Anchor = Anchor.Centre,
74-
Origin = Anchor.Centre,
75-
Alpha = 0,
76-
RelativeSizeAxes = Axes.Both,
77-
Blending = BlendingParameters.Additive,
78-
Masking = true,
79-
Children = new[]
80-
{
81-
new Box
82-
{
83-
RelativeSizeAxes = Axes.Both,
84-
Alpha = inner_ring_alpha,
85-
}
86-
}
87-
},
88-
targetRing = new CircularContainer
89-
{
90-
Name = "Target ring (thick border)",
91-
Anchor = Anchor.Centre,
92-
Origin = Anchor.Centre,
93-
RelativeSizeAxes = Axes.Both,
94-
Masking = true,
95-
BorderThickness = target_ring_thick_border,
96-
Blending = BlendingParameters.Additive,
97-
Children = new Drawable[]
98-
{
99-
new Box
100-
{
101-
RelativeSizeAxes = Axes.Both,
102-
Alpha = 0,
103-
AlwaysPresent = true
104-
},
105-
new CircularContainer
106-
{
107-
Name = "Target ring (thin border)",
108-
Anchor = Anchor.Centre,
109-
Origin = Anchor.Centre,
110-
RelativeSizeAxes = Axes.Both,
111-
Masking = true,
112-
BorderThickness = target_ring_thin_border,
113-
BorderColour = Color4.White,
114-
Children = new[]
115-
{
116-
new Box
117-
{
118-
RelativeSizeAxes = Axes.Both,
119-
Alpha = 0,
120-
AlwaysPresent = true
121-
}
122-
}
123-
}
124-
}
125-
}
126-
}
127-
});
128-
12953
AddInternal(ticks = new Container<DrawableSwellTick> { RelativeSizeAxes = Axes.Both });
13054
}
13155

132-
[BackgroundDependencyLoader]
133-
private void load(OsuColour colours)
134-
{
135-
expandingRing.Colour = colours.YellowLight;
136-
targetRing.BorderColour = colours.YellowDark.Opacity(0.25f);
137-
}
138-
13956
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.Swell),
140-
_ => new SwellCirclePiece
57+
_ => new DefaultSwell
14158
{
142-
// to allow for rotation transform
14359
Anchor = Anchor.Centre,
14460
Origin = Anchor.Centre,
61+
RelativeSizeAxes = Axes.Both,
14562
});
14663

14764
protected override void RecreatePieces()
@@ -208,16 +125,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
208125

209126
int numHits = ticks.Count(r => r.IsHit);
210127

211-
float completion = (float)numHits / HitObject.RequiredHits;
212-
213-
expandingRing
214-
.FadeTo(expandingRing.Alpha + Math.Clamp(completion / 16, 0.1f, 0.6f), 50)
215-
.Then()
216-
.FadeTo(completion / 8, 2000, Easing.OutQuint);
217-
218-
MainPiece.Drawable.RotateTo((float)(completion * HitObject.Duration / 8), 4000, Easing.OutQuint);
219-
220-
expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, Easing.OutQuint);
128+
UpdateHitProgress?.Invoke(numHits);
221129

222130
if (numHits == HitObject.RequiredHits)
223131
ApplyMaxResult();
@@ -248,28 +156,21 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
248156
}
249157
}
250158

251-
protected override void UpdateStartTimeStateTransforms()
252-
{
253-
base.UpdateStartTimeStateTransforms();
254-
255-
using (BeginDelayedSequence(-ring_appear_offset))
256-
targetRing.ScaleTo(target_ring_scale, 400, Easing.OutQuint);
257-
}
258-
259159
protected override void UpdateHitStateTransforms(ArmedState state)
260160
{
261-
const double transition_duration = 300;
161+
base.UpdateHitStateTransforms(state);
262162

263163
switch (state)
264164
{
265165
case ArmedState.Idle:
266-
expandingRing.FadeTo(0);
267166
break;
268167

269168
case ArmedState.Miss:
169+
this.Delay(300).FadeOut();
170+
break;
171+
270172
case ArmedState.Hit:
271-
this.FadeOut(transition_duration, Easing.Out);
272-
bodyContainer.ScaleTo(1.4f, transition_duration);
173+
this.Delay(660).FadeOut();
273174
break;
274175
}
275176
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2+
// See the LICENCE file in the repository root for full licence text.
3+
4+
using osu.Framework.Graphics;
5+
using osu.Game.Rulesets.Taiko.Skinning.Default;
6+
7+
namespace osu.Game.Rulesets.Taiko.Skinning.Argon
8+
{
9+
public partial class ArgonSwell : DefaultSwell
10+
{
11+
protected override Drawable CreateCentreCircle()
12+
{
13+
return new ArgonSwellCirclePiece
14+
{
15+
Anchor = Anchor.Centre,
16+
Origin = Anchor.Centre,
17+
};
18+
}
19+
}
20+
}

osu.Game.Rulesets.Taiko/Skinning/Argon/TaikoArgonSkinTransformer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public TaikoArgonSkinTransformer(ISkin skin)
6969
return new ArgonHitExplosion(taikoComponent.Component);
7070

7171
case TaikoSkinComponents.Swell:
72-
return new ArgonSwellCirclePiece();
72+
return new ArgonSwell();
7373
}
7474

7575
break;

0 commit comments

Comments
 (0)