예제 #1
0
        public void Copy()
        {
            Clipboard.Clear();
            RoomPotSaveEditor id = lastselectedItem.Copy();

            Clipboard.SetData("owitem", id);
        }
예제 #2
0
 public void onMouseDown(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         isLeftPress = true;
     }
     else
     {
         isLeftPress = false;
     }
     foreach (RoomPotSaveEditor item in scene.ow.allitems)
     {
         if (item.roomMapId >= 0 + (scene.ow.worldOffset) && item.roomMapId < (64 + scene.ow.worldOffset))
         {
             if (e.X >= item.x && e.X <= item.x + 16 && e.Y >= item.y && e.Y <= item.y + 16)
             {
                 selectedItem     = item;
                 lastselectedItem = item;
                 byte nid = item.id;
                 if ((item.id & 0x80) == 0x80)
                 {
                     nid = (byte)(((item.id - 0x80) / 2) + 0x17);
                 }
                 scene.mainForm.owcombobox.SelectedIndex = nid;
                 scene.mainForm.itemOWGroupbox.Visible   = true;
             }
         }
     }
     scene.mouse_down = true;
 }
예제 #3
0
        public void Cut()
        {
            Clipboard.Clear();
            RoomPotSaveEditor id = lastselectedItem.Copy();

            Clipboard.SetData("owitem", id);
            Delete();
            scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height));
        }
예제 #4
0
 public void Delete()
 {
     if (lastselectedItem != null)
     {
         scene.ow.allitems.Remove(lastselectedItem);
         lastselectedItem = null;
         scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height));
         scene.mainForm.itemOWGroupbox.Visible = false;
     }
 }
예제 #5
0
        private void addItem_Click(object sender, EventArgs e)
        {
            RoomPotSaveEditor pitem = new RoomPotSaveEditor(0, 0, 0, 0, false);

            scene.ow.allitems.Add(pitem);
            selectedItem     = pitem;
            lastselectedItem = selectedItem;
            isLeftPress      = true;
            scene.mouse_down = true;
            scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height));
        }
예제 #6
0
        public void Paste()
        {
            RoomPotSaveEditor data = (RoomPotSaveEditor)Clipboard.GetData("owitem");

            if (data != null)
            {
                scene.ow.allitems.Add(data);
                selectedItem     = data;
                lastselectedItem = selectedItem;
                isLeftPress      = true;
                scene.mouse_down = true;
                scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height));
            }
        }
예제 #7
0
        public void onMouseUp(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (selectedItem != null)
                {
                    byte mid = scene.ow.allmaps[scene.mapHover + scene.ow.worldOffset].parent;
                    if (mid == 255)
                    {
                        mid = (byte)(scene.mapHover + scene.ow.worldOffset);
                    }
                    selectedItem.updateMapStuff(mid);
                    lastselectedItem = selectedItem;
                    selectedItem     = null;
                }
                else
                {
                    lastselectedItem = null;
                    //scene.mainForm.itemOWGroupbox.Visible = false;
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                ContextMenuStrip menu = new ContextMenuStrip();
                menu.Items.Add("Add Item");
                menu.Items.Add("Delete Item");

                if (lastselectedItem == null)
                {
                    menu.Items[1].Enabled = false;
                }

                menu.Items[0].Click += addItem_Click;
                menu.Items[1].Click += deleteItem_Click;
                menu.Show(Cursor.Position);
            }

            scene.mouse_down = false;
        }