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

◆ DrawSelf()

override void Terraria.GameContent.UI.Elements.GroupOptionButton< T >.DrawSelf ( SpriteBatch spriteBatch)
inlineprotectedvirtual

Reimplemented from Terraria.UI.UIElement.

Definition at line 123 of file GroupOptionButton.cs.

124 {
125 if (_hovered)
126 {
127 if (!_soundedHover)
128 {
130 }
131 _soundedHover = true;
132 }
133 else
134 {
135 _soundedHover = false;
136 }
137 CalculatedStyle dimensions = GetDimensions();
138 Color color = _color;
139 float num = _opacity;
140 bool isSelected = IsSelected;
142 {
143 color = (isSelected ? _overridePickedColor : _overrideUnpickedColor);
145 }
146 Utils.DrawSplicedPanel(spriteBatch, _BasePanelTexture.Value, (int)dimensions.X, (int)dimensions.Y, (int)dimensions.Width, (int)dimensions.Height, 10, 10, 10, 10, Color.Lerp(Color.Black, color, FadeFromBlack) * num);
147 if (isSelected && ShowHighlightWhenSelected)
148 {
149 Utils.DrawSplicedPanel(spriteBatch, _selectedBorderTexture.Value, (int)dimensions.X + 7, (int)dimensions.Y + 7, (int)dimensions.Width - 14, (int)dimensions.Height - 14, 10, 10, 10, 10, Color.Lerp(color, Color.White, _whiteLerp) * num);
150 }
151 if (_hovered)
152 {
153 Utils.DrawSplicedPanel(spriteBatch, _hoveredBorderTexture.Value, (int)dimensions.X, (int)dimensions.Y, (int)dimensions.Width, (int)dimensions.Height, 10, 10, 10, 10, _borderColor);
154 }
155 if (_iconTexture != null)
156 {
157 Color color2 = Color.White;
158 if (!_hovered && !isSelected)
159 {
160 color2 = Color.Lerp(color, Color.White, _whiteLerp) * num;
161 }
162 spriteBatch.Draw(_iconTexture.Value, new Vector2(dimensions.X + 1f, dimensions.Y + 1f), color2);
163 }
164 }
void Draw(Texture2D texture, Vector2 position, Color color)
static void PlaySound(int type, Vector2 position, int style=1)
CalculatedStyle GetDimensions()
Definition UIElement.cs:382
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491

References Terraria.GameContent.UI.Elements.GroupOptionButton< T >._BasePanelTexture, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._borderColor, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._color, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._hovered, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._hoveredBorderTexture, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._iconTexture, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._opacity, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._overrideOpacityPicked, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._overrideOpacityUnpicked, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._overridePickedColor, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._overrideUnpickedColor, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._selectedBorderTexture, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._soundedHover, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._UseOverrideColors, Terraria.GameContent.UI.Elements.GroupOptionButton< T >._whiteLerp, Microsoft.Xna.Framework.Color.Black, Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.Utils.DrawSplicedPanel(), Terraria.GameContent.UI.Elements.GroupOptionButton< T >.FadeFromBlack, Terraria.UI.UIElement.GetDimensions(), Terraria.UI.CalculatedStyle.Height, Terraria.GameContent.UI.Elements.GroupOptionButton< T >.IsSelected, Microsoft.Xna.Framework.Color.Lerp(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.GameContent.UI.Elements.GroupOptionButton< T >.ShowHighlightWhenSelected, ReLogic.Content.Asset< T >.Value, Microsoft.Xna.Framework.Color.White, Terraria.UI.CalculatedStyle.Width, Terraria.UI.CalculatedStyle.X, and Terraria.UI.CalculatedStyle.Y.