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-12-05 08:13:22 +00:00
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using osu.Framework.Graphics;
|
2019-02-12 04:04:46 +00:00
|
|
|
using osu.Game.Graphics;
|
2018-12-05 08:13:22 +00:00
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.AccountCreation
|
|
|
|
{
|
|
|
|
public class ErrorTextFlowContainer : OsuTextFlowContainer
|
|
|
|
{
|
|
|
|
private readonly List<Drawable> errorDrawables = new List<Drawable>();
|
|
|
|
|
|
|
|
public ErrorTextFlowContainer()
|
2019-02-12 04:04:46 +00:00
|
|
|
: base(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12))
|
2018-12-05 08:13:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ClearErrors()
|
|
|
|
{
|
|
|
|
errorDrawables.ForEach(d => d.Expire());
|
|
|
|
}
|
|
|
|
|
|
|
|
public void AddErrors(string[] errors)
|
|
|
|
{
|
|
|
|
ClearErrors();
|
|
|
|
|
|
|
|
if (errors == null) return;
|
|
|
|
|
|
|
|
foreach (var error in errors)
|
|
|
|
errorDrawables.AddRange(AddParagraph(error, cp => cp.Colour = Color4.Red));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|