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

◆ DrawName()

static void Terraria.UI.ChestUI.DrawName ( SpriteBatch spritebatch)
inlinestaticprivate

Definition at line 95 of file ChestUI.cs.

96 {
97 Player player = Main.player[Main.myPlayer];
98 string text = string.Empty;
99 if (Main.editChest)
100 {
101 text = Main.npcChatText;
102 Main.instance.textBlinkerCount++;
103 if (Main.instance.textBlinkerCount >= 20)
104 {
105 if (Main.instance.textBlinkerState == 0)
106 {
107 Main.instance.textBlinkerState = 1;
108 }
109 else
110 {
111 Main.instance.textBlinkerState = 0;
112 }
113 Main.instance.textBlinkerCount = 0;
114 }
115 if (Main.instance.textBlinkerState == 1)
116 {
117 text += "|";
118 }
119 Main.instance.DrawWindowsIMEPanel(new Vector2(120f, 518f));
120 }
121 else if (player.chest > -1)
122 {
123 if (Main.chest[player.chest] == null)
124 {
125 Main.chest[player.chest] = new Chest();
126 }
127 Chest chest = Main.chest[player.chest];
128 if (chest.name != "")
129 {
130 text = chest.name;
131 }
132 else
133 {
134 Tile tile = Main.tile[player.chestX, player.chestY];
135 if (tile.type == 21)
136 {
137 text = Lang.chestType[tile.frameX / 36].Value;
138 }
139 else if (tile.type == 467 && tile.frameX / 36 == 4)
140 {
141 text = Lang.GetItemNameValue(3988);
142 }
143 else if (tile.type == 467)
144 {
145 text = Lang.chestType2[tile.frameX / 36].Value;
146 }
147 else if (tile.type == 88)
148 {
149 text = Lang.dresserType[tile.frameX / 54].Value;
150 }
151 }
152 }
153 else if (player.chest == -2)
154 {
155 text = Lang.inter[32].Value;
156 }
157 else if (player.chest == -3)
158 {
159 text = Lang.inter[33].Value;
160 }
161 else if (player.chest == -4)
162 {
163 text = Lang.GetItemNameValue(3813);
164 }
165 else if (player.chest == -5)
166 {
167 text = Lang.GetItemNameValue(4076);
168 }
169 Color color = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor);
170 color = Color.White * (1f - (255f - (float)(int)Main.mouseTextColor) / 255f * 0.5f);
171 color.A = byte.MaxValue;
172 Utils.WordwrapString(text, FontAssets.MouseText.Value, 200, 1, out var lineAmount);
173 lineAmount++;
174 for (int i = 0; i < lineAmount; i++)
175 {
176 ChatManager.DrawColorCodedStringWithShadow(spritebatch, FontAssets.MouseText.Value, text, new Vector2(504f, Main.instance.invBottom + i * 26), color, 0f, Vector2.Zero, Vector2.One, -1f, 1.5f);
177 }
178 }
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
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)

References Terraria.Main.chest, Terraria.Player.chest, Terraria.Lang.chestType, Terraria.Lang.chestType2, Terraria.Player.chestX, Terraria.Player.chestY, Microsoft.Xna.Framework.Graphics.Color, Terraria.UI.Chat.ChatManager.DrawColorCodedStringWithShadow(), Terraria.Lang.dresserType, Terraria.Main.editChest, Terraria.Tile.frameX, Terraria.Lang.GetItemNameValue(), Terraria.Main.instance, Terraria.Lang.inter, Terraria.GameContent.FontAssets.MouseText, Terraria.Main.mouseTextColor, Terraria.Main.myPlayer, Terraria.Chest.name, Terraria.Main.npcChatText, Microsoft.Xna.Framework.Vector2.One, Terraria.Main.player, Terraria.Main.tile, Terraria.Tile.type, Microsoft.Xna.Framework.Graphics.Vector2, Terraria.Utils.WordwrapString(), and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.UI.ChestUI.Draw().