Exemple #1
0
        /** Overrides transact to make a copy of the dragged in item, but leave the origional intact */
        public override bool Transact(IDragDrop source)
        {
            if (!(source is GuiItemSlot))
            {
                return(false);
            }

            var item = source.DDContent;

            if (item == null)
            {
                return(false);
            }

            if (OrigionalSource != null)
            {
                OrigionalSource.Locked = false;
                if (OrigionalSource.DDContent != null)
                {
                    OrigionalSource.DDContent.SelfEnabled = true;
                }
            }

            OrigionalSource = (GuiItemSlot)source;
            DDContent       = (GuiComponent)item.Clone();

            OrigionalSource.Locked = true;
            if (OrigionalSource.DDContent != null)
            {
                OrigionalSource.DDContent.SelfEnabled = false;
            }

            return(true);
        }
Exemple #2
0
        private GuiItemSlot CreateEquipedSlot(int x, int y)
        {
            GuiItemSlot result = new GuiItemSlot(120 + (x - 1) * 50, 80 + (y - 1) * 50);

            Add(result);
            return(result);
        }
Exemple #3
0
        /** Creates slots based on the number of slots in the characters inventory */
        private void Sync()
        {
            Invalidate();

            inventoryScrollArea.Clear();

            if (Source == null)
            {
                return;
            }

            slots = new GuiItemSlot[Source.Count];
            for (int index = 0; index < Source.Count; index++)
            {
                slots[index] = new GuiItemSlot((int)(index % COLUMNS) * SLOT_WIDTH, (int)(index / COLUMNS) * SLOT_HEIGHT, Source[index]);
                inventoryScrollArea.Add(slots[index]);
            }
            inventoryScrollArea.ContentsScrollRect.height = ((int)Math.Ceiling((float)(Source.Count / COLUMNS))) * SLOT_HEIGHT;
        }