Example #1
0
 private void EditGameAreaMouseHandler(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         if (egaMode == EditGameAreaMode.Normal)
         {
             if (mapPanel.InMapArea(e.X, e.Y) && cbSelectMap.Checked)
             {
                 egaMode      = EditGameAreaMode.MoveMap;
                 AnchorMouseX = e.X;
                 AnchorMouseY = e.Y;
                 this.Cursor  = Cursors.SizeAll;
             }
         }
         else if (egaMode == EditGameAreaMode.BorderHover)
         {
             if (cbSelectMap.Checked)
             {
                 if (mapPanel.InRightBorder(e.X, e.Y))
                 {
                     egaMode      = EditGameAreaMode.HorizontalResize;
                     AnchorMouseX = e.X;
                     AnchorMouseY = e.Y;
                 }
                 else if (mapPanel.InDownBorder(e.X, e.Y))
                 {
                     egaMode      = EditGameAreaMode.VerticalResize;
                     AnchorMouseX = e.X;
                     AnchorMouseY = e.Y;
                 }
             }
         }
     }
 }
Example #2
0
 private void EditGameAreaMouseMoveHandler(object sender, MouseEventArgs e)
 {
     if (egaMode == EditGameAreaMode.MoveMap)
     {
         if (e.Button == System.Windows.Forms.MouseButtons.Left)
         {
             mapPanel.MoveMap(e.X - AnchorMouseX, e.Y - AnchorMouseY);
             AnchorMouseX = e.X;
             AnchorMouseY = e.Y;
             updateMapInfo();
         }
     }
     else if (egaMode == EditGameAreaMode.Normal)
     {
         if (cbSelectMap.Checked)
         {
             if (mapPanel.InRightBorder(e.X, e.Y))
             {
                 egaMode     = EditGameAreaMode.BorderHover;
                 this.Cursor = Cursors.SizeWE;
             }
             else if (mapPanel.InDownBorder(e.X, e.Y))
             {
                 egaMode     = EditGameAreaMode.BorderHover;
                 this.Cursor = Cursors.SizeNS;
             }
         }
     }
     else if (egaMode == EditGameAreaMode.BorderHover)
     {
         if (!mapPanel.InRightBorder(e.X, e.Y) && !mapPanel.InDownBorder(e.X, e.Y))
         {
             egaMode     = EditGameAreaMode.Normal;
             this.Cursor = Cursors.Default;
         }
     }
     else if (egaMode == EditGameAreaMode.HorizontalResize)
     {
         if (e.Button == System.Windows.Forms.MouseButtons.Left)
         {
             mapPanel.ResizeMap(e.X - AnchorMouseX, 0);
             AnchorMouseX = e.X;
             AnchorMouseY = e.Y;
             updateMapInfo();
         }
     }
     else if (egaMode == EditGameAreaMode.VerticalResize)
     {
         if (e.Button == System.Windows.Forms.MouseButtons.Left)
         {
             mapPanel.ResizeMap(0, e.Y - AnchorMouseY);
             AnchorMouseX = e.X;
             AnchorMouseY = e.Y;
             updateMapInfo();
         }
     }
 }
Example #3
0
 private void mapPanel_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         if (operateMode == OperateMode.EditGameArea)
         {
             if (egaMode != EditGameAreaMode.Normal)
             {
                 egaMode     = EditGameAreaMode.Normal;
                 this.Cursor = Cursors.Default;
             }
         }
     }
 }
Example #4
0
 private void mapPanel_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         if (operateMode == OperateMode.EditGameArea)
         {
             if (egaMode != EditGameAreaMode.Normal)
             {
                 egaMode = EditGameAreaMode.Normal;
                 this.Cursor = Cursors.Default;
             }
         }
     }
 }
Example #5
0
 private void EditGameAreaMouseMoveHandler(object sender, MouseEventArgs e)
 {
     if (egaMode == EditGameAreaMode.MoveMap)
     {
         if (e.Button == System.Windows.Forms.MouseButtons.Left)
         {
             mapPanel.MoveMap(e.X - AnchorMouseX, e.Y - AnchorMouseY);
             AnchorMouseX = e.X;
             AnchorMouseY = e.Y;
             updateMapInfo();
         }
     }
     else if (egaMode == EditGameAreaMode.Normal)
     {
         if (cbSelectMap.Checked)
         {
             if (mapPanel.InRightBorder(e.X, e.Y))
             {
                 egaMode = EditGameAreaMode.BorderHover;
                 this.Cursor = Cursors.SizeWE;
             }
             else if (mapPanel.InDownBorder(e.X, e.Y))
             {
                 egaMode = EditGameAreaMode.BorderHover;
                 this.Cursor = Cursors.SizeNS;
             }
         }
     }
     else if (egaMode == EditGameAreaMode.BorderHover)
     {
         if (!mapPanel.InRightBorder(e.X, e.Y) && !mapPanel.InDownBorder(e.X, e.Y))
         {
             egaMode = EditGameAreaMode.Normal;
             this.Cursor = Cursors.Default;
         }
     }
     else if (egaMode == EditGameAreaMode.HorizontalResize)
     {
         if (e.Button == System.Windows.Forms.MouseButtons.Left)
         {
             mapPanel.ResizeMap(e.X - AnchorMouseX, 0);
             AnchorMouseX = e.X;
             AnchorMouseY = e.Y;
             updateMapInfo();
         }
     }
     else if (egaMode == EditGameAreaMode.VerticalResize)
     {
         if (e.Button == System.Windows.Forms.MouseButtons.Left)
         {
             mapPanel.ResizeMap(0, e.Y - AnchorMouseY);
             AnchorMouseX = e.X;
             AnchorMouseY = e.Y;
             updateMapInfo();
         }
     }
 }
Example #6
0
 private void EditGameAreaMouseHandler(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         if (egaMode == EditGameAreaMode.Normal)
         {
             if (mapPanel.InMapArea(e.X, e.Y) && cbSelectMap.Checked)
             {
                 egaMode = EditGameAreaMode.MoveMap;
                 AnchorMouseX = e.X;
                 AnchorMouseY = e.Y;
                 this.Cursor = Cursors.SizeAll;
             }
         }
         else if (egaMode == EditGameAreaMode.BorderHover)
         {
             if (cbSelectMap.Checked)
             {
                 if (mapPanel.InRightBorder(e.X, e.Y))
                 {
                     egaMode = EditGameAreaMode.HorizontalResize;
                     AnchorMouseX = e.X;
                     AnchorMouseY = e.Y;
                 }
                 else if (mapPanel.InDownBorder(e.X, e.Y))
                 {
                     egaMode = EditGameAreaMode.VerticalResize;
                     AnchorMouseX = e.X;
                     AnchorMouseY = e.Y;
                 }
             }
         }
     }
 }