2017-02-07 12:59:30 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-12-06 17:56:20 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Extensions;
|
2016-11-17 16:20:51 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Transformations;
|
2016-11-26 15:51:51 +08:00
|
|
|
|
using osu.Game.Modes.Objects.Drawables;
|
2016-11-17 16:20:51 +08:00
|
|
|
|
using OpenTK;
|
2016-12-06 20:14:38 +08:00
|
|
|
|
using OpenTK.Graphics;
|
2016-11-17 16:20:51 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Modes.Osu.Objects.Drawables
|
|
|
|
|
{
|
|
|
|
|
public class HitExplosion : FlowContainer
|
|
|
|
|
{
|
2016-12-06 20:14:38 +08:00
|
|
|
|
private readonly OsuJudgementInfo judgement;
|
2016-11-17 16:20:51 +08:00
|
|
|
|
private SpriteText line1;
|
|
|
|
|
private SpriteText line2;
|
|
|
|
|
|
2016-12-06 20:14:38 +08:00
|
|
|
|
public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null)
|
2016-11-17 16:20:51 +08:00
|
|
|
|
{
|
2016-12-06 20:14:38 +08:00
|
|
|
|
this.judgement = judgement;
|
2016-11-17 16:20:51 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
|
2017-02-13 15:02:14 +08:00
|
|
|
|
Direction = FlowDirections.Vertical;
|
2016-11-17 16:20:51 +08:00
|
|
|
|
Spacing = new Vector2(0, 2);
|
2017-02-09 15:29:21 +08:00
|
|
|
|
Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset;
|
2016-11-17 16:20:51 +08:00
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
line1 = new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2016-11-26 15:51:51 +08:00
|
|
|
|
Text = judgement.Score.GetDescription(),
|
2016-11-17 16:20:51 +08:00
|
|
|
|
Font = @"Venera",
|
2016-12-06 20:14:38 +08:00
|
|
|
|
TextSize = 16,
|
2016-11-17 16:20:51 +08:00
|
|
|
|
},
|
|
|
|
|
line2 = new SpriteText
|
|
|
|
|
{
|
2016-11-26 15:51:51 +08:00
|
|
|
|
Text = judgement.Combo.GetDescription(),
|
2016-11-17 16:20:51 +08:00
|
|
|
|
Font = @"Venera",
|
2016-12-06 20:14:38 +08:00
|
|
|
|
TextSize = 11,
|
2016-11-17 16:20:51 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
2016-12-06 20:14:38 +08:00
|
|
|
|
|
|
|
|
|
if (judgement.Result == HitResult.Miss)
|
|
|
|
|
{
|
|
|
|
|
FadeInFromZero(60);
|
|
|
|
|
|
|
|
|
|
ScaleTo(1.6f);
|
|
|
|
|
ScaleTo(1, 100, EasingTypes.In);
|
|
|
|
|
|
2016-12-10 21:37:00 +08:00
|
|
|
|
MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint);
|
2016-12-06 20:14:38 +08:00
|
|
|
|
RotateTo(40, 800, EasingTypes.InQuint);
|
|
|
|
|
|
|
|
|
|
Delay(600);
|
|
|
|
|
FadeOut(200);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
line1.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint);
|
|
|
|
|
line2.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint);
|
|
|
|
|
FadeOut(500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (judgement.Result)
|
|
|
|
|
{
|
|
|
|
|
case HitResult.Miss:
|
|
|
|
|
Colour = Color4.Red;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Expire();
|
2016-11-17 16:20:51 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|