Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DrawValueBarDynamicWidth()

bool Terraria.GameContent.UI.Elements.UIVerticalSlider.DrawValueBarDynamicWidth ( SpriteBatch spriteBatch,
out float sliderValueThatWasSet )
inlineprivate

Definition at line 83 of file UIVerticalSlider.cs.

84 {
85 sliderValueThatWasSet = 0f;
86 Texture2D value = TextureAssets.ColorBar.Value;
87 Rectangle rectangle = GetDimensions().ToRectangle();
88 Rectangle rectangle2 = new Rectangle(5, 4, 4, 4);
89 Utils.DrawSplicedPanel(spriteBatch, value, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, rectangle2.X, rectangle2.Width, rectangle2.Y, rectangle2.Height, Color.White);
90 Rectangle rectangle3 = rectangle;
91 rectangle3.X += rectangle2.Left;
92 rectangle3.Width -= rectangle2.Right;
93 rectangle3.Y += rectangle2.Top;
94 rectangle3.Height -= rectangle2.Bottom;
95 Texture2D value2 = TextureAssets.MagicPixel.Value;
96 Rectangle value3 = new Rectangle(0, 0, 1, 1);
97 spriteBatch.Draw(value2, rectangle3, value3, EmptyColor);
98 Rectangle destinationRectangle = rectangle3;
99 destinationRectangle.Height = (int)((float)destinationRectangle.Height * FillPercent);
100 destinationRectangle.Y += rectangle3.Height - destinationRectangle.Height;
101 spriteBatch.Draw(value2, destinationRectangle, value3, FilledColor);
102 Vector2 center = new Vector2(destinationRectangle.Center.X + 1, destinationRectangle.Top);
103 Vector2 size = new Vector2(destinationRectangle.Width + 16, 4f);
104 Rectangle rectangle4 = Utils.CenteredRectangle(center, size);
105 Rectangle destinationRectangle2 = rectangle4;
106 destinationRectangle2.Inflate(2, 2);
107 spriteBatch.Draw(value2, destinationRectangle2, value3, Color.Black);
108 spriteBatch.Draw(value2, rectangle4, value3, Color.White);
109 Rectangle rectangle5 = rectangle3;
110 rectangle5.Inflate(4, 0);
111 bool flag = (_isReallyMouseOvered = rectangle5.Contains(Main.MouseScreen.ToPoint()));
113 {
114 flag = false;
115 }
116 int usageLevel = GetUsageLevel();
117 if (usageLevel == 2)
118 {
119 flag = false;
120 }
121 if (usageLevel == 1)
122 {
123 flag = true;
124 }
125 if (flag || usageLevel == 1)
126 {
127 if (!_alreadyHovered)
128 {
130 }
131 _alreadyHovered = true;
132 }
133 else
134 {
135 _alreadyHovered = false;
136 }
137 if (flag)
138 {
139 sliderValueThatWasSet = Utils.GetLerpValue(rectangle3.Bottom, rectangle3.Top, Main.mouseY, clamped: true);
140 return true;
141 }
142 return false;
143 }
void Draw(Texture2D texture, Vector2 position, Color color)
static void PlaySound(int type, Vector2 position, int style=1)
CalculatedStyle GetDimensions()
Definition UIElement.cs:382
void Inflate(int horizontalAmount, int verticalAmount)
Definition Rectangle.cs:84
bool Contains(int x, int y)
Definition Rectangle.cs:92

References Terraria.GameContent.UI.Elements.UIVerticalSlider._alreadyHovered, Terraria.GameContent.UI.Elements.UIVerticalSlider._isReallyMouseOvered, Microsoft.Xna.Framework.Color.Black, Microsoft.Xna.Framework.Rectangle.Bottom, Microsoft.Xna.Framework.Rectangle.Center, Terraria.Utils.CenteredRectangle(), Terraria.GameContent.TextureAssets.ColorBar, Microsoft.Xna.Framework.Rectangle.Contains(), Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.Utils.DrawSplicedPanel(), Terraria.GameContent.UI.Elements.UIVerticalSlider.EmptyColor, Terraria.GameContent.UI.Elements.UIVerticalSlider.FilledColor, Terraria.GameContent.UI.Elements.UIVerticalSlider.FillPercent, Terraria.UI.UIElement.GetDimensions(), Terraria.Utils.GetLerpValue(), Terraria.GameContent.UI.Elements.UISliderBase.GetUsageLevel(), Microsoft.Xna.Framework.Rectangle.Height, Terraria.UI.UIElement.IgnoresMouseInteraction, Microsoft.Xna.Framework.Rectangle.Inflate(), Microsoft.Xna.Framework.Rectangle.Left, Terraria.GameContent.TextureAssets.MagicPixel, Terraria.Main.MouseScreen, Terraria.Main.mouseY, Terraria.Audio.SoundEngine.PlaySound(), Microsoft.Xna.Framework.Rectangle.Right, Microsoft.Xna.Framework.Rectangle.Top, Terraria.UI.CalculatedStyle.ToRectangle(), System.value, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Color.White, Microsoft.Xna.Framework.Rectangle.Width, Microsoft.Xna.Framework.Point.X, Microsoft.Xna.Framework.Rectangle.X, and Microsoft.Xna.Framework.Rectangle.Y.

Referenced by Terraria.GameContent.UI.Elements.UIVerticalSlider.DrawSelf().