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

◆ Draw()

void Terraria.GameContent.Animations.Segments.LocalizedTextSegment.Draw ( ref GameAnimationSegment info)
inline

Implements Terraria.GameContent.Animations.IAnimationSegment.

Definition at line 40 of file Segments.cs.

41 {
42 float num = 250f;
43 float num2 = 250f;
44 int timeInAnimation = info.TimeInAnimation;
45 float num3 = Utils.GetLerpValue(_timeToShowPeak - num, _timeToShowPeak, timeInAnimation, clamped: true) * Utils.GetLerpValue(_timeToShowPeak + num2, _timeToShowPeak, timeInAnimation, clamped: true);
46 if (!(num3 <= 0f))
47 {
48 float num4 = _timeToShowPeak - (float)timeInAnimation;
49 Vector2 position = info.AnchorPositionOnScreen + new Vector2(0f, num4 * 0.5f);
50 position += _anchorOffset;
51 Vector2 baseScale = new Vector2(0.7f);
52 float num5 = Main.GlobalTimeWrappedHourly * 0.02f % 1f;
53 if (num5 < 0f)
54 {
55 num5 += 1f;
56 }
57 Color color = Main.hslToRgb(num5, 1f, 0.5f);
58 string value = _text.Value;
59 Vector2 origin = FontAssets.DeathText.Value.MeasureString(value);
60 origin *= 0.5f;
61 float num6 = 1f - (1f - num3) * (1f - num3);
62 ChatManager.DrawColorCodedStringShadow(info.SpriteBatch, FontAssets.DeathText.Value, value, position, color * num6 * num6 * 0.25f * info.DisplayOpacity, 0f, origin, baseScale);
63 ChatManager.DrawColorCodedString(info.SpriteBatch, FontAssets.DeathText.Value, value, position, Color.White * num6 * info.DisplayOpacity, 0f, origin, baseScale);
64 }
65 }
static void DrawColorCodedStringShadow(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, float maxWidth=-1f, float spread=2f)
static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth, bool ignoreColors=false)

References Terraria.GameContent.Animations.Segments.LocalizedTextSegment._anchorOffset, Terraria.GameContent.Animations.Segments.LocalizedTextSegment._text, Terraria.GameContent.Animations.Segments.LocalizedTextSegment._timeToShowPeak, Terraria.GameContent.FontAssets.DeathText, Terraria.UI.Chat.ChatManager.DrawColorCodedString(), Terraria.UI.Chat.ChatManager.DrawColorCodedStringShadow(), Terraria.Utils.GetLerpValue(), Terraria.Main.hslToRgb(), Terraria.Localization.LocalizedText.Value, Microsoft.Xna.Framework.Graphics.Vector2, and Microsoft.Xna.Framework.Color.White.