1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:07:52 +08:00

Rename methods and skin component + add comments

This commit is contained in:
Joppe27 2022-12-13 19:32:05 +01:00
parent ac770157cc
commit 1b6a11fd99
6 changed files with 19 additions and 20 deletions

View File

@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
FillMode = FillMode.Fit;
Content.Add(spinnerBody = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.Swell), _ => new DefaultSwell())
Content.Add(spinnerBody = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.SwellBody), _ => new DefaultSwell())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -113,7 +113,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
int numHits = ticks.Count(r => r.IsHit);
(spinnerBody.Drawable as ISkinnableSwell)?.OnUserInput(this, numHits, MainPiece);
(spinnerBody.Drawable as ISkinnableSwell)?.AnimateSwellProgress(this, numHits, MainPiece);
if (numHits == HitObject.RequiredHits)
ApplyResult(r => r.Type = r.Judgement.MaxResult);
@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
base.UpdateStartTimeStateTransforms();
(spinnerBody.Drawable as ISkinnableSwell)?.ApplyPassiveTransforms(this, MainPiece);
(spinnerBody.Drawable as ISkinnableSwell)?.AnimateSwellStart(this, MainPiece);
}
protected override void UpdateHitStateTransforms(ArmedState state)
@ -153,16 +153,19 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
switch (state)
{
case ArmedState.Idle:
// Only for rewind support. Reallows user inputs if swell is rewound from being hit/missed to being idle.
HandleUserInput = true;
break;
case ArmedState.Miss:
case ArmedState.Hit:
const int clear_animation_duration = 1200;
// Postpone drawable hitobject expiration until it has animated/faded out. Inputs on the object are disallowed during this delay.
LifetimeEnd = Time.Current + 1200;
LifetimeEnd = Time.Current + clear_animation_duration;
HandleUserInput = false;
(spinnerBody.Drawable as ISkinnableSwell)?.OnHitObjectEnd(state, MainPiece);
(spinnerBody.Drawable as ISkinnableSwell)?.AnimateSwellCompletion(state, MainPiece);
break;
}
}

View File

@ -9,14 +9,10 @@ namespace osu.Game.Rulesets.Taiko.Objects
{
public interface ISkinnableSwell
{
void OnUserInput(DrawableTaikoHitObject<Swell> swell, int numHits, SkinnableDrawable mainPiece);
void AnimateSwellProgress(DrawableTaikoHitObject<Swell> swell, int numHits, SkinnableDrawable mainPiece);
void OnHitObjectEnd(ArmedState state, SkinnableDrawable mainPiece);
void AnimateSwellCompletion(ArmedState state, SkinnableDrawable mainPiece);
/// <summary>
/// Applies passive transforms on HitObject start. Gets called every time DrawableTaikoHitobject
/// changes state. This happens on creation, and when the object is completed (as in hit or missed).
/// </summary>
void ApplyPassiveTransforms(DrawableTaikoHitObject<Swell> swell, SkinnableDrawable mainPiece);
void AnimateSwellStart(DrawableTaikoHitObject<Swell> swell, SkinnableDrawable mainPiece);
}
}

View File

@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
targetRing.BorderColour = colours.YellowDark.Opacity(0.25f);
}
public void OnUserInput(DrawableTaikoHitObject<Swell> swell, int numHits, SkinnableDrawable mainPiece)
public void AnimateSwellProgress(DrawableTaikoHitObject<Swell> swell, int numHits, SkinnableDrawable mainPiece)
{
float completion = (float)numHits / swell.HitObject.RequiredHits;
@ -120,7 +120,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
.FadeTo(completion / 8, 2000, Easing.OutQuint);
}
public void OnHitObjectEnd(ArmedState state, SkinnableDrawable mainPiece)
public void AnimateSwellCompletion(ArmedState state, SkinnableDrawable mainPiece)
{
const double transition_duration = 300;
@ -129,7 +129,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
mainPiece.FadeOut(transition_duration, Easing.OutQuad);
}
public void ApplyPassiveTransforms(DrawableTaikoHitObject<Swell> swell, SkinnableDrawable mainPiece)
public void AnimateSwellStart(DrawableTaikoHitObject<Swell> swell, SkinnableDrawable mainPiece)
{
if (swell.IsHit == false)
expandingRing.FadeTo(0);

View File

@ -91,13 +91,13 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
clearSample = skin.GetSample(new SampleInfo("spinner-osu"));
}
public void OnUserInput(DrawableTaikoHitObject<Swell> swell, int numHits, SkinnableDrawable mainPiece)
public void AnimateSwellProgress(DrawableTaikoHitObject<Swell> swell, int numHits, SkinnableDrawable mainPiece)
{
remainingHitsCountdown.Text = $"{swell.HitObject.RequiredHits - numHits}";
spinnerCircle.RotateTo(180f * numHits, 1000, Easing.OutQuint);
}
public void OnHitObjectEnd(ArmedState state, SkinnableDrawable mainPiece)
public void AnimateSwellCompletion(ArmedState state, SkinnableDrawable mainPiece)
{
const double clear_transition_duration = 300;
@ -118,7 +118,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
}
}
public void ApplyPassiveTransforms(DrawableTaikoHitObject<Swell> swell, SkinnableDrawable mainPiece)
public void AnimateSwellStart(DrawableTaikoHitObject<Swell> swell, SkinnableDrawable mainPiece)
{
if (swell.IsHit == false)
{

View File

@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
case TaikoSkinComponents.DrumRollTick:
return this.GetAnimation("sliderscorepoint", false, false);
case TaikoSkinComponents.Swell:
case TaikoSkinComponents.SwellBody:
if (GetTexture("spinner-circle") != null)
return new LegacySwell();

View File

@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Taiko
RimHit,
DrumRollBody,
DrumRollTick,
Swell,
SwellBody,
SwellCirclePiece,
HitTarget,
PlayfieldBackgroundLeft,