示例#1
0
        /// <summary>
        /// Checks if an item in the inventory is going to be selected.
        /// </summary>
        /// <value> SelectedSlot </value>
        private void checkInventoryItemSelected()
        {
            for (int j = 0; j < Rows; j++) {
                for (int i = 0; i < Columns; i++) {

                    if (slots [i, j].CollisionBox.Contains (Mouse.GetState ().Position.X + SlotSpacing, Mouse.GetState().Position.Y) && Mouse.GetState().LeftButton == ButtonState.Pressed) {
                        selectedSlot = slots [i, j];
                    }
                }
            }
        }
示例#2
0
        public void Initialize()
        {
            for (int x = 0; x < Columns; x++) {
                for (int y = 0; y < Rows; y++) {

                    Rectangle r = new Rectangle ((int)screenPosition.X + (Item.SpriteWidth + SlotSpacing) * x, (int)screenPosition.Y+(Item.SpriteWidth + SlotSpacing) * y, Item.SpriteWidth, Item.SpriteWidth);

                    slots [x,y] = new InventorySlot (r);
                }
            }
        }