Пример #1
0
 private bool CollidesWith(TileGridPanel panel)
 {
     if (this.Right < panel.Left || this.Left > panel.Right)
     {
         return(false);
     }
     if (this.Bottom < panel.Top || this.Top > panel.Bottom)
     {
         return(false);
     }
     return(true);
 }
Пример #2
0
 public void TileBlock_MouseDown(object sender, MouseEventArgs e)
 {
     try
     {
         if (ContainerGrid.gameform.getClient().Player == null || ContainerGrid.gameform.getClient().Player.Nickname != ContainerGrid.gameform.getGameStatus().CurrentPlayer.Nickname)
         {
             return;
         }
     }
     catch (NullReferenceException i)
     {
         return;
     }
     if (e.Button == MouseButtons.Left)
     {
         if (ContainerGrid != null)
         {
             tileblockset = null;
             leftblock    = null;
             isDragging   = true;
             prevLocation = new Point(ContainerGrid.Left + Location.X, ContainerGrid.Top + Location.Y);
             prevGrid     = ContainerGrid;
             startPoint   = new Point(e.X, e.Y);
             ContainerGrid.PickupTile(this);
             ContainerGrid = null;
         }
         BringToFront();
     }
     else
     {
         tileblockset = this.ContainerGrid.FindTileSet(this);
         if (ContainerGrid != null)
         {
             foreach (TileBlock t in tileblockset)
             {
                 t.tileblockset = tileblockset;
                 t.isDragging   = true;
                 t.prevLocation = new Point(t.ContainerGrid.Left + t.Location.X, t.ContainerGrid.Top + t.Location.Y);
                 t.prevGrid     = t.ContainerGrid;
                 t.startPoint   = new Point(e.X, e.Y);
                 t.ContainerGrid.PickupTile(t);
                 t.ContainerGrid = null;
             }
         }
         foreach (TileBlock t in tileblockset)
         {
             t.BringToFront();
         }
     }
 }