Basic implementation of hold notes (not finalized yet).

This commit is contained in:
smoogipooo
2017-05-04 18:02:43 +09:00
parent f945c636c2
commit 4ad3e3d64e
7 changed files with 214 additions and 37 deletions

View File

@ -4,6 +4,7 @@
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
@ -12,20 +13,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
public abstract class DrawableManiaHitObject<TObject> : DrawableHitObject<ManiaHitObject, ManiaJudgement>
where TObject : ManiaHitObject
{
public override Color4 AccentColour
{
get { return base.AccentColour; }
set
{
base.AccentColour = value;
UpdateAccent();
}
}
public new TObject HitObject;
private readonly Container glowContainer;
protected override Container<Drawable> Content => noteFlow;
private FlowContainer<Drawable> noteFlow;
private readonly FlowContainer<Drawable> noteFlow;
public DrawableManiaHitObject(TObject hitObject)
: base(hitObject)
@ -35,18 +28,53 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
AddInternal(noteFlow = new FillFlowContainer<Drawable>
InternalChildren = new Drawable[]
{
Name = "Main container",
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
});
glowContainer = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
AlwaysPresent = true,
Alpha = 0
}
}
},
noteFlow = new FillFlowContainer<Drawable>
{
Name = "Main container",
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
}
};
}
public override Color4 AccentColour
{
get { return base.AccentColour; }
set
{
if (base.AccentColour == value)
return;
base.AccentColour = value;
glowContainer.EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Glow,
Radius = 5,
Colour = value
};
}
}
protected override ManiaJudgement CreateJudgement() => new ManiaJudgement();
protected virtual void UpdateAccent() { }
}
}