1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 13:42:59 +08:00

Reshuffle hit explosions to be on their own layer.

Style misses better.
This commit is contained in:
Dean Herbert 2016-12-06 21:14:38 +09:00
parent 4042a9e71e
commit ae72f91975
8 changed files with 72 additions and 24 deletions

View File

@ -22,7 +22,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
private ExplodePiece explode; private ExplodePiece explode;
private NumberPiece number; private NumberPiece number;
private GlowPiece glow; private GlowPiece glow;
private HitExplosion explosion;
public DrawableHitCircle(OsuHitObject h) : base(h) public DrawableHitCircle(OsuHitObject h) : base(h)
{ {
@ -130,9 +129,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
case ArmedState.Idle: case ArmedState.Idle:
Delay(osuObject.Duration + TIME_PREEMPT); Delay(osuObject.Duration + TIME_PREEMPT);
FadeOut(TIME_FADEOUT); FadeOut(TIME_FADEOUT);
explosion?.Expire();
explosion = null;
break; break;
case ArmedState.Miss: case ArmedState.Miss:
ring.FadeOut(); ring.FadeOut();
@ -140,11 +136,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
number.FadeOut(); number.FadeOut();
glow.FadeOut(); glow.FadeOut();
explosion?.Expire();
explosion = null;
Schedule(() => Add(explosion = new HitExplosion((OsuJudgementInfo)Judgement)));
FadeOut(800); FadeOut(800);
break; break;
case ArmedState.Hit: case ArmedState.Hit:
@ -156,8 +147,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
explode.FadeIn(flash_in); explode.FadeIn(flash_in);
Schedule(() => Add(explosion = new HitExplosion((OsuJudgementInfo)Judgement)));
Delay(flash_in, true); Delay(flash_in, true);
//after the flash, we can hide some elements that were behind it //after the flash, we can hide some elements that were behind it

View File

@ -83,7 +83,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
base.UpdateState(state); base.UpdateState(state);
Delay(HitObject.Duration); Delay(HitObject.Duration);
FadeOut(300); FadeOut(100);
} }
} }

View File

@ -5,22 +5,25 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
using OpenTK; using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.Objects.Drawables namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
public class HitExplosion : FlowContainer public class HitExplosion : FlowContainer
{ {
private readonly OsuJudgementInfo judgement;
private SpriteText line1; private SpriteText line1;
private SpriteText line2; private SpriteText line2;
public HitExplosion(OsuJudgementInfo judgement) public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null)
{ {
this.judgement = judgement;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Direction = FlowDirection.VerticalOnly; Direction = FlowDirection.VerticalOnly;
Spacing = new Vector2(0, 2); Spacing = new Vector2(0, 2);
Position = (h?.EndPosition ?? Vector2.Zero) + judgement.PositionOffset;
Children = new Drawable[] Children = new Drawable[]
{ {
@ -30,13 +33,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Text = judgement.Score.GetDescription(), Text = judgement.Score.GetDescription(),
Font = @"Venera", Font = @"Venera",
TextSize = 20, TextSize = 16,
}, },
line2 = new SpriteText line2 = new SpriteText
{ {
Text = judgement.Combo.GetDescription(), Text = judgement.Combo.GetDescription(),
Font = @"Venera", Font = @"Venera",
TextSize = 14, TextSize = 11,
} }
}; };
} }
@ -44,8 +47,35 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
line1.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint);
line2.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint); if (judgement.Result == HitResult.Miss)
{
FadeInFromZero(60);
ScaleTo(1.6f);
ScaleTo(1, 100, EasingTypes.In);
MoveToRelative(new Vector2(0, 100), 800, EasingTypes.InQuint);
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();
} }
} }
} }

View File

@ -12,6 +12,8 @@ namespace osu.Game.Modes.Osu.Objects
{ {
public Vector2 Position { get; set; } public Vector2 Position { get; set; }
public virtual Vector2 EndPosition => Position;
[Flags] [Flags]
internal enum HitObjectType internal enum HitObjectType
{ {

View File

@ -4,6 +4,7 @@
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using System; using System;
using OpenTK;
namespace osu.Game.Modes.Osu.Objects namespace osu.Game.Modes.Osu.Objects
{ {
@ -11,6 +12,8 @@ namespace osu.Game.Modes.Osu.Objects
{ {
public override double EndTime => StartTime + RepeatCount * Curve.Length / Velocity; public override double EndTime => StartTime + RepeatCount * Curve.Length / Velocity;
public override Vector2 EndPosition => RepeatCount % 2 == 0 ? Position : Curve.PositionAt(1);
public double Velocity; public double Velocity;
public override void SetDefaultsFromBeatmap(Beatmap beatmap) public override void SetDefaultsFromBeatmap(Beatmap beatmap)

View File

@ -6,7 +6,6 @@ using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Osu.Objects.Drawables; using osu.Game.Modes.Osu.Objects.Drawables;
using osu.Game.Modes.UI; using osu.Game.Modes.UI;
using OsuConverter = osu.Game.Modes.Osu.Objects.OsuHitObjectConverter;
namespace osu.Game.Modes.Osu.UI namespace osu.Game.Modes.Osu.UI
{ {

View File

@ -3,19 +3,18 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Osu.Objects.Drawables; using osu.Game.Modes.Osu.Objects.Drawables;
using osu.Game.Modes.UI; using osu.Game.Modes.UI;
using OpenTK; using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.UI namespace osu.Game.Modes.Osu.UI
{ {
public class OsuPlayfield : Playfield public class OsuPlayfield : Playfield
{ {
private Container approachCircles; private Container approachCircles;
private Container judgementLayer;
public override Vector2 Size public override Vector2 Size
{ {
@ -35,11 +34,17 @@ namespace osu.Game.Modes.Osu.UI
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Size = new Vector2(0.75f); Size = new Vector2(0.75f);
AddInternal(new Drawable[] Add(new Drawable[]
{ {
judgementLayer = new Container
{
RelativeSizeAxes = Axes.Both,
Depth = 1,
},
approachCircles = new Container approachCircles = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Depth = -1,
} }
}); });
} }
@ -52,7 +57,16 @@ namespace osu.Game.Modes.Osu.UI
approachCircles.Add(c.ApproachCircle.CreateProxy()); approachCircles.Add(c.ApproachCircle.CreateProxy());
} }
h.OnJudgement += judgement;
base.Add(h); base.Add(h);
} }
private void judgement(DrawableHitObject h, JudgementInfo j)
{
HitExplosion explosion = new HitExplosion((OsuJudgementInfo)j, (OsuHitObject)h.HitObject);
judgementLayer.Add(explosion);
}
} }
} }

View File

@ -11,23 +11,34 @@ namespace osu.Game.Modes.UI
public abstract class Playfield : Container public abstract class Playfield : Container
{ {
public HitObjectContainer HitObjects; public HitObjectContainer HitObjects;
private Container<Drawable> content;
public virtual void Add(DrawableHitObject h) => HitObjects.Add(h); public virtual void Add(DrawableHitObject h) => HitObjects.Add(h);
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
protected override Container<Drawable> Content => content;
public Playfield() public Playfield()
{ {
AddInternal(HitObjects = new HitObjectContainer AddInternal(content = new ScaledContainer()
{
RelativeSizeAxes = Axes.Both,
});
Add(HitObjects = new HitObjectContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}); });
} }
public class HitObjectContainer : Container<DrawableHitObject> public class ScaledContainer : Container
{ {
protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512); protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512);
}
public class HitObjectContainer : Container<DrawableHitObject>
{
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
} }
} }