2022-11-29 23:44:20 +00: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.
|
|
|
|
|
|
2022-12-02 08:32:57 +00:00
|
|
|
|
using System;
|
2022-11-29 23:44:20 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2022-11-30 18:50:47 +00:00
|
|
|
|
using osu.Framework.Audio.Track;
|
2022-11-29 23:44:20 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2022-11-30 18:50:47 +00:00
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
2022-11-29 23:44:20 +00:00
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
using osu.Game.Skinning;
|
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|
|
|
|
{
|
2022-11-30 18:50:47 +00:00
|
|
|
|
internal partial class LegacyKiaiGlow : BeatSyncedContainer
|
2022-11-29 23:44:20 +00:00
|
|
|
|
{
|
2022-12-02 07:54:58 +00:00
|
|
|
|
private bool isKiaiActive;
|
|
|
|
|
|
2022-12-02 08:32:57 +00:00
|
|
|
|
private Sprite sprite = null!;
|
|
|
|
|
|
2022-12-02 07:54:58 +00:00
|
|
|
|
[BackgroundDependencyLoader(true)]
|
|
|
|
|
private void load(ISkinSource skin, HealthProcessor? healthProcessor)
|
2022-11-29 23:44:20 +00:00
|
|
|
|
{
|
2022-12-02 08:32:57 +00:00
|
|
|
|
Child = sprite = new Sprite
|
2022-11-29 23:44:20 +00:00
|
|
|
|
{
|
|
|
|
|
Texture = skin.GetTexture("taiko-glow"),
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Anchor = Anchor.Centre,
|
2022-12-02 08:32:57 +00:00
|
|
|
|
Alpha = 0,
|
2022-11-30 18:50:47 +00:00
|
|
|
|
Scale = new Vector2(0.7f),
|
|
|
|
|
Colour = new Colour4(255, 228, 0, 255),
|
2022-11-29 23:44:20 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (healthProcessor != null)
|
|
|
|
|
healthProcessor.NewJudgement += onNewJudgement;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-02 08:32:57 +00:00
|
|
|
|
protected override void Update()
|
2022-11-29 23:44:20 +00:00
|
|
|
|
{
|
2022-12-02 08:32:57 +00:00
|
|
|
|
base.Update();
|
2022-11-29 23:44:20 +00:00
|
|
|
|
|
2022-12-02 08:32:57 +00:00
|
|
|
|
if (isKiaiActive)
|
|
|
|
|
sprite.Alpha = (float)Math.Min(1, sprite.Alpha + Math.Abs(Clock.ElapsedFrameTime) / 100f);
|
|
|
|
|
else
|
|
|
|
|
sprite.Alpha = (float)Math.Max(0, sprite.Alpha - Math.Abs(Clock.ElapsedFrameTime) / 600f);
|
2022-11-30 18:50:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
|
|
|
|
{
|
2022-12-02 07:54:58 +00:00
|
|
|
|
isKiaiActive = effectPoint.KiaiMode;
|
2022-12-02 08:32:57 +00:00
|
|
|
|
}
|
2022-12-02 07:54:58 +00:00
|
|
|
|
|
2022-12-02 08:32:57 +00:00
|
|
|
|
private void onNewJudgement(JudgementResult result)
|
|
|
|
|
{
|
|
|
|
|
if (!result.IsHit || !isKiaiActive)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
sprite.ScaleTo(0.85f).Then()
|
|
|
|
|
.ScaleTo(0.7f, 80, Easing.OutQuad);
|
2022-11-29 23:44:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|