Beispiel #1
0
 public void onMouseDown(MouseEventArgs e, int mouse_x, int mouse_y, bool mouse_down)
 {
     foreach (RoomPotSaveEditor item in jsonData.itemsOWEditor)
     {
         if (item.roomMapId >= scene.offset && item.roomMapId < scene.offset + 64)
         {
             if (mouse_x >= item.x && mouse_x <= item.x + 16 && mouse_y >= item.y && mouse_y <= item.y + 16)
             {
                 selectedItem     = item;
                 lastselectedItem = item;
                 scene.refresh    = true;
             }
         }
     }
 }
Beispiel #2
0
        private void addItem_Click(object sender, EventArgs e)
        {
            AddItemForm additemF = new AddItemForm();

            if (additemF.ShowDialog() == DialogResult.OK)
            {
                RoomPotSaveEditor s = new RoomPotSaveEditor(additemF.pickedItem, (ushort)scene.selectedMap.index, (scene.mouse_x / 16) * 16, (scene.mouse_y / 16) * 16, false);

                short mid = (short)scene.selectedMap.index;
                if (scene.selectedMap.largeMap)
                {
                    if (scene.selectedMap.parentMapId != 255)
                    {
                        mid = scene.selectedMap.parentMapId;
                    }
                }

                s.updateMapStuff(mid);
                jsonData.itemsOWEditor.Add(s);
            }
        }
Beispiel #3
0
        public void onMouseUp(MouseEventArgs e, int mouse_x, int mouse_y, bool mouse_down, short mouseOverMap, Map16 map)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (selectedItem != null)
                {
                    byte mid = map.parentMapId;
                    if (map.parentMapId == 255)
                    {
                        mid = (byte)(mouseOverMap + scene.offset);
                    }
                    selectedItem.updateMapStuff(mid);
                    lastselectedItem = selectedItem;
                    selectedItem     = null;
                }
                else
                {
                    lastselectedItem = null;
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                ContextMenuStrip menu = new ContextMenuStrip();
                menu.Items.Add("Add Item");
                menu.Items.Add("Item Properties");
                menu.Items.Add("Delete Item");
                if (lastselectedItem == null)
                {
                    menu.Items[1].Enabled = false;
                    menu.Items[2].Enabled = false;
                }

                menu.Items[0].Click += addItem_Click;
                menu.Items[1].Click += ItemProperties_Click;
                menu.Items[2].Click += deleteItem_Click;
                menu.Show(Cursor.Position);
            }
        }
Beispiel #4
0
 private void deleteItem_Click(object sender, EventArgs e)
 {
     jsonData.itemsOWEditor.Remove(lastselectedItem);
     lastselectedItem = null;
     selectedItem     = null;
 }