Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InventoryForm"/> class.
        /// </summary>
        /// <param name="dragDropHandler">The drag-drop handler.</param>
        /// <param name="isUserInv">A func used to determine if an <see cref="Inventory"/> is the
        /// user's inventory.</param>
        /// <param name="infoRequester">The item info tooltip.</param>
        /// <param name="position">The position.</param>
        /// <param name="parent">The parent.</param>
        /// <exception cref="ArgumentNullException"><paramref name="infoRequester"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="isUserInv"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="dragDropHandler"/> is null.</exception>
        public InventoryForm(DragDropHandler dragDropHandler, Func <Inventory, bool> isUserInv,
                             ItemInfoRequesterBase <InventorySlot> infoRequester, Vector2 position, Control parent)
            : base(parent, position, new Vector2(200, 200))
        {
            if (infoRequester == null)
            {
                throw new ArgumentNullException("infoRequester");
            }
            if (isUserInv == null)
            {
                throw new ArgumentNullException("isUserInv");
            }
            if (dragDropHandler == null)
            {
                throw new ArgumentNullException("dragDropHandler");
            }

            _dragDropHandler = dragDropHandler;
            _isUserInv       = isUserInv;
            _infoRequester   = infoRequester;

            var itemsSize   = _columns * _itemSize;
            var paddingSize = (_columns + 1) * _padding;

            Size = itemsSize + paddingSize + Border.Size;

            CreateItemSlots();
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EquippedForm"/> class.
        /// </summary>
        /// <param name="dragDropHandler">The drag-drop handler.</param>
        /// <param name="infoRequester">The info requester.</param>
        /// <param name="position">The position.</param>
        /// <param name="parent">The parent.</param>
        /// <exception cref="ArgumentNullException"><paramref name="infoRequester" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="dragDropHandler" /> is <c>null</c>.</exception>
        public EquippedForm(DragDropHandler dragDropHandler, ItemInfoRequesterBase <EquipmentSlot> infoRequester, Vector2 position,
                            Control parent) : base(parent, position, new Vector2(200, 200))
        {
            if (infoRequester == null)
            {
                throw new ArgumentNullException("infoRequester");
            }
            if (dragDropHandler == null)
            {
                throw new ArgumentNullException("dragDropHandler");
            }

            _dragDropHandler = dragDropHandler;
            _infoRequester   = infoRequester;

            CreateItemSlots();
        }