Terraria.ItemText.Update C# (CSharp) Method

Update() public method

public Update ( int whoAmI ) : void
whoAmI int
return void
        public void Update(int whoAmI)
        {
            if (!this.active)
                return;
            this.alpha += (float)this.alphaDir * 0.01f;
            if ((double)this.alpha <= 0.7)
            {
                this.alpha = 0.7f;
                this.alphaDir = 1;
            }
            if ((double)this.alpha >= 1.0)
            {
                this.alpha = 1f;
                this.alphaDir = -1;
            }
            if (this.expert && this.expert)
                this.color = new Color((int)(byte)Main.DiscoR, (int)(byte)Main.DiscoG, (int)(byte)Main.DiscoB, (int)Main.mouseTextColor);
            bool flag = false;
            string text1 = this.name;
            if (this.stack > 1)
                text1 = string.Concat(new object[4]
        {
          (object) text1,
          (object) " (",
          (object) this.stack,
          (object) ")"
        });
            Vector2 vector2_1 = Main.fontMouseText.MeasureString(text1) * this.scale;
            vector2_1.Y *= 0.8f;
            Rectangle rectangle1 = new Rectangle((int)((double)this.position.X - (double)vector2_1.X / 2.0), (int)((double)this.position.Y - (double)vector2_1.Y / 2.0), (int)vector2_1.X, (int)vector2_1.Y);
            for (int index = 0; index < 20; ++index)
            {
                if (Main.itemText[index].active && index != whoAmI)
                {
                    string text2 = Main.itemText[index].name;
                    if (Main.itemText[index].stack > 1)
                        text2 = string.Concat(new object[4]
            {
              (object) text2,
              (object) " (",
              (object) Main.itemText[index].stack,
              (object) ")"
            });
                    Vector2 vector2_2 = Main.fontMouseText.MeasureString(text2);
                    vector2_2 *= Main.itemText[index].scale;
                    vector2_2.Y *= 0.8f;
                    Rectangle rectangle2 = new Rectangle((int)((double)Main.itemText[index].position.X - (double)vector2_2.X / 2.0), (int)((double)Main.itemText[index].position.Y - (double)vector2_2.Y / 2.0), (int)vector2_2.X, (int)vector2_2.Y);
                    if (rectangle1.Intersects(rectangle2) && ((double)this.position.Y < (double)Main.itemText[index].position.Y || (double)this.position.Y == (double)Main.itemText[index].position.Y && whoAmI < index))
                    {
                        flag = true;
                        int num = ItemText.numActive;
                        if (num > 3)
                            num = 3;
                        Main.itemText[index].lifeTime = ItemText.activeTime + 15 * num;
                        this.lifeTime = ItemText.activeTime + 15 * num;
                    }
                }
            }
            if (!flag)
            {
                this.velocity.Y *= 0.86f;
                if ((double)this.scale == 1.0)
                    this.velocity.Y *= 0.4f;
            }
            else if ((double)this.velocity.Y > -6.0)
                this.velocity.Y -= 0.2f;
            else
                this.velocity.Y *= 0.86f;
            this.velocity.X *= 0.93f;
            this.position += this.velocity;
            --this.lifeTime;
            if (this.lifeTime <= 0)
            {
                this.scale -= 0.03f;
                if ((double)this.scale < 0.1)
                    this.active = false;
                this.lifeTime = 0;
            }
            else
            {
                if ((double)this.scale < 1.0)
                    this.scale += 0.1f;
                if ((double)this.scale <= 1.0)
                    return;
                this.scale = 1f;
            }
        }