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

◆ DrawInNotificationsArea()

void Terraria.UI.InGamePopups.PlayerWantsToJoinGamePopup.DrawInNotificationsArea ( SpriteBatch spriteBatch,
Rectangle area,
ref int gamepadPointLocalIndexTouse )
inline

Implements Terraria.UI.IInGameNotification.

Definition at line 278 of file InGamePopups.cs.

279 {
280 string userWrapperText = _request.GetUserWrapperText();
282 Utils.TrimTextIfNeeded(ref text, FontAssets.MouseText.Value, 0.9f, area.Width / 4);
283 string text2 = Utils.FormatWith(userWrapperText, new
284 {
285 DisplayName = text,
286 FullId = _request.UserFullIdentifier
287 });
288 Vector2 mouseScreen = Main.MouseScreen;
289 Color c = (area.Contains(mouseScreen.ToPoint()) ? (new Color(64, 109, 164) * 0.75f) : (new Color(64, 109, 164) * 0.5f));
290 Utils.DrawInvBG(spriteBatch, area, c);
291 Vector2 pos = new Vector2(area.Left, area.Center.Y);
292 pos.X += 32f;
293 Texture2D value = Main.Assets.Request<Texture2D>("Images/UI/ButtonPlay", (AssetRequestMode)1).Value;
294 Vector2 vector = new Vector2(area.Left + 7, MathHelper.Lerp(area.Top, area.Bottom, 0.5f) - (float)(value.Height / 2) - 1f);
295 bool flag = Utils.CenteredRectangle(vector + new Vector2(value.Width / 2, 0f), value.Size()).Contains(mouseScreen.ToPoint());
296 spriteBatch.Draw(value, vector, null, Color.White * (flag ? 1f : 0.5f), 0f, new Vector2(0f, 0.5f) * value.Size(), 1f, SpriteEffects.None, 0f);
297 if (flag)
298 {
299 OnMouseOver();
300 }
301 value = Main.Assets.Request<Texture2D>("Images/UI/ButtonDelete", (AssetRequestMode)1).Value;
302 vector = new Vector2(area.Left + 7, MathHelper.Lerp(area.Top, area.Bottom, 0.5f) + (float)(value.Height / 2) + 1f);
303 flag = Utils.CenteredRectangle(vector + new Vector2(value.Width / 2, 0f), value.Size()).Contains(mouseScreen.ToPoint());
304 spriteBatch.Draw(value, vector, null, Color.White * (flag ? 1f : 0.5f), 0f, new Vector2(0f, 0.5f) * value.Size(), 1f, SpriteEffects.None, 0f);
305 if (flag)
306 {
307 OnMouseOver(reject: true);
308 }
309 pos.X += 6f;
310 Utils.DrawBorderString(color: new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor / 5, Main.mouseTextColor), sb: spriteBatch, text: text2, pos: pos, scale: 0.9f, anchorx: 0f, anchory: 0.4f);
311 }
void Draw(Texture2D texture, Vector2 position, Color color)
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
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(), Microsoft.Xna.Framework.Rectangle.Left, Microsoft.Xna.Framework.MathHelper.Lerp(), Terraria.Main.MouseScreen, Terraria.GameContent.FontAssets.MouseText, Terraria.Main.mouseTextColor, Terraria.UI.InGamePopups.PlayerWantsToJoinGamePopup.OnMouseOver(), Microsoft.Xna.Framework.Rectangle.Top, Terraria.Utils.TrimTextIfNeeded(), Terraria.Social.Base.UserJoinToServerRequest.UserDisplayName, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Color.White, Microsoft.Xna.Framework.Rectangle.Width, and Microsoft.Xna.Framework.Point.Y.