Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ DrawInGame()

void Terraria.UI.InGamePopups.PlayerWantsToJoinGamePopup.DrawInGame ( SpriteBatch spriteBatch,
Vector2 bottomAnchorPosition )
inline

Implements Terraria.UI.IInGameNotification.

Definition at line 212 of file InGamePopups.cs.

213 {
214 float opacity = Opacity;
215 if (opacity > 0f)
216 {
217 string text = Utils.FormatWith(_request.GetUserWrapperText(), new
218 {
219 DisplayName = _request.UserDisplayName,
220 FullId = _request.UserFullIdentifier
221 });
222 float num = Scale * 1.1f;
223 Vector2 size = (FontAssets.ItemStack.Value.MeasureString(text) + new Vector2(58f, 10f)) * num;
224 Rectangle r = Utils.CenteredRectangle(bottomAnchorPosition + new Vector2(0f, (0f - size.Y) * 0.5f), size);
225 Vector2 mouseScreen = Main.MouseScreen;
226 Color c = (r.Contains(mouseScreen.ToPoint()) ? (new Color(64, 109, 164) * 0.75f) : (new Color(64, 109, 164) * 0.5f));
227 Utils.DrawInvBG(spriteBatch, r, c);
228 Vector2 vector = new Vector2(r.Left, r.Center.Y);
229 vector.X += 32f;
230 Texture2D value = Main.Assets.Request<Texture2D>("Images/UI/ButtonPlay", (AssetRequestMode)1).Value;
231 Vector2 vector2 = new Vector2(r.Left + 7, MathHelper.Lerp(r.Top, r.Bottom, 0.5f) - (float)(value.Height / 2) - 1f);
232 bool flag = Utils.CenteredRectangle(vector2 + new Vector2(value.Width / 2, 0f), value.Size()).Contains(mouseScreen.ToPoint());
233 spriteBatch.Draw(value, vector2, null, Color.White * (flag ? 1f : 0.5f), 0f, new Vector2(0f, 0.5f) * value.Size(), 1f, SpriteEffects.None, 0f);
234 if (flag)
235 {
236 OnMouseOver();
237 }
238 value = Main.Assets.Request<Texture2D>("Images/UI/ButtonDelete", (AssetRequestMode)1).Value;
239 vector2 = new Vector2(r.Left + 7, MathHelper.Lerp(r.Top, r.Bottom, 0.5f) + (float)(value.Height / 2) + 1f);
240 flag = Utils.CenteredRectangle(vector2 + new Vector2(value.Width / 2, 0f), value.Size()).Contains(mouseScreen.ToPoint());
241 spriteBatch.Draw(value, vector2, null, Color.White * (flag ? 1f : 0.5f), 0f, new Vector2(0f, 0.5f) * value.Size(), 1f, SpriteEffects.None, 0f);
242 if (flag)
243 {
244 OnMouseOver(reject: true);
245 }
246 Utils.DrawBorderString(color: new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor / 5, Main.mouseTextColor) * opacity, sb: spriteBatch, text: text, pos: r.Center.ToVector2() + new Vector2(10f, 0f), scale: num * 0.9f, anchorx: 0.5f, anchory: 0.4f);
247 }
248 }
void Draw(Texture2D texture, Vector2 position, Color color)
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static Asset< DynamicSpriteFont > ItemStack
Definition FontAssets.cs:8
bool Contains(int x, int y)
Definition Rectangle.cs:92

References Terraria.UI.InGamePopups.PlayerWantsToJoinGamePopup._request, Terraria.Main.Assets, Microsoft.Xna.Framework.Rectangle.Bottom, Microsoft.Xna.Framework.Rectangle.Center, Terraria.Utils.CenteredRectangle(), Microsoft.Xna.Framework.Graphics.Color, Microsoft.Xna.Framework.Rectangle.Contains(), Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.Utils.DrawBorderString(), Terraria.Utils.DrawInvBG(), Terraria.Utils.FormatWith(), Terraria.Social.Base.UserJoinToServerRequest.GetUserWrapperText(), Terraria.GameContent.FontAssets.ItemStack, Microsoft.Xna.Framework.Rectangle.Left, Microsoft.Xna.Framework.MathHelper.Lerp(), Terraria.Main.MouseScreen, Terraria.Main.mouseTextColor, Terraria.UI.InGamePopups.PlayerWantsToJoinGamePopup.OnMouseOver(), Terraria.UI.InGamePopups.PlayerWantsToJoinGamePopup.Opacity, Terraria.UI.InGamePopups.PlayerWantsToJoinGamePopup.Scale, Microsoft.Xna.Framework.Rectangle.Top, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Color.White, and Microsoft.Xna.Framework.Point.Y.