コード例 #1
0
 /// <summary>
 /// Resets Main.EquipPage to Main.EquipPageSelected for utility items if selected page is utility
 /// </summary>
 private void ItemEquipPage()
 {
     if (UtilityAccessories.GetHandler(Main.mouseItem) != null && Main.EquipPageSelected == EquipPage)
     {
         Main.EquipPage = EquipPage;
     }
 }
コード例 #2
0
        internal static void DrawPartiallyFunctionalAccDetails(Vector2 position)
        {
            float itemScale   = Main.inventoryScale * 0.7f;
            float itemSpacing = 40 * itemScale;

            position += new Vector2(18, 68) * Main.inventoryScale;

            foreach (var item in ContentInstance <UtilitySlot> .Instances.Select(slot => slot.FunctionalItem))
            {
                var h = UtilityAccessories.GetHandler(item);
                if (h == null)
                {
                    continue;
                }

                var hint = h.PartiallyFunctionalHintKey;
                if (hint == null)
                {
                    continue;
                }

                if (DrawItem(item, position, itemScale, Color.White))
                {
                    Main.HoverItem     = new Item();
                    Main.hoverItemName = Language.GetTextValue(hint);
                }
                position.X -= itemSpacing;
            }
        }
コード例 #3
0
 public override void ModifyTooltips(Item item, List <TooltipLine> tooltips)
 {
     if (item == UtilityHoverItem)
     {
         UtilityAccessories.GetHandler(item).ModifyTooltip(tooltips);
     }
 }
コード例 #4
0
        /// <summary>
        /// </summary>
        /// <param name="pos">Page icon drawing position</param>
        /// <returns>true if the page icon is under the mouse</returns>
        private bool DrawPageIcons(Vector2 pos)
        {
            pos.X += 92f;
            pos.Y += 2f;
            float scale = 0.8f;

            var  tex       = buttonTextures[Main.EquipPage == EquipPage ? 1 : 0].Value;
            bool highlight = false;

            if (Collision.CheckAABBvAABBCollision(pos, tex.Size(), Main.MouseScreen, Vector2.One) &&
                (Main.mouseItem.stack < 1 || UtilityAccessories.GetHandler(Main.mouseItem) != null || Main.mouseItem.dye > 0))
            {
                highlight = true;
                Main.spriteBatch.Draw(buttonTextures[2].Value, pos, null, Main.OurFavoriteColor, 0f, new Vector2(2f), scale, SpriteEffects.None, 0f);
                Main.HoverItem     = new Item();
                Main.hoverItemName = Language.GetTextValue("Mods.UtilitySlots.PageName");
            }
            Main.spriteBatch.Draw(tex, pos, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);
            return(highlight);
        }
コード例 #5
0
 public override void ApplyEquipEffects()
 {
     UtilityAccessories.GetHandler(FunctionalItem)?.ApplyEffect(Player, HideVisuals);
     Player.ApplyEquipVanity(VanityItem);
 }
コード例 #6
0
 public override bool ModifyDefaultSwapSlot(Item item, int accSlotToSwapTo) =>
 FunctionalItem.IsAir && (UtilityAccessories.GetHandler(item)?.FullyFunctional ?? false);
コード例 #7
0
 public override bool CanAcceptItem(Item checkItem, AccessorySlotType slotType) =>
 slotType == AccessorySlotType.DyeSlot || slotType == AccessorySlotType.FunctionalSlot && UtilityAccessories.GetHandler(checkItem) != null;