2017-04-05 01:01:40 +00: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 System;
|
2017-05-16 03:50:30 +00:00
|
|
|
using osu.Framework.Graphics;
|
2017-04-05 01:01:40 +00:00
|
|
|
|
2017-04-18 07:05:58 +00:00
|
|
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
|
2017-04-05 01:01:40 +00:00
|
|
|
{
|
|
|
|
public class ElongatedCirclePiece : CirclePiece
|
|
|
|
{
|
|
|
|
/// <summary>
|
2017-04-21 04:45:11 +00:00
|
|
|
/// As we are being used to define the absolute size of hits, we need to be given a relative reference of our containing playfield container.
|
2017-04-05 01:01:40 +00:00
|
|
|
/// </summary>
|
|
|
|
public Func<float> PlayfieldLengthReference;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The length of this piece as a multiple of the value returned by <see cref="PlayfieldLengthReference"/>
|
|
|
|
/// </summary>
|
|
|
|
public float Length;
|
|
|
|
|
2017-08-03 10:49:50 +00:00
|
|
|
public ElongatedCirclePiece()
|
2017-04-05 01:01:40 +00:00
|
|
|
{
|
2017-08-03 04:23:12 +00:00
|
|
|
RelativeSizeAxes = Axes.Y;
|
2017-04-05 01:01:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
2017-04-05 07:27:59 +00:00
|
|
|
var padding = Content.DrawHeight * Content.Width / 2;
|
|
|
|
|
2017-04-05 01:01:40 +00:00
|
|
|
Content.Padding = new MarginPadding
|
|
|
|
{
|
2017-04-05 07:27:59 +00:00
|
|
|
Left = padding,
|
|
|
|
Right = padding,
|
2017-04-05 01:01:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Width = (PlayfieldLengthReference?.Invoke() ?? 0) * Length + DrawHeight;
|
|
|
|
}
|
|
|
|
}
|
2017-04-21 04:45:11 +00:00
|
|
|
}
|