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

◆ DrawValueBar()

static float Terraria.IngameOptions.DrawValueBar ( SpriteBatch sb,
float scale,
float perc,
int lockState = 0,
Utils::ColorLerpMethod colorMethod = null )
inlinestatic

Definition at line 2000 of file IngameOptions.cs.

2001 {
2002 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
2003 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
2004 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
2005 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
2006 //IL_0065: Unknown result type (might be due to invalid IL or missing references)
2007 //IL_006f: Unknown result type (might be due to invalid IL or missing references)
2008 //IL_0076: Unknown result type (might be due to invalid IL or missing references)
2009 //IL_0082: Unknown result type (might be due to invalid IL or missing references)
2010 //IL_0083: Unknown result type (might be due to invalid IL or missing references)
2011 //IL_0086: Unknown result type (might be due to invalid IL or missing references)
2012 //IL_0087: Unknown result type (might be due to invalid IL or missing references)
2013 //IL_0098: Unknown result type (might be due to invalid IL or missing references)
2014 //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
2015 //IL_00df: Unknown result type (might be due to invalid IL or missing references)
2016 //IL_00f2: Unknown result type (might be due to invalid IL or missing references)
2017 //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
2018 //IL_013a: Unknown result type (might be due to invalid IL or missing references)
2019 //IL_0160: Unknown result type (might be due to invalid IL or missing references)
2020 //IL_0161: Unknown result type (might be due to invalid IL or missing references)
2021 //IL_018c: Unknown result type (might be due to invalid IL or missing references)
2022 //IL_019b: Unknown result type (might be due to invalid IL or missing references)
2023 //IL_01c7: Unknown result type (might be due to invalid IL or missing references)
2024 //IL_01dd: Unknown result type (might be due to invalid IL or missing references)
2025 //IL_021c: Unknown result type (might be due to invalid IL or missing references)
2026 //IL_01ea: Unknown result type (might be due to invalid IL or missing references)
2027 //IL_01f0: Unknown result type (might be due to invalid IL or missing references)
2028 //IL_0205: Unknown result type (might be due to invalid IL or missing references)
2029 //IL_020d: Unknown result type (might be due to invalid IL or missing references)
2030 if (colorMethod == null)
2031 {
2032 colorMethod = Utils.ColorLerp_BlackToWhite;
2033 }
2034 Texture2D value = TextureAssets.ColorBar.Value;
2035 Vector2 vector = new Vector2((float)value.Width, (float)value.Height) * scale;
2036 valuePosition.X -= (int)vector.X;
2037 Rectangle rectangle = default(Rectangle);
2038 ((Rectangle)(ref rectangle))._002Ector((int)valuePosition.X, (int)valuePosition.Y - (int)vector.Y / 2, (int)vector.X, (int)vector.Y);
2039 Rectangle destinationRectangle = rectangle;
2040 sb.Draw(value, rectangle, Color.White);
2041 int num = 167;
2042 float num2 = (float)rectangle.X + 5f * scale;
2043 float num3 = (float)rectangle.Y + 4f * scale;
2044 for (float num4 = 0f; num4 < (float)num; num4 += 1f)
2045 {
2046 float percent = num4 / (float)num;
2047 sb.Draw(TextureAssets.ColorBlip.Value, new Vector2(num2 + num4 * scale, num3), (Rectangle?)null, colorMethod(percent), 0f, Vector2.Zero, scale, (SpriteEffects)0, 0f);
2048 }
2049 ((Rectangle)(ref rectangle)).Inflate((int)(-5f * scale), 0);
2050 bool flag = ((Rectangle)(ref rectangle)).Contains(new Point(Main.mouseX, Main.mouseY));
2051 if (lockState == 2)
2052 {
2053 flag = false;
2054 }
2055 if (flag || lockState == 1)
2056 {
2057 sb.Draw(TextureAssets.ColorHighlight.Value, destinationRectangle, Main.OurFavoriteColor);
2058 }
2059 sb.Draw(TextureAssets.ColorSlider.Value, new Vector2(num2 + 167f * scale * perc, num3 + 4f * scale), (Rectangle?)null, Color.White, 0f, new Vector2(0.5f * (float)TextureAssets.ColorSlider.Width(), 0.5f * (float)TextureAssets.ColorSlider.Height()), scale, (SpriteEffects)0, 0f);
2060 if (Main.mouseX >= rectangle.X && Main.mouseX <= rectangle.X + rectangle.Width)
2061 {
2062 inBar = flag;
2063 return (float)(Main.mouseX - rectangle.X) / (float)rectangle.Width;
2064 }
2065 inBar = false;
2066 if (rectangle.X >= Main.mouseX)
2067 {
2068 return 0f;
2069 }
2070 return 1f;
2071 }
static Asset< Texture2D > ColorHighlight
static Asset< Texture2D > ColorSlider
static Asset< Texture2D > ColorBlip
static Asset< Texture2D > ColorBar
static Vector2 valuePosition

References Terraria.GameContent.TextureAssets.ColorBar, Terraria.GameContent.TextureAssets.ColorBlip, Terraria.GameContent.TextureAssets.ColorHighlight, Terraria.Utils.ColorLerp_BlackToWhite(), Terraria.GameContent.TextureAssets.ColorSlider, Terraria.Main.mouseX, Terraria.Main.mouseY, and Terraria.Main.OurFavoriteColor.

Referenced by Terraria.IngameOptions.Draw(), Terraria.Main.DrawMenu(), and Terraria.GameContent.UI.Elements.UIKeybindingSliderItem.DrawSelf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: