2019-01-24 08:43:03 +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.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
using System;
|
2018-11-20 07:51:59 +00:00
|
|
|
using osuTK;
|
2018-04-13 09:19:50 +00:00
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-04-02 05:51:28 +00:00
|
|
|
using osu.Framework.Graphics.Effects;
|
2018-04-13 09:19:50 +00:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Visualises a <see cref="HoldNoteTick"/> hit object.
|
|
|
|
/// </summary>
|
|
|
|
public class DrawableHoldNoteTick : DrawableManiaHitObject<HoldNoteTick>
|
|
|
|
{
|
2020-09-29 07:00:45 +00:00
|
|
|
public override bool DisplayResult => false;
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
/// <summary>
|
|
|
|
/// References the time at which the user started holding the hold note.
|
|
|
|
/// </summary>
|
|
|
|
public Func<double?> HoldStartTime;
|
|
|
|
|
|
|
|
public DrawableHoldNoteTick(HoldNoteTick hitObject)
|
|
|
|
: base(hitObject)
|
|
|
|
{
|
2019-07-22 05:45:25 +00:00
|
|
|
Container glowContainer;
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
Anchor = Anchor.TopCentre;
|
|
|
|
Origin = Anchor.TopCentre;
|
|
|
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
Size = new Vector2(1);
|
|
|
|
|
2019-03-25 04:47:28 +00:00
|
|
|
AddRangeInternal(new[]
|
2018-04-13 09:19:50 +00:00
|
|
|
{
|
|
|
|
glowContainer = new CircularContainer
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Masking = true,
|
|
|
|
Children = new[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Alpha = 0,
|
|
|
|
AlwaysPresent = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-25 04:47:28 +00:00
|
|
|
});
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2019-07-22 05:45:25 +00:00
|
|
|
AccentColour.BindValueChanged(colour =>
|
2018-04-13 09:19:50 +00:00
|
|
|
{
|
|
|
|
glowContainer.EdgeEffect = new EdgeEffectParameters
|
|
|
|
{
|
|
|
|
Type = EdgeEffectType.Glow,
|
|
|
|
Radius = 2f,
|
|
|
|
Roundness = 15f,
|
2019-07-22 05:45:25 +00:00
|
|
|
Colour = colour.NewValue.Opacity(0.3f)
|
2018-04-13 09:19:50 +00:00
|
|
|
};
|
2019-07-22 05:45:25 +00:00
|
|
|
}, true);
|
2018-04-13 09:19:50 +00:00
|
|
|
}
|
|
|
|
|
2018-08-06 02:31:46 +00:00
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
2018-04-13 09:19:50 +00:00
|
|
|
{
|
|
|
|
if (Time.Current < HitObject.StartTime)
|
|
|
|
return;
|
|
|
|
|
2018-08-02 07:44:01 +00:00
|
|
|
var startTime = HoldStartTime?.Invoke();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2018-08-02 07:44:01 +00:00
|
|
|
if (startTime == null || startTime > HitObject.StartTime)
|
2020-09-29 05:29:43 +00:00
|
|
|
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
2018-08-02 07:44:01 +00:00
|
|
|
else
|
2020-09-29 05:29:43 +00:00
|
|
|
ApplyResult(r => r.Type = r.Judgement.MaxResult);
|
2018-04-13 09:19:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|