mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 14:12:55 +08:00
Merge pull request #9545 from smoogipoo/reset-judgement-animation
This commit is contained in:
commit
8411a36a0f
@ -52,6 +52,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.622.1" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.710.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.714.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -2,9 +2,12 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Pooling;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
@ -16,14 +19,46 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
public TestSceneDrawableJudgement()
|
||||
{
|
||||
var pools = new List<DrawablePool<DrawableOsuJudgement>>();
|
||||
|
||||
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
|
||||
{
|
||||
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
|
||||
new DrawableOsuJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
|
||||
AddStep("Show " + result.GetDescription(), () =>
|
||||
{
|
||||
int poolIndex = 0;
|
||||
|
||||
SetContents(() =>
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}));
|
||||
DrawablePool<DrawableOsuJudgement> pool;
|
||||
|
||||
if (poolIndex >= pools.Count)
|
||||
pools.Add(pool = new DrawablePool<DrawableOsuJudgement>(1));
|
||||
else
|
||||
{
|
||||
pool = pools[poolIndex];
|
||||
|
||||
// We need to make sure neither the pool nor the judgement get disposed when new content is set, and they both share the same parent.
|
||||
((Container)pool.Parent).Clear(false);
|
||||
}
|
||||
|
||||
var container = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
pool,
|
||||
pool.Get(j => j.Apply(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)).With(j =>
|
||||
{
|
||||
j.Anchor = Anchor.Centre;
|
||||
j.Origin = Anchor.Centre;
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
poolIndex++;
|
||||
return container;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
if (lighting != null)
|
||||
{
|
||||
lighting.ResetAnimation();
|
||||
|
||||
if (JudgedObject != null)
|
||||
{
|
||||
lightingColour = JudgedObject.AccentColour.GetBoundCopy();
|
||||
|
@ -31,8 +31,10 @@ namespace osu.Game.Rulesets.Judgements
|
||||
public JudgementResult Result { get; private set; }
|
||||
public DrawableHitObject JudgedObject { get; private set; }
|
||||
|
||||
protected Container JudgementBody;
|
||||
protected SpriteText JudgementText;
|
||||
protected Container JudgementBody { get; private set; }
|
||||
protected SpriteText JudgementText { get; private set; }
|
||||
|
||||
private SkinnableDrawable bodyDrawable;
|
||||
|
||||
/// <summary>
|
||||
/// Duration of initial fade in.
|
||||
@ -89,6 +91,8 @@ namespace osu.Game.Rulesets.Judgements
|
||||
|
||||
prepareDrawables();
|
||||
|
||||
bodyDrawable.ResetAnimation();
|
||||
|
||||
this.FadeInFromZero(FadeInDuration, Easing.OutQuint);
|
||||
JudgementBody.ScaleTo(1);
|
||||
JudgementBody.RotateTo(0);
|
||||
@ -131,7 +135,7 @@ namespace osu.Game.Rulesets.Judgements
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new SkinnableDrawable(new GameplaySkinComponent<HitResult>(type), _ => JudgementText = new OsuSpriteText
|
||||
Child = bodyDrawable = new SkinnableDrawable(new GameplaySkinComponent<HitResult>(type), _ => JudgementText = new OsuSpriteText
|
||||
{
|
||||
Text = type.GetDescription().ToUpperInvariant(),
|
||||
Font = OsuFont.Numeric.With(size: 20),
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Animations;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
@ -50,6 +51,11 @@ namespace osu.Game.Skinning
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Seeks to the 0-th frame if the content of this <see cref="SkinnableDrawable"/> is an <see cref="IFramedAnimation"/>.
|
||||
/// </summary>
|
||||
public void ResetAnimation() => (Drawable as IFramedAnimation)?.GotoFrame(0);
|
||||
|
||||
private readonly Func<ISkinComponent, Drawable> createDefault;
|
||||
|
||||
private readonly Cached scaling = new Cached();
|
||||
|
@ -24,7 +24,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.710.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.714.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.622.1" />
|
||||
<PackageReference Include="Sentry" Version="2.1.4" />
|
||||
<PackageReference Include="SharpCompress" Version="0.25.1" />
|
||||
|
@ -70,7 +70,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.710.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.714.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.622.1" />
|
||||
</ItemGroup>
|
||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||
@ -80,7 +80,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.710.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.714.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.25.1" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user