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

◆ DrawFancyBar() [2/2]

static void Terraria.GameContent.UI.BigProgressBar.BigProgressBarHelper.DrawFancyBar ( SpriteBatch spriteBatch,
float lifeAmount,
float lifeMax,
Texture2D barIconTexture,
Rectangle barIconFrame,
float shieldCurrent,
float shieldMax )
inlinestatic

Definition at line 78 of file BigProgressBarHelper.cs.

79 {
80 Texture2D value = Main.Assets.Request<Texture2D>("Images/UI/UI_BossBar", (AssetRequestMode)1).Value;
81 Point p = new Point(456, 22);
82 Point p2 = new Point(32, 24);
83 int verticalFrames = 6;
84 Rectangle value2 = value.Frame(1, verticalFrames, 0, 3);
85 Color color = Color.White * 0.2f;
86 float num = lifeAmount / lifeMax;
87 int num2 = (int)((float)p.X * num);
88 num2 -= num2 % 2;
89 Rectangle value3 = value.Frame(1, verticalFrames, 0, 2);
90 value3.X += p2.X;
91 value3.Y += p2.Y;
92 value3.Width = 2;
93 value3.Height = p.Y;
94 Rectangle value4 = value.Frame(1, verticalFrames, 0, 1);
95 value4.X += p2.X;
96 value4.Y += p2.Y;
97 value4.Width = 2;
98 value4.Height = p.Y;
99 float num3 = shieldCurrent / shieldMax;
100 int num4 = (int)((float)p.X * num3);
101 num4 -= num4 % 2;
102 Rectangle value5 = value.Frame(1, verticalFrames, 0, 5);
103 value5.X += p2.X;
104 value5.Y += p2.Y;
105 value5.Width = 2;
106 value5.Height = p.Y;
107 Rectangle value6 = value.Frame(1, verticalFrames, 0, 4);
108 value6.X += p2.X;
109 value6.Y += p2.Y;
110 value6.Width = 2;
111 value6.Height = p.Y;
112 Rectangle rectangle = Utils.CenteredRectangle(Main.ScreenSize.ToVector2() * new Vector2(0.5f, 1f) + new Vector2(0f, -50f), p.ToVector2());
113 Vector2 vector = rectangle.TopLeft() - p2.ToVector2();
114 spriteBatch.Draw(value, vector, value2, color, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
115 spriteBatch.Draw(value, rectangle.TopLeft(), value3, Color.White, 0f, Vector2.Zero, new Vector2(num2 / value3.Width, 1f), SpriteEffects.None, 0f);
116 spriteBatch.Draw(value, rectangle.TopLeft() + new Vector2(num2 - 2, 0f), value4, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
117 spriteBatch.Draw(value, rectangle.TopLeft(), value5, Color.White, 0f, Vector2.Zero, new Vector2(num4 / value5.Width, 1f), SpriteEffects.None, 0f);
118 spriteBatch.Draw(value, rectangle.TopLeft() + new Vector2(num4 - 2, 0f), value6, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
119 Rectangle value7 = value.Frame(1, verticalFrames);
120 spriteBatch.Draw(value, vector, value7, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
121 Vector2 vector2 = new Vector2(4f, 20f) + barIconFrame.Size() / 2f;
122 spriteBatch.Draw(barIconTexture, vector + vector2, barIconFrame, Color.White, 0f, barIconFrame.Size() / 2f, 1f, SpriteEffects.None, 0f);
123 if (BigProgressBarSystem.ShowText)
124 {
125 if (shieldCurrent > 0f)
126 {
127 DrawHealthText(spriteBatch, rectangle, shieldCurrent, shieldMax);
128 }
129 else
130 {
131 DrawHealthText(spriteBatch, rectangle, lifeAmount, lifeMax);
132 }
133 }
134 }
void Draw(Texture2D texture, Vector2 position, Color color)
static void DrawHealthText(SpriteBatch spriteBatch, Rectangle area, float current, float max)

References Terraria.Main.Assets, Terraria.Utils.CenteredRectangle(), Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.GameContent.UI.BigProgressBar.BigProgressBarHelper.DrawHealthText(), Microsoft.Xna.Framework.Graphics.Point, Terraria.Main.ScreenSize, Terraria.GameContent.UI.BigProgressBar.BigProgressBarSystem.ShowText, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Color.White, Microsoft.Xna.Framework.Rectangle.Width, Microsoft.Xna.Framework.Point.X, Microsoft.Xna.Framework.Point.Y, and Microsoft.Xna.Framework.Vector2.Zero.