Files
OldThink/Content.Client/NPC/HTN/HTNOverlay.cs
rhailrake 7872502bf8 - add: new lobby and ui tweaks. (#7)
* base

* arrow pointer for buttons

* some progress for text buttons, need cleaning

* fixed observe button, remove fraction

* just for now

* ui tweaks

* more ui tweaks

* feat: ченджлог в лобби

---------

Co-authored-by: Remuchi <RemuchiOfficial@gmail.com>
2024-01-31 12:54:38 +00:00

43 lines
1.3 KiB
C#

using System.Numerics;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Enums;
namespace Content.Client.NPC.HTN;
public sealed class HTNOverlay : Overlay
{
private readonly IEntityManager _entManager = default!;
private readonly Font _font = default!;
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
public HTNOverlay(IEntityManager entManager, IResourceCache resourceCache)
{
_entManager = entManager;
_font = new VectorFont(resourceCache.GetResource<FontResource>("/Fonts/IBMPlexMono/IBMPlexMono-Regular.ttf"), 10);
}
protected override void Draw(in OverlayDrawArgs args)
{
if (args.ViewportControl == null)
return;
var handle = args.ScreenHandle;
foreach (var (comp, xform) in _entManager.EntityQuery<HTNComponent, TransformComponent>(true))
{
if (string.IsNullOrEmpty(comp.DebugText) || xform.MapID != args.MapId)
continue;
var worldPos = xform.WorldPosition;
if (!args.WorldAABB.Contains(worldPos))
continue;
var screenPos = args.ViewportControl.WorldToScreen(worldPos);
handle.DrawString(_font, screenPos + new Vector2(0, 10f), comp.DebugText, Color.White);
}
}
}