2022-10-26 16:32:26 +08:00
|
|
|
// 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.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2022-10-27 12:16:15 +08:00
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2022-10-26 16:32:26 +08:00
|
|
|
using osu.Framework.Utils;
|
|
|
|
using osu.Game.Rulesets.Catch.Skinning.Default;
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Skinning.Argon
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
internal partial class ArgonDropletPiece : CatchHitObjectPiece
|
2022-10-26 16:32:26 +08:00
|
|
|
{
|
|
|
|
protected override Drawable HyperBorderPiece => hyperBorderPiece;
|
|
|
|
|
|
|
|
private Drawable hyperBorderPiece = null!;
|
|
|
|
|
|
|
|
private Container layers = null!;
|
|
|
|
|
|
|
|
private float rotationRandomness;
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2022-10-27 12:16:15 +08:00
|
|
|
private void load()
|
2022-10-26 16:32:26 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
2022-10-27 12:16:15 +08:00
|
|
|
const float droplet_scale_down = 0.7f;
|
|
|
|
|
|
|
|
int largeBlobSeed = RNG.Next();
|
2022-10-26 16:32:26 +08:00
|
|
|
|
|
|
|
InternalChildren = new[]
|
|
|
|
{
|
|
|
|
new Circle
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Size = new Vector2(20),
|
|
|
|
},
|
|
|
|
layers = new Container
|
|
|
|
{
|
|
|
|
Scale = new Vector2(droplet_scale_down),
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2022-10-27 12:16:15 +08:00
|
|
|
new CircularBlob
|
2022-10-26 16:32:26 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
2022-10-27 12:16:15 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-10-26 16:32:26 +08:00
|
|
|
Blending = BlendingParameters.Additive,
|
2022-10-27 12:16:15 +08:00
|
|
|
InnerRadius = 0.5f,
|
2022-10-26 16:32:26 +08:00
|
|
|
Alpha = 0.15f,
|
2022-10-27 12:16:15 +08:00
|
|
|
Seed = largeBlobSeed
|
2022-10-26 16:32:26 +08:00
|
|
|
},
|
2022-10-27 12:16:15 +08:00
|
|
|
new CircularBlob
|
2022-10-26 16:32:26 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
2022-10-27 12:16:15 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-10-26 16:32:26 +08:00
|
|
|
Blending = BlendingParameters.Additive,
|
2022-10-27 12:16:15 +08:00
|
|
|
InnerRadius = 0.4f,
|
2022-10-26 16:32:26 +08:00
|
|
|
Alpha = 0.5f,
|
2022-10-27 12:16:15 +08:00
|
|
|
Scale = new Vector2(0.7f),
|
|
|
|
Seed = RNG.Next()
|
2022-10-26 16:32:26 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2022-10-27 12:16:15 +08:00
|
|
|
hyperBorderPiece = new CircularBlob
|
2022-10-26 16:32:26 +08:00
|
|
|
{
|
|
|
|
Scale = new Vector2(droplet_scale_down),
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR,
|
2022-10-27 12:16:15 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-10-26 16:32:26 +08:00
|
|
|
Blending = BlendingParameters.Additive,
|
2022-10-27 12:16:15 +08:00
|
|
|
InnerRadius = 0.5f,
|
2022-10-26 16:32:26 +08:00
|
|
|
Alpha = 0.15f,
|
2022-10-27 12:16:15 +08:00
|
|
|
Seed = largeBlobSeed
|
2022-10-26 16:32:26 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
AccentColour.BindValueChanged(colour =>
|
|
|
|
{
|
|
|
|
foreach (var sprite in layers)
|
|
|
|
sprite.Colour = colour.NewValue;
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
rotationRandomness = RNG.NextSingle(0.2f, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
// Note that droplets are rotated at a higher level, so this is mostly just to create more
|
|
|
|
// random arrangements of the multiple layers than actually rotate.
|
|
|
|
//
|
|
|
|
// Because underlying rotation is always clockwise, we apply anti-clockwise resistance to avoid
|
|
|
|
// making things spin too fast.
|
|
|
|
for (int i = 0; i < layers.Count; i++)
|
|
|
|
{
|
|
|
|
layers[i].Rotation -=
|
2022-10-27 12:16:15 +08:00
|
|
|
(float)Clock.ElapsedFrameTime
|
|
|
|
* 0.4f * rotationRandomness
|
2022-10-28 09:19:53 +08:00
|
|
|
// Each layer should alternate rotation speed.
|
2022-10-26 16:32:26 +08:00
|
|
|
* (i % 2 == 1 ? 0.5f : 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|