Files
tbd-station-14/Content.Client/UserInterface/Controls/ProgressTextureRect.cs
metalgearsloth 2e1b486e8b Add BUI ctor tests (#31463)
5 lines of eaten iocmanager.injectdependencies led to this.
2024-08-26 17:39:48 +10:00

29 lines
902 B
C#

using System.Numerics;
using Content.Client.UserInterface.Systems;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.UserInterface.Controls
{
public sealed class ProgressTextureRect : TextureRect
{
public float Progress;
private readonly ProgressColorSystem _progressColor;
public ProgressTextureRect()
{
_progressColor = IoCManager.Resolve<IEntityManager>().System<ProgressColorSystem>();
}
protected override void Draw(DrawingHandleScreen handle)
{
var dims = Texture != null ? GetDrawDimensions(Texture) : UIBox2.FromDimensions(Vector2.Zero, PixelSize);
dims.Top = Math.Max(dims.Bottom - dims.Bottom * Progress,0);
handle.DrawRect(dims, _progressColor.GetProgressColor(Progress));
base.Draw(handle);
}
}
}