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

◆ DrawPlayerChat()

void Terraria.Main.DrawPlayerChat ( )
inlineprotected

Definition at line 37650 of file Main.cs.

37651 {
37652 TextSnippet[] array = null;
37654 {
37655 PlayerInput.WritingText = true;
37656 }
37657 HandleIME();
37659 {
37661 if (textBlinkerCount >= 20)
37662 {
37663 if (textBlinkerState == 0)
37664 {
37665 textBlinkerState = 1;
37666 }
37667 else
37668 {
37669 textBlinkerState = 0;
37670 }
37671 textBlinkerCount = 0;
37672 }
37673 string text = chatText;
37674 if (screenWidth > 800)
37675 {
37676 int num = screenWidth - 300;
37677 int num2 = 78;
37678 spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2(num2, screenHeight - 36), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.TextBack.Width() - 100, TextureAssets.TextBack.Height()), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
37679 num -= 400;
37680 num2 += 400;
37681 while (num > 0)
37682 {
37683 if (num > 300)
37684 {
37685 spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2(num2, screenHeight - 36), new Microsoft.Xna.Framework.Rectangle(100, 0, TextureAssets.TextBack.Width() - 200, TextureAssets.TextBack.Height()), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
37686 num -= 300;
37687 num2 += 300;
37688 }
37689 else
37690 {
37691 spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2(num2, screenHeight - 36), new Microsoft.Xna.Framework.Rectangle(TextureAssets.TextBack.Width() - num, 0, TextureAssets.TextBack.Width() - (TextureAssets.TextBack.Width() - num), TextureAssets.TextBack.Height()), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
37692 num = 0;
37693 }
37694 }
37695 }
37696 else
37697 {
37698 spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2(78f, screenHeight - 36), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.TextBack.Width(), TextureAssets.TextBack.Height()), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
37699 }
37700 int hoveredSnippet = -1;
37702 string compositionString = Platform.Get<IImeService>().CompositionString;
37703 if (compositionString != null && compositionString.Length > 0)
37704 {
37705 list.Add(new TextSnippet(compositionString, new Microsoft.Xna.Framework.Color(255, 240, 20)));
37706 }
37707 if (textBlinkerState == 1)
37708 {
37710 }
37711 array = list.ToArray();
37713 if (hoveredSnippet > -1)
37714 {
37715 array[hoveredSnippet].OnHover();
37717 {
37718 array[hoveredSnippet].OnClick();
37719 }
37720 }
37721 }
37723 if (drawingPlayerChat && array != null)
37724 {
37726 DrawWindowsIMEPanel(new Vector2(88f, screenHeight - 30) + new Vector2(stringSize.X + 10f, -6f));
37727 }
37728 TimeLogger.DetailedDrawTime(10);
37729 }
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
static Asset< Texture2D > TextBack
void DrawWindowsIMEPanel(Vector2 position, float xAnchor=0f)
Definition Main.cs:37575
static bool drawingPlayerChat
Definition Main.cs:1739
static SpriteBatch spriteBatch
Definition Main.cs:974
static bool mouseLeftRelease
Definition Main.cs:1755
void HandleIME()
Definition Main.cs:37634
static string chatText
Definition Main.cs:1743
static int screenHeight
Definition Main.cs:1721
static IChatMonitor chatMonitor
Definition Main.cs:2339
int textBlinkerCount
Definition Main.cs:2389
static int screenWidth
Definition Main.cs:1719
int textBlinkerState
Definition Main.cs:2391
static bool mouseLeft
Definition Main.cs:614
static Vector2 DrawColorCodedStringWithShadow(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth=-1f, float spread=2f)
static Vector2 GetStringSize(DynamicSpriteFont font, string text, Vector2 baseScale, float maxWidth=-1f)
static List< TextSnippet > ParseMessage(string text, Color baseColor)

References System.array, Terraria.Main.chatMonitor, Terraria.Main.chatText, Terraria.TimeLogger.DetailedDrawTime(), Terraria.UI.Chat.ChatManager.DrawColorCodedStringWithShadow(), Terraria.Main.drawingPlayerChat, Terraria.Main.DrawWindowsIMEPanel(), Terraria.UI.Chat.ChatManager.GetStringSize(), Terraria.Main.HandleIME(), System.list, Terraria.Main.mouseLeft, Terraria.Main.mouseLeftRelease, Terraria.GameContent.FontAssets.MouseText, Microsoft.Xna.Framework.Vector2.One, Terraria.UI.Chat.ChatManager.ParseMessage(), Terraria.Main.screenHeight, Terraria.Main.screenWidth, Terraria.Main.spriteBatch, System.text, Terraria.GameContent.TextureAssets.TextBack, Terraria.Main.textBlinkerCount, Terraria.Main.textBlinkerState, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Color.White, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Main.DoDraw(), and Terraria.Main.DrawInterface_34_PlayerChat().