mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 05:02:55 +08:00
Merge pull request #8213 from peppy/correct-trail-animation-frame
Fix osu!catch trail animating (and displaying incorrect frame)
This commit is contained in:
commit
26c034e364
@ -52,6 +52,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.312.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.314.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -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);
|
||||||
@ -398,27 +398,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
Scheduler.AddDelayed(beginTrail, HyperDashing ? 25 : 50);
|
Scheduler.AddDelayed(beginTrail, HyperDashing ? 25 : 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable createAdditiveSprite(bool hyperDash)
|
|
||||||
{
|
|
||||||
var additive = createCatcherSprite();
|
|
||||||
|
|
||||||
additive.Anchor = Anchor;
|
|
||||||
additive.Scale = Scale;
|
|
||||||
additive.Colour = hyperDash ? Color4.Red : Color4.White;
|
|
||||||
additive.Blending = BlendingParameters.Additive;
|
|
||||||
additive.RelativePositionAxes = RelativePositionAxes;
|
|
||||||
additive.Position = Position;
|
|
||||||
|
|
||||||
AdditiveTarget.Add(additive);
|
|
||||||
|
|
||||||
return additive;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Drawable createCatcherSprite()
|
|
||||||
{
|
|
||||||
return new CatcherSprite(CurrentState);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateState(CatcherAnimationState state)
|
private void updateState(CatcherAnimationState state)
|
||||||
{
|
{
|
||||||
if (CurrentState == state)
|
if (CurrentState == state)
|
||||||
@ -428,6 +407,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)
|
||||||
|
22
osu.Game.Rulesets.Catch/UI/CatcherTrailSprite.cs
Normal file
22
osu.Game.Rulesets.Catch/UI/CatcherTrailSprite.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// 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.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
|
{
|
||||||
|
public class CatcherTrailSprite : Sprite
|
||||||
|
{
|
||||||
|
public CatcherTrailSprite(Texture texture)
|
||||||
|
{
|
||||||
|
Texture = texture;
|
||||||
|
|
||||||
|
Size = new Vector2(CatcherArea.CATCHER_SIZE);
|
||||||
|
|
||||||
|
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
|
||||||
|
OriginPosition = new Vector2(0.5f, 0.06f) * CatcherArea.CATCHER_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -23,7 +23,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.312.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.314.0" />
|
||||||
<PackageReference Include="Sentry" Version="2.1.0" />
|
<PackageReference Include="Sentry" Version="2.1.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.312.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.314.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||||
<ItemGroup Label="Transitive Dependencies">
|
<ItemGroup Label="Transitive Dependencies">
|
||||||
@ -79,7 +79,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.312.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.314.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user