UpdateHover() public static method

public static UpdateHover ( int ID, bool hovering ) : void
ID int
hovering bool
return void
Example #1
0
        private static void DrawButton(SpriteBatch spriteBatch, int ID, int X, int Y)
        {
            Player player = Main.player[Main.myPlayer];

            if (ID == 4 && player.chest < -1 || ID == 5 && !Main.editChest)
            {
                ChestUI.UpdateHover(ID, false);
            }
            else
            {
                Y += ID * 26;
                float  num  = ChestUI.ButtonScale[ID];
                string text = "";
                switch (ID)
                {
                case 0:
                    text = Lang.inter[29];
                    break;

                case 1:
                    text = Lang.inter[30];
                    break;

                case 2:
                    text = Lang.inter[31];
                    break;

                case 3:
                    text = Lang.inter[82];
                    break;

                case 4:
                    text = Lang.inter[Main.editChest ? 47 : 61];
                    break;

                case 5:
                    text = Lang.inter[63];
                    break;
                }
                Vector2 vector2   = Main.fontMouseText.MeasureString(text);
                Color   color     = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor) * num;
                Color   baseColor = Color.White * 0.97f * (float)(1.0 - ((double)byte.MaxValue - (double)Main.mouseTextColor) / (double)byte.MaxValue * 0.5);
                baseColor.A = byte.MaxValue;
                X          += (int)((double)vector2.X * (double)num / 2.0);
                ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, text, new Vector2((float)X, (float)Y), baseColor, 0.0f, vector2 / 2f, new Vector2(num), -1f, 1.5f);
                vector2 *= num;
                if (!Utils.FloatIntersect((float)Main.mouseX, (float)Main.mouseY, 0.0f, 0.0f, (float)X - vector2.X / 2f, (float)Y - vector2.Y / 2f, vector2.X, vector2.Y))
                {
                    ChestUI.UpdateHover(ID, false);
                }
                else
                {
                    ChestUI.UpdateHover(ID, true);
                    player.mouseInterface = true;
                    if (!Main.mouseLeft || !Main.mouseLeftRelease)
                    {
                        return;
                    }
                    switch (ID)
                    {
                    case 0:
                        ChestUI.LootAll();
                        break;

                    case 1:
                        ChestUI.DepositAll();
                        break;

                    case 2:
                        ChestUI.QuickStack();
                        break;

                    case 3:
                        ChestUI.Restock();
                        break;

                    case 4:
                        ChestUI.RenameChest();
                        break;

                    case 5:
                        ChestUI.RenameChestCancel();
                        break;
                    }
                    Recipe.FindRecipes();
                }
            }
        }