2023-07-08 14:08:32 +10:00
|
|
|
|
using System.Numerics;
|
2024-03-09 06:43:19 -05:00
|
|
|
|
using Content.Client.UserInterface.Systems;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Client.Graphics;
|
2020-11-22 08:38:07 +01:00
|
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
|
|
2022-09-11 20:42:12 -07:00
|
|
|
|
namespace Content.Client.UserInterface.Controls
|
2020-11-22 08:38:07 +01:00
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class ProgressTextureRect : TextureRect
|
2020-11-22 08:38:07 +01:00
|
|
|
|
{
|
|
|
|
|
|
public float Progress;
|
|
|
|
|
|
|
2024-03-09 06:43:19 -05:00
|
|
|
|
private readonly ProgressColorSystem _progressColor = IoCManager.Resolve<IEntityManager>().System<ProgressColorSystem>();
|
|
|
|
|
|
|
2020-11-22 08:38:07 +01:00
|
|
|
|
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);
|
2024-03-09 06:43:19 -05:00
|
|
|
|
handle.DrawRect(dims, _progressColor.GetProgressColor(Progress));
|
2020-11-22 08:38:07 +01:00
|
|
|
|
|
|
|
|
|
|
base.Draw(handle);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|