mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Adjust game-side text flow containers to part-based model
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -10,7 +10,7 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
public class ErrorTextFlowContainer : OsuTextFlowContainer
|
||||
{
|
||||
private readonly List<Drawable> errorDrawables = new List<Drawable>();
|
||||
private readonly List<ITextPart> errorTextParts = new List<ITextPart>();
|
||||
|
||||
public ErrorTextFlowContainer()
|
||||
: base(cp => cp.Font = cp.Font.With(size: 12))
|
||||
@ -19,7 +19,8 @@ namespace osu.Game.Graphics
|
||||
|
||||
public void ClearErrors()
|
||||
{
|
||||
errorDrawables.ForEach(d => d.Expire());
|
||||
foreach (var textPart in errorTextParts)
|
||||
RemovePart(textPart);
|
||||
}
|
||||
|
||||
public void AddErrors(string[] errors)
|
||||
@ -29,7 +30,7 @@ namespace osu.Game.Graphics
|
||||
if (errors == null) return;
|
||||
|
||||
foreach (string error in errors)
|
||||
errorDrawables.AddRange(AddParagraph(error, cp => cp.Colour = Color4.Red));
|
||||
errorTextParts.Add(AddParagraph(error, cp => cp.Colour = Color4.Red));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user