1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 23:27:25 +08:00

Move across to new file in line with master

This commit is contained in:
Dean Herbert 2020-03-14 17:06:23 +09:00
parent 9ea0e83f3d
commit d3f23b766e

View File

@ -7,6 +7,7 @@ using osu.Framework.Allocation;
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.Sprites;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -55,14 +56,14 @@ namespace osu.Game.Rulesets.Catch.UI
} }
/// <summary> /// <summary>
/// Activate or deactive the trail. Will be automatically deactivated when conditions to keep the trail displayed are no longer met. /// Activate or deactivate the trail. Will be automatically deactivated when conditions to keep the trail displayed are no longer met.
/// </summary> /// </summary>
protected bool Trail protected bool Trail
{ {
get => trail; get => trail;
set set
{ {
if (value == trail) return; if (value == trail || AdditiveTarget == null) return;
trail = value; trail = value;
@ -77,6 +78,8 @@ namespace osu.Game.Rulesets.Catch.UI
private CatcherSprite catcherKiai; private CatcherSprite catcherKiai;
private CatcherSprite catcherFail; private CatcherSprite catcherFail;
private CatcherSprite currentCatcher;
private int currentDirection; private int currentDirection;
private bool dashing; private bool dashing;
@ -236,10 +239,10 @@ namespace osu.Game.Rulesets.Catch.UI
this.FadeTo(0.2f, hyper_dash_transition_length, Easing.OutQuint); this.FadeTo(0.2f, hyper_dash_transition_length, Easing.OutQuint);
Trail = true; Trail = true;
var hyperDashEndGlow = createAdditiveSprite(true); var hyperDashEndGlow = createAdditiveSprite();
hyperDashEndGlow.MoveToOffset(new Vector2(0, -20), 1200, Easing.In); hyperDashEndGlow.MoveToOffset(new Vector2(0, -10), 1200, Easing.In);
hyperDashEndGlow.ScaleTo(hyperDashEndGlow.Scale * 0.9f).ScaleTo(hyperDashEndGlow.Scale * 1.2f, 1200, Easing.In); hyperDashEndGlow.ScaleTo(hyperDashEndGlow.Scale * 0.95f).ScaleTo(hyperDashEndGlow.Scale * 1.2f, 1200, Easing.In);
hyperDashEndGlow.FadeOut(1200); hyperDashEndGlow.FadeOut(1200);
hyperDashEndGlow.Expire(true); hyperDashEndGlow.Expire(true);
} }
@ -358,39 +361,36 @@ namespace osu.Game.Rulesets.Catch.UI
private void updateCatcher() private void updateCatcher()
{ {
catcherIdle.Hide(); currentCatcher?.Hide();
catcherKiai.Hide();
catcherFail.Hide();
CatcherSprite current;
switch (CurrentState) switch (CurrentState)
{ {
default: default:
current = catcherIdle; currentCatcher = catcherIdle;
break; break;
case CatcherAnimationState.Fail: case CatcherAnimationState.Fail:
current = catcherFail; currentCatcher = catcherFail;
break; break;
case CatcherAnimationState.Kiai: case CatcherAnimationState.Kiai:
current = catcherKiai; currentCatcher = catcherKiai;
break; break;
} }
current.Show(); currentCatcher.Show();
(current.Drawable as IAnimation)?.GotoFrame(0); (currentCatcher.Drawable as IAnimation)?.GotoFrame(0);
} }
private void beginTrail() private void beginTrail()
{ {
Trail &= dashing || HyperDashing; if (!dashing && !HyperDashing)
Trail &= AdditiveTarget != null; {
Trail = false;
return;
}
if (!Trail) return; var additive = createAdditiveSprite();
var additive = createAdditiveSprite(HyperDashing);
additive.FadeTo(0.4f).FadeOut(800, Easing.OutQuint); additive.FadeTo(0.4f).FadeOut(800, Easing.OutQuint);
additive.Expire(true); additive.Expire(true);
@ -428,6 +428,25 @@ namespace osu.Game.Rulesets.Catch.UI
updateCatcher(); updateCatcher();
} }
private CatcherTrailSprite createAdditiveSprite()
{
var tex = (currentCatcher.Drawable as TextureAnimation)?.CurrentFrame ?? ((Sprite)currentCatcher.Drawable).Texture;
var sprite = new CatcherTrailSprite(tex)
{
Anchor = Anchor,
Scale = Scale,
Colour = HyperDashing ? Color4.Red : Color4.White,
Blending = BlendingParameters.Additive,
RelativePositionAxes = RelativePositionAxes,
Position = Position
};
AdditiveTarget?.Add(sprite);
return sprite;
}
private void removeFromPlateWithTransform(DrawableHitObject fruit, Action<DrawableHitObject> action) private void removeFromPlateWithTransform(DrawableHitObject fruit, Action<DrawableHitObject> action)
{ {
if (ExplodingFruitTarget != null) if (ExplodingFruitTarget != null)