Merge remote-tracking branch 'upstream/master' into taiko-don

This commit is contained in:
Craftplacer
2020-04-27 12:43:51 +02:00
35 changed files with 367 additions and 116 deletions

View File

@ -49,10 +49,7 @@ namespace osu.Game.Rulesets.Taiko.UI
switch (h)
{
case Hit hit:
if (hit.Type == HitType.Centre)
return new DrawableCentreHit(hit);
else
return new DrawableRimHit(hit);
return new DrawableHit(hit);
case DrumRoll drumRoll:
return new DrawableDrumRoll(drumRoll);

View File

@ -0,0 +1,35 @@
// 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.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
namespace osu.Game.Rulesets.Taiko.UI
{
internal class DrumRollHitContainer : ScrollingHitObjectContainer
{
protected override void Update()
{
base.Update();
// Remove any auxiliary hit notes that were spawned during a drum roll but subsequently rewound.
for (var i = AliveInternalChildren.Count - 1; i >= 0; i--)
{
var flyingHit = (DrawableFlyingHit)AliveInternalChildren[i];
if (Time.Current <= flyingHit.HitObject.StartTime)
Remove(flyingHit);
}
}
protected override void OnChildLifetimeBoundaryCrossed(LifetimeBoundaryCrossedEvent e)
{
base.OnChildLifetimeBoundaryCrossed(e);
// ensure all old hits are removed on becoming alive (may miss being in the AliveInternalChildren list above).
if (e.Kind == LifetimeBoundaryKind.Start && e.Direction == LifetimeBoundaryCrossingDirection.Backward)
Remove((DrawableHitObject)e.Child);
}
}
}

View File

@ -21,16 +21,14 @@ namespace osu.Game.Rulesets.Taiko.UI
public override bool RemoveWhenNotAlive => true;
public readonly DrawableHitObject JudgedObject;
private readonly HitType type;
private readonly Box innerFill;
private readonly bool isRim;
public HitExplosion(DrawableHitObject judgedObject, bool isRim)
public HitExplosion(DrawableHitObject judgedObject, HitType type)
{
this.isRim = isRim;
JudgedObject = judgedObject;
this.type = type;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
@ -58,7 +56,7 @@ namespace osu.Game.Rulesets.Taiko.UI
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
innerFill.Colour = isRim ? colours.BlueDarker : colours.PinkDarker;
innerFill.Colour = type == HitType.Rim ? colours.BlueDarker : colours.PinkDarker;
}
protected override void LoadComplete()

View File

@ -18,14 +18,12 @@ namespace osu.Game.Rulesets.Taiko.UI
public override bool RemoveWhenNotAlive => true;
public readonly DrawableHitObject JudgedObject;
private readonly HitType type;
private readonly bool isRim;
public KiaiHitExplosion(DrawableHitObject judgedObject, bool isRim)
public KiaiHitExplosion(DrawableHitObject judgedObject, HitType type)
{
this.isRim = isRim;
JudgedObject = judgedObject;
this.type = type;
Anchor = Anchor.CentreLeft;
Origin = Anchor.Centre;
@ -53,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.UI
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Colour = isRim ? colours.BlueDarker : colours.PinkDarker,
Colour = type == HitType.Rim ? colours.BlueDarker : colours.PinkDarker,
Radius = 60,
};
}

View File

@ -32,6 +32,7 @@ namespace osu.Game.Rulesets.Taiko.UI
private Container<HitExplosion> hitExplosionContainer;
private Container<KiaiHitExplosion> kiaiExplosionContainer;
private JudgementContainer<DrawableTaikoJudgement> judgementContainer;
private ScrollingHitObjectContainer drumRollHitContainer;
internal Drawable HitTarget;
private ProxyContainer topLevelHitContainer;
@ -53,7 +54,7 @@ namespace osu.Game.Rulesets.Taiko.UI
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
InternalChildren = new Drawable[]
InternalChildren = new[]
{
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()),
rightArea = new Container
@ -94,7 +95,11 @@ namespace osu.Game.Rulesets.Taiko.UI
{
Name = "Hit objects",
RelativeSizeAxes = Axes.Both,
Child = HitObjectContainer
Children = new Drawable[]
{
HitObjectContainer,
drumRollHitContainer = new DrumRollHitContainer()
}
},
kiaiExplosionContainer = new Container<KiaiHitExplosion>
{
@ -134,6 +139,7 @@ namespace osu.Game.Rulesets.Taiko.UI
Name = "Top level hit objects",
RelativeSizeAxes = Axes.Both,
},
drumRollHitContainer.CreateProxy(),
mascotDrawable = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.TaikoDon), _ => new Container(), confineMode: ConfineMode.ScaleToFit)
{
Origin = Anchor.BottomLeft,
@ -156,7 +162,6 @@ namespace osu.Game.Rulesets.Taiko.UI
public override void Add(DrawableHitObject h)
{
h.OnNewResult += OnNewResult;
base.Add(h);
switch (h)
@ -175,7 +180,6 @@ namespace osu.Game.Rulesets.Taiko.UI
{
if (!DisplayJudgements.Value)
return;
if (!judgedObject.DisplayResult)
return;
@ -186,6 +190,16 @@ namespace osu.Game.Rulesets.Taiko.UI
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).MainObject)?.VisualiseSecondHit();
break;
case TaikoDrumRollTickJudgement _:
if (!result.IsHit)
break;
var drawableTick = (DrawableDrumRollTick)judgedObject;
addDrumRollHit(drawableTick);
addExplosion(drawableTick, drawableTick.JudgementType);
break;
default:
judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject)
{
@ -198,13 +212,7 @@ namespace osu.Game.Rulesets.Taiko.UI
if (!result.IsHit)
break;
bool isRim = (judgedObject.HitObject as Hit)?.Type == HitType.Rim;
hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim));
if (judgedObject.HitObject.Kiai)
kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim));
addExplosion(judgedObject, (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre);
break;
}
@ -219,6 +227,16 @@ namespace osu.Game.Rulesets.Taiko.UI
}
}
private void addDrumRollHit(DrawableDrumRollTick drawableTick) =>
drumRollHitContainer.Add(new DrawableFlyingHit(drawableTick));
private void addExplosion(DrawableHitObject drawableObject, HitType type)
{
hitExplosionContainer.Add(new HitExplosion(drawableObject, type));
if (drawableObject.HitObject.Kiai)
kiaiExplosionContainer.Add(new KiaiHitExplosion(drawableObject, type));
}
private class ProxyContainer : LifetimeManagementContainer
{
public new MarginPadding Padding