Example #1
0
        void item_Changed(object sender, ObjectChangedEventArgs e)
        {
            // Teoreticky se muze stat (a obcas stane), ze se item objevi jinde,
            // aniz by se pred tim odstranil. Tohle to osetri.
            if ((e.Type == ObjectChangeType.ItemUpdated && !collection.Contains(e.ItemSerial)))
            {
                bool fire = false;

                lock (this)
                {
                    UOItem item = new UOItem(e.ItemSerial);
                    item.Changed -= new ObjectChangedEventHandler(item_Changed);

                    if (tracked.Remove(e.ItemSerial))
                    {
                        // Recount
                        int a = 0;
                        foreach (var i in tracked.Values.ToArray())
                        {
                            a += (i.Amount == 0 ? 1 : i.Amount);
                        }

                        amount = a;
                        fire   = true;
                    }
                }

                // Fire event
                if (fire)
                {
                    OnAmountChanged(EventArgs.Empty);
                }
            }
        }
 public void HideIfOwned(ItemsCollection itemsCollection)
 {
     if (itemsCollection.Contains(_item))
     {
         Visibility = Visibility.Collapsed;
     }
     else
     {
         Visibility = Visibility.Visible;
     }
 }
Example #3
0
    public void update()
    {
        ItemsCollection playerInventory = GameManager.Instance.PC.items;

        if (playerInventory.Contains(_item))
        {
            hide();
        }
        else
        {
            show();
        }
    }