Beispiel #1
0
        public GuiStoreListing(GuiStore parentStore, int x, int y, int itemID, int price, int quantity = 1)
            : base(300, 50)
        {
            X = x;
            Y = y;

            this.ItemID = itemID;
            this.Style  = Engine.GetStyleCopy("PanelSquare");
            this.price  = price;
            this.Style.padding.right     = 10;
            this.parentStore             = parentStore;
            this.DisableChildInteraction = true;

            link          = new MDRItemSlot();
            link.Quantity = quantity;

            itemContainer                    = new GuiItemSlot(2, 2, link);
            itemContainer.Locked             = true;
            itemContainer.ShowToolTipOnHover = false;
            Add(itemContainer);

            nameLabel = new GuiLabel(52, 14, "", 220);
            Add(nameLabel);

            coinsAmount = new GuiCoinAmount();
            Add(coinsAmount, -10, -10, true);

            CacheMode = CacheMode.Solid;

            Refresh();
        }
Beispiel #2
0
        /** Sets the data link, monitors for changes. */
        private void setDataLink(MDRItemSlot newDataLink)
        {
            if (_dataLink != null)
            {
                _dataLink.OnAfterSetItem -= monitorDataLinkChanges;
            }
            _dataLink = newDataLink;
            if (_dataLink != null)
            {
                _dataLink.OnAfterSetItem += monitorDataLinkChanges;
            }

            _dirty = true;
        }
Beispiel #3
0
 /** Create a new item */
 public GuiItemSlot(int x, int y, MDRItemSlot dataLink = null)
     : base(x, y)
 {
     IDPartial          = IDPartial ?? ResourceManager.GetSprite("Icons/SlotIDPartial");
     IDNone             = IDNone ?? ResourceManager.GetSprite("Icons/SlotIDNone");
     ItemIcon           = new GuiItem();
     DataLink           = dataLink;
     ShowToolTipOnHover = true;
     OnDoubleClicked   += delegate {
         if (!Locked)
         {
             UseOrEquipItem();
         }
     };
 }
Beispiel #4
0
 /** Notice when our linked item changes. */
 private void monitorDataLinkChanges(MDRItemSlot source, MDRItemInstance item)
 {
     _dirty = true;
 }