Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
GuiButton.cs
Go to the documentation of this file.
1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
3 
4 namespace Loot.UI.Common.Controls.Button
5 {
6  internal class GuiButton : GuiFramedElement
7  {
8  protected const int WIDTH = 50;
9  protected const int HEIGHT = 50;
10 
11  internal enum ButtonType
12  {
13  StoneInnerBevel,
14  StoneOuterBevel,
15  Parchment,
16  None
17  }
18 
19  private static Texture2D _texture => Assets.Textures.GUI.ButtonTexture;
20  protected ButtonType _buttonType;
21 
22  internal GuiButton(ButtonType buttonType) : base(new Vector2(WIDTH, HEIGHT), new Vector2(10, 10))
23  {
24  _buttonType = buttonType;
25  }
26 
27  private Rectangle GetDrawRectangle()
28  {
29  switch (_buttonType)
30  {
31  case ButtonType.StoneInnerBevel:
32  return new Rectangle(0, 0, WIDTH, HEIGHT);
33  case ButtonType.StoneOuterBevel:
34  return new Rectangle(WIDTH, 0, WIDTH, HEIGHT);
35  case ButtonType.Parchment:
36  default:
37  return new Rectangle(2 * WIDTH, 0, WIDTH, HEIGHT);
38  }
39  }
40 
41  protected override void DrawSelf(SpriteBatch spriteBatch)
42  {
43  //base.DrawSelf(spriteBatch);
44  if (_buttonType != ButtonType.None)
45  {
46  spriteBatch.Draw(
47  _texture,
48  GetOuterDimensions().Position(),
49  GetDrawRectangle(),
50  Color.White
51  );
52  }
53 
54  //#if DEBUG
55  // spriteBatch.Draw(
56  // Main.magicPixel,
57  // GetOuterDimensions().ToRectangle(),
58  // Color.Blue * 0.4f
59  // );
60  //#endif
61  }
62  }
63 }