Beispiel #1
0
 internal void OnItemSelected(TrackedItem i)
 {
     itemViewer.CurrentItem = i;
     itemViewer.Invalidate();
 }
 private void EquipmentControl_MouseClick(object sender, MouseEventArgs e)
 {
     foreach (var rect in rectTrackedItems.Keys)
     {
         if (rect.Contains(e.Location))
         {
             LastSelectedItem = rectTrackedItems[rect];
             if (OnItemSelected != null) OnItemSelected(LastSelectedItem);
         }
     }
 }
 private void ItemSelectedHandler(TrackedItem i)
 {
     if (OnItemSelected != null) OnItemSelected(i);
 }
        private void InventoryControl_MouseClick(object sender, MouseEventArgs e)
        {
            int row = e.Y / height_size;
            int col = e.X / width_size;
            if (row < 0) row = 0;
            if (col < 0) col = 0;
            if (col > 9) col = 9;
            int index = (row * 10) + col;
            if (ItemInventory.ContainsKey(index))
            {
                TrackedItem item = ItemInventory[index];
                if (LastSelectedItem==null || item!=LastSelectedItem)
                {
                    LastSelectedItem = item;

                    //Clear our Highlighted Rectangles
                    HighlightedSquares.Clear();

                    //Add new Rectangle to Highlighted Collection
                    Rectangle r = new Rectangle(item.invCol * width_size, (item.invRow - row_reduction) * height_size, width_size, item.DetermineIsTwoSlot() ? height_size * 2 : height_size);
                    HighlightedSquares.Add(r);

                    //Raise Event!
                    if (OnItemSelected != null) OnItemSelected(item);

                    //Invalidate (force repaint)
                    Invalidate();
                }

                if (e.Button == MouseButtons.Right)
                    itemMenu.Show(MousePosition);
            }
        }