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

◆ Draw()

void Terraria.GameContent.UI.EmoteBubble.Draw ( SpriteBatch sb)
inlineprivate

Definition at line 187 of file EmoteBubble.cs.

188 {
189 Texture2D value = TextureAssets.Extra[48].Value;
190 SpriteEffects effect = SpriteEffects.None;
191 Vector2 position = GetPosition(out effect);
192 position = position.Floor();
193 bool flag = lifeTime < 6 || lifeTimeStart - lifeTime < 6;
194 Rectangle value2 = value.Frame(8, EMOTE_SHEET_VERTICAL_FRAMES, (!flag) ? 1 : 0);
195 Vector2 origin = new Vector2(value2.Width / 2, value2.Height);
196 if (Main.player[Main.myPlayer].gravDir == -1f)
197 {
198 origin.Y = 0f;
199 effect |= SpriteEffects.FlipVertically;
200 position = Main.ReverseGravitySupport(position);
201 }
202 sb.Draw(value, position, value2, Color.White, 0f, origin, 1f, effect, 0f);
203 if (flag)
204 {
205 return;
206 }
207 if (emote >= 0)
208 {
209 if ((emote == 87 || emote == 89) && effect.HasFlag(SpriteEffects.FlipHorizontally))
210 {
211 effect &= ~SpriteEffects.FlipHorizontally;
212 position.X += 4f;
213 }
214 sb.Draw(value, position, value.Frame(8, EMOTE_SHEET_VERTICAL_FRAMES, emote * 2 % 8 + frame, 1 + emote / 4), Color.White, 0f, origin, 1f, effect, 0f);
215 }
216 else if (emote == -1)
217 {
218 value = TextureAssets.NpcHead[metadata].Value;
219 float num = 1f;
220 if ((float)value.Width / 22f > 1f)
221 {
222 num = 22f / (float)value.Width;
223 }
224 if ((float)value.Height / 16f > 1f / num)
225 {
226 num = 16f / (float)value.Height;
227 }
228 sb.Draw(value, position + new Vector2(effect.HasFlag(SpriteEffects.FlipHorizontally) ? 1 : (-1), -value2.Height + 3), null, Color.White, 0f, new Vector2(value.Width / 2, 0f), num, effect, 0f);
229 }
230 }
void Draw(Texture2D texture, Vector2 position, Color color)
Vector2 GetPosition(out SpriteEffects effect)
static readonly int EMOTE_SHEET_VERTICAL_FRAMES

References Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.GameContent.UI.EmoteBubble.emote, Terraria.GameContent.UI.EmoteBubble.EMOTE_SHEET_VERTICAL_FRAMES, Terraria.GameContent.TextureAssets.Extra, Terraria.GameContent.UI.EmoteBubble.frame, Terraria.GameContent.UI.EmoteBubble.GetPosition(), Terraria.GameContent.UI.EmoteBubble.lifeTime, Terraria.GameContent.UI.EmoteBubble.lifeTimeStart, Terraria.GameContent.UI.EmoteBubble.metadata, Terraria.Main.myPlayer, Terraria.GameContent.TextureAssets.NpcHead, Terraria.Main.player, Terraria.Main.ReverseGravitySupport(), System.value, Microsoft.Xna.Framework.Graphics.Vector2, and Microsoft.Xna.Framework.Color.White.