osu/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs

58 lines
1.9 KiB
C#
Raw Normal View History

// 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.
2018-04-13 09:19:50 +00:00
using System.Collections.Generic;
2018-04-13 09:19:50 +00:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
2020-02-19 04:27:15 +00:00
using osu.Framework.Graphics.Containers;
2018-04-13 09:19:50 +00:00
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
2020-02-19 04:27:15 +00:00
using osu.Game.Skinning;
2018-11-20 07:51:59 +00:00
using osuTK;
2020-02-19 04:27:15 +00:00
using osuTK.Graphics;
2018-04-13 09:19:50 +00:00
namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
public class DrawableDroplet : PalpableCatchHitObject<Droplet>
{
public override bool StaysOnPlate => false;
protected Container ScaleContainer;
2018-04-13 09:19:50 +00:00
public DrawableDroplet(Droplet h)
: base(h)
{
}
[BackgroundDependencyLoader]
private void load()
{
2020-02-19 04:27:15 +00:00
AddRangeInternal(new Framework.Graphics.Drawable[]
{
2020-02-19 05:31:14 +00:00
ScaleContainer = new Container
2020-02-19 04:27:15 +00:00
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Children = new Framework.Graphics.Drawable[]
{
new SkinnableDrawable(
new CatchSkinComponent(CatchSkinComponents.Droplet), _ => new Pulp
{
2020-02-19 06:55:22 +00:00
Size = Size / 4,
2020-02-19 04:27:15 +00:00
AccentColour = { Value = Color4.White }
})
}
}
});
2020-02-19 04:27:15 +00:00
2020-02-19 05:31:14 +00:00
ScaleContainer.Scale = new Vector2(HitObject.Scale);
2018-04-13 09:19:50 +00:00
}
protected override void UpdateComboColour(Color4 proposedColour, IReadOnlyList<Color4> comboColours)
{
// ignore the incoming combo colour as we use a custom lookup
AccentColour.Value = comboColours[(HitObject.IndexInBeatmap + 1) % comboColours.Count];
}
2018-04-13 09:19:50 +00:00
}
}