Ejemplo n.º 1
0
        public static bool LoadMapInfo(string path, MapPanelEditor mapEditor)
        {
            if (File.Exists(path))
            {
                try
                {
                    FileStream   fs = new FileStream(path, FileMode.Open);
                    BinaryReader r  = new BinaryReader(fs);
                    OnceOperation.RedoAllMap(mapEditor);

                    for (int i = 0; i <= MapPanelEditor.PictureTotal - 1; ++i)
                    {
                        mapEditor.MapIMG_Block[i] = mapEditor.Int2MapImage(r.ReadInt32());
                    }

                    OnceOperation.ClearResume();

                    SmartPaste.HoverPasteInit();

                    r.Close();
                    fs.Close();
                }
                catch
                {
                    return(false);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public static void DownEvent(MouseEventArgs e, MapPanelEditor mapEditor, MyPanel.MyPanel MapPanel)
        {
            MapPanelMouse.NowDownTime = MapPanelMouse.CurrentTimeMillis;
            MapPanel.Focus();
            MapPanelMouse.RecordDownPoint(e, mapEditor);
            MapPanelShow showTemp      = new MapPanelShow(mapEditor);
            int          MapTotalSizeX = showTemp.MapTotalSizeX;
            int          MapTotalSizeY = showTemp.MapTotalSizeY;

            if (e.X >= MapTotalSizeX || e.Y >= MapTotalSizeY)
            {
                return;
            }
            if (e.X < 0 || e.Y < 0)
            {
                return;
            }
            if (e.Button == MouseButtons.Right)
            {
                MapDragPlace.IsEnter = false;
                MapDragPlace.IsOver  = false;
                MoveXOld             = e.X;
                MoveYOld             = e.Y;
                mapEditor.MapDragEN  = true;

                mapEditor.SelectedIndex = MapPanelMouse.DownSelectIndex(e, mapEditor);
            }
            else if (e.Button == MouseButtons.Left)
            {
                SmartPaste.HoverPasteInit();
                mapEditor.SelectedIndex = MapPanelMouse.DownSelectIndex(e, mapEditor);

                MapPanelMouse.ImLineFisrtDown(e, mapEditor);

                mapEditor.Imaginary    = true;
                mapEditor.ImagBlockCus = false;
            }
            else if (e.Button == MouseButtons.Middle)
            {
                mapEditor.ImagBlockCus = false;
                MoveXOld          = e.X;
                MoveYOld          = e.Y;
                mapEditor.Magnify = true;

                mapEditor.SelectedIndex = MapPanelMouse.DownSelectIndex(e, mapEditor);

                MapPanel.Refresh();
            }
        }
Ejemplo n.º 3
0
        public static void UpEvent(MouseEventArgs e, MapPanelEditor mapEditor, MyPanel.MyPanel MapPanel)
        {
            MapPanelMouse.NowUpTime = MapPanelMouse.CurrentTimeMillis;
            mapEditor.MapDragEN     = false;
            mapEditor.Magnify       = false;
            mapEditor.Imaginary     = false;

            SmartPaste.HoverPasteInit();
            if (e.Button == MouseButtons.Left)
            {
                int MapTotalSizeX = mapEditor.PictureSize * MapPanelEditor.RowNum + mapEditor.MapLeft;
                int MapTotalSizeY = mapEditor.PictureSize * MapPanelEditor.RowNum + mapEditor.MapTop;
                if (MapPanelMouse.IsMouseHold() == true)
                {
                    mapEditor.ImagBlockCus = true;
                }
            }
        }
Ejemplo n.º 4
0
 private void MapPlaceCom()
 {
     MapPanel.Refresh();
     SmartPaste.HoverPasteInit();
 }