2017-03-21 14:09:54 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Modes.Taiko.Objects;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Modes.Taiko.UI
|
|
|
|
|
{
|
2017-03-21 17:16:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A component that is displayed at the hit position in the taiko playfield.
|
|
|
|
|
/// </summary>
|
2017-03-21 14:09:54 +08:00
|
|
|
|
internal class HitTarget : Container
|
|
|
|
|
{
|
2017-03-21 17:16:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The 1px inner border of the taiko playfield.
|
|
|
|
|
/// </summary>
|
2017-03-21 17:13:10 +08:00
|
|
|
|
private const float border_offset = 1;
|
2017-03-21 14:09:54 +08:00
|
|
|
|
|
2017-03-23 14:32:41 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Thickness of all drawn line pieces.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private const float border_thickness = 2.5f;
|
|
|
|
|
|
2017-03-21 14:09:54 +08:00
|
|
|
|
public HitTarget()
|
|
|
|
|
{
|
2017-04-10 04:08:05 +08:00
|
|
|
|
Size = new Vector2(TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT);
|
2017-03-21 16:48:19 +08:00
|
|
|
|
|
2017-03-21 14:09:54 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
2017-03-21 16:48:19 +08:00
|
|
|
|
Name = "Bar Upper",
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2017-03-21 17:13:10 +08:00
|
|
|
|
Y = border_offset,
|
2017-04-10 08:23:00 +08:00
|
|
|
|
Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER) / 2f - border_offset),
|
2017-03-21 16:48:19 +08:00
|
|
|
|
Alpha = 0.1f
|
2017-03-21 14:09:54 +08:00
|
|
|
|
},
|
2017-03-21 16:48:19 +08:00
|
|
|
|
new CircularContainer
|
2017-03-21 14:09:54 +08:00
|
|
|
|
{
|
2017-04-03 09:59:49 +08:00
|
|
|
|
Name = "Strong Hit Ring",
|
2017-03-21 14:09:54 +08:00
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2017-04-10 08:23:00 +08:00
|
|
|
|
Size = new Vector2(TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER),
|
2017-03-23 08:12:51 +08:00
|
|
|
|
Masking = true,
|
2017-03-21 16:48:19 +08:00
|
|
|
|
BorderColour = Color4.White,
|
2017-03-23 14:32:41 +08:00
|
|
|
|
BorderThickness = border_thickness,
|
2017-03-21 16:48:19 +08:00
|
|
|
|
Alpha = 0.1f,
|
|
|
|
|
Children = new[]
|
2017-03-21 14:09:54 +08:00
|
|
|
|
{
|
2017-03-21 16:48:19 +08:00
|
|
|
|
new Box
|
2017-03-21 14:09:54 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-03-21 16:48:19 +08:00
|
|
|
|
Alpha = 0,
|
|
|
|
|
AlwaysPresent = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new CircularContainer
|
|
|
|
|
{
|
2017-04-03 09:59:49 +08:00
|
|
|
|
Name = "Normal Hit Ring",
|
2017-03-21 16:48:19 +08:00
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2017-04-10 08:23:00 +08:00
|
|
|
|
Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER),
|
2017-03-23 08:12:51 +08:00
|
|
|
|
Masking = true,
|
2017-03-21 16:48:19 +08:00
|
|
|
|
BorderColour = Color4.White,
|
2017-03-23 14:32:41 +08:00
|
|
|
|
BorderThickness = border_thickness,
|
2017-03-21 16:48:19 +08:00
|
|
|
|
Alpha = 0.5f,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
2017-03-21 14:09:54 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-03-21 16:48:19 +08:00
|
|
|
|
Alpha = 0,
|
|
|
|
|
AlwaysPresent = true
|
2017-03-21 14:09:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-21 16:48:19 +08:00
|
|
|
|
},
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
Name = "Bar Lower",
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
2017-03-21 17:13:10 +08:00
|
|
|
|
Y = -border_offset,
|
2017-04-10 08:23:00 +08:00
|
|
|
|
Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER) / 2f - border_offset),
|
2017-03-21 16:48:19 +08:00
|
|
|
|
Alpha = 0.1f
|
|
|
|
|
},
|
2017-03-21 14:09:54 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|