mirror of https://github.com/ppy/osu
Reshuffle hit explosions to be on their own layer.
Style misses better.
This commit is contained in:
parent
4042a9e71e
commit
ae72f91975
|
@ -22,7 +22,6 @@ public class DrawableHitCircle : DrawableOsuHitObject
|
|||
private ExplodePiece explode;
|
||||
private NumberPiece number;
|
||||
private GlowPiece glow;
|
||||
private HitExplosion explosion;
|
||||
|
||||
public DrawableHitCircle(OsuHitObject h) : base(h)
|
||||
{
|
||||
|
@ -130,9 +129,6 @@ protected override void UpdateState(ArmedState state)
|
|||
case ArmedState.Idle:
|
||||
Delay(osuObject.Duration + TIME_PREEMPT);
|
||||
FadeOut(TIME_FADEOUT);
|
||||
|
||||
explosion?.Expire();
|
||||
explosion = null;
|
||||
break;
|
||||
case ArmedState.Miss:
|
||||
ring.FadeOut();
|
||||
|
@ -140,11 +136,6 @@ protected override void UpdateState(ArmedState state)
|
|||
number.FadeOut();
|
||||
glow.FadeOut();
|
||||
|
||||
explosion?.Expire();
|
||||
explosion = null;
|
||||
|
||||
Schedule(() => Add(explosion = new HitExplosion((OsuJudgementInfo)Judgement)));
|
||||
|
||||
FadeOut(800);
|
||||
break;
|
||||
case ArmedState.Hit:
|
||||
|
@ -156,8 +147,6 @@ protected override void UpdateState(ArmedState state)
|
|||
|
||||
explode.FadeIn(flash_in);
|
||||
|
||||
Schedule(() => Add(explosion = new HitExplosion((OsuJudgementInfo)Judgement)));
|
||||
|
||||
Delay(flash_in, true);
|
||||
|
||||
//after the flash, we can hide some elements that were behind it
|
||||
|
|
|
@ -83,7 +83,7 @@ protected override void UpdateState(ArmedState state)
|
|||
base.UpdateState(state);
|
||||
|
||||
Delay(HitObject.Duration);
|
||||
FadeOut(300);
|
||||
FadeOut(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,22 +5,25 @@
|
|||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
public class HitExplosion : FlowContainer
|
||||
{
|
||||
private readonly OsuJudgementInfo judgement;
|
||||
private SpriteText line1;
|
||||
private SpriteText line2;
|
||||
|
||||
public HitExplosion(OsuJudgementInfo judgement)
|
||||
public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null)
|
||||
{
|
||||
this.judgement = judgement;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Direction = FlowDirection.VerticalOnly;
|
||||
Spacing = new Vector2(0, 2);
|
||||
Position = (h?.EndPosition ?? Vector2.Zero) + judgement.PositionOffset;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -30,13 +33,13 @@ public HitExplosion(OsuJudgementInfo judgement)
|
|||
Origin = Anchor.TopCentre,
|
||||
Text = judgement.Score.GetDescription(),
|
||||
Font = @"Venera",
|
||||
TextSize = 20,
|
||||
TextSize = 16,
|
||||
},
|
||||
line2 = new SpriteText
|
||||
{
|
||||
Text = judgement.Combo.GetDescription(),
|
||||
Font = @"Venera",
|
||||
TextSize = 14,
|
||||
TextSize = 11,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -44,8 +47,35 @@ public HitExplosion(OsuJudgementInfo judgement)
|
|||
protected override void 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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,6 +12,8 @@ public abstract class OsuHitObject : HitObject
|
|||
{
|
||||
public Vector2 Position { get; set; }
|
||||
|
||||
public virtual Vector2 EndPosition => Position;
|
||||
|
||||
[Flags]
|
||||
internal enum HitObjectType
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
using osu.Game.Database;
|
||||
using osu.Game.Beatmaps;
|
||||
using System;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects
|
||||
{
|
||||
|
@ -11,6 +12,8 @@ public class Slider : OsuHitObject
|
|||
{
|
||||
public override double EndTime => StartTime + RepeatCount * Curve.Length / Velocity;
|
||||
|
||||
public override Vector2 EndPosition => RepeatCount % 2 == 0 ? Position : Curve.PositionAt(1);
|
||||
|
||||
public double Velocity;
|
||||
|
||||
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
using osu.Game.Modes.Osu.Objects;
|
||||
using osu.Game.Modes.Osu.Objects.Drawables;
|
||||
using osu.Game.Modes.UI;
|
||||
using OsuConverter = osu.Game.Modes.Osu.Objects.OsuHitObjectConverter;
|
||||
|
||||
namespace osu.Game.Modes.Osu.UI
|
||||
{
|
||||
|
|
|
@ -3,19 +3,18 @@
|
|||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Osu.Objects;
|
||||
using osu.Game.Modes.Osu.Objects.Drawables;
|
||||
using osu.Game.Modes.UI;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Osu.UI
|
||||
{
|
||||
public class OsuPlayfield : Playfield
|
||||
{
|
||||
private Container approachCircles;
|
||||
private Container judgementLayer;
|
||||
|
||||
public override Vector2 Size
|
||||
{
|
||||
|
@ -35,11 +34,17 @@ public OsuPlayfield()
|
|||
RelativeSizeAxes = Axes.Both;
|
||||
Size = new Vector2(0.75f);
|
||||
|
||||
AddInternal(new Drawable[]
|
||||
Add(new Drawable[]
|
||||
{
|
||||
judgementLayer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = 1,
|
||||
},
|
||||
approachCircles = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = -1,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -52,7 +57,16 @@ public override void Add(DrawableHitObject h)
|
|||
approachCircles.Add(c.ApproachCircle.CreateProxy());
|
||||
}
|
||||
|
||||
h.OnJudgement += judgement;
|
||||
|
||||
base.Add(h);
|
||||
}
|
||||
|
||||
private void judgement(DrawableHitObject h, JudgementInfo j)
|
||||
{
|
||||
HitExplosion explosion = new HitExplosion((OsuJudgementInfo)j, (OsuHitObject)h.HitObject);
|
||||
|
||||
judgementLayer.Add(explosion);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,23 +11,34 @@ namespace osu.Game.Modes.UI
|
|||
public abstract class Playfield : Container
|
||||
{
|
||||
public HitObjectContainer HitObjects;
|
||||
private Container<Drawable> content;
|
||||
|
||||
public virtual void Add(DrawableHitObject h) => HitObjects.Add(h);
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
public Playfield()
|
||||
{
|
||||
AddInternal(HitObjects = new HitObjectContainer
|
||||
AddInternal(content = new ScaledContainer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
|
||||
Add(HitObjects = new HitObjectContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
}
|
||||
|
||||
public class HitObjectContainer : Container<DrawableHitObject>
|
||||
public class ScaledContainer : Container
|
||||
{
|
||||
protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512);
|
||||
}
|
||||
|
||||
public class HitObjectContainer : Container<DrawableHitObject>
|
||||
{
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue