using SoulHarvest.Common; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.UI; namespace SoulHarvest.UI; internal sealed class AltarEquipmentTreeViewportOverlay : UIElement { private readonly AltarEquipmentTreeViewport viewport; public AltarEquipmentTreeViewportOverlay(AltarEquipmentTreeViewport viewport) { this.viewport = viewport; } protected override void DrawSelf(SpriteBatch spriteBatch) { Rectangle bounds = GetDimensions().ToRectangle(); Texture2D pixel = TextureAssets.MagicPixel.Value; float scale = viewport.LayoutScale; ReaperTreeDraw.DrawBorder(spriteBatch, pixel, bounds, new Color(71, 59, 59), Math.Max(1, (int)(2f * scale))); ReaperTreeDraw.DrawInsetBorder(spriteBatch, pixel, bounds, Math.Max(2, (int)(5f * scale)), new Color(126, 39, 47) * 0.52f, 1); string hint = Language.GetTextValue("Mods.SoulHarvest.UI.ReaperTree.PanHint"); float hintScale = 0.46f * scale; string fitted = AltarDrawHelpers.FitText(hint, Math.Max(12f, bounds.Width - 26f * scale), hintScale); Vector2 size = FontAssets.MouseText.Value.MeasureString(fitted) * hintScale; Rectangle backdrop = viewport.GetHintStripBounds(); spriteBatch.Draw(pixel, backdrop, new Color(7, 7, 9) * 0.82f); Utils.DrawBorderString(spriteBatch, fitted, new Vector2(bounds.Center.X - size.X * 0.5f, backdrop.Y + 3f * scale), new Color(154, 139, 134), hintScale); } }