3 using Microsoft.Xna.Framework;
4 using Microsoft.Xna.Framework.Graphics;
10 internal class GuiCloseButton : UIElement
12 public override void OnInitialize()
14 Width.Set(Assets.Textures.GUI.CloseButtonTexture.Width, 0);
15 Height.Set(Assets.Textures.GUI.CloseButtonTexture.Height, 0);
16 Top.Set(20 + Assets.Textures.GUI.CloseButtonChainsTexture.Height, 0);
20 protected override void DrawSelf(SpriteBatch spriteBatch)
22 var parentBounds = GetOuterDimensions().ToRectangle();
23 Rectangle BoundsWithOffset(Vector2 bounds, Point off)
25 return new Rectangle(parentBounds.X + off.X, parentBounds.Y + off.Y, (
int)bounds.X, (
int)bounds.Y);
28 var _btn = Assets.Textures.GUI.CloseButtonTexture;
35 var _chains = Assets.Textures.GUI.CloseButtonChainsTexture;
36 Point offset =
new Point(
41 Rectangle rectangle = _chains.BoundsFromParent(BoundsWithOffset(_chains.Size(), offset));
48 if (parentBounds.Contains(Main.MouseScreen.ToPoint()))
50 Main.hoverItemName =
"Close";
51 if (Main.mouseLeft && Main.mouseLeftRelease)
53 Loot.Instance.GuiState.ToggleUI(
Loot.Instance.GuiInterface);