Initial design for user registration dialog

This commit is contained in:
Dean Herbert
2018-12-04 20:33:29 +09:00
parent 21305ffd71
commit 1a974f64de
11 changed files with 384 additions and 20 deletions

View File

@ -11,29 +11,43 @@ namespace osu.Game.Graphics.Containers
/// </summary>
public class ShakeContainer : Container
{
/// <summary>
/// The length of a single shake.
/// </summary>
public float ShakeDuration = 80;
/// <summary>
/// Total number of shakes. May be shortened if possible.
/// </summary>
public float TotalShakes = 4;
/// <summary>
/// Pixels of displacement per shake.
/// </summary>
public float ShakeMagnitude = 8;
/// <summary>
/// Shake the contents of this container.
/// </summary>
/// <param name="maximumLength">The maximum length the shake should last.</param>
public void Shake(double maximumLength)
public void Shake(double? maximumLength = null)
{
const float shake_amount = 8;
const float shake_duration = 30;
// if we don't have enough time, don't bother shaking.
if (maximumLength < shake_duration * 2)
if (maximumLength < ShakeDuration * 2)
return;
var sequence = this.MoveToX(shake_amount, shake_duration / 2, Easing.OutSine).Then()
.MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then();
var sequence = this.MoveToX(shake_amount, ShakeDuration / 2, Easing.OutSine).Then()
.MoveToX(-shake_amount, ShakeDuration, Easing.InOutSine).Then();
// if we don't have enough time for the second shake, skip it.
if (maximumLength > shake_duration * 4)
if (!maximumLength.HasValue || maximumLength >= ShakeDuration * 4)
sequence = sequence
.MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then()
.MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then();
.MoveToX(shake_amount, ShakeDuration, Easing.InOutSine).Then()
.MoveToX(-shake_amount, ShakeDuration, Easing.InOutSine).Then();
sequence.MoveToX(0, shake_duration / 2, Easing.InSine);
sequence.MoveToX(0, ShakeDuration / 2, Easing.InSine);
}
}
}