mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Implement transitions into and from clear state
This commit is contained in:
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
private readonly Bindable<TaikoMascotAnimationState> state;
|
||||
private readonly Dictionary<TaikoMascotAnimationState, TaikoMascotAnimation> animations;
|
||||
private Drawable currentAnimation;
|
||||
private TaikoMascotAnimation currentAnimation;
|
||||
|
||||
private bool lastHitMissed;
|
||||
private bool kiaiMode;
|
||||
@ -44,8 +44,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
animations[TaikoMascotAnimationState.Kiai] = new TaikoMascotAnimation(TaikoMascotAnimationState.Kiai),
|
||||
animations[TaikoMascotAnimationState.Fail] = new TaikoMascotAnimation(TaikoMascotAnimationState.Fail),
|
||||
};
|
||||
|
||||
updateState();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -53,28 +51,32 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
base.LoadComplete();
|
||||
|
||||
animations.Values.ForEach(animation => animation.Hide());
|
||||
State.BindValueChanged(mascotStateChanged, true);
|
||||
state.BindValueChanged(mascotStateChanged, true);
|
||||
}
|
||||
|
||||
public void OnNewResult(JudgementResult result)
|
||||
{
|
||||
lastHitMissed = result.Type == HitResult.Miss && result.Judgement.AffectsCombo;
|
||||
updateState();
|
||||
}
|
||||
|
||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||
{
|
||||
kiaiMode = effectPoint.KiaiMode;
|
||||
updateState();
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
state.Value = getNextState();
|
||||
}
|
||||
|
||||
private TaikoMascotAnimationState getNextState()
|
||||
{
|
||||
// don't change state if current animation is playing
|
||||
// (used for clear state - others are manually animated on new beats)
|
||||
if (currentAnimation != null && !currentAnimation.Completed)
|
||||
return state.Value;
|
||||
|
||||
if (lastHitMissed)
|
||||
return TaikoMascotAnimationState.Fail;
|
||||
|
||||
|
@ -29,6 +29,15 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Origin = Anchor = Anchor.BottomLeft;
|
||||
AlwaysPresent = true;
|
||||
}
|
||||
|
||||
public bool Completed => !textureAnimation.IsPlaying || textureAnimation.PlaybackPosition >= textureAnimation.Duration;
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
textureAnimation.Seek(0);
|
||||
}
|
||||
|
||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||
@ -93,6 +102,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
public ClearMascotTextureAnimation()
|
||||
{
|
||||
DefaultFrameLength = clear_animation_speed;
|
||||
Loop = false;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
Reference in New Issue
Block a user